621 lines
19 KiB
ObjectPascal
621 lines
19 KiB
ObjectPascal
|
|
unit U_DyeClothInPut;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
|||
|
|
cxEdit, DB, cxDBData, cxCalendar, cxDropDownEdit, ComCtrls, ToolWin,
|
|||
|
|
cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
|||
|
|
cxClasses, cxControls, cxGridCustomView, cxGrid, cxGridCustomPopupMenu,
|
|||
|
|
cxGridPopupMenu, ADODB, DBClient, cxButtonEdit, cxTextEdit, cxSpinEdit,
|
|||
|
|
StdCtrls, ExtCtrls, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore,
|
|||
|
|
dxSkinsDefaultPainters, cxNavigator, dxDateRanges, dxBarBuiltInMenu,
|
|||
|
|
U_BaseInput, System.ImageList, Vcl.ImgList, dxScrollbarAnnotations, cxCheckBox;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmDyeClothInPut = class(TfrmBaseInput)
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
TBAdd: TToolButton;
|
|||
|
|
TBDel: TToolButton;
|
|||
|
|
TBSave: TToolButton;
|
|||
|
|
TBClose: TToolButton;
|
|||
|
|
DataSource3: TDataSource;
|
|||
|
|
CDS_Sub: TClientDataSet;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
cxGrid2: TcxGrid;
|
|||
|
|
Tv1: TcxGridDBTableView;
|
|||
|
|
v1Column6: TcxGridDBColumn;
|
|||
|
|
Tv1ioTime: TcxGridDBColumn;
|
|||
|
|
Tv1IOType: TcxGridDBColumn;
|
|||
|
|
Tv1IONo: TcxGridDBColumn;
|
|||
|
|
v2Column1: TcxGridDBColumn;
|
|||
|
|
v2Column6: TcxGridDBColumn;
|
|||
|
|
v1Column15: TcxGridDBColumn;
|
|||
|
|
Tv1IONote: TcxGridDBColumn;
|
|||
|
|
cxGrid2Level1: TcxGridLevel;
|
|||
|
|
ToolButton2: TToolButton;
|
|||
|
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
procedure TBAddClick(Sender: TObject);
|
|||
|
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure TBDelClick(Sender: TObject);
|
|||
|
|
procedure TBSaveClick(Sender: TObject);
|
|||
|
|
procedure Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
|
procedure Tv1Column2PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure v1Column13PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
|||
|
|
procedure ToolButton2Click(Sender: TObject);
|
|||
|
|
procedure Tv1IONoPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
private
|
|||
|
|
{ Private declarations }
|
|||
|
|
function SaveCKData(): Boolean;
|
|||
|
|
public
|
|||
|
|
{ Public declarations }
|
|||
|
|
FIOID, FStkName, FKHName, FWorkshop: string;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmDyeClothInPut: TfrmDyeClothInPut;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_RTFun, U_ZDYHelp, U_CompanySel, U_DyeClothStkSel, U_DyeCPImport,
|
|||
|
|
U_DyePlanForCardSel;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
procedure TfrmDyeClothInPut.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
Action := caFree;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeClothInPut.TBAddClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
with CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('IOTime').Value := Trim(FormatDateTime('yyyy-MM-dd hh:mm:ss', Now));
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrmDyeClothInPut.SaveCKData(): Boolean;
|
|||
|
|
var
|
|||
|
|
MBCIOID, Maxno: string;
|
|||
|
|
MStkID, maxStkID: string;
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
|
CDS_Sub.DisableControls;
|
|||
|
|
with CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
First;
|
|||
|
|
while not eof do
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from Dye_Cloth_IO where IOID=''' + Trim(CDS_Sub.fieldbyname('IOID').AsString) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
MBCIOID := Trim(ADOQueryTemp.fieldbyname('IOID').AsString);
|
|||
|
|
if Trim(MBCIOID) = '' then
|
|||
|
|
begin
|
|||
|
|
if not GetLSNo(ADOQueryCmd, Maxno, 'R', 'Dye_Cloth_IO', 5, 1) then
|
|||
|
|
raise Exception.Create('ȡ<><C8A1>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Maxno := Trim(MBCIOID);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from Dye_Cloth_IO where IOID=''' + Trim(Maxno) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
if Trim(MBCIOID) = '' then
|
|||
|
|
begin
|
|||
|
|
Append;
|
|||
|
|
FieldByName('Filler').Value := Trim(DName);
|
|||
|
|
FieldByName('FillTime').Value := SGetServerDate(ADOQueryTemp);
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('Editer').Value := Trim(DName);
|
|||
|
|
FieldByName('EditTime').Value := SGetServerDate(ADOQueryTemp);
|
|||
|
|
end;
|
|||
|
|
// RTSetSaveDataCDS(ADOQueryCmd, Tv1, CDS_Sub, 'Dye_Cloth_IO', 2);
|
|||
|
|
|
|||
|
|
FieldByName('IOID').Value := Trim(Maxno);
|
|||
|
|
FieldByName('IONo').Value := CDS_Sub.FieldByName('IONo').asString;
|
|||
|
|
FieldByName('IOTime').Value := CDS_Sub.FieldByName('IOTime').asString;
|
|||
|
|
FieldByName('IOType').Value := CDS_Sub.FieldByName('IOType').asString;
|
|||
|
|
FieldByName('IONote').Value := CDS_Sub.FieldByName('IONote').asString;
|
|||
|
|
FieldByName('Meter').Value := CDS_Sub.FieldByName('Meter').asString;
|
|||
|
|
FieldByName('Piece').Value := CDS_Sub.FieldByName('Piece').asString;
|
|||
|
|
|
|||
|
|
FieldByName('IOFlag').Value := '<27><><EFBFBD><EFBFBD>';
|
|||
|
|
FieldByName('IOQtyFlag').Value := 1;
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
/////////////////<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>///////////////////////////////
|
|||
|
|
if (CDS_Sub.FieldByName('IOType').AsString = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ') or (CDS_Sub.FieldByName('IOType').AsString = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ') then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.add(' SELECT StkID FROM Dye_Cloth_Stock WHERE OrderNo = ' + QuotedStr(Trim(CDS_Sub.FieldByName('IONo').asString)));
|
|||
|
|
SQL.Add(' and IOType = ' + QuotedStr(Trim(CDS_Sub.FieldByName('IOType').asString)));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
MStkID := Trim(ADOQueryTemp.fieldbyname('StkID').AsString);
|
|||
|
|
if Trim(MStkID) = '' then
|
|||
|
|
begin
|
|||
|
|
if not GetLSNo(ADOQueryCmd, maxStkID, 'KC', 'Dye_Cloth_Stock', 5, 1) then
|
|||
|
|
raise Exception.Create('ȡ<><C8A1>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
maxStkID := Trim(MStkID);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if ADOQueryTemp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('INSERT INTO Dye_Cloth_Stock(StkID,Workshop,IOType,IONote,StkExists,OrderNo,MainId,SubId,StkMeter,StkPiece)');
|
|||
|
|
sql.Add(' SELECT StkID=' + quotedstr(maxStkID) + ',Workshop=''ӡȾһ<C8BE><D2BB><EFBFBD><EFBFBD>'',A.IOType,A.IONote,StkExists=1,A.IONO,A.IONO,A.IONO,A.Meter,A.Piece from Dye_Cloth_IO A ');
|
|||
|
|
sql.Add(' where A.IOID=''' + Trim(Maxno) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
SQL.Add(' update Dye_Cloth_IO set stkID = ' + QuotedStr(Trim(maxStkID)));
|
|||
|
|
SQL.Add(' where IOID=''' + Trim(Maxno) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update Dye_Cloth_Stock Set StkPiece=(select Sum(isnull(Piece,0)*IOQtyFlag) from Dye_Cloth_IO A where A.StkID =''' + Trim(maxStkID) + ''')');
|
|||
|
|
sql.Add(',STKMeter=(select Sum(isnull(Meter,0)*IOQtyFlag) from Dye_Cloth_IO A where A.StkID =''' + Trim(maxStkID) + ''')');
|
|||
|
|
sql.Add(' where StkID=''' + Trim(maxStkID) + '''');
|
|||
|
|
// sql.Add('where OrderNo=''' + Trim(CDS_Sub.fieldbyname('IONO').AsString) + '''');
|
|||
|
|
// SQL.Add(' and IOType = ' + QuotedStr(Trim(CDS_Sub.FieldByName('IOType').asString)));
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from Dye_Cloth_Stock where OrderNo=''' + Trim(CDS_Sub.fieldbyname('IONO').AsString) + '''');
|
|||
|
|
SQL.Add(' and IOType = ' + QuotedStr(Trim(CDS_Sub.FieldByName('IOType').asString)));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if (ADOQueryCmd.FieldByName('StkPiece').AsString = '0') and (ADOQueryCmd.FieldByName('StkMeter').AsString = '0') then
|
|||
|
|
begin
|
|||
|
|
ADOQueryCmd.Edit;
|
|||
|
|
ADOQueryCmd.FieldByName('StkExists').Value := 0;
|
|||
|
|
ADOQueryCmd.Post;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
ADOQueryCmd.Edit;
|
|||
|
|
ADOQueryCmd.FieldByName('StkExists').Value := 1;
|
|||
|
|
ADOQueryCmd.Post;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from Dye_Cloth_Stock where OrderNo=''' + Trim(CDS_Sub.fieldbyname('IONO').AsString) + '''');
|
|||
|
|
SQL.Add(' and IOType = ' + QuotedStr(Trim(CDS_Sub.FieldByName('IOType').asString)));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if ADOQueryTemp.FieldByName('StkMeter').Value < 0 then
|
|||
|
|
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1>棡');
|
|||
|
|
|
|||
|
|
if ADOQueryTemp.FieldByName('StkPiece').Value < 0 then
|
|||
|
|
raise Exception.Create('<27><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1>棡');
|
|||
|
|
|
|||
|
|
end
|
|||
|
|
else if (CDS_Sub.FieldByName('IOType').AsString = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ') or (CDS_Sub.FieldByName('IOType').AsString = '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʒ') then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.add(' SELECT StkID FROM Dye_Cloth_Stock WHERE OrderNo = ' + QuotedStr(Trim(CDS_Sub.FieldByName('IONo').asString)));
|
|||
|
|
SQL.Add(' and IOType = ' + QuotedStr(Trim(CDS_Sub.FieldByName('IOType').asString)));
|
|||
|
|
SQL.Add(' and IONote = ' + QuotedStr(Trim(CDS_Sub.FieldByName('IONote').asString)));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
MStkID := Trim(ADOQueryTemp.fieldbyname('StkID').AsString);
|
|||
|
|
if Trim(MStkID) = '' then
|
|||
|
|
begin
|
|||
|
|
if not GetLSNo(ADOQueryCmd, maxStkID, 'KC', 'Dye_Cloth_Stock', 5, 1) then
|
|||
|
|
raise Exception.Create('ȡ<><C8A1>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>');
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
maxStkID := Trim(MStkID);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if ADOQueryTemp.IsEmpty then
|
|||
|
|
begin
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
sql.Add('INSERT INTO Dye_Cloth_Stock(StkID,Workshop,IOType,IONote,StkExists,OrderNo,MainId,SubId,StkMeter,StkPiece)');
|
|||
|
|
sql.Add(' SELECT StkID=' + quotedstr(maxStkID) + ',Workshop=''ӡȾһ<C8BE><D2BB><EFBFBD><EFBFBD>'',A.IOType,A.IONote,StkExists=1,A.IONO,A.IONO,A.IONO,A.Meter,A.Piece from Dye_Cloth_IO A ');
|
|||
|
|
sql.Add(' where A.IOID=''' + Trim(Maxno) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
SQL.Clear;
|
|||
|
|
SQL.Add(' update Dye_Cloth_IO set stkID = ' + QuotedStr(Trim(maxStkID)));
|
|||
|
|
SQL.Add(' where IOID=''' + Trim(Maxno) + '''');
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('Update Dye_Cloth_Stock Set StkPiece=(select Sum(isnull(Piece,0)*IOQtyFlag) from Dye_Cloth_IO A where A.StkID =''' + Trim(maxStkID) + ''')');
|
|||
|
|
sql.Add(',STKMeter=(select Sum(isnull(Meter,0)*IOQtyFlag) from Dye_Cloth_IO A where A.StkID =''' + Trim(maxStkID) + ''')');
|
|||
|
|
sql.Add(' where StkID=''' + Trim(maxStkID) + '''');
|
|||
|
|
// sql.Add('where OrderNo=''' + Trim(CDS_Sub.fieldbyname('IONO').AsString) + '''');
|
|||
|
|
// SQL.Add(' and IOType = ' + QuotedStr(Trim(CDS_Sub.FieldByName('IOType').asString)));
|
|||
|
|
// SQL.Add(' and IONote = ' + QuotedStr(Trim(CDS_Sub.FieldByName('IONote').asString)));
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from Dye_Cloth_Stock where OrderNo=''' + Trim(CDS_Sub.fieldbyname('IONO').AsString) + '''');
|
|||
|
|
SQL.Add(' and IOType = ' + QuotedStr(Trim(CDS_Sub.FieldByName('IOType').asString)));
|
|||
|
|
SQL.Add(' and IONote = ' + QuotedStr(Trim(CDS_Sub.FieldByName('IONote').asString)));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if (ADOQueryCmd.FieldByName('StkPiece').AsString = '0') and (ADOQueryCmd.FieldByName('StkMeter').AsString = '0') then
|
|||
|
|
begin
|
|||
|
|
ADOQueryCmd.Edit;
|
|||
|
|
ADOQueryCmd.FieldByName('StkExists').Value := 0;
|
|||
|
|
ADOQueryCmd.Post;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
ADOQueryCmd.Edit;
|
|||
|
|
ADOQueryCmd.FieldByName('StkExists').Value := 1;
|
|||
|
|
ADOQueryCmd.Post;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select * from Dye_Cloth_Stock where OrderNo=''' + Trim(CDS_Sub.fieldbyname('IONO').AsString) + '''');
|
|||
|
|
SQL.Add(' and IOType = ' + QuotedStr(Trim(CDS_Sub.FieldByName('IOType').asString)));
|
|||
|
|
SQL.Add(' and IONote = ' + QuotedStr(Trim(CDS_Sub.FieldByName('IONote').asString)));
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if ADOQueryTemp.FieldByName('StkMeter').Value < 0 then
|
|||
|
|
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1>棡');
|
|||
|
|
|
|||
|
|
if ADOQueryTemp.FieldByName('StkPiece').Value < 0 then
|
|||
|
|
raise Exception.Create('<27><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1>棡');
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('IOID').Value := Trim(Maxno);
|
|||
|
|
Post;
|
|||
|
|
Next;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
CDS_Sub.EnableControls;
|
|||
|
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
|
Result := True;
|
|||
|
|
except
|
|||
|
|
CDS_Sub.EnableControls;
|
|||
|
|
Result := False;
|
|||
|
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
|
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeClothInPut.TBCloseClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
Close;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeClothInPut.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
|||
|
|
begin
|
|||
|
|
if Key = VK_ESCAPE then // VK_ESCAPE <20><> ESC <20><><EFBFBD>ij<EFBFBD><C4B3><EFBFBD>
|
|||
|
|
begin
|
|||
|
|
Key := 0; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
Close; // <20><><EFBFBD><EFBFBD> ModalResult := mrCancel;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeClothInPut.FormShow(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
fsj: string;
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
ReadCxGrid(FSTKName + '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>', Tv1, '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>');
|
|||
|
|
with ADOQueryTemp do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add(' select A.* ');
|
|||
|
|
sql.Add(' from V_Dye_Cloth_IO_cai A');
|
|||
|
|
sql.Add(' where IOID=''' + Trim(FIOID) + '''');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
SCreateCDS(ADOQueryTemp, CDS_Sub);
|
|||
|
|
SInitCDSData(ADOQueryTemp, CDS_Sub);
|
|||
|
|
KeyPreview := True; // ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
// fsj:='select name=CJName ,Code=null from CheJian';
|
|||
|
|
// SInitCxGridComboBoxBySql(ADOQueryTemp,v1CheJian,fsj,0,True,'');
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeClothInPut.TBDelClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_Sub.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
|
|||
|
|
CDS_Sub.Delete;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeClothInPut.TBSaveClick(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
if CDS_Sub.IsEmpty then
|
|||
|
|
Exit;
|
|||
|
|
if CDS_Sub.Locate('IOTime', null, []) = True then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʱ<EFBFBD>䲻<EFBFBD><E4B2BB>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if CDS_Sub.Locate('IOType', null, []) = True then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if CDS_Sub.Locate('IONO', null, []) = True then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if CDS_Sub.Locate('Piece', null, []) = True then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if CDS_Sub.Locate('Meter', null, []) = True then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
// if CDS_Sub.Locate('Meter', 0, []) = True then
|
|||
|
|
// begin
|
|||
|
|
// Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0!', '<27><>ʾ', 0);
|
|||
|
|
// Exit;
|
|||
|
|
// end;
|
|||
|
|
// if CDS_Sub.Locate('Piece', 0, []) = True then
|
|||
|
|
// begin
|
|||
|
|
// Application.MessageBox('ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0!', '<27><>ʾ', 0);
|
|||
|
|
// Exit;
|
|||
|
|
// end;
|
|||
|
|
|
|||
|
|
CDS_Sub.First;
|
|||
|
|
while not CDS_Sub.Eof do
|
|||
|
|
begin
|
|||
|
|
if (CDS_Sub.FieldByName('Meter').AsFloat = 0) and (CDS_Sub.FieldByName('Piece').AsFloat = 0) then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD>ܶ<EFBFBD>Ϊ0!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
CDS_Sub.Next;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if CDS_Sub.Locate('IONO', null, []) = True then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
if SaveCKData() then
|
|||
|
|
begin
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
//ModalResult:=1;
|
|||
|
|
Exit;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeClothInPut.ToolButton1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
WriteCxGrid(fSTKName + '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>', Tv1, '<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>');
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeClothInPut.ToolButton2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmDyeCPImport := TfrmDyeCPImport.Create(Application);
|
|||
|
|
with frmDyeCPImport do
|
|||
|
|
begin
|
|||
|
|
// FCTID := Trim(Self.CDS_Tree.fieldbyname('CTID').AsString);
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
// Self.InitGrid();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmDyeCPImport.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeClothInPut.Tv1Column2PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
frmCompanySel := TfrmCompanySel.Create(Application);
|
|||
|
|
with frmCompanySel do
|
|||
|
|
begin
|
|||
|
|
if Trim(self.CDS_Sub.fieldbyname('IOType').AsString) = '<27>˻<EFBFBD>' then
|
|||
|
|
FCoType := '<27>ͻ<EFBFBD>'
|
|||
|
|
else
|
|||
|
|
FCoType := '<27><>Ӧ<EFBFBD><D3A6>';
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
with Self.CDS_Sub do
|
|||
|
|
begin
|
|||
|
|
Edit;
|
|||
|
|
FieldByName('ToCoNo').Value := Trim(CDS_1.fieldbyname('CoCode').AsString);
|
|||
|
|
FieldByName('ToCoName').Value := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmCompanySel.Free;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeClothInPut.Tv1IONoPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
frmProductOrderListSel := TfrmProductOrderListSel.create(self);
|
|||
|
|
with frmProductOrderListSel do
|
|||
|
|
begin
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
Self.CDS_Sub.Edit;
|
|||
|
|
Self.CDS_Sub.FieldByName('IONO').Value := Order_Main.fieldbyname('OrderNo').asstring;
|
|||
|
|
Self.CDS_Sub.Post;
|
|||
|
|
end;
|
|||
|
|
free;
|
|||
|
|
end;
|
|||
|
|
// with ADOQueryTemp do
|
|||
|
|
// begin
|
|||
|
|
// Close;
|
|||
|
|
// SQL.Clear;
|
|||
|
|
// SQL.Add('select * from BS_Cloth_Info where C_Name = ' + QuotedStr(Trim(CDS_Sub.FieldByName('C_Name').asString)));
|
|||
|
|
// Open;
|
|||
|
|
// end;
|
|||
|
|
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeClothInPut.Tv1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
|||
|
|
var
|
|||
|
|
FFSPID: string;
|
|||
|
|
begin
|
|||
|
|
// if CDS_Sub.IsEmpty then
|
|||
|
|
// Exit;
|
|||
|
|
// if Trim(CDS_Sub.fieldbyname('BCIOID').AsString) <> '' then
|
|||
|
|
// begin
|
|||
|
|
// with ADOQueryTemp do
|
|||
|
|
// begin
|
|||
|
|
// Close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// sql.Add('select * from BS_Cloth_IO where BCIOID=''' + Trim(CDS_Sub.fieldbyname('BCIOID').AsString) + '''');
|
|||
|
|
// Open;
|
|||
|
|
// end;
|
|||
|
|
// FFSPID := Trim(ADOQueryTemp.fieldbyname('BCIOID').AsString);
|
|||
|
|
// if Trim(FFSPID) <> '' then
|
|||
|
|
// begin
|
|||
|
|
// v1CRType.Options.Editing := False;
|
|||
|
|
// end
|
|||
|
|
// else
|
|||
|
|
// begin
|
|||
|
|
// v1CRType.Options.Editing := True;
|
|||
|
|
// end;
|
|||
|
|
// end
|
|||
|
|
// else
|
|||
|
|
// begin
|
|||
|
|
// v1CRType.Options.Editing := True;
|
|||
|
|
// end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmDyeClothInPut.v1Column13PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|||
|
|
begin
|
|||
|
|
// with ADOQueryTemp do
|
|||
|
|
// begin
|
|||
|
|
// close;
|
|||
|
|
// sql.Clear;
|
|||
|
|
// sql.Add('exec P_OrderCR');
|
|||
|
|
//
|
|||
|
|
//// ShowMessage(sql.Text);
|
|||
|
|
// execsql;
|
|||
|
|
// end;
|
|||
|
|
//
|
|||
|
|
// frmProductOrderListSel := TfrmProductOrderListSel.create(self);
|
|||
|
|
// with frmProductOrderListSel do
|
|||
|
|
// begin
|
|||
|
|
// FWorkshop := self.FWorkshop;
|
|||
|
|
// if ShowModal = 1 then
|
|||
|
|
// begin
|
|||
|
|
// Self.CDS_Sub.FieldByName('OrderNo').Value := Order_Main.fieldbyname('OrderNo').asstring;
|
|||
|
|
//// initGlide();
|
|||
|
|
// end;
|
|||
|
|
// free;
|
|||
|
|
// end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|