417 lines
11 KiB
ObjectPascal
417 lines
11 KiB
ObjectPascal
|
unit U_DyeOutput;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, StdCtrls, ExtCtrls, Menus, cxLookAndFeelPainters, cxButtons,
|
|||
|
cxControls, cxContainer, cxEdit, cxTextEdit, Buttons, DB, ADODB, cxGraphics,
|
|||
|
cxLookAndFeels, cxCheckBox, cxMaskEdit, cxDropDownEdit, cxCheckComboBox,
|
|||
|
cxGroupBox, cxRadioGroup, CheckLst, cxCheckListBox, U_BaseList, dxSkinsCore,
|
|||
|
dxSkinsDefaultPainters, Datasnap.DBClient;
|
|||
|
|
|||
|
type
|
|||
|
TfrmDyeOutput = class(TfrmBaseList)
|
|||
|
Panel1: TPanel;
|
|||
|
Label1: TLabel;
|
|||
|
Panel2: TPanel;
|
|||
|
Scan: TcxTextEdit;
|
|||
|
Label2: TLabel;
|
|||
|
PCID: TcxTextEdit;
|
|||
|
Label3: TLabel;
|
|||
|
custName: TcxTextEdit;
|
|||
|
Label4: TLabel;
|
|||
|
Label5: TLabel;
|
|||
|
C_Name: TcxTextEdit;
|
|||
|
Saleser: TcxTextEdit;
|
|||
|
Label6: TLabel;
|
|||
|
C_ColorNo: TcxTextEdit;
|
|||
|
Label7: TLabel;
|
|||
|
C_Color: TcxTextEdit;
|
|||
|
Label8: TLabel;
|
|||
|
Qty: TcxTextEdit;
|
|||
|
Label12: TLabel;
|
|||
|
Panel_JP: TPanel;
|
|||
|
SpeedButton1: TSpeedButton;
|
|||
|
SpeedButton2: TSpeedButton;
|
|||
|
SpeedButton3: TSpeedButton;
|
|||
|
SpeedButton4: TSpeedButton;
|
|||
|
SpeedButton5: TSpeedButton;
|
|||
|
SpeedButton6: TSpeedButton;
|
|||
|
SpeedButton7: TSpeedButton;
|
|||
|
SpeedButton8: TSpeedButton;
|
|||
|
SpeedButton9: TSpeedButton;
|
|||
|
SpeedButton10: TSpeedButton;
|
|||
|
SpeedButton11: TSpeedButton;
|
|||
|
SpeedButton12: TSpeedButton;
|
|||
|
SpeedButton49: TSpeedButton;
|
|||
|
ADOQuery1: TADOQuery;
|
|||
|
ADO_Car: TADOQuery;
|
|||
|
ADO_YG: TADOQuery;
|
|||
|
ADO_Cmd: TADOQuery;
|
|||
|
ADO_Tmp: TADOQuery;
|
|||
|
SpeedButton14: TSpeedButton;
|
|||
|
EECode: TcxTextEdit;
|
|||
|
Label16: TLabel;
|
|||
|
Label17: TLabel;
|
|||
|
EEName: TcxTextEdit;
|
|||
|
SpeedButton15: TSpeedButton;
|
|||
|
SpeedButton16: TSpeedButton;
|
|||
|
SpeedButton17: TSpeedButton;
|
|||
|
SpeedButton18: TSpeedButton;
|
|||
|
SpeedButton19: TSpeedButton;
|
|||
|
SpeedButton20: TSpeedButton;
|
|||
|
GlideMsg: TComboBox;
|
|||
|
CDS_GX: TClientDataSet;
|
|||
|
SpeedButton13: TSpeedButton;
|
|||
|
SpeedButton21: TSpeedButton;
|
|||
|
cxButton3: TcxButton;
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure SpeedButton1Click(Sender: TObject);
|
|||
|
procedure SpeedButton12Click(Sender: TObject);
|
|||
|
procedure SpeedButton49Click(Sender: TObject);
|
|||
|
procedure GlideRateClick(Sender: TObject);
|
|||
|
procedure ScanKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure Sel1Click(Sender: TObject);
|
|||
|
procedure SpeedButton14Click(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure cxButton3Click(Sender: TObject);
|
|||
|
procedure EECodeExit(Sender: TObject);
|
|||
|
private
|
|||
|
fGlideName, fSCunit, fJPUnit: string;
|
|||
|
procedure InitCar(fPCID: string);
|
|||
|
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
fflag: Integer;
|
|||
|
fKeyNo: string;
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmDyeOutput: TfrmDyeOutput;
|
|||
|
|
|||
|
implementation
|
|||
|
|
|||
|
uses
|
|||
|
U_DataLink, U_RTFun;
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure SOutData(mParent: TWinControl; FTag: Integer);
|
|||
|
var
|
|||
|
i, idx: integer;
|
|||
|
begin
|
|||
|
with mParent do
|
|||
|
begin
|
|||
|
for i := 0 to ControlCount - 1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TLabel then
|
|||
|
continue;
|
|||
|
if Controls[i].Tag <> FTag then
|
|||
|
continue;
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
TEdit(Controls[i]).Text := '';
|
|||
|
end
|
|||
|
else if Controls[i] is TcxTextEdit then
|
|||
|
begin
|
|||
|
TcxTextEdit(Controls[i]).Text := '';
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure SInData(ADOQueryTmp: TADOQuery; mParent: TWinControl; FTag: Integer);
|
|||
|
var
|
|||
|
i, idx: integer;
|
|||
|
mfield, mfieldCode: string;
|
|||
|
begin
|
|||
|
with ADOQueryTmp do
|
|||
|
begin
|
|||
|
if isEmpty then
|
|||
|
exit;
|
|||
|
with mParent do
|
|||
|
begin
|
|||
|
for i := 0 to ControlCount - 1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TLabel then
|
|||
|
continue;
|
|||
|
if Controls[i].Tag <> FTag then
|
|||
|
continue;
|
|||
|
mfield := Controls[i].Name;
|
|||
|
if Controls[i] is TEdit then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString) <> '' then
|
|||
|
TEdit(Controls[i]).Text := trim(fieldByName(mfield).AsString)
|
|||
|
else
|
|||
|
TEdit(Controls[i]).Text := '';
|
|||
|
end
|
|||
|
else if Controls[i] is TcxTextEdit then
|
|||
|
begin
|
|||
|
if Trim(fieldByName(mfield).AsString) <> '' then
|
|||
|
TcxTextEdit(Controls[i]).Text := trim(fieldByName(mfield).AsString)
|
|||
|
else
|
|||
|
TcxTextEdit(Controls[i]).Text := '';
|
|||
|
end;
|
|||
|
end; // end for
|
|||
|
end; // end with
|
|||
|
end; //end for with
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeOutput.InitCar(fPCID: string);
|
|||
|
begin
|
|||
|
try
|
|||
|
with ADO_Car do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select * from Dye_Plan_Card ');
|
|||
|
sql.Add('where PCID=' + quotedstr(trim(fPCID)));
|
|||
|
// showmessage(sql.Text);
|
|||
|
open;
|
|||
|
end;
|
|||
|
// if trim(ADO_Car.fieldbyname('ShowMsg').AsString) <> '' then
|
|||
|
// begin
|
|||
|
// Scan.text := '';
|
|||
|
// Application.MessageBox(pchar(trim(ADO_Car.fieldbyname('ShowMsg').AsString)), '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
|
|||
|
// ADO_Car.Close;
|
|||
|
// exit;
|
|||
|
// end
|
|||
|
// else
|
|||
|
SInData(ADO_Car, Panel2, 2);
|
|||
|
|
|||
|
Qty.Enabled := false;
|
|||
|
|
|||
|
Qty.Enabled := true;
|
|||
|
|
|||
|
Scan.text := '';
|
|||
|
Scan.OnClick(Scan);
|
|||
|
except
|
|||
|
Scan.text := '';
|
|||
|
Scan.OnClick(Scan);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeOutput.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Action := cafree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeOutput.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
frmDyeOutput := nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeOutput.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Panel2.Align := alclient;
|
|||
|
SOutData(Panel2, 2);
|
|||
|
SOutData(Panel2, 0);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeOutput.SpeedButton1Click(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
fsj := Trim(TSpeedButton(Sender).Hint);
|
|||
|
if Trim(fsj) = '' then
|
|||
|
Exit;
|
|||
|
fsj := Trim(TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text);
|
|||
|
TcxTextEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text := fsj + Trim(TSpeedButton(Sender).Caption);
|
|||
|
|
|||
|
TcxTextEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).SelStart := length(TcxTextEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text);
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeOutput.SpeedButton12Click(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
begin
|
|||
|
fsj := Trim(TEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text);
|
|||
|
if Trim(fsj) = '' then
|
|||
|
Exit;
|
|||
|
TcxTextEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text := Copy(fsj, 1, Length(fsj) - 1);
|
|||
|
TcxTextEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).SelStart := length(TcxTextEdit(FindComponent(Trim(TSpeedButton(Sender).Hint))).Text);
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeOutput.SpeedButton49Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel_JP.Visible := false;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeOutput.EECodeExit(Sender: TObject);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
str: string;
|
|||
|
begin
|
|||
|
with ADO_Tmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from SY_Employee ');
|
|||
|
sql.Add('where EECode =' + quotedstr(EECode.Text));
|
|||
|
open;
|
|||
|
end;
|
|||
|
EEName.Text := trim(ADO_Tmp.fieldbyname('EEName').AsString);
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeOutput.GlideRateClick(Sender: TObject);
|
|||
|
var
|
|||
|
i: Integer;
|
|||
|
begin
|
|||
|
Panel_JP.Visible := True;
|
|||
|
with Panel_JP do
|
|||
|
begin
|
|||
|
for i := 0 to ControlCount - 1 do
|
|||
|
begin
|
|||
|
if Controls[i] is TSpeedButton then
|
|||
|
begin
|
|||
|
TSpeedButton(Controls[i]).Hint := Trim(TEdit(Sender).Name);
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeOutput.ScanKeyPress(Sender: TObject; var Key: Char);
|
|||
|
var
|
|||
|
fsj: string;
|
|||
|
str: string;
|
|||
|
begin
|
|||
|
if trim(Scan.Text) = '' then
|
|||
|
exit;
|
|||
|
if Key = #13 then
|
|||
|
begin
|
|||
|
InitCar(Scan.Text);
|
|||
|
|
|||
|
fsj := 'exec P_Dye_Glide_Get_Idx ' + quotedstr(PCID.Text);
|
|||
|
|
|||
|
SInitComBoxBySql(ADO_Cmd, GlideMsg, False, fsj);
|
|||
|
|
|||
|
with ADO_Tmp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('exec P_Dye_Glide_Get_Idx ' + quotedstr(PCID.Text));
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS(ADO_Tmp, CDS_GX);
|
|||
|
SInitCDSData(ADO_Tmp, CDS_GX);
|
|||
|
CDS_GX.First;
|
|||
|
GlideMsg.ItemIndex := 0;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeOutput.cxButton3Click(Sender: TObject);
|
|||
|
var
|
|||
|
key: Char;
|
|||
|
begin
|
|||
|
key := #13;
|
|||
|
ScanKeyPress(Scan, key);
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeOutput.Sel1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if trim(TcxTextEdit(Sender).Text) = '<27><>' then
|
|||
|
begin
|
|||
|
TcxTextEdit(Sender).Text := '';
|
|||
|
end
|
|||
|
else
|
|||
|
begin
|
|||
|
TcxTextEdit(Sender).Text := '<27><>';
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeOutput.SpeedButton14Click(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
try
|
|||
|
SpeedButton14.Enabled := False;
|
|||
|
if strtofloatdef(trim(Qty.Text), 0) = 0 then
|
|||
|
raise Exception.Create(pchar('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>ջ<EFBFBD><D5BB><EFBFBD><EFBFBD>㣡'));
|
|||
|
if not CDS_GX.Locate('Name', GlideMsg.Text, []) then
|
|||
|
raise Exception.Create(pchar('<27><><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!'));
|
|||
|
if GetLSNo(ADO_Tmp, fkeyNo, 'CL', 'CL_Group', 4, 1) = False then
|
|||
|
raise Exception.Create(pchar('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!'));
|
|||
|
|
|||
|
with ADO_Tmp do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select X.GlideName from Dye_Plan_Glide_OutPut X ');
|
|||
|
sql.Add('where X.GlideNo=' + QuotedStr(trim(CDS_GX.FieldByName('GlideNo').AsString)));
|
|||
|
sql.Add('and X.GlideName=' + QuotedStr(trim(CDS_GX.FieldByName('GlideName').AsString)));
|
|||
|
sql.Add('and x.PCID=' + QuotedStr(trim(PCID.Text)));
|
|||
|
open;
|
|||
|
end;
|
|||
|
if not ADO_Tmp.IsEmpty then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8>ǼDz<C7BC><C7B2><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
SpeedButton14.Enabled := True;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
with ADO_Cmd do
|
|||
|
begin
|
|||
|
close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add(' select * from Dye_Plan_Glide_OutPut where 1=2 ');
|
|||
|
open;
|
|||
|
Append;
|
|||
|
FieldByName('GOID').Value := fkeyNo;
|
|||
|
FieldByName('PCID').Value := trim(PCID.text);
|
|||
|
FieldByName('GlideNo').Value := trim(CDS_GX.FieldByName('GlideNo').AsString);
|
|||
|
FieldByName('GlideName').Value := trim(CDS_GX.FieldByName('GlideName').AsString);
|
|||
|
FieldByName('StaffId').Value := trim(EECode.text);
|
|||
|
FieldByName('StaffName').Value := trim(EEName.text);
|
|||
|
FieldByName('Qty').Value := trim(Qty.text);
|
|||
|
FieldByName('Filler').Value := trim(DName);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
|
|||
|
////////////////// <20><><EFBFBD>½<EFBFBD><C2BD><EFBFBD> //////////////////
|
|||
|
with ADO_Cmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('insert into Dye_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ');
|
|||
|
sql.Add('values(''<27><>̨ˢ<CCA8><CBA2>'' ');
|
|||
|
sql.Add(',' + quotedstr(PCID.text));
|
|||
|
sql.Add(',''PCˢ<43><CBA2>'' ');
|
|||
|
sql.Add(',' + quotedstr(DName));
|
|||
|
sql.Add(',' + quotedstr(trim(self.Caption)));
|
|||
|
sql.Add(',' + quotedstr(fkeyNo));
|
|||
|
sql.Add(') ');
|
|||
|
execsql;
|
|||
|
end;
|
|||
|
////////////////// <20><><EFBFBD>½<EFBFBD><C2BD><EFBFBD> //////////////////
|
|||
|
|
|||
|
Scan.SetFocus;
|
|||
|
SpeedButton14.Enabled := True;
|
|||
|
Application.MessageBox('ˢ<><CBA2><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ');
|
|||
|
except
|
|||
|
Scan.SetFocus;
|
|||
|
SpeedButton14.Enabled := True;
|
|||
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmDyeOutput.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
inherited;
|
|||
|
Scan.OnClick(Scan);
|
|||
|
end;
|
|||
|
|
|||
|
end.
|
|||
|
|