RTFormwork/项目代码/RTBasicsV1/F06染色成品仓库/U_DyeClothInEdit.pas
“ddf” 61630656e9 1
2024-07-07 09:35:27 +08:00

787 lines
22 KiB
ObjectPascal
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_DyeClothInEdit;
interface
uses
Windows, Messages, strUtils, SysUtils, Variants, Classes, Graphics, Controls,
Forms, Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, StdCtrls, ExtCtrls, ADODB, DBClient,
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, MMSystem,
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
cxControls, cxGridCustomView, cxGrid, MovePanel, cxCheckBox, Menus, ComCtrls,
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, U_BaseList, dxSkinsCore,
dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu, RM_Common, RM_Class,
RM_GridReport, RM_Dataset, Vcl.ToolWin;
type
TfrmDyeClothInEdit = class(TfrmBaseList)
GPM_1: TcxGridPopupMenu;
CDS_1: TClientDataSet;
DS_1: TDataSource;
ADOQueryTemp: TADOQuery;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
Panel1: TPanel;
CDS_2: TClientDataSet;
DS_2: TDataSource;
GPM_2: TcxGridPopupMenu;
DS_3: TDataSource;
CDS_3: TClientDataSet;
GPM_3: TcxGridPopupMenu;
cxGrid2: TcxGrid;
Tv2: TcxGridDBTableView;
v1OrderNo: TcxGridDBColumn;
v2Column2: TcxGridDBColumn;
cxGridDBColumn2: TcxGridDBColumn;
v1Column10: TcxGridDBColumn;
v1Column14: TcxGridDBColumn;
cxGridDBColumn3: TcxGridDBColumn;
v1PRTMF: TcxGridDBColumn;
v1PRTKZ: TcxGridDBColumn;
cxGrid2Level1: TcxGridLevel;
Tv2Column1: TcxGridDBColumn;
Panel2: TPanel;
Panel4: TPanel;
cxGrid1: TcxGrid;
Tv1: TcxGridDBTableView;
v1Column6: TcxGridDBColumn;
v1Column11: TcxGridDBColumn;
v1Column5: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
Tv1Column1: TcxGridDBColumn;
v1Column4: TcxGridDBColumn;
v2Column6: TcxGridDBColumn;
v2Column5: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
ToolBar1: TToolBar;
ToolButton2: TToolButton;
cxGrid3: TcxGrid;
Tv3: TcxGridDBTableView;
v3Column5: TcxGridDBColumn;
cxGridDBColumn4: TcxGridDBColumn;
v3MJID: TcxGridDBColumn;
v3Column3: TcxGridDBColumn;
Tv3Column1: TcxGridDBColumn;
v3Column4: TcxGridDBColumn;
cxGridDBColumn6: TcxGridDBColumn;
v3Column1: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
ToolBar2: TToolBar;
ToolButton1: TToolButton;
Panel3: TPanel;
Label4: TLabel;
Label5: TLabel;
Label11: TLabel;
CRTime: TDateTimePicker;
InNo: TEdit;
CRType: TComboBox;
ToolBar3: TToolBar;
ToolButton3: TToolButton;
btnGetOutNo: TToolButton;
ToolButton6: TToolButton;
ToolButton7: TToolButton;
ToolButton8: TToolButton;
edtScan: TEdit;
Label6: TLabel;
ToolButton9: TToolButton;
ToolButton10: TToolButton;
ToolButton11: TToolButton;
ToolButton12: TToolButton;
Tv2Column2: TcxGridDBColumn;
ToolButton4: TToolButton;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormDestroy(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure ToolButton6Click(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure btnGetOutNoClick(Sender: TObject);
procedure ToolButton7Click(Sender: TObject);
procedure ToolButton8Click(Sender: TObject);
procedure edtScanKeyPress(Sender: TObject; var Key: Char);
procedure ToolButton9Click(Sender: TObject);
procedure ToolButton10Click(Sender: TObject);
procedure ToolButton11Click(Sender: TObject);
procedure ToolButton12Click(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
private
{ Private declarations }
FScan, FPCIds: string;
procedure PlayWav(MWav: string);
procedure InitGrid1();
procedure InitGrid2();
procedure InitGrid3();
procedure ScanPCID();
procedure ScanCIID();
public
{ Public declarations }
end;
var
frmDyeClothInEdit: TfrmDyeClothInEdit;
implementation
uses
U_DataLink, U_RTFun, U_DyeClothWaitStorage, U_LabelPrint;
{$R *.dfm}
procedure TfrmDyeClothInEdit.PlayWav(MWav: string);
begin
if FileExists(PChar(ExtractFilePath(Application.ExeName) + 'wav\' + MWav + '.wav')) then
PlaySound(PChar(ExtractFilePath(Application.ExeName) + 'wav\' + MWav + '.wav'), 0, SND_ASYNC);
end;
procedure TfrmDyeClothInEdit.InitGrid2();
begin
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select A.*,B.*,C.* ');
sql.Add(' from Dye_Plan_Card A inner join Dye_Plan_Sub B on A.SubId=B.SubId');
sql.Add(' inner join Dye_Plan_Main C on A.MainId=C.Mainid');
if TRIm(FPCIds) <> '' then
sql.add('and PCId in (' + FPCIds + ')')
else
sql.add('and 1=2');
Open;
end;
SCreateCDS(ADOQueryTemp, CDS_2);
SInitCDSData(ADOQueryTemp, CDS_2);
end;
procedure TfrmDyeClothInEdit.InitGrid1();
begin
with ADOQueryMain do
begin
Close;
sql.Clear;
sql.Add('select A.IOFlag,A.IONo,A.IOID,B.* from Dye_Cloth_IO A ');
sql.Add('right join Dye_Cloth_Stock B on A.StkId=B.StkId ');
sql.Add(' where B.StkExists=0 and B.StkCycles=0 ');
if TRIm(FPCIds) <> '' then
sql.add('and PCId in (' + FPCIds + ')')
else
sql.add('and 1=2');
Open;
end;
SCreateCDS(ADOQueryMain, CDS_1);
SInitCDSData(ADOQueryMain, CDS_1);
end;
procedure TfrmDyeClothInEdit.InitGrid3();
begin
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select A.IOFlag,A.IONo,A.IOID,B.* from Dye_Cloth_IO A ');
sql.Add('inner join Dye_Cloth_Stock B on A.StkId=B.StkId and A.IOCycles=B.StkCycles ');
sql.Add('where A.IOFlag=''<27><><EFBFBD><EFBFBD>'' and B.StkExists=1 ');
if TRIm(InNo.Text) <> '' then
sql.add('and IONO =' + QuotedStr(TRIm(InNo.Text)))
else
sql.add('and 1=2');
Open;
end;
SCreateCDS(ADOQueryTemp, CDS_3);
SInitCDSData(ADOQueryTemp, CDS_3);
end;
procedure TfrmDyeClothInEdit.ScanPCID();
var
MStkIds, MPCIDS: string;
begin
try
if Trim(InNo.Text) = '' then
raise Exception.Create('<27><><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!');
if CDS_2.IsEmpty then
raise Exception.Create(ѡ<CEB4><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
if not CDS_1.Locate('IONo', Trim(FScan), []) then
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E2B5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
MStkIds := '';
MPCIDS := '';
with CDS_1 do
begin
First;
while CDS_1.Locate('IONo', Trim(FScan), []) = True do
begin
MStkIds := MStkIds + (Trim(CDS_1.FieldByName('StkId').AsString)) + ',';
MPCIDS := MPCIDS + (Trim(CDS_1.FieldByName('PCID').AsString)) + ',';
MoveCDS(CDS_1, CDS_3);
CDS_1.Delete;
end;
end;
MStkIds := copy(MStkIds, 1, Length(MStkIds) - 1);
try
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('insert into Dye_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ');
sql.Add('values(''Ⱦɫ<C8BE><C9AB>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>'' ');
sql.Add(',' + quotedstr(MPCIDS));
sql.Add(',''<27><><EFBFBD><EFBFBD>'' ');
sql.Add(',' + quotedstr(DName));
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(MStkIds));
sql.Add(') ');
execsql;
end;
with ADOQueryCmd do
begin
Close;
Sql.Clear;
Sql.Add('exec P_Dye_Cloth_In ');
Sql.Add('@StkIds=' + quotedstr(trim(MStkIds)));
Sql.Add(',@IOTime=' + Quotedstr(FormatDateTime('yyyy-MM-dd', CRTime.DateTime)));
Sql.Add(',@IOType=' + Quotedstr(crtype.Text));
Sql.Add(',@IONO=' + Quotedstr(InNo.Text));
Sql.Add(',@StkPosition=' + Quotedstr(''));
Sql.Add(',@FillId=' + Quotedstr(DCode));
Sql.Add(',@Filler=' + Quotedstr(DName));
Open;
end;
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
begin
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
end;
ADOQueryCmd.Connection.CommitTrans;
PlayWav('<27><>ȷ');
except
ADOQueryCmd.Connection.RollbackTrans;
raise Exception.Create(PChar(Exception(ExceptObject).Message));
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('exec P_Dye_Card_PSC ');
execsql;
end;
except
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
// PlayWav('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
end;
procedure TfrmDyeClothInEdit.ScanCIID();
var
MStkIds, MPCIDS: string;
begin
try
if Trim(InNo.Text) = '' then
raise Exception.Create('<27><><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!');
if CDS_2.IsEmpty then
raise Exception.Create(ѡ<CEB4><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
if not CDS_1.Locate('StkId', Trim(FScan), []) then
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EBB2BB><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ľ<EFBFBD><C4BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
MStkIds := (Trim(CDS_1.FieldByName('StkId').AsString));
MPCIDS := (Trim(CDS_1.FieldByName('PCID').AsString));
MoveCDS(CDS_1, CDS_3);
CDS_1.Delete;
try
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('insert into Dye_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ');
sql.Add('values(''Ⱦɫ<C8BE><C9AB>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>'' ');
sql.Add(',' + quotedstr(MPCIDS));
sql.Add(',''<27><><EFBFBD><EFBFBD>'' ');
sql.Add(',' + quotedstr(DName));
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(MStkIds));
sql.Add(') ');
execsql;
end;
with ADOQueryCmd do
begin
Close;
Sql.Clear;
Sql.Add('exec P_Dye_Cloth_In ');
Sql.Add('@StkIds=' + quotedstr(trim(MStkIds)));
Sql.Add(',@IOTime=' + Quotedstr(FormatDateTime('yyyy-MM-dd', CRTime.DateTime)));
Sql.Add(',@IOType=' + Quotedstr(crtype.Text));
Sql.Add(',@IONO=' + Quotedstr(InNo.Text));
Sql.Add(',@StkPosition=' + Quotedstr(''));
Sql.Add(',@FillId=' + Quotedstr(DCode));
Sql.Add(',@Filler=' + Quotedstr(DName));
Open;
end;
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
begin
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
end;
ADOQueryCmd.Connection.CommitTrans;
PlayWav('<27><>ȷ');
except
ADOQueryCmd.Connection.RollbackTrans;
raise Exception.Create(PChar(Exception(ExceptObject).Message));
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('exec P_Dye_Card_PSC ');
execsql;
end;
except
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
// PlayWav('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
end;
procedure TfrmDyeClothInEdit.FormClose(Sender: TObject; var Action: TCloseAction);
begin
inherited;
Action := caFree;
end;
procedure TfrmDyeClothInEdit.FormDestroy(Sender: TObject);
begin
inherited;
frmDyeClothInEdit := nil;
end;
procedure TfrmDyeClothInEdit.FormShow(Sender: TObject);
begin
inherited;
ReadCxGrid(self.caption + 'Tv1', Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
ReadCxGrid(self.caption + 'Tv2', Tv2, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
ReadCxGrid(self.caption + 'Tv3', Tv3, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
InitGrid2();
InitGrid1();
InitGrid3();
CRTime.DateTime := SGetServerDate(ADOQueryTemp);
end;
procedure TfrmDyeClothInEdit.Tv2CellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
begin
if CDS_3.IsEmpty = False then
Exit;
if CDS_2.IsEmpty then
Exit;
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
CDS_1.DisableControls;
with CDS_1 do
begin
First;
while not Eof do
begin
if Trim(CDS_1.fieldbyname('SubId').AsString) = Trim(CDS_2.fieldbyname('SubId').AsString) then
begin
CDS_1.Delete;
end
else
Next;
end;
end;
CDS_1.EnableControls;
CDS_2.Delete;
end;
procedure TfrmDyeClothInEdit.edtScanKeyPress(Sender: TObject; var Key: Char);
var
maxno, SMFlag, KYCKFlag, FMainId, ff: string;
FFQty: Integer;
begin
if Key = #13 then
begin
FScan := TRIM(edtScan.Text);
edtScan.Text := '';
if Copy(FScan, 1, 2) = 'RK' then
begin
ScanPCID();
end
else
begin
ScanCIID();
InitGrid3();
{if Trim(edtIsSMTH.Text) = '' then
begin
if Copy(FScan, 1, 2) = 'BI' then
begin
if not JudgeBao() then
exit;
SaveCKBao();
PlaySound('wav/<2F><>ȷ.wav', 0, SND_FILENAME or SND_ASYNC);
end
else
begin
if not JudgeJTM() then
exit;
SaveCKJTM();
PlaySound('wav/<2F><>ȷ.wav', 0, SND_FILENAME or SND_ASYNC);
end;
end
else
begin
if JudgeJTMCX() then //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SaveCKJTMCX();
end; }
// with ADOQueryCmd do
// begin
// Close;
// sql.Clear;
// sql.Add('exec P_FH_UP_FHQty ''' + Trim(CKNO.Text) + '''');
// ExecSQL;
// end;
end;
end;
end;
procedure TfrmDyeClothInEdit.ToolButton10Click(Sender: TObject);
begin
SelOKNo(CDS_1, False);
end;
procedure TfrmDyeClothInEdit.ToolButton11Click(Sender: TObject);
begin
SelOKNo(CDS_3, True);
end;
procedure TfrmDyeClothInEdit.ToolButton12Click(Sender: TObject);
begin
SelOKNo(CDS_3, False);
end;
procedure TfrmDyeClothInEdit.ToolButton1Click(Sender: TObject);
var
MStkIds, MIOIDS, MPCIDS: string;
begin
if CDS_3.IsEmpty then
Exit;
if Application.MessageBox(<><C8B7>Ҫִ<D2AA>д˲<D0B4><CBB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
try
if not CDS_3.Locate('SSel', True, []) then
raise Exception.Create('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
MStkIds := '';
MIOIDS := '';
MPCIDS := '';
with CDS_3 do
begin
while CDS_3.Locate('SSel', True, []) do
begin
MPCIDS := MPCIDS + (Trim(CDS_3.FieldByName('PCID').AsString)) + ',';
MStkIds := MStkIds + (Trim(CDS_3.FieldByName('StkId').AsString)) + ',';
MIOIDS := MIOIDS + (Trim(CDS_3.FieldByName('IOID').AsString)) + ',';
CDS_3.Delete;
end;
end;
MStkIds := copy(MStkIds, 1, Length(MStkIds) - 1);
MIOIDS := copy(MIOIDS, 1, Length(MIOIDS) - 1);
try
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('insert into Dye_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ');
sql.Add('values(''Ⱦɫ<C8BE><C9AB>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>'' ');
sql.Add(',' + quotedstr(MPCIDS));
sql.Add(',''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' ');
sql.Add(',' + quotedstr(DName));
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(MStkIds));
sql.Add(') ');
execsql;
end;
with ADOQueryCmd do
begin
Close;
Sql.Clear;
Sql.Add('exec P_Dye_Cloth_ReIn ');
Sql.Add('@StkIds=' + quotedstr(trim(MStkIds)));
Sql.Add(',@IOIDS=' + quotedstr(trim(MIOIDS)));
Sql.Add(',@StkPosition=' + Quotedstr(''));
Sql.Add(',@FillId=' + Quotedstr(DCode));
Sql.Add(',@Filler=' + Quotedstr(DName));
Open;
end;
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
begin
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
end;
ADOQueryCmd.Connection.CommitTrans;
PlayWav('<27><>ȷ');
InitGrid1();
except
ADOQueryCmd.Connection.RollbackTrans;
raise Exception.Create(PChar(Exception(ExceptObject).Message));
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('exec P_Dye_Card_PSC ');
execsql;
end;
except
InitGrid1();
InitGrid3();
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
// PlayWav('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
end;
procedure TfrmDyeClothInEdit.ToolButton2Click(Sender: TObject);
var
MStkIds, MPCIDS: string;
begin
try
if Trim(InNo.Text) = '' then
raise Exception.Create('<27><><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!');
if CDS_2.IsEmpty then
raise Exception.Create(ѡ<CEB4><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
if not CDS_1.Locate('SSel', True, []) then
raise Exception.Create('<27><>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
MStkIds := '';
MPCIDS := '';
with CDS_1 do
begin
while CDS_1.Locate('SSel', True, []) = True do
begin
MStkIds := MStkIds + Trim(CDS_1.FieldByName('StkId').AsString) + ',';
MPCIDS := MPCIDS + Trim(CDS_1.FieldByName('PCID').AsString) + ',';
CDS_1.Delete;
end;
end;
MStkIds := copy(MStkIds, 1, Length(MStkIds) - 1);
try
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('insert into Dye_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ');
sql.Add('values(''Ⱦɫ<C8BE><C9AB>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>'' ');
sql.Add(',' + quotedstr(MPCIDS));
sql.Add(',''<27><><EFBFBD><EFBFBD>'' ');
sql.Add(',' + quotedstr(DName));
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(MStkIds));
sql.Add(') ');
execsql;
end;
with ADOQueryCmd do
begin
Close;
Sql.Clear;
Sql.Add('exec P_Dye_Cloth_In ');
Sql.Add('@StkIds=' + quotedstr(trim(MStkIds)));
Sql.Add(',@IOTime=' + Quotedstr(FormatDateTime('yyyy-MM-dd', CRTime.DateTime)));
Sql.Add(',@IOType=' + Quotedstr(crtype.Text));
Sql.Add(',@IONO=' + Quotedstr(InNo.Text));
Sql.Add(',@StkPosition=' + Quotedstr(''));
Sql.Add(',@FillId=' + Quotedstr(DCode));
Sql.Add(',@Filler=' + Quotedstr(DName));
// ShowMessage(SQL.Text);
Open;
end;
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
begin
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
end;
ADOQueryCmd.Connection.CommitTrans;
PlayWav('<27><>ȷ');
InitGrid3();
except
ADOQueryCmd.Connection.RollbackTrans;
raise Exception.Create(PChar(Exception(ExceptObject).Message));
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('exec P_Dye_Card_PSC ');
execsql;
end;
except
InitGrid1();
InitGrid3();
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
// PlayWav('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
end;
end;
procedure TfrmDyeClothInEdit.ToolButton3Click(Sender: TObject);
begin
if Trim(InNo.Text) = '' then
Exit;
try
frmLabelPrint := TfrmLabelPrint.Create(Application);
with frmLabelPrint do
begin
FLMType := 'DyeClothIn1';
FFiltration1 := Trim(Self.InNo.Text);
if ShowModal = 1 then
begin
end;
end;
finally
frmLabelPrint.Free;
end;
end;
procedure TfrmDyeClothInEdit.ToolButton4Click(Sender: TObject);
begin
FPCIds := '';
InitGrid2();
end;
procedure TfrmDyeClothInEdit.btnGetOutNoClick(Sender: TObject);
var
maxNo: string;
begin
if GetLSNo(ADOQueryCmd, maxNo, 'RK', 'Dye_Cloth_IO', 3, 1) = False then
begin
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><E2B5A5>ʧ<EFBFBD><CAA7>!', '<27><>ʾ', 0);
Exit;
end;
InNo.Text := Trim(maxNo);
CRTime.DateTime := SGetServerDate(ADOQueryTemp);
InitGrid3();
end;
procedure TfrmDyeClothInEdit.ToolButton6Click(Sender: TObject);
var
maxno, fsj: string;
begin
try
frmDyeClothWaitStorage := TfrmDyeClothWaitStorage.Create(Application);
with frmDyeClothWaitStorage do
begin
if ShowModal = 1 then
begin
CDS_OrderSel.DisableControls;
with CDS_OrderSel do
begin
First;
while not Eof do
begin
if FieldByName('SSel').Value = True then
begin
if Self.CDS_2.Locate('PCID', Trim(CDS_OrderSel.fieldbyname('PCID').AsString), []) = False then
begin
with Self.CDS_2 do
begin
Append;
FieldByName('MainId').Value := Trim(CDS_OrderSel.fieldbyname('MainId').AsString);
FieldByName('SubId').Value := Trim(CDS_OrderSel.fieldbyname('SubId').AsString);
FieldByName('PCID').Value := Trim(CDS_OrderSel.fieldbyname('PCID').AsString);
FieldByName('CustNo').Value := Trim(CDS_OrderSel.fieldbyname('CustNo').AsString);
FieldByName('CustName').Value := Trim(CDS_OrderSel.fieldbyname('CustName').AsString);
FieldByName('C_Name').Value := Trim(CDS_OrderSel.fieldbyname('C_Name').AsString);
FieldByName('PCPiece').Value := CDS_OrderSel.fieldbyname('PCPiece').Value;
FieldByName('PCQty').Value := CDS_OrderSel.fieldbyname('PCQty').Value;
FieldByName('PCUnit').Value := Trim(CDS_OrderSel.fieldbyname('PCUnit').AsString);
FieldByName('C_Color').Value := Trim(CDS_OrderSel.fieldbyname('C_Color').AsString);
FieldByName('C_Width').Value := Trim(CDS_OrderSel.fieldbyname('C_Width').AsString);
FieldByName('C_GramWeight').Value := Trim(CDS_OrderSel.fieldbyname('C_GramWeight').AsString);
Post;
end;
end;
end;
Next;
end;
end;
CDS_OrderSel.EnableControls;
end;
end;
finally
frmDyeClothWaitStorage.Free;
end;
FPCIds := '';
CDS_2.DisableControls;
with CDS_2 do
begin
First;
while not Eof do
begin
FPCIds := FPCIds + Quotedstr(Trim(CDS_2.FieldByName('PCId').AsString)) + ',';
Next;
end;
end;
FPCIds := copy(FPCIds, 1, Length(FPCIds) - 1);
CDS_2.EnableControls;
if Trim(InNo.Text) = '' then
btnGetOutNo.Click;
InitGrid1();
InitGrid3();
end;
procedure TfrmDyeClothInEdit.ToolButton7Click(Sender: TObject);
begin
tv1.Controller.EditingController.ShowEdit();
tv3.Controller.EditingController.ShowEdit();
Close;
end;
procedure TfrmDyeClothInEdit.ToolButton8Click(Sender: TObject);
begin
WriteCxGrid(self.caption + 'Tv2', Tv2, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
WriteCxGrid(self.caption + 'Tv1', Tv1, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
WriteCxGrid(self.caption + 'Tv3', Tv3, '<27><>Ʒ<EFBFBD>ֿ<EFBFBD>');
end;
procedure TfrmDyeClothInEdit.ToolButton9Click(Sender: TObject);
begin
SelOKNo(CDS_1, True);
end;
end.