220 lines
4.7 KiB
ObjectPascal
220 lines
4.7 KiB
ObjectPascal
|
unit U_SCPerson;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, Buttons, DB, ADODB, StdCtrls;
|
|||
|
|
|||
|
type
|
|||
|
TfrmSCPerson = class(TForm)
|
|||
|
ScrollBox1: TScrollBox;
|
|||
|
btn1: TSpeedButton;
|
|||
|
btn2: TSpeedButton;
|
|||
|
btn3: TSpeedButton;
|
|||
|
btn4: TSpeedButton;
|
|||
|
btn5: TSpeedButton;
|
|||
|
btn6: TSpeedButton;
|
|||
|
btn7: TSpeedButton;
|
|||
|
btn8: TSpeedButton;
|
|||
|
btn58: TSpeedButton;
|
|||
|
btn9: TSpeedButton;
|
|||
|
btn10: TSpeedButton;
|
|||
|
btn11: TSpeedButton;
|
|||
|
btn12: TSpeedButton;
|
|||
|
btn13: TSpeedButton;
|
|||
|
btn14: TSpeedButton;
|
|||
|
btn15: TSpeedButton;
|
|||
|
btn59: TSpeedButton;
|
|||
|
btn16: TSpeedButton;
|
|||
|
btn17: TSpeedButton;
|
|||
|
btn18: TSpeedButton;
|
|||
|
btn19: TSpeedButton;
|
|||
|
btn20: TSpeedButton;
|
|||
|
btn21: TSpeedButton;
|
|||
|
btn22: TSpeedButton;
|
|||
|
btn60: TSpeedButton;
|
|||
|
btn23: TSpeedButton;
|
|||
|
btn24: TSpeedButton;
|
|||
|
btn25: TSpeedButton;
|
|||
|
btn26: TSpeedButton;
|
|||
|
btn27: TSpeedButton;
|
|||
|
btn28: TSpeedButton;
|
|||
|
btn29: TSpeedButton;
|
|||
|
btn61: TSpeedButton;
|
|||
|
btn30: TSpeedButton;
|
|||
|
btn31: TSpeedButton;
|
|||
|
btn32: TSpeedButton;
|
|||
|
btn33: TSpeedButton;
|
|||
|
btn34: TSpeedButton;
|
|||
|
btn35: TSpeedButton;
|
|||
|
btn36: TSpeedButton;
|
|||
|
btn62: TSpeedButton;
|
|||
|
btn37: TSpeedButton;
|
|||
|
btn38: TSpeedButton;
|
|||
|
btn39: TSpeedButton;
|
|||
|
btn40: TSpeedButton;
|
|||
|
btn41: TSpeedButton;
|
|||
|
btn42: TSpeedButton;
|
|||
|
btn43: TSpeedButton;
|
|||
|
btn63: TSpeedButton;
|
|||
|
btn44: TSpeedButton;
|
|||
|
btn45: TSpeedButton;
|
|||
|
btn46: TSpeedButton;
|
|||
|
btn47: TSpeedButton;
|
|||
|
btn48: TSpeedButton;
|
|||
|
btn49: TSpeedButton;
|
|||
|
btn50: TSpeedButton;
|
|||
|
btn64: TSpeedButton;
|
|||
|
btn51: TSpeedButton;
|
|||
|
btn52: TSpeedButton;
|
|||
|
btn53: TSpeedButton;
|
|||
|
btn54: TSpeedButton;
|
|||
|
btn55: TSpeedButton;
|
|||
|
btn56: TSpeedButton;
|
|||
|
btn57: TSpeedButton;
|
|||
|
ADOTmp: TADOQuery;
|
|||
|
Label27: TLabel;
|
|||
|
Label1: TLabel;
|
|||
|
Button3: TButton;
|
|||
|
Button1: TButton;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure btn1Click(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure Button1Click(Sender: TObject);
|
|||
|
procedure Button3Click(Sender: TObject);
|
|||
|
private
|
|||
|
CPage: Integer;
|
|||
|
procedure InitPerson(page: Integer);
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
FlagStr: string;
|
|||
|
FYarnRackNo, FYarnRackWeight, FType: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmSCPerson: TfrmSCPerson;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmSCPerson.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmSCPerson := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSCPerson.InitPerson(page: Integer);
|
|||
|
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;
|
|||
|
|
|||
|
sql.Add('select YRNo,YRWeight from YE_YarnRack ');
|
|||
|
sql.Add('where YRType = ' + QuotedStr(FType));
|
|||
|
sql.Add('order by YRNo ');
|
|||
|
sql.Add('offset 64*(' + inttostr(page) + '-1) rows fetch next 64 rows only ');
|
|||
|
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOTmp.IsEmpty then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOTmp do
|
|||
|
begin
|
|||
|
First;
|
|||
|
i := 0;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
BB[i].inc := i;
|
|||
|
BB[i].FDdys := Trim(fieldbyname('YRWeight').AsString);
|
|||
|
BB[i].FdDysName := Trim(fieldbyname('YRNo').AsString);
|
|||
|
i := i + 1;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
i := i - 1;
|
|||
|
if i > 63 then
|
|||
|
begin
|
|||
|
i := 63;
|
|||
|
end;
|
|||
|
for j := 0 to 63 do
|
|||
|
begin
|
|||
|
with ScrollBox1 do
|
|||
|
begin
|
|||
|
TSpeedButton(Controls[j]).Visible := false;
|
|||
|
TSpeedButton(Controls[j]).Caption := '';
|
|||
|
TSpeedButton(Controls[j]).Hint := '';
|
|||
|
end;
|
|||
|
end;
|
|||
|
for j := 0 to i do
|
|||
|
begin
|
|||
|
with ScrollBox1 do
|
|||
|
begin
|
|||
|
TSpeedButton(Controls[j]).Visible := True;
|
|||
|
TSpeedButton(Controls[j]).Caption := BB[j].FdDysName;
|
|||
|
TSpeedButton(Controls[j]).Hint := BB[j].FDdys;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSCPerson.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
InitPerson(1);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSCPerson.btn1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
FYarnRackNo := Trim(TSpeedButton(Sender).Caption);
|
|||
|
FYarnRackWeight := Trim(TSpeedButton(Sender).Hint);
|
|||
|
ModalResult := 1;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSCPerson.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action := caHide;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSCPerson.Button1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if CPage <= 1 then
|
|||
|
begin
|
|||
|
InitPerson(1);
|
|||
|
Label1.Caption := '1';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
CPage := CPage - 1;
|
|||
|
InitPerson(CPage);
|
|||
|
Label1.Caption := IntToStr(CPage);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmSCPerson.Button3Click(Sender: TObject);
|
|||
|
begin
|
|||
|
CPage := CPage + 1;
|
|||
|
InitPerson(CPage);
|
|||
|
Label1.Caption := IntToStr(CPage);
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|