2024-07-04 16:01:24 +08:00
|
|
|
|
unit U_TradeFinishClothInEdit;
|
|
|
|
|
|
|
|
|
|
|
|
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, StdCtrls, ExtCtrls,
|
|
|
|
|
|
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxSkinsCore,
|
|
|
|
|
|
dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu, U_BaseInput,
|
2024-09-20 16:26:35 +08:00
|
|
|
|
System.ImageList, Vcl.ImgList, dxSkinWXI, dxScrollbarAnnotations;
|
2024-07-04 16:01:24 +08:00
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
TfrmTradeFinishClothInEdit = class(TfrmBaseInput)
|
|
|
|
|
|
cxGrid2: TcxGrid;
|
|
|
|
|
|
Tv1: TcxGridDBTableView;
|
|
|
|
|
|
v1Column2: TcxGridDBColumn;
|
|
|
|
|
|
v1SPName: TcxGridDBColumn;
|
|
|
|
|
|
v2Column6: TcxGridDBColumn;
|
|
|
|
|
|
cxGrid2Level1: TcxGridLevel;
|
|
|
|
|
|
ToolBar1: TToolBar;
|
|
|
|
|
|
TBAdd: TToolButton;
|
|
|
|
|
|
TBDel: TToolButton;
|
|
|
|
|
|
TBSave: TToolButton;
|
|
|
|
|
|
TBClose: TToolButton;
|
|
|
|
|
|
v1Column4: TcxGridDBColumn;
|
|
|
|
|
|
DataSource3: TDataSource;
|
|
|
|
|
|
CDS_Sub: TClientDataSet;
|
|
|
|
|
|
ADOQueryCmd: TADOQuery;
|
|
|
|
|
|
ADOQueryMain: TADOQuery;
|
|
|
|
|
|
ADOQueryTemp: TADOQuery;
|
|
|
|
|
|
cxGridPopupMenu2: TcxGridPopupMenu;
|
|
|
|
|
|
v1Column12: TcxGridDBColumn;
|
|
|
|
|
|
v1FactoryName: TcxGridDBColumn;
|
|
|
|
|
|
v1Column6: TcxGridDBColumn;
|
|
|
|
|
|
v1SPSpec: TcxGridDBColumn;
|
|
|
|
|
|
v1QtyUnit: TcxGridDBColumn;
|
|
|
|
|
|
v1Column5: TcxGridDBColumn;
|
|
|
|
|
|
v1Column1: TcxGridDBColumn;
|
|
|
|
|
|
v1SPMF: TcxGridDBColumn;
|
|
|
|
|
|
v1Column8: TcxGridDBColumn;
|
|
|
|
|
|
v1Column9: TcxGridDBColumn;
|
|
|
|
|
|
v1Column7: TcxGridDBColumn;
|
|
|
|
|
|
Tv1Column3: TcxGridDBColumn;
|
|
|
|
|
|
Tv1Column5: TcxGridDBColumn;
|
|
|
|
|
|
Tv1Column1: TcxGridDBColumn;
|
|
|
|
|
|
Tv1Column2: TcxGridDBColumn;
|
|
|
|
|
|
Tv1Column4: TcxGridDBColumn;
|
|
|
|
|
|
ToolButton1: TToolButton;
|
|
|
|
|
|
Tv1Column6: TcxGridDBColumn;
|
|
|
|
|
|
ToolButton2: TToolButton;
|
|
|
|
|
|
Tv1Column7: TcxGridDBColumn;
|
|
|
|
|
|
Tv1Column8: TcxGridDBColumn;
|
|
|
|
|
|
Tv1Column9: TcxGridDBColumn;
|
|
|
|
|
|
Tv1Column10: TcxGridDBColumn;
|
|
|
|
|
|
Tv1Column11: TcxGridDBColumn;
|
|
|
|
|
|
ToolButton3: TToolButton;
|
|
|
|
|
|
Tv1Column12: TcxGridDBColumn;
|
|
|
|
|
|
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 v1Column14PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
procedure v2Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
procedure v1Column5PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
procedure v1Column8PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
procedure Tv1Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
procedure Tv1Column4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
procedure ToolButton1Click(Sender: TObject);
|
|
|
|
|
|
procedure ToolButton2Click(Sender: TObject);
|
|
|
|
|
|
procedure ButtonEdit(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
procedure ToolButton3Click(Sender: TObject);
|
|
|
|
|
|
private
|
|
|
|
|
|
{ Private declarations }
|
|
|
|
|
|
function SaveCKData(): Boolean;
|
2026-05-19 17:05:02 +08:00
|
|
|
|
|
|
|
|
|
|
function ValidateInData(ARow: Integer): Boolean;
|
2024-07-04 16:01:24 +08:00
|
|
|
|
public
|
|
|
|
|
|
{ Public declarations }
|
|
|
|
|
|
FBCId, canshu3, FSTKName, FKHName: string;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
|
frmTradeFinishClothInEdit: TfrmTradeFinishClothInEdit;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
U_DataLink, U_RTFun, U_ZDYHelp, U_CompanySel, U_TradePlanSel, U_ClothInfoSel;
|
|
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
2026-05-19 17:05:02 +08:00
|
|
|
|
function TfrmTradeFinishClothInEdit.ValidateInData(ARow: Integer): Boolean;
|
|
|
|
|
|
var
|
|
|
|
|
|
IOType, FromSubId, FromOrdNo, C_Code: string;
|
|
|
|
|
|
HasPlan, HasProcess, HasOutRecord: Boolean;
|
|
|
|
|
|
MaxGlideIdx: Integer;
|
|
|
|
|
|
LastProcessName: string;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := True;
|
|
|
|
|
|
|
|
|
|
|
|
IOType := Trim(CDS_Sub.FieldByName('IOType').AsString);
|
|
|
|
|
|
FromSubId := Trim(CDS_Sub.FieldByName('FromSubId').AsString);
|
|
|
|
|
|
FromOrdNo := Trim(CDS_Sub.FieldByName('FromOrdNo').AsString);
|
|
|
|
|
|
C_Code := Trim(CDS_Sub.FieldByName('C_Code').AsString);
|
|
|
|
|
|
|
|
|
|
|
|
if IOType = '<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if FromSubId = '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox(PChar('<27><>' + IntToStr(ARow) + '<27>У<EFBFBD><D0A3>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>'), PChar('<27><>֤ʧ<D6A4><CAA7>'), MB_ICONERROR);
|
|
|
|
|
|
Result := False;
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
SQL.Clear;
|
|
|
|
|
|
SQL.Add('SELECT 1 FROM Pur_ClothPlan_sub WHERE SubId = :SubId');
|
|
|
|
|
|
Parameters.ParamByName('SubId').Value := FromSubId;
|
|
|
|
|
|
Open;
|
|
|
|
|
|
HasPlan := not IsEmpty;
|
|
|
|
|
|
Close;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if not HasPlan then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox(PChar('<27><>' + IntToStr(ARow) + '<27>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJɹ<C4B2><C9B9>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>'), PChar('<27><>֤ʧ<D6A4><CAA7>'), MB_ICONERROR);
|
|
|
|
|
|
Result := False;
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
|
|
|
else if IOType = '<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>' then
|
|
|
|
|
|
begin
|
2026-05-23 15:59:02 +08:00
|
|
|
|
// <20><>ѯ<EFBFBD>Ƿ<EFBFBD><C7B7>й<EFBFBD><D0B9><EFBFBD>
|
2026-05-19 17:05:02 +08:00
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
SQL.Clear;
|
|
|
|
|
|
SQL.Add('SELECT TOP 1 GlideIdx, ProcessName');
|
|
|
|
|
|
SQL.Add('FROM BS_Cloth_Glide g');
|
|
|
|
|
|
SQL.Add('INNER JOIN Bs_Cloth_Info i ON g.BCIID = i.BCIID');
|
|
|
|
|
|
SQL.Add('WHERE i.C_Code = :C_Code');
|
|
|
|
|
|
SQL.Add('ORDER BY GlideIdx DESC');
|
|
|
|
|
|
Parameters.ParamByName('C_Code').Value := C_Code;
|
|
|
|
|
|
Open;
|
|
|
|
|
|
|
|
|
|
|
|
HasProcess := not IsEmpty;
|
|
|
|
|
|
if HasProcess then
|
|
|
|
|
|
begin
|
|
|
|
|
|
MaxGlideIdx := FieldByName('GlideIdx').AsInteger;
|
|
|
|
|
|
LastProcessName := Trim(FieldByName('ProcessName').AsString);
|
|
|
|
|
|
end;
|
|
|
|
|
|
Close;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if not HasProcess then
|
|
|
|
|
|
begin
|
2026-05-23 15:59:02 +08:00
|
|
|
|
// û<>й<EFBFBD><D0B9><EFBFBD><F2A3ACBC><EFBFBD>Ⱦɫ<C8BE>ƻ<EFBFBD><C6BB><EFBFBD>
|
|
|
|
|
|
if FromSubId = '' then
|
2026-05-19 17:05:02 +08:00
|
|
|
|
begin
|
2026-05-23 15:59:02 +08:00
|
|
|
|
Application.MessageBox(PChar('<27><>' + IntToStr(ARow) + '<27>У<EFBFBD><D0A3>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>'), PChar('<27><>֤ʧ<D6A4><CAA7>'), MB_ICONERROR);
|
2026-05-19 17:05:02 +08:00
|
|
|
|
Result := False;
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
SQL.Clear;
|
2026-05-23 15:59:02 +08:00
|
|
|
|
SQL.Add('SELECT 1 FROM Pur_ClothPlan_sub s');
|
|
|
|
|
|
SQL.Add('INNER JOIN Pur_ClothPlan_Main m ON s.PurMId = m.PurMId');
|
|
|
|
|
|
SQL.Add('WHERE s.SubId = :SubId');
|
|
|
|
|
|
SQL.Add('AND m.PurType = ''Ⱦɫ''');
|
|
|
|
|
|
Parameters.ParamByName('SubId').Value := FromSubId;
|
2026-05-19 17:05:02 +08:00
|
|
|
|
Open;
|
|
|
|
|
|
HasOutRecord := not IsEmpty;
|
|
|
|
|
|
Close;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if not HasOutRecord then
|
|
|
|
|
|
begin
|
2026-05-23 15:59:02 +08:00
|
|
|
|
Application.MessageBox(PChar('<27><>' + IntToStr(ARow) + '<27>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD>Ⱦɫ<C8BE>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵǼ<DCB5><C7BC><EFBFBD><EFBFBD>⡣'), PChar('<27><>֤ʧ<D6A4><CAA7>'), MB_ICONERROR);
|
2026-05-19 17:05:02 +08:00
|
|
|
|
Result := False;
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
2026-05-23 15:59:02 +08:00
|
|
|
|
// <20>й<EFBFBD><D0B9><EFBFBD><F2A3ACBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9>ƻ<EFBFBD><C6BB><EFBFBD>
|
2026-05-19 17:05:02 +08:00
|
|
|
|
if FromSubId = '' then
|
|
|
|
|
|
begin
|
2026-05-23 15:59:02 +08:00
|
|
|
|
Application.MessageBox(PChar('<27><>' + IntToStr(ARow) + '<27>У<EFBFBD><D0A3>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>'), PChar('<27><>֤ʧ<D6A4><CAA7>'), MB_ICONERROR);
|
2026-05-19 17:05:02 +08:00
|
|
|
|
Result := False;
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
SQL.Clear;
|
|
|
|
|
|
SQL.Add('SELECT 1 FROM Pur_ClothPlan_sub s');
|
|
|
|
|
|
SQL.Add('INNER JOIN Pur_ClothPlan_Main m ON s.PurMId = m.PurMId');
|
|
|
|
|
|
SQL.Add('WHERE s.SubId = :SubId');
|
2026-05-23 15:59:02 +08:00
|
|
|
|
SQL.Add('AND m.PurType = ''<27><><EFBFBD>ӹ<EFBFBD>''');
|
2026-05-19 17:05:02 +08:00
|
|
|
|
Parameters.ParamByName('SubId').Value := FromSubId;
|
|
|
|
|
|
Open;
|
|
|
|
|
|
HasOutRecord := not IsEmpty;
|
|
|
|
|
|
Close;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
if not HasOutRecord then
|
|
|
|
|
|
begin
|
2026-05-23 15:59:02 +08:00
|
|
|
|
Application.MessageBox(PChar('<27><>' + IntToStr(ARow) + '<27>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>º<EFBFBD><C2BA>ӹ<EFBFBD><D3B9>ƻ<EFBFBD><C6BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵǼ<DCB5><C7BC><EFBFBD><EFBFBD>⡣'), PChar('<27><>֤ʧ<D6A4><CAA7>'), MB_ICONERROR);
|
2026-05-19 17:05:02 +08:00
|
|
|
|
Result := False;
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2026-05-23 15:59:02 +08:00
|
|
|
|
|
2024-07-04 16:01:24 +08:00
|
|
|
|
procedure TfrmTradeFinishClothInEdit.FormClose(Sender: TObject; var Action: TCloseAction);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
Action := caFree;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeFinishClothInEdit.TBAddClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if CDS_Sub.IsEmpty = False then
|
|
|
|
|
|
begin
|
|
|
|
|
|
CopyAddRowCDS(CDS_Sub);
|
|
|
|
|
|
with CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName('BCIOID').Value := null;
|
|
|
|
|
|
FieldByName('StkCoNo').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>';
|
|
|
|
|
|
FieldByName('StkCoName').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>';
|
|
|
|
|
|
post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
with CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Append;
|
|
|
|
|
|
FieldByName('IOTime').Value := Trim(FormatDateTime('yyyy-MM-dd', Now));
|
|
|
|
|
|
FieldByName('StkCoNo').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>';
|
|
|
|
|
|
FieldByName('StkCoName').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>';
|
|
|
|
|
|
// FieldByName('QtyUnit').Value := 'KG';
|
|
|
|
|
|
Post;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfrmTradeFinishClothInEdit.SaveCKData(): Boolean;
|
|
|
|
|
|
var
|
|
|
|
|
|
Maxno, MBCIOID: 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, 'PR', 'BS_Cloth_IO', 3, 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('FromCoNo').Value := CDS_Sub.fieldbyname('FromCoNo').Value;
|
|
|
|
|
|
FieldByName('StkCoNo').Value := CDS_Sub.fieldbyname('StkCoNo').Value;
|
|
|
|
|
|
|
|
|
|
|
|
FieldByName('FromMainId').Value := CDS_Sub.fieldbyname('FromMainId').Value;
|
|
|
|
|
|
FieldByName('FromSubId').Value := CDS_Sub.fieldbyname('FromSubId').Value;
|
|
|
|
|
|
|
|
|
|
|
|
FieldByName('BCIOID').Value := Trim(Maxno);
|
|
|
|
|
|
FieldByName('STKID').Value := Trim(Maxno);
|
|
|
|
|
|
FieldByName('STKName').Value := FSTKName;
|
|
|
|
|
|
FieldByName('IOFlag').Value := '<27><><EFBFBD><EFBFBD>';
|
|
|
|
|
|
FieldByName('IOQtyFlag').Value := 1;
|
|
|
|
|
|
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(Maxno) + '''');
|
|
|
|
|
|
ExecSQL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('select stkQty,StkPiece from BS_Cloth_IO where BCIOID=''' + Trim(Maxno) + '''');
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if ADOQueryTemp.FieldByName('stkQty').Value < 0 then
|
|
|
|
|
|
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>!');
|
|
|
|
|
|
if ADOQueryTemp.FieldByName('StkPiece').Value < 0 then
|
|
|
|
|
|
raise Exception.Create('<27><><EFBFBD><EFBFBD>ƥ<EFBFBD><C6A5>С<EFBFBD>ڳ<EFBFBD><DAB3><EFBFBD>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>!');
|
|
|
|
|
|
|
|
|
|
|
|
// if CDS_Sub.fieldbyname('IOType').Value = '<27>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD>' then
|
|
|
|
|
|
// begin
|
2024-10-21 17:19:42 +08:00
|
|
|
|
with ADOQueryCmd do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('insert into Finance_Need_Up(UType,UDataId,UOperation,UOperator,UModule,UDetails) ');
|
|
|
|
|
|
sql.Add('values(''<27><><EFBFBD>첼<EFBFBD><ECB2BC><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;
|
2024-07-04 16:01:24 +08:00
|
|
|
|
// 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 TfrmTradeFinishClothInEdit.TBCloseClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
Close;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeFinishClothInEdit.FormShow(Sender: TObject);
|
|
|
|
|
|
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);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeFinishClothInEdit.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;
|
|
|
|
|
|
|
|
|
|
|
|
with ADOQueryTemp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Close;
|
|
|
|
|
|
sql.Clear;
|
|
|
|
|
|
sql.Add('exec P_Fin_Flow_Judge ');
|
|
|
|
|
|
Sql.Add(' @FFIDS=' + quotedstr(Trim(CDS_Sub.fieldbyname('BCIOID').AsString)));
|
|
|
|
|
|
Sql.Add(',@DCode=' + quotedstr(Trim(DCode)));
|
|
|
|
|
|
Sql.Add(',@DName=' + quotedstr(Trim(DName)));
|
|
|
|
|
|
Open;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if ADOQueryTemp.FieldByName('intReturn').AsInteger = -1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox(PChar(ADOQueryTemp.fieldbyname('ShowMsg').AsString), '<27><>ʾ', 0);
|
|
|
|
|
|
exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
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(''<27><><EFBFBD>첼<EFBFBD><ECB2BC><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_In_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
|
|
|
|
|
|
begin
|
|
|
|
|
|
CDS_Sub.Delete;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeFinishClothInEdit.TBSaveClick(Sender: TObject);
|
2026-05-19 17:05:02 +08:00
|
|
|
|
var
|
|
|
|
|
|
RowIndex: Integer;
|
2024-07-04 16:01:24 +08:00
|
|
|
|
begin
|
|
|
|
|
|
if CDS_Sub.IsEmpty then
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
if CDS_Sub.Locate('QtyUnit', null, []) = True then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
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('C_Name', null, []) = True then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('Ʒ<><C6B7><EFBFBD><EFBFBD><EFBFBD><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 CDS_Sub.Locate('FromCoName', null, []) = True then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD>Ե<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if CDS_Sub.Locate('FromCoName', '', []) = True then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD>Ե<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2026-05-19 17:05:02 +08:00
|
|
|
|
CDS_Sub.DisableControls;
|
|
|
|
|
|
try
|
|
|
|
|
|
CDS_Sub.First;
|
|
|
|
|
|
RowIndex := 1;
|
|
|
|
|
|
while not CDS_Sub.Eof do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if not ValidateInData(RowIndex) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
// <20><>֤ʧ<D6A4>ܣ<EFBFBD><DCA3><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>в<EFBFBD><D0B2>˳<EFBFBD>
|
|
|
|
|
|
Tv1.DataController.FocusedRowIndex := RowIndex - 1;
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
CDS_Sub.Next;
|
|
|
|
|
|
Inc(RowIndex);
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
CDS_Sub.EnableControls;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2024-07-04 16:01:24 +08:00
|
|
|
|
if SaveCKData() then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
|
|
|
|
|
//ModalResult:=1;
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeFinishClothInEdit.ToolButton1Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
WriteCxGrid(FSTKName + '<27><><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>', Tv1, 'ó<><EFBFBD><D7BB>ֿܲ<DCB2>');
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeFinishClothInEdit.ToolButton2Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
frmTradePlanSel := TfrmTradePlanSel.Create(Application);
|
|
|
|
|
|
with frmTradePlanSel do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with frmTradePlanSel.CDS_1 do
|
|
|
|
|
|
begin
|
|
|
|
|
|
DisableControls;
|
|
|
|
|
|
First;
|
|
|
|
|
|
while not eof do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if frmTradePlanSel.CDS_1.fieldbyname('SSel').AsBoolean then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with Self.CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
append;
|
|
|
|
|
|
FieldByName('IOTime').Value := Trim(FormatDateTime('yyyy-MM-dd', Now));
|
|
|
|
|
|
FieldByName('BCIOID').Value := null;
|
|
|
|
|
|
FieldByName('IOType').Value := '<27>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD>';
|
|
|
|
|
|
FieldByName('StkCoNo').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>';
|
|
|
|
|
|
FieldByName('StkCoName').Value := '<27><><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>';
|
|
|
|
|
|
FieldByName('FromCoNo').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('FtyNo').AsString);
|
|
|
|
|
|
FieldByName('FromCoName').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('FtyName').AsString);
|
|
|
|
|
|
FieldByName('FromOrdNo').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('OrderNo').AsString);
|
|
|
|
|
|
FieldByName('FromMainId').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('MainId').AsString);
|
|
|
|
|
|
FieldByName('FromSubId').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('SubId').AsString);
|
|
|
|
|
|
FieldByName('C_Code').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_Code').AsString);
|
|
|
|
|
|
FieldByName('C_Name').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_Name').AsString);
|
|
|
|
|
|
FieldByName('C_Spec').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_Spec').AsString);
|
|
|
|
|
|
FieldByName('C_Composition').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_Composition').AsString);
|
|
|
|
|
|
FieldByName('C_Width').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_Width').AsString);
|
|
|
|
|
|
FieldByName('C_GramWeight').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_GramWeight').AsString);
|
|
|
|
|
|
FieldByName('C_Color').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_Color').AsString);
|
|
|
|
|
|
FieldByName('C_ColorNo').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_ColorNo').AsString);
|
|
|
|
|
|
FieldByName('C_Pattern').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_Pattern').AsString);
|
|
|
|
|
|
FieldByName('C_StyleNo').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_StyleNo').AsString);
|
|
|
|
|
|
// FieldByName('QtyUnit').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('OrdUnit').AsString);
|
|
|
|
|
|
FieldByName('Saleser').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('Saleser').AsString);
|
|
|
|
|
|
// FieldByName('SalesId').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('SalesId').AsString);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
Next;
|
|
|
|
|
|
end;
|
|
|
|
|
|
EnableControls;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmTradePlanSel.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeFinishClothInEdit.ToolButton3Click(Sender: TObject);
|
2026-05-13 09:12:14 +08:00
|
|
|
|
var
|
|
|
|
|
|
PFromCoNo: string;
|
2024-07-04 16:01:24 +08:00
|
|
|
|
begin
|
|
|
|
|
|
if CDS_Sub.IsEmpty then
|
|
|
|
|
|
Exit;
|
2026-05-13 09:12:14 +08:00
|
|
|
|
PFromCoNo := CDS_Sub.FieldByName('FromCoNo').AsString;
|
2024-07-04 16:01:24 +08:00
|
|
|
|
OneKeyPost(Tv1, CDS_Sub);
|
|
|
|
|
|
|
2026-05-13 09:12:14 +08:00
|
|
|
|
if Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName = 'FromCoName' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
with CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
DisableControls;
|
|
|
|
|
|
first;
|
|
|
|
|
|
while not Eof do
|
|
|
|
|
|
begin
|
|
|
|
|
|
edit;
|
|
|
|
|
|
FieldByName('FromCoNo').AsString := PFromCoNo;
|
|
|
|
|
|
post;
|
|
|
|
|
|
Next;
|
|
|
|
|
|
end;
|
|
|
|
|
|
EnableControls;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
2024-07-04 16:01:24 +08:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeFinishClothInEdit.Tv1Column1PropertiesButtonClick(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('StkCoNo').Value := Trim(CDS_1.fieldbyname('CoCode').AsString);
|
|
|
|
|
|
FieldByName('StkCoName').Value := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmCompanySel.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeFinishClothInEdit.Tv1Column4PropertiesButtonClick(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('FromCoNo').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('FtyNo').AsString);
|
|
|
|
|
|
FieldByName('FromCoName').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('FtyName').AsString);
|
|
|
|
|
|
FieldByName('FromOrdNo').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('OrderNo').AsString);
|
|
|
|
|
|
FieldByName('FromMainId').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('MainId').AsString);
|
|
|
|
|
|
FieldByName('FromSubId').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('SubId').AsString);
|
|
|
|
|
|
FieldByName('C_Code').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_Code').AsString);
|
|
|
|
|
|
FieldByName('C_Name').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_Name').AsString);
|
|
|
|
|
|
FieldByName('C_Spec').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_Spec').AsString);
|
|
|
|
|
|
FieldByName('C_Composition').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_Composition').AsString);
|
|
|
|
|
|
FieldByName('C_Width').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_Width').AsString);
|
|
|
|
|
|
FieldByName('C_GramWeight').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_GramWeight').AsString);
|
|
|
|
|
|
FieldByName('C_Color').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_Color').AsString);
|
|
|
|
|
|
FieldByName('C_ColorNo').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_ColorNo').AsString);
|
|
|
|
|
|
FieldByName('C_Pattern').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('C_Pattern').AsString);
|
|
|
|
|
|
FieldByName('Saleser').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('Saleser').AsString);
|
|
|
|
|
|
// FieldByName('SalesId').Value := Trim(frmTradePlanSel.CDS_1.fieldbyname('SalesId').AsString);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmTradePlanSel.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeFinishClothInEdit.ButtonEdit(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
frmClothInfoSel := TfrmClothInfoSel.Create(Application);
|
|
|
|
|
|
with frmClothInfoSel do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with Self.CDS_Sub do
|
|
|
|
|
|
begin
|
2025-08-08 09:57:29 +08:00
|
|
|
|
// append;
|
|
|
|
|
|
Edit;
|
2024-07-04 16:01:24 +08:00
|
|
|
|
FieldByName('C_Code').Value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Code').AsString);
|
|
|
|
|
|
FieldByName('C_Name').Value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Name').AsString);
|
|
|
|
|
|
FieldByName('C_Spec').Value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Spec').AsString);
|
|
|
|
|
|
FieldByName('C_Composition').Value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Composition').AsString);
|
|
|
|
|
|
FieldByName('C_Width').Value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Width').AsString);
|
|
|
|
|
|
FieldByName('C_GramWeight').Value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_GramWeight').AsString);
|
|
|
|
|
|
|
|
|
|
|
|
Fieldbyname('C_ColorNo').value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_ColorNo').AsString);
|
|
|
|
|
|
Fieldbyname('C_Color').value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Color').AsString);
|
2025-08-08 09:57:29 +08:00
|
|
|
|
|
2024-07-04 16:01:24 +08:00
|
|
|
|
Fieldbyname('C_Pattern').value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Pattern').AsString);
|
2025-08-08 09:57:29 +08:00
|
|
|
|
Post;
|
2024-07-04 16:01:24 +08:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmClothInfoSel.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeFinishClothInEdit.v1Column14PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
frmCompanySel := TfrmCompanySel.Create(Application);
|
|
|
|
|
|
with frmCompanySel do
|
|
|
|
|
|
begin
|
2024-10-21 17:19:42 +08:00
|
|
|
|
if CDS_Sub.FieldByName('IOType').value = '<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
FCoType := '<27>ͻ<EFBFBD>';
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
FCoType := '<27><>Ӧ<EFBFBD><D3A6>';
|
|
|
|
|
|
end;
|
2024-07-04 16:01:24 +08:00
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with Self.CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName('FromCoNo').Value := Trim(CDS_1.fieldbyname('CoCode').AsString);
|
|
|
|
|
|
FieldByName('FromCoName').Value := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
|
|
|
|
|
|
|
|
|
|
|
|
// FieldByName('SalesER').Value := Trim(CDS_1.fieldbyname('SalesER').AsString);
|
2026-05-13 09:12:14 +08:00
|
|
|
|
post;
|
2024-07-04 16:01:24 +08:00
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmCompanySel.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeFinishClothInEdit.v2Column1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|
|
|
|
|
with frmZDYHelp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
flag := 'JWLYCLName';
|
|
|
|
|
|
flagname := 'Ʒ<><C6B7>';
|
|
|
|
|
|
MainType := FSTKName;
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with Self.CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName('C_Name').Value := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmZDYHelp.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeFinishClothInEdit.v1Column5PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|
|
|
|
|
with frmZDYHelp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
flag := 'StkPosition';
|
|
|
|
|
|
flagname := '<27><>λ';
|
|
|
|
|
|
MainType := FSTKName;
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with Self.CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName('StkPosition').Value := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmZDYHelp.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmTradeFinishClothInEdit.v1Column8PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
|
|
|
|
|
begin
|
|
|
|
|
|
try
|
|
|
|
|
|
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
|
|
|
|
|
with frmZDYHelp do
|
|
|
|
|
|
begin
|
|
|
|
|
|
flag := 'C_Spec';
|
|
|
|
|
|
flagname := '<27><><EFBFBD><EFBFBD>';
|
|
|
|
|
|
MainType := FSTKName;
|
|
|
|
|
|
if ShowModal = 1 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
with Self.CDS_Sub do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Edit;
|
|
|
|
|
|
FieldByName('C_Spec').Value := Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
frmZDYHelp.Free;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|
|
|
|
|
|
|