📄 uselmsr.pas
字号:
unit USelMsr;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls, StdCtrls,db,adodb;
type
TFrm_SelMsr = class(TForm)
Button1: TButton;
Button2: TButton;
CB1: TCheckBox;
Cbx_eupet: TComboBox;
CB2: TCheckBox;
Cbx_Part: TComboBox;
Label1: TLabel;
Label2: TLabel;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Cbx_eupetClick(Sender: TObject);
procedure FormDeactivate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Frm_SelMsr: TFrm_SelMsr;
ls_eupetnno,Ls_NPartno:TStrings;
implementation
uses UnPerPlan, Undm;
{$R *.dfm}
procedure TFrm_SelMsr.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=caFree; Frm_SelMsr:=nil;
end;
procedure TFrm_SelMsr.Button2Click(Sender: TObject);
begin
Close;
end;
procedure TFrm_SelMsr.Button1Click(Sender: TObject);
var
sqlstr:string;
stmp1,stmp4:string;
begin
sqlstr:='';
if Cbx_eupet.ItemIndex<>-1 then //机组stmp1
stmp1:=ls_eupetnno[Cbx_eupet.ItemIndex];
if Cbx_Part.ItemIndex<>-1 then //设备stmp4
stmp4:=Ls_NPartno[Cbx_Part.ItemIndex];
if CB1.Checked then
sqlstr:='eupetnno='+quotedstr(stmp1);
if CB2.Checked then
if sqlstr<>'' then
sqlstr:=sqlstr+' and npartno='+quotedstr(stmp4)
else
sqlstr:=' npartno='+quotedstr(stmp4);
if sqlstr<>'' then
sqlstr:='select * from view_sbdj where '+sqlstr+' order by Msrno,ib'
else
sqlstr:='select * from view_sbdj order by Msrno,ib';
PerPlan_frm.FillMsr(sqlstr);
Close;
end;
procedure TFrm_SelMsr.FormCreate(Sender: TObject);
var
adotmp:TADOQuery;
begin
top:=180;Left:=300;
adotmp:=TADOQuery.Create(self);
try
with adotmp do
begin
Connection:=DM.AdoConn;
SQL.Text:='select * from T_eupet order by eupetno';
Open;
if not eof then begin
ls_eupetnno:=TStringList.Create;
Ls_NPartno:=TStringList.Create;
end;
while not eof do
begin
Cbx_eupet.Items.Add(fieldbyname('eupetno').AsString+'-'+fieldbyname('eupetname').AsString);
ls_eupetnno.Add(fieldbyname('eupetnno').AsString);
Next;
end;
Free;
end;
except
adotmp.Free;
end;
end;
procedure TFrm_SelMsr.Cbx_eupetClick(Sender: TObject);
var
adotmp:TADOQuery;
stmp1:string;
begin
Cbx_Part.Clear;
Ls_NPartno.Clear;
adotmp:=TADOQuery.Create(self);
if Cbx_eupet.ItemIndex<>-1 then //机组stmp1
stmp1:=ls_eupetnno[Cbx_eupet.ItemIndex];
try
with adotmp do
begin
Connection:=DM.AdoConn;
Close;
SQL.Text:='select * from T_Part where eupetnno='+quotedstr(stmp1)+' order by Partno';
Open;
while not eof do
begin
Cbx_Part.Items.Add(fieldbyname('Partno').AsString+'-'+fieldbyname('partname').AsString);
Ls_NPartno.Add(fieldbyname('npartno').AsString);
Next;
end;
Close;
Free;
end;
except
adotmp.Free;
end;
end;
procedure TFrm_SelMsr.FormDeactivate(Sender: TObject);
begin
Close;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -