823 lines
22 KiB
ObjectPascal
823 lines
22 KiB
ObjectPascal
unit U_SMCK;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
||
cxEdit, DB, cxDBData, StdCtrls, ExtCtrls, ADODB, DBClient,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, cxGridLevel, cxGridCustomTableView,
|
||
cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView,
|
||
cxGrid, MovePanel, cxCheckBox, Menus, ComCtrls, BtnEdit, ShellAPI, cxTextEdit,
|
||
RM_Common, RM_Class, RM_GridReport, RM_System, RM_Dataset, RM_e_Xls,
|
||
cxLookAndFeels, cxLookAndFeelPainters,
|
||
cxNavigator, dxDateRanges, dxBarBuiltInMenu, U_BaseList,
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
dxScrollbarAnnotations,
|
||
cxDropDownEdit, StrUtils, cxContainer, cxProgressBar;
|
||
|
||
type
|
||
TfrmSMCK = class(TfrmBaseList)
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
DS_MainSel: TDataSource;
|
||
CDS_MainSel: TClientDataSet;
|
||
GPM_1: TcxGridPopupMenu;
|
||
Panel2: TPanel;
|
||
Label5: TLabel;
|
||
Label4: TLabel;
|
||
Label9: TLabel;
|
||
edtScan: TEdit;
|
||
CRTime: TDateTimePicker;
|
||
ToCoName: TEdit;
|
||
Button2: TButton;
|
||
cxStyleRepository1: TcxStyleRepository;
|
||
cxStyle1: TcxStyle;
|
||
Label12: TLabel;
|
||
CDS_Main: TClientDataSet;
|
||
CRType: TEdit;
|
||
Button1: TButton;
|
||
RMXLSExport1: TRMXLSExport;
|
||
RMDBMX: TRMDBDataSet;
|
||
RM1: TRMGridReport;
|
||
CDS_JuanPRT: TClientDataSet;
|
||
Label10: TLabel;
|
||
edtIsSMTH: TEdit;
|
||
btn1: TButton;
|
||
ds1: TClientDataSet;
|
||
ds2: TDataSource;
|
||
Panel1: TPanel;
|
||
cxGrid3: TcxGrid;
|
||
Tv3: TcxGridDBTableView;
|
||
VC_MJXH: TcxGridDBColumn;
|
||
v3Column2: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
OutNo: TEdit;
|
||
GPM_2: TcxGridPopupMenu;
|
||
Tv3Column2: TcxGridDBColumn;
|
||
Tv3Column3: TcxGridDBColumn;
|
||
Tv3Column1: TcxGridDBColumn;
|
||
Tv3Column4: TcxGridDBColumn;
|
||
Button3: TButton;
|
||
Button4: TButton;
|
||
Tv3Column5: TcxGridDBColumn;
|
||
Tv3Column6: TcxGridDBColumn;
|
||
Tv3Column7: TcxGridDBColumn;
|
||
Tv3Column8: TcxGridDBColumn;
|
||
Tv3Column9: TcxGridDBColumn;
|
||
Tv3Column10: TcxGridDBColumn;
|
||
Tv3Column11: TcxGridDBColumn;
|
||
Button5: TButton;
|
||
ToCoNo: TEdit;
|
||
cxGrid2: TcxGrid;
|
||
Tv4: TcxGridDBTableView;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
cxGridDBColumn2: TcxGridDBColumn;
|
||
Tv1Column3: TcxGridDBColumn;
|
||
Tv1Column4: TcxGridDBColumn;
|
||
Tv1Column5: TcxGridDBColumn;
|
||
Tv1Column6: TcxGridDBColumn;
|
||
Tv1Column7: TcxGridDBColumn;
|
||
Tv1Column8: TcxGridDBColumn;
|
||
Tv1Column9: TcxGridDBColumn;
|
||
cxGridLevel2: TcxGridLevel;
|
||
Label1: TLabel;
|
||
OrderNo: TEdit;
|
||
Label2: TLabel;
|
||
Tv4Column1: TcxGridDBColumn;
|
||
Tv3Column12: TcxGridDBColumn;
|
||
Tv3Column13: TcxGridDBColumn;
|
||
PM_1: TPopupMenu;
|
||
PM11: TMenuItem;
|
||
N1: TMenuItem;
|
||
N2: TMenuItem;
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure edtScanKeyPress(Sender: TObject; var Key: Char);
|
||
procedure Button2Click(Sender: TObject);
|
||
procedure edtIsSMTHClick(Sender: TObject);
|
||
procedure btn1Click(Sender: TObject);
|
||
procedure TV4MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
procedure Button4Click(Sender: TObject);
|
||
procedure Button5Click(Sender: TObject);
|
||
procedure Button3Click(Sender: TObject);
|
||
procedure PM11Click(Sender: TObject);
|
||
procedure N1Click(Sender: TObject);
|
||
procedure N2Click(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
FCKNO, FSMStr, JXFlag, CZZT, fcuowu, FOutNo: string;
|
||
procedure InitCKGrid();
|
||
procedure InitSQGrid();
|
||
procedure PlayWav(MWav: string);
|
||
function JudgeSQD(): Boolean;
|
||
function SaveCKJTM(MStkIds: string): Boolean;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
procedure SaveCKJTMCX(); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
public
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmSMCK: TfrmSMCK;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_RTFun, MMSystem, U_CompanySel, U_KCList_Sel, U_YarnDRList_Sel;
|
||
|
||
procedure TfrmSMCK.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 TfrmSMCK.PM11Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_MainSel, true);
|
||
end;
|
||
|
||
procedure TfrmSMCK.SaveCKJTMCX();
|
||
begin
|
||
|
||
try
|
||
if Trim(OutNo.Text) = '' then
|
||
raise Exception.Create('<27><><EFBFBD>ⵥ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!');
|
||
|
||
if CDS_MainSel.IsEmpty then
|
||
raise Exception.Create('<27>ɳ<DEBF><C9B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!');
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
Sql.Clear;
|
||
sql.Add('insert into Finance_Need_Up(UType,UDataId) values(''ó<>׳<EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>'',' + quotedstr(OutNo.Text) + ') ');
|
||
|
||
Sql.Add('exec P_Knit_Cloth_ReOut ');
|
||
Sql.Add(' @StkIds=' + quotedstr(trim(FSMStr)));
|
||
Sql.Add(',@IOIDS=' + quotedstr(trim('')));
|
||
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_Knit_Cloth_DR @OutNo=' + Quotedstr(Trim(OutNo.Text)));
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
||
begin
|
||
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
||
end;
|
||
except
|
||
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
// PlayWav('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmSMCK.TV4MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
inherited;
|
||
|
||
InitCKGrid();
|
||
end;
|
||
|
||
function TfrmSMCK.SaveCKJTM(MStkIds: string): Boolean;
|
||
begin
|
||
try
|
||
if Trim(OutNo.Text) = '' then
|
||
begin
|
||
PlayWav('<27><><EFBFBD>ⵥ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>');
|
||
raise Exception.Create('<27><><EFBFBD>ⵥ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!');
|
||
end;
|
||
|
||
if Trim(ToCoName.Text) = '' then
|
||
begin
|
||
PlayWav('<27>ջ<EFBFBD><D5BB><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>');
|
||
raise Exception.Create('<27>ջ<EFBFBD><D5BB><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!');
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select * from Knit_Plan_Card ');
|
||
sql.Add(' where PCID=''' + Trim(MStkIds) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty then
|
||
begin
|
||
edtScan.text := '';
|
||
PlayWav('<27><>Ʊ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD><EFBFBD>');
|
||
raise Exception.Create('<27><>Ʊ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD><EFBFBD><EFBFBD>');
|
||
end;
|
||
|
||
if Trim(ADOQueryTemp.fieldbyname('status').AsString) = '-1' then
|
||
begin
|
||
edtScan.text := '';
|
||
PlayWav('<27><>Ʊ<EFBFBD><C6B1>ɾ<EFBFBD><C9BE>');
|
||
raise Exception.Create('<27><>Ʊ<EFBFBD><C6B1>ɾ<EFBFBD><C9BE>');
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select A.* from Knit_Cloth_Inspect A where A.CIIOFlag <>''δ<><CEB4><EFBFBD><EFBFBD>'' ');
|
||
sql.Add(' and A.PCID=''' + Trim(MStkIds) + '''');
|
||
// showmessage(sql.text);
|
||
Open;
|
||
end;
|
||
|
||
if ADOQueryTemp.IsEmpty then
|
||
begin
|
||
edtScan.text := '';
|
||
PlayWav('δ<><CEB4><EFBFBD><EFBFBD>');
|
||
edtScan.SetFocus;
|
||
Exit;
|
||
end;
|
||
|
||
if Trim(ADOQueryTemp.fieldbyname('CIIOFlag').AsString) = '<27>ѳ<EFBFBD><D1B3><EFBFBD>' then
|
||
begin
|
||
edtScan.text := '';
|
||
PlayWav('<27>ѳ<EFBFBD><D1B3><EFBFBD>');
|
||
edtScan.SetFocus;
|
||
Exit;
|
||
end;
|
||
|
||
MStkIds := Trim(ADOQueryTemp.fieldbyname('CIID').AsString);
|
||
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
Sql.Clear;
|
||
sql.Add('insert into Finance_Need_Up(UType,UDataId) values(''<27><><EFBFBD><EFBFBD>ɨ<EFBFBD><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'',' + quotedstr(OutNo.Text) + ') ');
|
||
|
||
Sql.Add('exec P_Knit_Cloth_Out ');
|
||
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(OutNo.Text));
|
||
Sql.Add(',@FillID=' + Quotedstr(DCode));
|
||
Sql.Add(',@Filler=' + Quotedstr(DName));
|
||
Sql.Add(',@ToCoName=' + Quotedstr(ToCoName.text));
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
||
begin
|
||
edtScan.text := '';
|
||
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
||
end;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
raise Exception.Create(PChar(Exception(ExceptObject).Message));
|
||
end;
|
||
|
||
{ with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Knit_Cloth_DR @OutNos=' + Quotedstr(Trim(OutNo.Text)));
|
||
open;
|
||
end;
|
||
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
||
begin
|
||
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
||
end; }
|
||
|
||
PlayWav('<27><>ȷ');
|
||
Result := True;
|
||
except
|
||
Result := False;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
// PlayWav('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
end;
|
||
|
||
end;
|
||
|
||
{$R *.dfm}
|
||
|
||
function TfrmSMCK.JudgeSQD(): Boolean;
|
||
begin
|
||
Result := false;
|
||
try
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Tat_Cloth_DR_Main A inner join Tat_Cloth_DR_Sub B on A.DRMID=B.DRMID where A.DRMID=''' + Trim(FSMStr) + '''');
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty then
|
||
raise Exception.Create('<27><><EFBFBD>뵥<EFBFBD><EBB5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>!');
|
||
|
||
if Trim(OutNo.Text) <> '' then
|
||
begin
|
||
FCKNO := Trim(OutNo.Text);
|
||
end;
|
||
OutNo.Text := Trim(FSMStr);
|
||
|
||
if FSMStr <> FCKNO then
|
||
begin
|
||
InitCKGrid();
|
||
InitSQGrid();
|
||
end;
|
||
|
||
Result := True;
|
||
except
|
||
Result := false;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
// PlaySound('δɨ<CEB4><C9A8><EFBFBD><EFBFBD><EFBFBD>뵥<EFBFBD><EBB5A5>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>.wav', 0, SND_FILENAME or SND_ASYNC);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSMCK.N1Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_MainSel, false);
|
||
end;
|
||
|
||
procedure TfrmSMCK.N2Click(Sender: TObject);
|
||
var
|
||
MBYIOIDS: string;
|
||
begin
|
||
if CDS_MainSel.IsEmpty then
|
||
Exit;
|
||
if not CDS_MainSel.Locate('SSel', True, []) then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
MBYIOIDS := '';
|
||
|
||
CDS_MainSel.DisableControls;
|
||
with CDS_MainSel do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if CDS_MainSel.fieldbyname('SSel').AsBoolean then
|
||
begin
|
||
MBYIOIDS := MBYIOIDS + (Trim(CDS_MainSel.fieldbyname('BYIOID2').AsString)) + ',';
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
MBYIOIDS := leftBstr(trim(MBYIOIDS), length(MBYIOIDS) - 1);
|
||
|
||
CDS_MainSel.Locate('SSel', True, []);
|
||
CDS_MainSel.EnableControls;
|
||
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('insert into Finance_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ');
|
||
sql.Add('values(''ɴ<>߳<EFBFBD><DFB3><EFBFBD>'' ');
|
||
sql.Add(',' + quotedstr(MBYIOIDS));
|
||
sql.Add(',''ɾ<><C9BE>'' ');
|
||
sql.Add(',' + quotedstr(DName));
|
||
sql.Add(',' + quotedstr(trim(self.Caption)));
|
||
sql.Add(',' + quotedstr(MBYIOIDS));
|
||
sql.Add(') ');
|
||
execsql;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
Sql.Clear;
|
||
Sql.Add('exec P_BS_Yarn_Out_Del ');
|
||
Sql.Add(' @BYIOIDS=' + quotedstr(MBYIOIDS));
|
||
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
||
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
||
// ShowMessage(sql.Text);
|
||
Open;
|
||
end;
|
||
|
||
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
||
begin
|
||
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Yarn_DR @OutNo=' + Quotedstr(Trim(OutNo.text)));
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
||
begin
|
||
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
||
end;
|
||
|
||
InitSQGrid();
|
||
InitCKGrid();
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
|
||
except
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSMCK.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
inherited;
|
||
Action := caFree;
|
||
end;
|
||
|
||
procedure TfrmSMCK.FormDestroy(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
frmSMCK := nil;
|
||
end;
|
||
|
||
procedure TfrmSMCK.FormShow(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
edtScan.SetFocus;
|
||
ReadCxGrid('ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Tv44', Tv4, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
ReadCxGrid('ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Tv33', Tv3, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
CRTime.DateTime := SGetServerDate(ADOQueryTemp);
|
||
|
||
end;
|
||
|
||
procedure TfrmSMCK.edtScanKeyPress(Sender: TObject; var Key: Char);
|
||
var
|
||
maxno, SMFlag, KYCKFlag, FMainId, ff: string;
|
||
FFQty: Integer;
|
||
begin
|
||
|
||
if Key = #13 then
|
||
begin
|
||
FSMStr := TRIM(edtScan.Text);
|
||
if Copy(FSMStr, 1, 2) = 'SC' then
|
||
begin
|
||
if not JudgeSQD() then
|
||
exit;
|
||
end
|
||
else
|
||
begin
|
||
if Trim(edtIsSMTH.Text) = '' then
|
||
begin
|
||
|
||
if SaveCKJTM(FSMStr) then
|
||
begin
|
||
PlayWav('<27><>ȷ');
|
||
end
|
||
else
|
||
exit;
|
||
|
||
end
|
||
else
|
||
begin
|
||
SaveCKJTMCX();
|
||
end;
|
||
|
||
// InitSQGrid();
|
||
InitCKGrid();
|
||
end;
|
||
|
||
edtScan.Text := '';
|
||
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmSMCK.Button2Click(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Tv44', Tv4, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
WriteCxGrid('ɨ<><C9A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Tv33', Tv3, '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
Close;
|
||
|
||
end;
|
||
|
||
procedure TfrmSMCK.Button3Click(Sender: TObject);
|
||
var
|
||
MKey: Char;
|
||
begin
|
||
MKey := #13;
|
||
try
|
||
frmYarnDRList_Sel := TfrmYarnDRList_Sel.Create(self);
|
||
with frmYarnDRList_Sel do
|
||
begin
|
||
if ShowModal = 1 then
|
||
begin
|
||
edtScan.Text := Trim(Order_Main.fieldbyname('DRMID').AsString);
|
||
edtScanKeyPress(edtScan, MKey);
|
||
end;
|
||
end;
|
||
finally
|
||
frmYarnDRList_Sel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSMCK.Button4Click(Sender: TObject);
|
||
begin
|
||
|
||
try
|
||
frmCompanySel := TfrmCompanySel.Create(Application);
|
||
with frmCompanySel do
|
||
begin
|
||
FCoType := '<27><>Ӧ<EFBFBD><D3A6>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
self.ToCoName.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoAbbrName').AsString);
|
||
self.ToCoNo.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoCode').AsString);
|
||
end;
|
||
end;
|
||
|
||
finally
|
||
frmCompanySel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSMCK.Button5Click(Sender: TObject);
|
||
var
|
||
MKey: Char;
|
||
FBYIOID, FBanID, FMXID, FStkID: string;
|
||
FQty: Integer;
|
||
begin
|
||
MKey := #13;
|
||
|
||
if Trim(OutNo.Text) = '' then
|
||
begin
|
||
exit;
|
||
end;
|
||
|
||
try
|
||
frmKCList_Sel := TfrmKCList_Sel.Create(Application);
|
||
with frmKCList_Sel do
|
||
begin
|
||
FFOutNo := OutNo.text;
|
||
if ShowModal = 1 then
|
||
begin
|
||
FQty := FFQty;
|
||
FStkID := FFStkID;
|
||
|
||
// with ADOQueryTemp do
|
||
// begin
|
||
// Close;
|
||
// sql.Clear;
|
||
// Sql.Add(' Select Min(isnull(Qty,0)-DlyQTy) from Tat_Cloth_DR_Sub A where EXISTS(select * from Bs_Yarn_IO X where X.BYIOID=''' + trim(FStkID) + '''');
|
||
// SQL.Add(' and isnull(X.Y_Code,'''') = isnull(A.Y_Code,'''') ');
|
||
// SQL.Add(' and isnull(X.Yarn_Name,'''') = isnull(A.Yarn_Name,'''') ');
|
||
// SQL.Add(' and isnull(X.Y_name,'''') = isnull(A.Y_name,'''') ');
|
||
// SQL.Add(' and isnull(X.Y_Spec,'''') = isnull(A.Y_Spec,'''') ');
|
||
// SQL.Add(' and isnull(X.Denier,0) = isnull(A.Denier,0) ');
|
||
// SQL.Add(' and isnull(X.Z_Number,0) = isnull(A.Z_Number,0) ');
|
||
// SQL.Add(' and isnull(X.F_Number,0) = isnull(A.F_Number,0) ');
|
||
// SQL.Add(' and isnull(X.Y_Type,'''') = isnull(A.Y_Type,'''')) ');
|
||
//// ShowMessage(SQL.text);
|
||
// Open;
|
||
// end;
|
||
// if ADOQueryTemp.IsEmpty then
|
||
// begin
|
||
// raise Exception.Create('δ<><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ<EFBFBD>֣<EFBFBD><D6A3><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD>');
|
||
// end
|
||
// else
|
||
// begin
|
||
//
|
||
// end;
|
||
|
||
if frmKCList_Sel.cxPageControl1.ActivePageIndex = 0 then
|
||
begin
|
||
FBYIOID := FFBYIOID;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
Sql.Add(' update BS_Yarn_IO_MX set IOFlag= ''<27>ѳ<EFBFBD><D1B3><EFBFBD>'',CKLX=''<27><><EFBFBD><EFBFBD>'',OutPutId= REPLACE(MXID,''Bao'',''YC''),HZCKNO=''' + Trim(OutNo.text) + '''');
|
||
Sql.Add(' from BS_Yarn_IO_MX A');
|
||
sql.Add(' where IOFlag= ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' and EXISTS(select X.RTValue from [dbo].[F_Tool_SplitString](' + quotedstr(FBYIOID) + ','','') X where A.BYIOID=X.RTValue ) ');
|
||
if (CRType.text = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') or (CRType.text = '֯<><D6AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') then
|
||
begin
|
||
Sql.Add(' update BS_Yarn_IO_MX set IOFlag2= ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>''');
|
||
Sql.Add(' from BS_Yarn_IO_MX A');
|
||
sql.Add(' where IOFlag= ''<27>ѳ<EFBFBD><D1B3><EFBFBD>'' and EXISTS(select X.RTValue from [dbo].[F_Tool_SplitString](' + quotedstr(FBYIOID) + ','','') X where A.BYIOID=X.RTValue ) ');
|
||
end;
|
||
|
||
// ShowMessage(SQL.text);
|
||
ExecSQL;
|
||
end;
|
||
|
||
end
|
||
else if frmKCList_Sel.cxPageControl1.ActivePageIndex = 1 then
|
||
begin
|
||
FBanID := FFBanID;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
Sql.Add(' update BS_Yarn_IO_MX set IOFlag= ''<27>ѳ<EFBFBD><D1B3><EFBFBD>'',CKLX=''<27><><EFBFBD><EFBFBD>'',OutPutId= REPLACE(MXID,''Bao'',''YC''),HZCKNO=''' + Trim(OutNo.text) + '''');
|
||
Sql.Add(' from BS_Yarn_IO_MX A');
|
||
sql.Add(' where IOFlag= ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' and EXISTS(select X.RTValue from [dbo].[F_Tool_SplitString](' + quotedstr(FBanID) + ','','') X where A.BanID=X.RTValue ) ');
|
||
|
||
if (CRType.text = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') or (CRType.text = '֯<><D6AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') then
|
||
begin
|
||
Sql.Add(' update BS_Yarn_IO_MX set IOFlag2= ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>''');
|
||
Sql.Add(' from BS_Yarn_IO_MX A');
|
||
sql.Add(' where IOFlag= ''<27>ѳ<EFBFBD><D1B3><EFBFBD>'' and EXISTS(select X.RTValue from [dbo].[F_Tool_SplitString](' + quotedstr(FBanID) + ','','') X where A.BanID=X.RTValue ) ');
|
||
end;
|
||
// ShowMessage(SQL.text);
|
||
ExecSQL;
|
||
end;
|
||
end
|
||
else if frmKCList_Sel.cxPageControl1.ActivePageIndex = 2 then
|
||
begin
|
||
FMXID := FFMXID;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
Sql.Add(' update BS_Yarn_IO_MX set IOFlag= ''<27>ѳ<EFBFBD><D1B3><EFBFBD>'',CKLX=''<27><><EFBFBD><EFBFBD>'',OutPutId= REPLACE(MXID,''Bao'',''YC''),HZCKNO=''' + Trim(OutNo.text) + '''');
|
||
Sql.Add(' from BS_Yarn_IO_MX A');
|
||
sql.Add(' where IOFlag= ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'' and EXISTS(select X.RTValue from [dbo].[F_Tool_SplitString](' + quotedstr(FMXID) + ','','') X where A.MXID=X.RTValue ) ');
|
||
|
||
if (CRType.text = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') or (CRType.text = '֯<><D6AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') then
|
||
begin
|
||
Sql.Add(' update BS_Yarn_IO_MX set IOFlag2= ''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>''');
|
||
Sql.Add(' from BS_Yarn_IO_MX A');
|
||
sql.Add(' where IOFlag= ''<27>ѳ<EFBFBD><D1B3><EFBFBD>'' and EXISTS(select X.RTValue from [dbo].[F_Tool_SplitString](' + quotedstr(FMXID) + ','','') X where A.MXID=X.RTValue ) ');
|
||
end;
|
||
|
||
// ShowMessage(SQL.text);
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('exec P_Yarn_CK ');
|
||
sql.Add(' @OutNo=' + quotedstr(Trim(OutNo.text)));
|
||
sql.Add(',@FillID=' + quotedstr(Trim(DCode)));
|
||
sql.Add(',@Filler=' + quotedstr(Trim(DName)));
|
||
sql.Add(',@ToCoNo=' + quotedstr(Trim(ToCoNo.text)));
|
||
sql.Add(',@ToCoName=' + quotedstr(Trim(ToCoName.text)));
|
||
// ShowMessage(SQL.text);
|
||
ExecSQL;
|
||
end;
|
||
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('exec P_Yarn_DR @OutNo=' + Quotedstr(Trim(OutNo.Text)));
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
|
||
begin
|
||
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
|
||
end;
|
||
InitSQGrid();
|
||
InitCKGrid();
|
||
end;
|
||
finally
|
||
frmKCList_Sel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSMCK.edtIsSMTHClick(Sender: TObject);
|
||
begin
|
||
if Trim(edtIsSMTH.Text) = '' then
|
||
edtIsSMTH.Text := '<27><>'
|
||
else
|
||
edtIsSMTH.Text := '';
|
||
end;
|
||
|
||
procedure TfrmSMCK.btn1Click(Sender: TObject);
|
||
var
|
||
MKey: Char;
|
||
begin
|
||
MKey := #13;
|
||
CZZT := 'ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
fcuowu := '1';
|
||
// try
|
||
// frmCKProductCPKCListSel := TfrmCKProductCPKCListSel.Create(Application);
|
||
// with frmCKProductCPKCListSel do
|
||
// begin
|
||
//// CustomerNoName.text := trim(Self.KHName.text);
|
||
// if ShowModal = 1 then
|
||
// begin
|
||
// with frmCKProductCPKCListSel.CDS_Main do
|
||
// begin
|
||
// First;
|
||
// while not Eof do
|
||
// begin
|
||
// if Fieldbyname('ssel').AsBoolean then
|
||
// begin
|
||
//
|
||
// Self.edtScan.Text := Trim(Fieldbyname('JYID').AsString);
|
||
// edtScanKeyPress(Self.edtScan, MKey);
|
||
// if fcuowu = '<27><><EFBFBD><EFBFBD>' then
|
||
// begin
|
||
// Break;
|
||
// end;
|
||
// Sleep(200);
|
||
// end;
|
||
// Next;
|
||
// end;
|
||
// end;
|
||
// end;
|
||
// end;
|
||
// finally
|
||
// frmCKProductCPKCListSel.Free;
|
||
// end;
|
||
InitCKGrid();
|
||
end;
|
||
|
||
procedure TfrmSMCK.InitSQGrid();
|
||
begin
|
||
if OutNo.Text <> '' then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('SELECT A.OrderNo,* FROM Tat_Cloth_DR_Sub B');
|
||
sql.Add('inner join Tat_Cloth_DR_Main A ON A.DRMID=B.DRMID ');
|
||
sql.Add('WHERE B.DRMID=''' + Trim(OutNo.Text) + '''');
|
||
// ShowMessage(SQL.text);
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryTemp, DS1);
|
||
SInitCDSData(ADOQueryTemp, DS1);
|
||
|
||
crtype.Text := Trim(ADOQueryTemp.FieldByName('OutType').AsString);
|
||
ToCoName.Text := Trim(ADOQueryTemp.FieldByName('ToCoName').AsString);
|
||
OrderNo.Text := Trim(ADOQueryTemp.FieldByName('OrderNo').AsString);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmSMCK.InitCKGrid();
|
||
begin
|
||
if OutNo.Text <> '' then
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select A.*,B.*,BYIOID2=B.BYIOID ');
|
||
sql.Add(' from BS_Yarn_IO_MX A INNER JOIN BS_Yarn_IO B on A.MXID =B.FromMXID ');
|
||
sql.Add(' where B.BYIONO=''' + Trim(OutNo.Text) + '''');
|
||
sql.Add(' order by A.BYIOID,A.BanNo,A.BaoNO');
|
||
// ShowMessage(sql.text);
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryTemp, CDS_MainSel);
|
||
SInitCDSData(ADOQueryTemp, CDS_MainSel);
|
||
end;
|
||
|
||
end;
|
||
|
||
end.
|
||
|