RTFormwork/项目代码/RTBasicsV1/T02贸易汇总仓库/U_TradeFtyClothOutEdit.pas
“ddf” 61630656e9 1
2024-07-07 09:35:27 +08:00

587 lines
20 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_TradeFtyClothOutEdit;
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, cxPC;
type
TfrmTradeFtyClothOutEdit = class(TfrmBaseInput)
ToolBar1: TToolBar;
TBAdd: TToolButton;
TBDel: TToolButton;
TBSave: TToolButton;
TBClose: TToolButton;
DS_1: TDataSource;
CDS_Sub: TClientDataSet;
ADOQueryCmd: TADOQuery;
ADOQueryMain: TADOQuery;
ADOQueryTemp: TADOQuery;
GPM_1: TcxGridPopupMenu;
cxGrid1: TcxGrid;
Tv1: TcxGridDBTableView;
v1Column6: TcxGridDBColumn;
v1Column2: TcxGridDBColumn;
v1CRType: TcxGridDBColumn;
v2Column1: TcxGridDBColumn;
v1Column8: TcxGridDBColumn;
v2Column6: TcxGridDBColumn;
v1Column3: TcxGridDBColumn;
v1Column12: TcxGridDBColumn;
cxGrid1Level1: TcxGridLevel;
v1Column1: TcxGridDBColumn;
v1Column5: TcxGridDBColumn;
v1CheJian: TcxGridDBColumn;
v1Column7: TcxGridDBColumn;
v1Column10: TcxGridDBColumn;
v1Column11: TcxGridDBColumn;
v1Column13: TcxGridDBColumn;
v1Column14: TcxGridDBColumn;
Tv1Column1: TcxGridDBColumn;
ToolButton1: TToolButton;
Tv1Column2: TcxGridDBColumn;
Tv1Column3: TcxGridDBColumn;
Tv1Column4: TcxGridDBColumn;
Tv1Column5: TcxGridDBColumn;
Tv1Column6: TcxGridDBColumn;
Tv1Column7: TcxGridDBColumn;
Tv1Column8: TcxGridDBColumn;
Tv1Column9: TcxGridDBColumn;
Tv1Column10: TcxGridDBColumn;
DS_2: TDataSource;
CDS_2: TClientDataSet;
GPM_2: TcxGridPopupMenu;
ADO_2: TADOQuery;
cxPageControl1: TcxPageControl;
cxTabSheet2: TcxTabSheet;
cxGrid2: TcxGrid;
TV2: TcxGridDBTableView;
cxGridDBColumn19: TcxGridDBColumn;
v1OrderNo: TcxGridDBColumn;
v1ConNo: TcxGridDBColumn;
v1DeliveryDate: TcxGridDBColumn;
cxGridDBColumn20: TcxGridDBColumn;
cxGridDBColumn21: TcxGridDBColumn;
cxGridDBColumn22: TcxGridDBColumn;
v1OrdDefStr1: TcxGridDBColumn;
v1MPRTCodeName: TcxGridDBColumn;
v1MPRTSpec: TcxGridDBColumn;
cxGridDBColumn23: TcxGridDBColumn;
v1MPRTMF: TcxGridDBColumn;
v1MPRTKZ: TcxGridDBColumn;
v1PRTColor: TcxGridDBColumn;
cxGridDBColumn24: TcxGridDBColumn;
cxGridDBColumn25: TcxGridDBColumn;
cxGridDBColumn26: TcxGridDBColumn;
cxGridDBColumn27: TcxGridDBColumn;
cxGridDBColumn28: TcxGridDBColumn;
cxGridDBColumn29: TcxGridDBColumn;
cxGridDBColumn30: TcxGridDBColumn;
cxGridDBColumn31: TcxGridDBColumn;
cxGridDBColumn32: TcxGridDBColumn;
cxGridLevel2: TcxGridLevel;
Pnl_F2: TPanel;
Label2: TLabel;
Label4: TLabel;
Edit1: TEdit;
Edit2: TEdit;
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 TV2DblClick(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
function SaveData(): Boolean;
procedure InitReceipt();
public
{ Public declarations }
FBCId, FStkName, FKHName: string;
end;
var
frmTradeFtyClothOutEdit: TfrmTradeFtyClothOutEdit;
implementation
uses
U_DataLink, U_RTFun, U_ZDYHelp, U_TradeFtyClothStkSel, U_CompanySel,
U_TradePlanSel;
{$R *.dfm}
procedure TfrmTradeFtyClothOutEdit.InitReceipt();
var
FWSql: string;
begin
case cxPageControl1.ActivePageIndex of
0:
begin
FWSql := SGetHintFilters(Pnl_F2, 1, 2);
if FWSql <> '' then
FWSql := ' and ' + FWSql;
with ADO_2 do
begin
Close;
sql.Clear;
sql.Add('select A.* ');
sql.Add(',SumPiece=(select Sum(X.Piece) from BS_Cloth_IO X where X.IOType=''<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>'' and X.fromSubID=A.SubID and isnull(X.STKNAME,'''')=' + Quotedstr(Trim(FSTKNAME)) + ')');
sql.Add(',SumQty=(select Sum(X.Qty) from BS_Cloth_IO X where X.IOType=''<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>'' and X.fromSubID=A.SubID and isnull(X.STKNAME,'''')=' + Quotedstr(Trim(FSTKNAME)) + ')');
sql.Add('from V_Trade_Plan_Fty A ');
sql.add('where Status=''9'' ');
if Trim(FWSql) <> '' then
sql.Add(FWSql);
Open;
end;
SCreateCDS(ADO_2, CDS_2);
SInitCDSData(ADO_2, CDS_2);
end;
end;
end;
procedure TfrmTradeFtyClothOutEdit.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if Key = #13 then
begin
InitReceipt();
end;
end;
procedure TfrmTradeFtyClothOutEdit.FormClose(Sender: TObject; var Action: TCloseAction);
begin
inherited;
Action := caFree;
end;
procedure TfrmTradeFtyClothOutEdit.TBAddClick(Sender: TObject);
begin
try
frmTradeFtyClothStkSel := TfrmTradeFtyClothStkSel.Create(Application);
with frmTradeFtyClothStkSel do
begin
FstkName := Self.FstkName;
if ShowModal = 1 then
begin
frmTradeFtyClothStkSel.CDS_Main.DisableControls;
with frmTradeFtyClothStkSel.CDS_Main do
begin
First;
while frmTradeFtyClothStkSel.CDS_Main.Locate('SSel', True, []) do
begin
with Self.CDS_Sub do
begin
Append;
FieldByName('IOTime').Value := Trim(FormatDateTime('yyyy-MM-dd', Now));
FieldByName('STKID').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('BCIOID').Value;
FieldByName('IOType').Value := '<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>';
FieldByName('FromCoNo').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('FromCoNo').Value;
FieldByName('FromCoName').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('FromCoName').Value;
FieldByName('StkCoNo').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('StkCoNo').Value;
FieldByName('StkCoName').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('StkCoName').Value;
FieldByName('ToCoNo').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('StkCoNo').Value;
FieldByName('ToCoName').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('StkCoName').Value;
FieldByName('C_Code').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('C_Code').Value;
FieldByName('C_Name').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('C_Name').Value;
FieldByName('C_Spec').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('C_Spec').Value;
FieldByName('QtyUnit').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('QtyUnit').Value;
FieldByName('Qty').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('STKQTY').Value;
FieldByName('Piece').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('StkPiece').Value;
FieldByName('BatchNo').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('BatchNo').Value;
FieldByName('C_Width').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('C_Width').Value;
FieldByName('C_GramWeight').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('C_GramWeight').Value;
FieldByName('FromOrdNo').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('FromOrdNo').Value;
FieldByName('FromMainId').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('FromMainId').Value;
FieldByName('FromSubId').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('FromSubId').Value;
FieldByName('ToOrdNo').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('FromOrdNo').Value;
FieldByName('ToMainId').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('FromMainId').Value;
FieldByName('ToSubId').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('FromSubId').Value;
FieldByName('Workshop').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('Workshop').Value;
FieldByName('PieceWeight').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('PieceWeight').Value;
FieldByName('C_ColorDepth').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('C_ColorDepth').Value;
FieldByName('C_Color').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('C_Color').Value;
FieldByName('C_ColorNo').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('C_ColorNo').Value;
FieldByName('FtyPCId').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('FtyPCId').Value;
FieldByName('C_Pattern').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('C_Pattern').Value;
FieldByName('C_Composition').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('C_Composition').Value;
FieldByName('C_StyleNo').Value := frmTradeFtyClothStkSel.CDS_Main.fieldbyname('C_StyleNo').Value;
end;
frmTradeFtyClothStkSel.CDS_Main.Delete;
end;
end;
frmTradeFtyClothStkSel.CDS_Main.EnableControls;
end;
end;
finally
frmTradeFtyClothStkSel.Free;
end;
end;
function TfrmTradeFtyClothOutEdit.SaveData(): Boolean;
var
MBCIOID, Maxno: 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 BS_Cloth_IO where BCIOID=''' + Trim(CDS_Sub.fieldbyname('BCIOID').AsString) + '''');
Open;
end;
MBCIOID := Trim(ADOQueryTemp.fieldbyname('BCIOID').AsString);
if Trim(MBCIOID) = '' then
begin
if not GetLSNo(ADOQueryCmd, Maxno, 'MC', 'BS_Cloth_IO', 4, 1) then
raise Exception.Create('ȡȾɫ<C8BE><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><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 BS_Cloth_IO where BCIOID=''' + Trim(Maxno) + '''');
Open;
end;
with ADOQueryCmd do
begin
if Trim(MBCIOID) = '' then
begin
Append;
FieldByName('Fillid').Value := Trim(Dcode);
FieldByName('Filler').Value := Trim(DName);
end
else
begin
Edit;
FieldByName('Editid').Value := Trim(Dcode);
FieldByName('Editer').Value := Trim(DName);
FieldByName('EditTime').Value := SGetServerDate(ADOQueryTemp);
end;
RTSetSaveDataCDS(ADOQueryCmd, Tv1, CDS_Sub, 'BS_Cloth_IO', 0);
FieldByName('STKName').Value := FSTKName;
FieldByName('BCIOID').Value := Trim(Maxno);
FieldByName('IOFlag').Value := '<27><><EFBFBD><EFBFBD>';
FieldByName('IOQtyFlag').Value := -1;
FieldByName('STKID').Value := CDS_Sub.fieldbyname('STKID').Value;
FieldByName('FromCoNo').Value := CDS_Sub.fieldbyname('FromCoNo').Value;
FieldByName('FromCoName').Value := CDS_Sub.fieldbyname('FromCoName').Value;
FieldByName('StkCoNo').Value := CDS_Sub.fieldbyname('StkCoNo').Value;
FieldByName('ToCoNo').Value := CDS_Sub.fieldbyname('ToCoNo').Value;
FieldByName('FromOrdNo').Value := CDS_Sub.fieldbyname('FromOrdNo').Value;
FieldByName('FromMainId').Value := CDS_Sub.fieldbyname('FromMainId').Value;
FieldByName('FromSubId').Value := CDS_Sub.fieldbyname('FromSubId').Value;
FieldByName('ToOrdNo').Value := CDS_Sub.fieldbyname('ToOrdNo').Value;
FieldByName('ToMainId').Value := CDS_Sub.fieldbyname('ToMainId').Value;
FieldByName('ToSubId').Value := CDS_Sub.fieldbyname('ToSubId').Value;
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('Update BS_Cloth_IO Set StkPiece=(select Sum(isnull(Piece,0)*IOQtyFlag) from BS_Cloth_IO A where A.STKID=BS_Cloth_IO.BCIOID)');
sql.Add(',STKQty=(select Sum(isnull(Qty,0)*IOQtyFlag) from BS_Cloth_IO A where A.STKID=BS_Cloth_IO.BCIOID )');
sql.Add('where BCIOID=''' + Trim(CDS_Sub.fieldbyname('STKID').AsString) + '''');
ExecSQL;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from BS_Cloth_IO where BCIOID=''' + Trim(CDS_Sub.fieldbyname('STKID').AsString) + '''');
Open;
end;
if ADOQueryTemp.FieldByName('STKQty').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>棡');
with ADOQueryCmd do
begin
Close;
Sql.Clear;
Sql.Add('exec P_BS_Cloth_Move ');
Sql.Add(' @BCIOID=' + quotedstr(Trim(Maxno)));
Open;
end;
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('insert into Finance_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ');
sql.Add('values('<><C3B3><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>'' ');
sql.Add(',' + quotedstr(Maxno));
sql.Add(',''<27><><EFBFBD><EFBFBD>'' ');
sql.Add(',' + quotedstr(DName));
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(Maxno));
sql.Add(') ');
ExecSQL;
end;
Edit;
FieldByName('BCIOID').Value := Trim(Maxno);
Post;
Next;
end;
end;
CDS_Sub.EnableControls;
ADOQueryCmd.Connection.CommitTrans;
Result := True;
except
Result := False;
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
procedure TfrmTradeFtyClothOutEdit.TBCloseClick(Sender: TObject);
begin
Close;
end;
procedure TfrmTradeFtyClothOutEdit.FormShow(Sender: TObject);
var
fsj: string;
begin
inherited;
ReadCxGrid(FSTKName + '<27><><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>', Tv1, <>׻<EFBFBD><D7BB>ֿܲ<DCB2>');
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add(' select A.* ');
sql.Add(' from BS_Cloth_IO A');
sql.Add(' where BCIOID=''' + Trim(FBCId) + '''');
Open;
end;
SCreateCDS(ADOQueryTemp, CDS_Sub);
SInitCDSData(ADOQueryTemp, CDS_Sub);
// fsj:='select name=CJName ,Code=null from CheJian';
// SInitCxGridComboBoxBySql(ADOQueryTemp,v1CheJian,fsj,0,True,'');
end;
procedure TfrmTradeFtyClothOutEdit.TBDelClick(Sender: TObject);
begin
if CDS_Sub.IsEmpty then
Exit;
if Trim(CDS_Sub.fieldbyname('BCIOID').AsString) <> '' then
begin
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><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('<><C3B3><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>'' ');
sql.Add(',' + quotedstr(Trim(CDS_Sub.fieldbyname('BCIOID').AsString)));
sql.Add(','<><C9BE>'' ');
sql.Add(',' + quotedstr(DName));
sql.Add(',' + quotedstr(trim(self.Caption)));
sql.Add(',' + quotedstr(Trim(CDS_Sub.fieldbyname('BCIOID').AsString)));
sql.Add(') ');
Sql.Add('exec P_BS_Cloth_Out_Del ');
Sql.Add(' @BCIOIDS=' + quotedstr(Trim(CDS_Sub.fieldbyname('BCIOID').AsString)));
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
Open;
end;
if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then
raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString)));
ADOQueryCmd.Connection.CommitTrans;
CDS_Sub.Delete;
except
ADOQueryCmd.Connection.RollbackTrans;
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end
else
CDS_Sub.Delete;
end;
procedure TfrmTradeFtyClothOutEdit.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('CRType;LCKNO', VarArrayOf(['<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>', Null]), [loPartialKey]) then
begin
Application.MessageBox('<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̿<EFBFBD><CCBF>Ų<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('Qty', null, []) = True then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
if SaveData() then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
//ModalResult:=1;
Exit;
end;
end;
procedure TfrmTradeFtyClothOutEdit.ToolButton1Click(Sender: TObject);
begin
WriteCxGrid(fSTKName + '<27><><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>', Tv1, <>׻<EFBFBD><D7BB>ֿܲ<DCB2>');
end;
procedure TfrmTradeFtyClothOutEdit.Tv1Column2PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmCompanySel := TfrmCompanySel.Create(Application);
with frmCompanySel do
begin
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 TfrmTradeFtyClothOutEdit.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 TfrmTradeFtyClothOutEdit.TV2DblClick(Sender: TObject);
begin
if not Self.CDS_Sub.IsEmpty then
begin
with Self.CDS_Sub do
begin
Edit;
FieldByName('ToOrdNo').Value := Trim(CDS_2.fieldbyname('OrderNo').AsString);
FieldByName('ToMainId').Value := Trim(CDS_2.fieldbyname('MainId').AsString);
FieldByName('ToSubId').Value := Trim(CDS_2.fieldbyname('SubId').AsString);
end;
end;
end;
procedure TfrmTradeFtyClothOutEdit.v1Column13PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmTradePlanSel := TfrmTradePlanSel.Create(Application);
with frmTradePlanSel do
begin
if ShowModal = 1 then
begin
with Self.CDS_Sub do
begin
Edit;
FieldByName('ToOrdNo').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('OrderNo').AsString);
FieldByName('ToMainId').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('MainId').AsString);
FieldByName('ToSubId').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('SubId').AsString);
end;
end;
end;
finally
frmTradePlanSel.Free;
end;
end;
end.