1539 lines
43 KiB
ObjectPascal
1539 lines
43 KiB
ObjectPascal
unit U_TradePlanProofInPut;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Winapi.ShellAPI, ComObj, Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter,
|
||
cxData, cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel,
|
||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
|
||
cxControls, cxGridCustomView, cxGrid, cxMemo, cxRichEdit, ComCtrls,
|
||
cxContainer, cxTextEdit, cxMaskEdit, cxButtonEdit, StdCtrls, ToolWin, DBClient,
|
||
ADODB, ExtCtrls, BtnEdit, cxCalendar, StrUtils, cxCurrencyEdit,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, cxDropDownEdit, RM_Common, RM_Preview,
|
||
RM_System, RM_Class, RM_GridReport, RM_Dataset, Menus, cxSplitter,
|
||
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, cxCheckBox, dxSkinsCore,
|
||
dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu, cxPC, System.ImageList,
|
||
Vcl.ImgList, U_BaseInput, dxSkinWXI, dxCore, cxDateUtils,
|
||
dxScrollbarAnnotations, IdBaseComponent, IdComponent, IdTCPConnection,
|
||
IdTCPClient, IdExplicitTLSClientServerBase, IdFTP, cxImage, cxDBEdit,
|
||
cxGroupBox;
|
||
|
||
type
|
||
TfrmTradePlanProofInPut = class(TfrmBaseInput)
|
||
ToolBar1: TToolBar;
|
||
TBSave: TToolButton;
|
||
TBClose: TToolButton;
|
||
ScrollBox1: TScrollBox;
|
||
OrderNo: TcxTextEdit;
|
||
ADOTemp: TADOQuery;
|
||
ADOCmd: TADOQuery;
|
||
DS_1: TDataSource;
|
||
CDS_1: TClientDataSet;
|
||
Label3: TLabel;
|
||
Label25: TLabel;
|
||
Label23: TLabel;
|
||
GPM_1: TcxGridPopupMenu;
|
||
ADOQueryLabel: TADOQuery;
|
||
Label51: TLabel;
|
||
Label7: TLabel;
|
||
ADO_I1: TADOQuery;
|
||
DS_I1: TDataSource;
|
||
ToolButton3: TToolButton;
|
||
Label1: TLabel;
|
||
Label2: TLabel;
|
||
Label4: TLabel;
|
||
BuyConNo: TcxTextEdit;
|
||
Label5: TLabel;
|
||
C_Name: TcxTextEdit;
|
||
Label6: TLabel;
|
||
Label8: TLabel;
|
||
C_Spec: TcxTextEdit;
|
||
C_Composition: TcxTextEdit;
|
||
Label9: TLabel;
|
||
C_GramWeight: TcxTextEdit;
|
||
Label10: TLabel;
|
||
C_Width: TcxTextEdit;
|
||
Label11: TLabel;
|
||
Label27: TLabel;
|
||
IdFTP1: TIdFTP;
|
||
Label14: TLabel;
|
||
Label20: TLabel;
|
||
ConNo: TcxTextEdit;
|
||
ADO_I2: TADOQuery;
|
||
DS_I2: TDataSource;
|
||
CDS_LM: TClientDataSet;
|
||
OpenDialog1: TOpenDialog;
|
||
PM_1: TPopupMenu;
|
||
N5: TMenuItem;
|
||
N6: TMenuItem;
|
||
CDS_Fact: TClientDataSet;
|
||
GPM_2: TcxGridPopupMenu;
|
||
DSFact: TDataSource;
|
||
cxPageControl3: TcxPageControl;
|
||
cxTabSheet2: TcxTabSheet;
|
||
cxTabSheet3: TcxTabSheet;
|
||
tlb2: TToolBar;
|
||
btnConSel: TToolButton;
|
||
ToolButton5: TToolButton;
|
||
ToolButton7: TToolButton;
|
||
ToolButton4: TToolButton;
|
||
ToolButton1: TToolButton;
|
||
ToolButton6: TToolButton;
|
||
ToolButton2: TToolButton;
|
||
cxGrid1: TcxGrid;
|
||
TV1: TcxGridDBTableView;
|
||
TV1Column8: TcxGridDBColumn;
|
||
v1Column11: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
v1PRTColor: TcxGridDBColumn;
|
||
TV1Column5: TcxGridDBColumn;
|
||
TV1Column6: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
TV1Column3: TcxGridDBColumn;
|
||
VC_PRTPs: TcxGridDBColumn;
|
||
v1PRTOrderQty: TcxGridDBColumn;
|
||
TV1Column2: TcxGridDBColumn;
|
||
TV1Column4: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
Panel3: TPanel;
|
||
OrdDate: TcxDateEdit;
|
||
DlyDate: TcxDateEdit;
|
||
CustName: TcxButtonEdit;
|
||
OurCoName: TcxButtonEdit;
|
||
C_Code: TcxButtonEdit;
|
||
OrdUnit: TcxComboBox;
|
||
OrdNote: TcxMemo;
|
||
RM2: TRMGridReport;
|
||
RM1: TRMGridReport;
|
||
RMDB_1: TRMDBDataSet;
|
||
RMDB_2: TRMDBDataSet;
|
||
ADO_1: TADOQuery;
|
||
Label15: TLabel;
|
||
OrdType: TcxComboBox;
|
||
Label16: TLabel;
|
||
GC_Name: TcxTextEdit;
|
||
Label17: TLabel;
|
||
CraftCode: TcxTextEdit;
|
||
lbl6: TLabel;
|
||
lbl7: TLabel;
|
||
lbl8: TLabel;
|
||
lbl9: TLabel;
|
||
lbl12: TLabel;
|
||
lbl15: TLabel;
|
||
Label12: TLabel;
|
||
Label13: TLabel;
|
||
lbl19: TLabel;
|
||
lbl20: TLabel;
|
||
lbl21: TLabel;
|
||
lbl22: TLabel;
|
||
lbl23: TLabel;
|
||
lbl24: TLabel;
|
||
lbl25: TLabel;
|
||
lbl26: TLabel;
|
||
lbl27: TLabel;
|
||
lbl28: TLabel;
|
||
lbl29: TLabel;
|
||
lbl30: TLabel;
|
||
PH: TcxTextEdit;
|
||
QtyNote: TcxButtonEdit;
|
||
LightNote: TcxButtonEdit;
|
||
ShippingSample: TcxButtonEdit;
|
||
FtyName: TcxButtonEdit;
|
||
Follower: TcxButtonEdit;
|
||
Technics: TcxButtonEdit;
|
||
Feel: TcxButtonEdit;
|
||
OtherProcess1: TcxButtonEdit;
|
||
OtherProcess2: TcxButtonEdit;
|
||
OtherProcess3: TcxButtonEdit;
|
||
ColorFastness1: TcxButtonEdit;
|
||
OtherProcess4: TcxButtonEdit;
|
||
OtherProcess5: TcxButtonEdit;
|
||
OtherProcess6: TcxButtonEdit;
|
||
ColorFastness2: TcxButtonEdit;
|
||
OtherProcess8: TcxButtonEdit;
|
||
OtherProcess9: TcxButtonEdit;
|
||
OtherProcess10: TcxButtonEdit;
|
||
OtherProcess7: TcxButtonEdit;
|
||
Label18: TLabel;
|
||
CraftName: TcxTextEdit;
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBSaveClick(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure CustomerNoNameBtnDnClick(Sender: TObject);
|
||
procedure v1OrderUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure v1PriceUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure YCLFactoryBtnUpClick(Sender: TObject);
|
||
procedure v1Column5PropertiesEditValueChanged(Sender: TObject);
|
||
procedure HYTTBtnUpClick(Sender: TObject);
|
||
procedure KYTTBtnUpClick(Sender: TObject);
|
||
procedure btnConSelClick(Sender: TObject);
|
||
procedure TV1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
procedure v1OrderUnitPropertiesEditValueChanged(Sender: TObject);
|
||
procedure Tv1Column4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure cxDBImage1DblClick(Sender: TObject);
|
||
procedure SYRNameBtnUpClick(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure ToolButton5Click(Sender: TObject);
|
||
procedure TechnicsBtnDnClick(Sender: TObject);
|
||
procedure Tv1Column1PropertiesEditValueChanged(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure N5Click(Sender: TObject);
|
||
procedure N6Click(Sender: TObject);
|
||
procedure ToolButton6Click(Sender: TObject);
|
||
procedure ToolButton7Click(Sender: TObject);
|
||
procedure CustNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure CustNameDblClick(Sender: TObject);
|
||
procedure C_CodeDblClick(Sender: TObject);
|
||
procedure C_CodePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure OrdNoteDblClick(Sender: TObject);
|
||
procedure QtyNotePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure OurCoNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure FollowerPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure FtyNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
private
|
||
FSCXDH: string;
|
||
procedure InitData();
|
||
procedure ZDYHelp(FButn: TcxButtonEdit; LType: string);
|
||
function SaveData(): Boolean;
|
||
function getOrderNo(fconNo: string): string;
|
||
procedure InitImage2();
|
||
procedure LookImage(FileName: string);
|
||
procedure SetXH();
|
||
{ Private declarations }
|
||
public
|
||
PState, CopyInt, PriceFlag: Integer;
|
||
FMainId, FFMainId, FOrderNo: string;
|
||
FXS: Integer;
|
||
canshu1: string;
|
||
fFlileFlag: string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmTradePlanProofInPut: TfrmTradePlanProofInPut;
|
||
newh: hwnd;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_ZDYHelp, U_ZDYHelpSel, U_RTFun, U_TradeSalesContractSel,
|
||
U_CompanySel, U_PictureUpload, U_ClothInfoSel, U_PatternColorHelp,
|
||
U_TradeLabelSel;
|
||
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmTradePlanProofInPut.SetXH();
|
||
var
|
||
i: Integer;
|
||
begin
|
||
with CDS_1 do
|
||
begin
|
||
First;
|
||
i := 1;
|
||
while not Eof do
|
||
begin
|
||
with CDS_1 do
|
||
begin
|
||
Edit;
|
||
FieldByName('XHNoTemp').Value := i;
|
||
Post;
|
||
end;
|
||
i := i + 1;
|
||
Next;
|
||
end;
|
||
end;
|
||
|
||
with CDS_1 do
|
||
begin
|
||
CDS_1.IndexFieldNames := '';
|
||
First;
|
||
i := 1;
|
||
while not Eof do
|
||
begin
|
||
with CDS_1 do
|
||
begin
|
||
Edit;
|
||
FieldByName('SerialNo').Value := FieldByName('XHNoTemp').AsInteger;
|
||
Post;
|
||
end;
|
||
i := i + 1;
|
||
Next;
|
||
end;
|
||
CDS_1.IndexFieldNames := 'SerialNo';
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.InitImage2();
|
||
begin
|
||
with ADO_I2 do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select * from TP_File A');
|
||
sql.Add('where isnull(WBID,'''')<>'''' and FileName=' + quotedstr(Trim(CDS_1.fieldbyname('AttName').AsString)));
|
||
open;
|
||
end;
|
||
end;
|
||
|
||
function TfrmTradePlanProofInPut.getOrderNo(fconNo: string): string;
|
||
var
|
||
str1: string;
|
||
i: integer;
|
||
begin
|
||
str1 := trim(fconNo) + '01';
|
||
with ADOTemp do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select MainID from Trade_Plan_Main where orderNo=' + quotedstr(trim(str1)));
|
||
open;
|
||
end;
|
||
if not ADOTemp.IsEmpty then
|
||
begin
|
||
for i := 1 to 99 do
|
||
begin
|
||
str1 := trim(fconNo) + rightstr(inttostr(100 + i), 2);
|
||
with ADOCmd do
|
||
begin
|
||
close;
|
||
sql.Clear;
|
||
sql.Add('select MainID from Trade_Plan_Main where orderNo=' + quotedstr(trim(str1)));
|
||
open;
|
||
end;
|
||
if ADOCmd.IsEmpty then
|
||
break;
|
||
end;
|
||
end;
|
||
result := str1;
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.TBCloseClick(Sender: TObject);
|
||
begin
|
||
|
||
Close;
|
||
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.InitData();
|
||
var
|
||
FDate: TDateTime;
|
||
begin
|
||
FDate := SGetServerDateTime(ADOTemp);
|
||
OrdDate.Date := FDate;
|
||
DlyDate.Date := FDate;
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Trade_Plan_Main where MainId=''' + Trim(FMainId) + '''');
|
||
Open;
|
||
end;
|
||
SCSHData(ADOTemp, ScrollBox1, 1);
|
||
SCSHData(ADOTemp, Panel3, 1);
|
||
OurCoName.Properties.LookupItems.Text := Trim(ADOTemp.FieldByName('OurCoNo').AsString);
|
||
CustName.Properties.LookupItems.Text := Trim(ADOTemp.FieldByName('CustNo').AsString);
|
||
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select * from Trade_Plan_Sub where 1=1 ');
|
||
sql.Add(' and MainId=''' + Trim(FMainId) + '''');
|
||
Open;
|
||
end;
|
||
SCSHData(ADOTemp, ScrollBox1, 2);
|
||
SCreateCDS(ADOTemp, CDS_1);
|
||
SInitCDSData(ADOTemp, CDS_1);
|
||
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add(' select * from Trade_Plan_Fty ');
|
||
sql.Add(' where MainId=''' + Trim(FMainId) + '''');
|
||
Open;
|
||
end;
|
||
SCSHData(ADOTemp, Panel3, 4);
|
||
|
||
if PState = 0 then
|
||
begin
|
||
OrdDate.Date := SGetServerDateTime(ADOTemp);
|
||
DlyDate.Date := OrdDate.Date;
|
||
|
||
OrderNo.Text := '';
|
||
OrderNo.Enabled := True;
|
||
end
|
||
else
|
||
begin
|
||
end;
|
||
if CopyInt = 99 then
|
||
begin
|
||
PState := 0;
|
||
FMainId := '';
|
||
OrderNo.Text := '';
|
||
OrderNo.Enabled := True;
|
||
|
||
OrdDate.Date := FDate;
|
||
|
||
with CDS_1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
Edit;
|
||
FieldByName('MainId').Value := '';
|
||
FieldByName('SubId').Value := '';
|
||
Post;
|
||
Next;
|
||
end;
|
||
end;
|
||
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.ZDYHelp(FButn: TcxButtonEdit; LType: string);
|
||
var
|
||
FType, ZDYName, FText: string;
|
||
begin
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.FollowerPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
// try
|
||
// frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
// with frmZDYHelp do
|
||
// begin
|
||
// fnote := True;
|
||
// flag := 'Follower';
|
||
// flagname := '<27><><EFBFBD><EFBFBD>Ա';
|
||
// if ShowModal = 1 then
|
||
// begin
|
||
// CDS_Fact.Edit;
|
||
// CDS_Fact.FieldByName('Follower').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
// self.Follower.Properties.LookupItems.Text := Trim(frmCompanySel.CDS_1.fieldbyname('FollowId').AsString);
|
||
// self.Follower.Text := Trim(frmCompanySel.CDS_1.fieldbyname('Follower').AsString);
|
||
//
|
||
// end;
|
||
// end;
|
||
// finally
|
||
// frmZDYHelp.Free;
|
||
// end;
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.FormShow(Sender: TObject);
|
||
var
|
||
i: Integer;
|
||
begin
|
||
inherited;
|
||
with CDS_LM do
|
||
begin
|
||
FieldDefs.Clear;
|
||
FieldDefs.Add('LXH', ftInteger, 0);
|
||
FieldDefs.Add('lCode', ftString, 40);
|
||
FieldDefs.Add('LName', ftString, 40);
|
||
close;
|
||
CreateDataSet;
|
||
end;
|
||
with ADO_1 do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('exec P_BS_Label_Get_Test');
|
||
Open;
|
||
end;
|
||
readCxGrid(TRIM(SELF.Caption) + 'Tv1', Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
OrderNo.Text := '';
|
||
fFlileFlag := UserDataFlag + 'HX';
|
||
InitData();
|
||
InitImage2();
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.FtyNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmCompanySel := TfrmCompanySel.Create(Application);
|
||
with frmCompanySel do
|
||
begin
|
||
FCoType := '<27><>Ӧ<EFBFBD><D3A6>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
self.FtyName.Properties.LookupItems.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoCode').AsString);
|
||
self.FtyName.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoAbbrName').AsString);
|
||
|
||
self.Follower.Properties.LookupItems.Text := Trim(frmCompanySel.CDS_1.fieldbyname('FollowId').AsString);
|
||
self.Follower.Text := Trim(frmCompanySel.CDS_1.fieldbyname('Follower').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmCompanySel.Free;
|
||
end;
|
||
end;
|
||
|
||
function TfrmTradePlanProofInPut.SaveData(): Boolean;
|
||
var
|
||
maxno, Smaxno, maxorderno, MaxFNo: string;
|
||
begin
|
||
try
|
||
ADOCmd.Connection.BeginTrans;
|
||
///<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
if Trim(FMainId) = '' then
|
||
begin
|
||
if GetLSNo(ADOCmd, maxno, 'JM', 'Trade_Plan_Main', 3, 1) = False then
|
||
raise Exception.Create('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!');
|
||
end
|
||
else
|
||
begin
|
||
maxno := Trim(FMainId);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from Trade_Plan_Main where MainId=''' + Trim(FMainId) + '''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(FMainId) = '' 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 := SGetServerDateTime(ADOTemp);
|
||
end;
|
||
RTSetsavedata(ADOCmd, 'Trade_Plan_Main', ScrollBox1, 1);
|
||
RTSetsavedata(ADOCmd, 'Trade_Plan_Main', Panel3, 1);
|
||
FieldByName('MainId').Value := Trim(maxno);
|
||
FieldByName('OurCoNo').Value := Trim(OurCoName.Properties.LookupItems.Text);
|
||
FieldByName('CustNo').Value := Trim(CustName.Properties.LookupItems.Text);
|
||
Post;
|
||
end;
|
||
|
||
///////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD> ///////////////////////////
|
||
with CDS_1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(CDS_1.fieldbyname('SubId').AsString) = '' then
|
||
begin
|
||
if GetLSNo(ADOCmd, Smaxno, 'JS', 'Trade_Plan_Sub', 4, 1) = False then
|
||
raise Exception.Create('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!');
|
||
end
|
||
else
|
||
begin
|
||
Smaxno := Trim(CDS_1.fieldbyname('SubId').AsString);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from Trade_Plan_Sub where MainId=''' + Trim(maxno) + '''');
|
||
sql.Add(' and SubId=''' + Trim(Smaxno) + '''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(CDS_1.fieldbyname('SubId').AsString) = '' then
|
||
Append
|
||
else
|
||
Edit;
|
||
RTSetSaveDataCDS(ADOCmd, Tv1, CDS_1, 'Trade_Plan_Sub', 0);
|
||
RTSetsavedata(ADOCmd, 'Trade_Plan_Sub', ScrollBox1, 2);
|
||
FieldByName('MainId').Value := Trim(maxno);
|
||
FieldByName('SubId').Value := Trim(Smaxno);
|
||
FieldByName('ConSId').Value := Trim(CDS_1.fieldbyname('ConSId').AsString);
|
||
FieldByName('ConMId').Value := Trim(CDS_1.fieldbyname('ConMId').AsString);
|
||
Post;
|
||
with CDS_1 do
|
||
begin
|
||
Edit;
|
||
fieldbyname('SubId').Value := Trim(Smaxno);
|
||
Post;
|
||
end;
|
||
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
///////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD> ///////////////////////////
|
||
///////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD> ///////////////////////////
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from Trade_Plan_Fty where TPFId=''' + Trim(maxno) + '''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if ADOCmd.IsEmpty then
|
||
begin
|
||
Append;
|
||
end
|
||
else
|
||
Edit;
|
||
RTSetsavedata(ADOCmd, 'Trade_Plan_Fty', Panel3, 4);
|
||
FieldByName('FtyNo').Value := Trim(FtyName.Properties.LookupItems.Text);
|
||
FieldByName('MainId').Value := Trim(maxno);
|
||
FieldByName('TPFId').Value := Trim(maxno);
|
||
Post;
|
||
end;
|
||
///////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD> ///////////////////////////
|
||
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Trade_Plan_Main where orderno=''' + Trim(OrderNo.Text) + '''');
|
||
Open;
|
||
end;
|
||
if ADOCmd.RecordCount > 1 then
|
||
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>!');
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('update Trade_Plan_Main set SalesId=X.SalesId,Saleser=X.Saleser,TallyId=X.TallyId,Tallyer=X.Tallyer from Bs_Company X where X.CoCode=CustNo');
|
||
sql.Add('and orderno=''' + Trim(OrderNo.Text) + '''');
|
||
execsql;
|
||
end;
|
||
FMainId := Trim(maxno);
|
||
|
||
ADOCmd.Connection.CommitTrans;
|
||
Result := True;
|
||
except
|
||
Result := False;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
|
||
if pos('KEY Լ<><D4BC>', Exception(ExceptObject).Message) > 0 then
|
||
begin
|
||
if GetLSNo(ADOCmd, Smaxno, 'JS', 'Trade_Plan_Sub', 4, 1) = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.TBSaveClick(Sender: TObject);
|
||
begin
|
||
if PState <> 1 then
|
||
begin
|
||
ToolBar1.SetFocus;
|
||
end;
|
||
|
||
if Trim(OrderNo.Text) = '' then
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('exec P_Trade_Plan_Get_OrdNo @ConNo=''' + Trim(ConNo.Text) + '''');
|
||
Open;
|
||
end;
|
||
OrderNo.Text := ADOTemp.FieldByName('OrderNo').AsString;
|
||
end;
|
||
|
||
if CDS_1.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27><>ϸ<EFBFBD><CFB8><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if OrdUnit.Text = '' then
|
||
begin
|
||
Application.MessageBox('<27><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if CDS_1.Locate('OrdQty', null, []) 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><C9B9><EFBFBD>', '<27><>ʾ', 0);
|
||
// ModalResult := 1;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.ToolButton1Click(Sender: TObject);
|
||
var
|
||
i: Integer;
|
||
begin
|
||
i := CDS_1.RecordCount;
|
||
CopyAddRow(Tv1, CDS_1);
|
||
with CDS_1 do
|
||
begin
|
||
Edit;
|
||
FieldByName('SSel').Value := false;
|
||
FieldByName('SerialNo').Value := i + 1;
|
||
FieldByName('AttName').Value := '';
|
||
Post;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
if CDS_1.IsEmpty then
|
||
Exit;
|
||
if CDS_1.Locate('SSel', True, []) = False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
exit;
|
||
CDS_1.DisableControls;
|
||
with CDS_1 do
|
||
begin
|
||
First;
|
||
while Locate('SSel', True, []) do
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from Trade_Cloth_Inspect where isnull(SubId,'''')<>'''' and SubId=''' + Trim(CDS_1.fieldbyname('SubId').AsString) + '''');
|
||
Open;
|
||
end;
|
||
if ADOTemp.IsEmpty = False then
|
||
begin
|
||
Application.MessageBox('<27>Ѽ<EFBFBD><D1BC>鲻<EFBFBD><E9B2BB>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Trim(CDS_1.fieldbyname('SubId').AsString) <> '' then
|
||
begin
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
|
||
// sql.Add('insert into Trade_Plan_Sub_Del select * from Trade_Plan_Sub where SubId=''' + Trim(CDS_1.fieldbyname('SubId').AsString) + '''');
|
||
|
||
sql.Add('delete Trade_Plan_Sub where SubId=''' + Trim(CDS_1.fieldbyname('SubId').AsString) + '''');
|
||
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
Delete;
|
||
end;
|
||
end;
|
||
CDS_1.EnableControls;
|
||
SetXH();
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
WriteCxGrid(TRIM(SELF.Caption) + 'Tv1', Tv1, '<27><><EFBFBD><EFBFBD>ָʾ<D6B8><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.ToolButton4Click(Sender: TObject);
|
||
var
|
||
excelApp, WorkBook: Variant;
|
||
i, j, k, LX, ExcelRowCount: integer;
|
||
maxId, FCPID, FCPName, t1, t2, t3, FFID: string;
|
||
begin
|
||
try
|
||
excelApp := CreateOleObject('Excel.Application');
|
||
openDialog1.Filter := '*.CSV;*.xls';
|
||
if opendialog1.Execute then
|
||
begin
|
||
WorkBook := excelApp.WorkBooks.Open(OpenDialog1.FileName);
|
||
end
|
||
else
|
||
exit;
|
||
excelApp.Visible := false;
|
||
ExcelRowCount := WorkBook.WorkSheets[1].UsedRange.Rows.Count;
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD>EXCEL<45><4C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
|
||
CDS_LM.EmptyDataSet;
|
||
|
||
for j := 0 to Tv1.ColumnCount - 1 do
|
||
begin
|
||
with CDS_LM do
|
||
begin
|
||
Append;
|
||
FieldByName('LCode').Value := trim(Tv1.Columns[j].DataBinding.FieldName);
|
||
FieldByName('LName').Value := trim(Tv1.Columns[j].Caption);
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
try
|
||
for i := 1 to 50 do
|
||
begin
|
||
if trim(WorkBook.WorkSheets[1].Cells[1, i].value) = '' then
|
||
continue;
|
||
if CDS_LM.Locate('LName', trim(WorkBook.WorkSheets[1].Cells[1, i].value), []) then
|
||
begin
|
||
with CDS_LM do
|
||
begin
|
||
Edit;
|
||
FieldByName('LXH').Value := i;
|
||
Post;
|
||
end;
|
||
end;
|
||
end;
|
||
except
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ', MB_ICONERROR);
|
||
exit;
|
||
end;
|
||
|
||
try
|
||
for i := 2 to ExcelRowCount do
|
||
begin
|
||
with CDS_1 do
|
||
begin
|
||
Append;
|
||
CDS_LM.First;
|
||
while not CDS_LM.Eof do
|
||
begin
|
||
if CDS_LM.FieldByName('LXH').AsInteger > 0 then
|
||
CDS_1.fieldbyname(CDS_LM.FieldByName('LCode').AsString).Value := WorkBook.WorkSheets[1].Cells[i, CDS_LM.FieldByName('LXH').AsInteger].Value;
|
||
CDS_LM.Next;
|
||
end;
|
||
CDS_1.FieldByName('SSel').Value := false;
|
||
Post;
|
||
end;
|
||
end;
|
||
WorkBook.Close;
|
||
excelApp.Quit;
|
||
excelApp := Unassigned;
|
||
WorkBook := Unassigned;
|
||
except
|
||
WorkBook.Close;
|
||
excelApp.Quit;
|
||
excelApp := Unassigned;
|
||
WorkBook := Unassigned;
|
||
exit;
|
||
end;
|
||
SetXH();
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.ToolButton5Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmClothInfoSel := TfrmClothInfoSel.Create(Application);
|
||
with frmClothInfoSel do
|
||
begin
|
||
if ShowModal = 1 then
|
||
begin
|
||
while CDS_1.locate('SSel', true, []) do
|
||
begin
|
||
if self.CDS_1.locate('ConSubId', trim(CDS_1.Fieldbyname('SubId').AsString), []) then
|
||
begin
|
||
CDS_1.Edit;
|
||
CDS_1.fieldbyname('SSel').value := false;
|
||
continue;
|
||
end;
|
||
with self.CDS_1 do
|
||
begin
|
||
append;
|
||
FieldByName('SSel').Value := false;
|
||
C_Code.Text := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Code').AsString);
|
||
C_Name.Text := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Name').AsString);
|
||
C_Spec.Text := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Spec').AsString);
|
||
C_Composition.Text := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Composition').AsString);
|
||
C_Width.Text := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Width').AsString);
|
||
C_GramWeight.Text := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_GramWeight').AsString);
|
||
OrdUnit.ItemIndex := OrdUnit.Properties.Items.IndexOf(trim(frmClothInfoSel.CDS_1.fieldbyname('ConUnit').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);
|
||
Fieldbyname('C_Pattern').value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Pattern').AsString);
|
||
|
||
Fieldbyname('OrdQty').value := frmClothInfoSel.CDS_1.Fieldbyname('ConQty').AsFloat;
|
||
|
||
Fieldbyname('DDQtyUnit').value := frmClothInfoSel.CDS_1.Fieldbyname('SCSUnit').AsString;
|
||
Fieldbyname('OrderUnit').value := trim(frmClothInfoSel.CDS_1.Fieldbyname('SCSUnit').AsString);
|
||
Fieldbyname('SerialNo').value := 999;
|
||
end;
|
||
CDS_1.Edit;
|
||
CDS_1.fieldbyname('SSel').value := false;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmClothInfoSel.Free;
|
||
end;
|
||
SetXH();
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.ToolButton6Click(Sender: TObject);
|
||
var
|
||
i: Integer;
|
||
begin
|
||
i := CDS_1.RecordCount;
|
||
with CDS_1 do
|
||
begin
|
||
Append;
|
||
FieldByName('SSel').Value := false;
|
||
FieldByName('SerialNo').Value := i + 1;
|
||
FieldByName('AttName').Value := '';
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.ToolButton7Click(Sender: TObject);
|
||
var
|
||
I, J, K: Integer;
|
||
begin
|
||
|
||
K := CDS_1.RecordCount + 1;
|
||
|
||
try
|
||
frmPatternColorHelp := TfrmPatternColorHelp.Create(Application);
|
||
with frmPatternColorHelp do
|
||
begin
|
||
if ShowModal = 1 then
|
||
begin
|
||
for I := STRTOINTDEF(QSHX.Text, 1) to STRTOINTDEF(JSHX.Text, 1) do
|
||
begin
|
||
for J := 1 to STRTOINTDEF(YSSL.Text, 1) do
|
||
begin
|
||
with CDS_1 do
|
||
begin
|
||
Append;
|
||
FieldByName('SSel').Value := false;
|
||
FieldByName('SerialNo').Value := K;
|
||
if STRTOINTDEF(QSHX.Text, 0) <> 0 then
|
||
FieldByName('C_Pattern').Value := 'D#' + inttostr(I);
|
||
if STRTOINTDEF(YSSL.Text, 0) <> 0 then
|
||
FieldByName('C_ColorNo').Value := 'C#' + inttostr(J);
|
||
FieldByName('OrdPiece').Value := STRTOINTDEF(ps.Text, 0);
|
||
FieldByName('OrdQty').Value := STRTOINTDEF(sl.Text, 0);
|
||
|
||
FieldByName('C_GS').Value := STRTOINTDEF(GS.Text, 0);
|
||
FieldByName('C_GL').Value := STRTOINTDEF(GL.Text, 0);
|
||
FieldByName('OrdPiece').Value := STRTOINTDEF(GS.Text, 0) * STRTOINTDEF(GL.Text, 0);
|
||
Post;
|
||
end;
|
||
K := K + 1;
|
||
end;
|
||
end;
|
||
SetXH();
|
||
end;
|
||
end;
|
||
finally
|
||
frmPatternColorHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.TechnicsBtnDnClick(Sender: TObject);
|
||
begin
|
||
TcxButtonEdit(Sender).Text := '';
|
||
TcxButtonEdit(Sender).Properties.LookupItems.Text := '';
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.CustNameDblClick(Sender: TObject);
|
||
begin
|
||
TcxButtonEdit(Sender).Text := '';
|
||
TcxButtonEdit(Sender).Properties.LookupItems.Text := '';
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.CustNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmCompanySel := TfrmCompanySel.Create(Application);
|
||
with frmCompanySel do
|
||
begin
|
||
FCoType := '<27>ͻ<EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
self.CustName.Properties.LookupItems.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoCode').AsString);
|
||
self.CustName.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoAbbrName').AsString);
|
||
end;
|
||
end;
|
||
|
||
finally
|
||
frmCompanySel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.CustomerNoNameBtnDnClick(Sender: TObject);
|
||
begin
|
||
TcxButtonEdit(Sender).Text := '';
|
||
TcxButtonEdit(Sender).Properties.LookupItems.Text := '';
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.C_CodeDblClick(Sender: TObject);
|
||
begin
|
||
Self.C_Code.Text := '';
|
||
Self.C_Name.Text := '';
|
||
Self.C_Spec.Text := '';
|
||
Self.C_Composition.Text := '';
|
||
Self.C_Width.Text := '';
|
||
Self.C_GramWeight.Text := '';
|
||
Self.CraftCode.Text := '';
|
||
Self.GC_Name.Text := '';
|
||
Self.CraftName.Text := '';
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.C_CodePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmClothInfoSel := TfrmClothInfoSel.Create(Application);
|
||
with frmClothInfoSel do
|
||
begin
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.C_Code.Text := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Code').AsString);
|
||
Self.C_Name.Text := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Name').AsString);
|
||
Self.C_Spec.Text := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Spec').AsString);
|
||
Self.C_Composition.Text := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Composition').AsString);
|
||
Self.C_Width.Text := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Width').AsString);
|
||
Self.C_GramWeight.Text := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_GramWeight').AsString);
|
||
Self.CraftCode.Text := trim(frmClothInfoSel.CDS_1.Fieldbyname('CraftCode').AsString);
|
||
Self.GC_Name.Text := trim(frmClothInfoSel.CDS_1.Fieldbyname('GC_Name').AsString);
|
||
Self.CraftName.Text := trim(frmClothInfoSel.CDS_1.Fieldbyname('CraftName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmClothInfoSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.cxDBImage1DblClick(Sender: TObject);
|
||
begin
|
||
if TcxDBImage(Sender).Picture.Height = 0 then
|
||
exit;
|
||
LookImage(ADO_I1.fieldbyname(TcxDBImage(Sender).Hint).asstring);
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.OrdNoteDblClick(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
FWZ: Integer;
|
||
i: integer;
|
||
begin
|
||
fsj := Trim(TMemo(Sender).Hint);
|
||
FWZ := Pos('/', fsj);
|
||
i := 0;
|
||
try
|
||
frmZDYHelpSel := TfrmZDYHelpSel.Create(Application);
|
||
with frmZDYHelpSel do
|
||
begin
|
||
flag := Copy(fsj, 1, FWZ - 1);
|
||
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
||
if ShowModal = 1 then
|
||
begin
|
||
TMemo(Sender).Lines.Clear;
|
||
with ClientDataSet1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if FieldByName('SSel').AsBoolean = True then
|
||
begin
|
||
i := i + 1;
|
||
TMemo(Sender).Lines.Add(inttostr(i) + '.' + FieldByName('ZDYName').AsString) //inttostr(i)+'.'+
|
||
end;
|
||
Next;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelpSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.OurCoNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmCompanySel := TfrmCompanySel.Create(Application);
|
||
with frmCompanySel do
|
||
begin
|
||
FCoType := '<27><>˾';
|
||
if ShowModal = 1 then
|
||
begin
|
||
self.OurCoName.Properties.LookupItems.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoCode').AsString);
|
||
self.OurCoName.Text := Trim(frmCompanySel.CDS_1.fieldbyname('CoAbbrName').AsString);
|
||
end;
|
||
end;
|
||
|
||
finally
|
||
frmCompanySel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.LookImage(FileName: string);
|
||
var
|
||
sFieldName: string;
|
||
begin
|
||
|
||
sFieldName := leftbstr(ExtractFilePath(Application.ExeName), 1) + ':\ͼƬ<CDBC>鿴';
|
||
|
||
if not DirectoryExists(pchar(sFieldName)) then
|
||
CreateDirectory(pchar(sFieldName), nil);
|
||
|
||
sFieldName := sFieldName + '\' + trim(FileName);
|
||
|
||
try
|
||
IdFTP1.Host := ReadINIFileStr('SYSTEMSET.INI', 'SERVER', '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ', '127.0.0.1');
|
||
IdFTP1.Username := 'three';
|
||
IdFTP1.Password := '641010';
|
||
IdFTP1.Connect();
|
||
except
|
||
;
|
||
end;
|
||
|
||
if IdFTP1.Connected then
|
||
begin
|
||
try
|
||
IdFTP1.Get(fFlileFlag + '\' + Trim(FileName), sFieldName, true, false);
|
||
except
|
||
Application.MessageBox('<27>ͻ<EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
|
||
IdFTP1.Quit;
|
||
Exit;
|
||
end;
|
||
end
|
||
else
|
||
begin
|
||
Application.MessageBox('<27><EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', MB_ICONWARNING);
|
||
IdFTP1.Quit;
|
||
Exit;
|
||
end;
|
||
if IdFTP1.Connected then
|
||
IdFTP1.Quit;
|
||
ShellExecute(Handle, 'open', PChar(sFieldName), '', '', SW_SHOWNORMAL);
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.N5Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_1, True);
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.N6Click(Sender: TObject);
|
||
begin
|
||
SelOKNo(CDS_1, False);
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.v1OrderUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
var
|
||
mvalues: string;
|
||
begin
|
||
mvalues := tv1.Columns[tv1.Controller.FocusedColumn.index].DataBinding.FieldName;
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'OrderUnit';
|
||
flagname := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ';
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.CDS_1.Edit;
|
||
Self.CDS_1.FieldByName(mvalues).Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.v1OrderUnitPropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue, FFieldName, YValue: string;
|
||
FDDQty, FCPCDXS, FQty, FDKCQty: Double;
|
||
begin
|
||
mvalue := TcxComboBox(Sender).EditingText; //<2F>仯<EFBFBD><E4BBAF><EFBFBD><EFBFBD>λ
|
||
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
with CDS_1 do
|
||
begin
|
||
|
||
Edit;
|
||
FieldByName(FFieldName).Value := mvalue;
|
||
Post;
|
||
YValue := FieldByName('DDQtyUnit').AsString; //ԭ<><D4AD>λ=<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
|
||
FDDQty := FieldByName('DDQty').AsFloat; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
FCPCDXS := FieldByName('CPCDXS').AsFloat;
|
||
FDKCQty := FieldByName('DKCQty').AsFloat;
|
||
FQty := FieldByName('PRTOrderQty').AsFloat;
|
||
end;
|
||
if mvalue = 'Kg' then
|
||
begin
|
||
if YValue = 'Y' then
|
||
begin
|
||
FQty := FDDQty * 0.9144 / FCPCDXS;
|
||
end;
|
||
if YValue = 'M' then
|
||
begin
|
||
FQty := FDDQty / FCPCDXS;
|
||
end;
|
||
if YValue = 'Kg' then
|
||
begin
|
||
FQty := FDDQty;
|
||
end;
|
||
end;
|
||
|
||
if mvalue = 'M' then
|
||
begin
|
||
if YValue = 'Y' then
|
||
begin
|
||
FQty := FDDQty * 0.9144;
|
||
end;
|
||
if YValue = 'Kg' then
|
||
begin
|
||
FQty := FDDQty * FCPCDXS;
|
||
end;
|
||
if YValue = 'M' then
|
||
begin
|
||
FQty := FDDQty;
|
||
end;
|
||
end;
|
||
if mvalue = 'Y' then
|
||
begin
|
||
if YValue = 'M' then
|
||
begin
|
||
FQty := FDDQty / 0.9144;
|
||
end;
|
||
if YValue = 'Kg' then
|
||
begin
|
||
FQty := FDDQty * FCPCDXS / 0.9144;
|
||
end;
|
||
if YValue = 'Y' then
|
||
begin
|
||
FQty := FDDQty;
|
||
end;
|
||
end;
|
||
|
||
with CDS_1 do
|
||
begin
|
||
Edit;
|
||
FieldByName('PRTOrderQty').Value := FQty - FDKCQty;
|
||
Post;
|
||
end;
|
||
|
||
Tv1.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.v1PriceUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := 'PriceUnit';
|
||
flagname := '<27>۸<EFBFBD><DBB8><EFBFBD>λ';
|
||
if Trim(DParameters1) <> '<27><>Ȩ<EFBFBD><C8A8>' then
|
||
begin
|
||
TBAdd.Visible := False;
|
||
TBEdit.Visible := False;
|
||
TBDel.Visible := False;
|
||
end;
|
||
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.CDS_1.Edit;
|
||
Self.CDS_1.FieldByName('PriceUnit').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.YCLFactoryBtnUpClick(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
FWZ: Integer;
|
||
begin
|
||
fsj := Trim(TcxTextEdit(Sender).Hint);
|
||
FWZ := Pos('/', fsj);
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := Copy(fsj, 1, FWZ - 1);
|
||
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
||
if ShowModal = 1 then
|
||
begin
|
||
TcxTextEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.btnConSelClick(Sender: TObject);
|
||
var
|
||
FConMainId, FMPRTCode: string;
|
||
begin
|
||
try
|
||
frmTradeSalesContractSel := TfrmTradeSalesContractSel.Create(Application);
|
||
with frmTradeSalesContractSel do
|
||
begin
|
||
fconNo := self.ConNo.Text;
|
||
fC_Code := self.C_Code.Text;
|
||
if ShowModal = 1 then
|
||
begin
|
||
while CDS_1.locate('SSel', true, []) do
|
||
begin
|
||
if self.CDS_1.locate('ConSId', trim(CDS_1.Fieldbyname('ConSId').AsString), []) then
|
||
begin
|
||
CDS_1.Edit;
|
||
CDS_1.fieldbyname('SSel').value := false;
|
||
continue;
|
||
end;
|
||
|
||
self.BuyConNo.Text := Trim(frmTradeSalesContractSel.CDS_1.fieldbyname('BuyConNo').AsString);
|
||
self.CustName.Properties.LookupItems.Text := Trim(frmTradeSalesContractSel.CDS_1.fieldbyname('BuyNo').AsString);
|
||
self.CustName.Text := Trim(frmTradeSalesContractSel.CDS_1.fieldbyname('BuyName').AsString);
|
||
|
||
self.QtyNote.Text := Trim(frmTradeSalesContractSel.CDS_1.fieldbyname('QtyNote').AsString);
|
||
self.ShippingSample.Text := Trim(frmTradeSalesContractSel.CDS_1.fieldbyname('ShippingSample').AsString);
|
||
|
||
self.OurCoName.Properties.LookupItems.Text := Trim(frmTradeSalesContractSel.CDS_1.fieldbyname('Sellno').AsString);
|
||
self.OurCoName.Text := Trim(frmTradeSalesContractSel.CDS_1.fieldbyname('Sellname').AsString);
|
||
self.OrderNo.Text := Trim(frmTradeSalesContractSel.CDS_1.fieldbyname('ConNo').AsString);
|
||
self.ConNo.Text := Trim(frmTradeSalesContractSel.CDS_1.fieldbyname('ConNo').AsString);
|
||
self.C_Code.Text := trim(frmTradeSalesContractSel.CDS_1.Fieldbyname('C_Code').AsString);
|
||
self.C_Name.Text := trim(frmTradeSalesContractSel.CDS_1.Fieldbyname('C_Name').AsString);
|
||
self.C_Spec.Text := trim(frmTradeSalesContractSel.CDS_1.Fieldbyname('C_Spec').AsString);
|
||
self.C_Composition.Text := trim(frmTradeSalesContractSel.CDS_1.Fieldbyname('C_Composition').AsString);
|
||
self.C_Width.Text := trim(frmTradeSalesContractSel.CDS_1.Fieldbyname('C_Width').AsString);
|
||
self.C_GramWeight.Text := trim(frmTradeSalesContractSel.CDS_1.Fieldbyname('C_GramWeight').AsString);
|
||
self.OrdUnit.ItemIndex := OrdUnit.Properties.Items.IndexOf(trim(frmTradeSalesContractSel.CDS_1.fieldbyname('ConUnit').AsString));
|
||
with self.CDS_1 do
|
||
begin
|
||
Append;
|
||
FieldByName('SSel').Value := false;
|
||
Fieldbyname('SerialNo').value := trim(frmTradeSalesContractSel.CDS_1.Fieldbyname('SerialNo').AsString);
|
||
Fieldbyname('ConNo').value := trim(frmTradeSalesContractSel.CDS_1.Fieldbyname('ConNo').AsString);
|
||
Fieldbyname('ConMId').value := trim(frmTradeSalesContractSel.CDS_1.Fieldbyname('ConMId').AsString);
|
||
Fieldbyname('ConSId').value := trim(frmTradeSalesContractSel.CDS_1.Fieldbyname('ConSId').AsString);
|
||
Fieldbyname('C_ColorNo').value := trim(frmTradeSalesContractSel.CDS_1.Fieldbyname('C_ColorNo').AsString);
|
||
Fieldbyname('C_Color').value := trim(frmTradeSalesContractSel.CDS_1.Fieldbyname('C_Color').AsString);
|
||
Fieldbyname('C_Pattern').value := trim(frmTradeSalesContractSel.CDS_1.Fieldbyname('C_Pattern').AsString);
|
||
Fieldbyname('OrdQty').value := frmTradeSalesContractSel.CDS_1.Fieldbyname('ConQty').AsFloat;
|
||
Post;
|
||
end;
|
||
CDS_1.Edit;
|
||
CDS_1.fieldbyname('SSel').value := false;
|
||
end;
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmTradeSalesContractSel.Free;
|
||
end;
|
||
SetXH();
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.QtyNotePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
var
|
||
fsj: string;
|
||
FWZ: Integer;
|
||
begin
|
||
fsj := Trim(TcxButtonEdit(Sender).Hint);
|
||
FWZ := Pos('/', fsj);
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := Copy(fsj, 1, FWZ - 1);
|
||
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
||
if ShowModal = 1 then
|
||
begin
|
||
TcxButtonEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.SYRNameBtnUpClick(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
FWZ: Integer;
|
||
begin
|
||
fsj := Trim(TcxTextEdit(Sender).Hint);
|
||
FWZ := Pos('/', fsj);
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
fnote := True;
|
||
flag := Copy(fsj, 1, FWZ - 1);
|
||
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
||
if ShowModal = 1 then
|
||
begin
|
||
TcxTextEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.Tv1Column1PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue, FFieldName: string;
|
||
FGS, FGL, FOrdPiece: Double;
|
||
i: Integer;
|
||
begin
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
FOrdPiece := 0;
|
||
if Trim(mvalue) = '' then
|
||
begin
|
||
mvalue := '0';
|
||
end;
|
||
|
||
with CDS_1 do
|
||
begin
|
||
Edit;
|
||
FieldByName(FFieldName).Value := mvalue;
|
||
Post;
|
||
FGL := CDS_1.fieldbyname('C_Gl').AsFloat;
|
||
FGS := CDS_1.fieldbyname('C_GS').AsFloat;
|
||
FOrdPiece := CDS_1.fieldbyname('OrdPiece').AsFloat;
|
||
end;
|
||
|
||
if Trim(FFieldName) <> 'OrdPiece' then
|
||
begin
|
||
FOrdPiece := (FGS * FGL);
|
||
end;
|
||
|
||
with CDS_1 do
|
||
begin
|
||
Edit;
|
||
FieldByName('OrdPiece').Value := FOrdPiece;
|
||
Post;
|
||
end;
|
||
tv1.Controller.EditingController.ShowEdit();
|
||
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.Tv1Column4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
|
||
try
|
||
frmPictureUpload := TfrmPictureUpload.create(self);
|
||
with frmPictureUpload do
|
||
begin
|
||
fFlileFlag := self.fFlileFlag;
|
||
FDataId := Trim(self.CDS_1.fieldbyname('AttName').AsString);
|
||
FPictureName := Trim(self.CDS_1.fieldbyname('AttName').AsString);
|
||
FWidth := 450;
|
||
FHeight := 600;
|
||
FTFType := 'HX';
|
||
if showmodal = 1 then
|
||
begin
|
||
with self.CDS_1 do
|
||
begin
|
||
Edit;
|
||
Fieldbyname('AttName').Value := frmPictureUpload.FPictureName;
|
||
Post;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmPictureUpload.free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.TV1MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
InitImage2();
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.v1Column5PropertiesEditValueChanged(Sender: TObject);
|
||
var
|
||
mvalue, FFieldName: string;
|
||
begin
|
||
|
||
mvalue := TcxTextEdit(Sender).EditingText;
|
||
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
with CDS_1 do
|
||
begin
|
||
Edit;
|
||
FieldByName(FFieldName).Value := mvalue;
|
||
FieldByName('MGMainId').Value := '';
|
||
Post;
|
||
end;
|
||
Tv1.Controller.EditingController.ShowEdit();
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.HYTTBtnUpClick(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
FWZ: Integer;
|
||
begin
|
||
fsj := Trim(TcxTextEdit(Sender).Hint);
|
||
FWZ := Pos('/', fsj);
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := Copy(fsj, 1, FWZ - 1);
|
||
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
||
if ShowModal = 1 then
|
||
begin
|
||
TcxTextEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTradePlanProofInPut.KYTTBtnUpClick(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
FWZ: Integer;
|
||
begin
|
||
fsj := Trim(TcxTextEdit(Sender).Hint);
|
||
FWZ := Pos('/', fsj);
|
||
try
|
||
frmZDYHelp := TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag := Copy(fsj, 1, FWZ - 1);
|
||
flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ);
|
||
if Trim(flag) = 'OrdDefStr2' then
|
||
begin
|
||
V1Name.Caption := '<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
V1Note.Caption := 'Ӣ<><D3A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
fnote := True;
|
||
end;
|
||
if ShowModal = 1 then
|
||
begin
|
||
TcxTextEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
end.
|
||
|