162 lines
3.6 KiB
ObjectPascal
162 lines
3.6 KiB
ObjectPascal
unit U_MFSel;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, Buttons, DB, ADODB;
|
|
|
|
type
|
|
TfrmMFSel = class(TForm)
|
|
ScrollBox1: TScrollBox;
|
|
btn1: TSpeedButton;
|
|
btn2: TSpeedButton;
|
|
btn3: TSpeedButton;
|
|
btn4: TSpeedButton;
|
|
btn5: TSpeedButton;
|
|
btn58: TSpeedButton;
|
|
btn9: TSpeedButton;
|
|
btn10: TSpeedButton;
|
|
btn11: TSpeedButton;
|
|
btn12: TSpeedButton;
|
|
btn59: TSpeedButton;
|
|
btn16: TSpeedButton;
|
|
btn17: TSpeedButton;
|
|
btn18: TSpeedButton;
|
|
btn19: TSpeedButton;
|
|
btn60: TSpeedButton;
|
|
btn23: TSpeedButton;
|
|
btn24: TSpeedButton;
|
|
btn25: TSpeedButton;
|
|
btn26: TSpeedButton;
|
|
btn61: TSpeedButton;
|
|
btn30: TSpeedButton;
|
|
btn31: TSpeedButton;
|
|
btn32: TSpeedButton;
|
|
btn33: TSpeedButton;
|
|
ADOTmp: TADOQuery;
|
|
procedure FormDestroy(Sender: TObject);
|
|
procedure FormShow(Sender: TObject);
|
|
procedure btn1Click(Sender: TObject);
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|
private
|
|
procedure InitPerson();
|
|
{ Private declarations }
|
|
public
|
|
FlagStr: string;
|
|
FSDPerson: string;
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
frmMFSel: TfrmMFSel;
|
|
|
|
implementation
|
|
|
|
uses
|
|
U_DataLink;
|
|
|
|
{$R *.dfm}
|
|
|
|
procedure TfrmMFSel.FormDestroy(Sender: TObject);
|
|
begin
|
|
frmMFSel := nil;
|
|
end;
|
|
|
|
procedure TfrmMFSel.InitPerson();
|
|
type
|
|
FdDy = record
|
|
inc: integer;
|
|
FDdys: string[32];
|
|
FdDysName: string[32];
|
|
end;
|
|
var
|
|
BB: array[0..100] of FdDy;
|
|
i, j: Integer;
|
|
begin
|
|
|
|
with ADOTmp do
|
|
begin
|
|
Close;
|
|
sql.Clear;
|
|
if FlagStr = 'MachNo' then
|
|
begin
|
|
sql.Add('select Machid as note ,MachNo as ZDYName from BS_Machine where Workshop=''拉丝车间'' order by MachNo,Machid ');
|
|
end
|
|
else
|
|
begin
|
|
sql.Add('select ZdyFlag as note ,ZDYName from KH_ZDY where note=''' + Trim(FlagStr) + ''' order by ZDYName ');
|
|
end;
|
|
Open;
|
|
end;
|
|
if ADOTmp.IsEmpty then
|
|
begin
|
|
Application.MessageBox('没有定义数据!', '提示', 0);
|
|
Exit;
|
|
end;
|
|
with ADOTmp do
|
|
begin
|
|
First;
|
|
i := 0;
|
|
while not Eof do
|
|
begin
|
|
BB[i].inc := i;
|
|
BB[i].FDdys := Trim(fieldbyname('Note').AsString);
|
|
BB[i].FdDysName := Trim(fieldbyname('ZDYName').AsString);
|
|
i := i + 1;
|
|
Next;
|
|
end;
|
|
end;
|
|
i := i - 1;
|
|
if i > 63 then
|
|
begin
|
|
i := 63;
|
|
end;
|
|
for j := 0 to i do
|
|
begin
|
|
with ScrollBox1 do
|
|
begin
|
|
TSpeedButton(Controls[j]).Visible := True;
|
|
TSpeedButton(Controls[j]).Caption := BB[j].FdDysName;
|
|
if BB[j].FDdys = '平机' then
|
|
TSpeedButton(Controls[j]).Font.Color := clNavy;
|
|
if BB[j].FDdys = '平机1' then
|
|
TSpeedButton(Controls[j]).Font.Color := clBlack;
|
|
if BB[j].FDdys = '平机2' then
|
|
TSpeedButton(Controls[j]).Font.Color := clMaroon;
|
|
if BB[j].FDdys = '提花' then
|
|
TSpeedButton(Controls[j]).Font.Color := clPurple;
|
|
if BB[j].FDdys = '提花1' then
|
|
TSpeedButton(Controls[j]).Font.Color := clGreen;
|
|
if BB[j].FDdys = '提花2' then
|
|
TSpeedButton(Controls[j]).Font.Color := clOlive;
|
|
{TSpeedButton(Controls[j]).Hint:=BB[j];
|
|
if Length(BB[j])>4 then
|
|
begin
|
|
TSpeedButton(Controls[j]).Caption:=Copy(Trim(BB[j]),1,4)+#13+Copy(Trim(BB[j]),5,Length(BB[j])-4);
|
|
end else
|
|
TSpeedButton(Controls[j]).Caption:=BB[j]; }
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
procedure TfrmMFSel.FormShow(Sender: TObject);
|
|
begin
|
|
// InitPerson();
|
|
end;
|
|
|
|
procedure TfrmMFSel.btn1Click(Sender: TObject);
|
|
begin
|
|
FSDPerson := Trim(TSpeedButton(Sender).Caption);
|
|
ModalResult := 1;
|
|
end;
|
|
|
|
procedure TfrmMFSel.FormClose(Sender: TObject; var Action: TCloseAction);
|
|
begin
|
|
// Action:=caHide;
|
|
|
|
end;
|
|
|
|
end.
|
|
|