RTFormwork/项目代码/RTBasicsV1/C02纱线加弹检验/U_CPSelBig.pas
“ddf” 61630656e9 1
2024-07-07 09:35:27 +08:00

124 lines
2.8 KiB
ObjectPascal

unit U_CPSelBig;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Buttons, ExtCtrls, DBClient, DB, ADODB;
type
TfrmCPSelBig = class(TForm)
Panel1: TPanel;
SpeedButton1: TSpeedButton;
ADOQuery1: TADOQuery;
ClientDataSet1: TClientDataSet;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton10: TSpeedButton;
SpeedButton11: TSpeedButton;
SpeedButton12: TSpeedButton;
SpeedButton13: TSpeedButton;
SpeedButton19: TSpeedButton;
SpeedButton20: TSpeedButton;
SpeedButton21: TSpeedButton;
SpeedButton22: TSpeedButton;
SpeedButton28: TSpeedButton;
SpeedButton29: TSpeedButton;
SpeedButton30: TSpeedButton;
SpeedButton31: TSpeedButton;
procedure FormDestroy(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
private
procedure InitGrid();
procedure InitJP();
{ Private declarations }
public
FHMainId, FHInfo: string;
{ Public declarations }
end;
var
frmCPSelBig: TfrmCPSelBig;
implementation
uses
U_DataLink, U_RTFun;
{$R *.dfm}
procedure TfrmCPSelBig.FormDestroy(Sender: TObject);
begin
frmCPSelBig := nil;
end;
procedure TfrmCPSelBig.SpeedButton1Click(Sender: TObject);
begin
FHMainId := TSpeedButton(Sender).Hint;
FHInfo := TSpeedButton(Sender).Caption;
ModalResult := 1;
end;
procedure TfrmCPSelBig.InitGrid();
begin
with ADOQuery1 do
begin
Filtered := False;
Close;
sql.Clear;
sql.Add('select A.* from YE_Plan_Main A');
sql.Add(' where isnull(Status,''0'')=''1'' ');
Open;
end;
SCreateCDS(ADOQuery1, ClientDataSet1);
SInitCDSData(ADOQuery1, ClientDataSet1);
//InitJP();
end;
procedure TfrmCPSelBig.InitJP();
var
AA: array[0..100] of string;
BB: array[0..100] of string;
i, j: Integer;
begin
with ClientDataSet1 do
begin
First;
i := 0;
while not Eof do
begin
AA[i] := Trim(fieldbyname('MainId').AsString);
BB[i] := Trim(fieldbyname('Y_Name').AsString) + #13 + #13 + Trim(fieldbyname('Y_Color').AsString) + #13 + #13 + Trim(fieldbyname('YE_Name').AsString) + #13 + #13 + Trim(fieldbyname('BatchNo').AsString);
i := i + 1;
Next;
end;
end;
i := i - 1;
for j := 0 to i do
begin
with Panel1 do
begin
TSpeedButton(Controls[j]).Visible := True;
TSpeedButton(Controls[j]).Hint := AA[j];
TSpeedButton(Controls[j]).Caption := BB[j];
end;
end;
end;
procedure TfrmCPSelBig.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action := caHide;
end;
procedure TfrmCPSelBig.FormShow(Sender: TObject);
begin
InitGrid();
InitJP();
end;
end.