972 lines
28 KiB
ObjectPascal
972 lines
28 KiB
ObjectPascal
unit U_TatPlanInPut;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
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, cxDropDownEdit,
|
||
StrUtils, cxPC, ShellAPI, cxCalendar, Math, cxLookAndFeels,
|
||
cxLookAndFeelPainters, dxBarBuiltInMenu, cxNavigator, dxSkinsCore,
|
||
dxSkinsDefaultPainters, dxDateRanges, U_BaseInput, System.ImageList,
|
||
Vcl.ImgList, Vcl.Menus;
|
||
|
||
type
|
||
TfrmTatPlanInPut = class(TfrmBaseInput)
|
||
ToolBar1: TToolBar;
|
||
TBSave: TToolButton;
|
||
TBClose: TToolButton;
|
||
ScrollBox1: TScrollBox;
|
||
Label1: TLabel;
|
||
Label2: TLabel;
|
||
OrdDate: TDateTimePicker;
|
||
Label3: TLabel;
|
||
Label14: TLabel;
|
||
ADOQueryTemp: TADOQuery;
|
||
Label18: TLabel;
|
||
Panel2: TPanel;
|
||
Label22: TLabel;
|
||
ADOQueryCmd: TADOQuery;
|
||
Label5: TLabel;
|
||
DlyDate: TDateTimePicker;
|
||
Label8: TLabel;
|
||
Label12: TLabel;
|
||
OrdPieceLen: TEdit;
|
||
OrdPiece: TEdit;
|
||
Label13: TLabel;
|
||
OrdQty: TEdit;
|
||
Label16: TLabel;
|
||
cxPageControl1: TcxPageControl;
|
||
CDS_2: TClientDataSet;
|
||
DS_1: TDataSource;
|
||
CDS_1: TClientDataSet;
|
||
DS_2: TDataSource;
|
||
Label26: TLabel;
|
||
Label31: TLabel;
|
||
OrdSNote: TRichEdit;
|
||
Label47: TLabel;
|
||
C_GramWeight: TEdit;
|
||
C_Width: TEdit;
|
||
C_Name: TEdit;
|
||
Label43: TLabel;
|
||
lbl2: TLabel;
|
||
CustName: TBtnEditC;
|
||
C_Code: TBtnEditC;
|
||
ConNo: TBtnEditC;
|
||
Saleser: TEdit;
|
||
OurCoName: TBtnEditC;
|
||
Label7: TLabel;
|
||
OrderNo: TEdit;
|
||
C_Spec: TRichEdit;
|
||
OrdType: TComboBox;
|
||
Label4: TLabel;
|
||
FtyCoName: TBtnEditC;
|
||
ToolButton8: TToolButton;
|
||
Label6: TLabel;
|
||
Label9: TLabel;
|
||
C_FinishLatitudeDensity: TEdit;
|
||
C_MachLatitudeDensity: TEdit;
|
||
Label10: TLabel;
|
||
C_FinishLongitudeDensity: TEdit;
|
||
Label11: TLabel;
|
||
C_YarnQty: TEdit;
|
||
Label15: TLabel;
|
||
Label17: TLabel;
|
||
C_LatitudeSpec: TEdit;
|
||
C_LongitudeSpec: TEdit;
|
||
Label19: TLabel;
|
||
C_ReedNo: TEdit;
|
||
cxGrid2: TcxGrid;
|
||
Tv2: TcxGridDBTableView;
|
||
v2Column10: TcxGridDBColumn;
|
||
cxGridDBColumn1: TcxGridDBColumn;
|
||
v2Column2: TcxGridDBColumn;
|
||
v2Column5: TcxGridDBColumn;
|
||
v2Column6: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
Panel1: TPanel;
|
||
cxPageControl2: TcxPageControl;
|
||
cxGrid1: TcxGrid;
|
||
TV1: TcxGridDBTableView;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
cxGridDBColumn4: TcxGridDBColumn;
|
||
cxGridDBColumn5: TcxGridDBColumn;
|
||
cxGridDBColumn7: TcxGridDBColumn;
|
||
cxGridDBColumn8: TcxGridDBColumn;
|
||
cxGridLevel2: TcxGridLevel;
|
||
Panel3: TPanel;
|
||
Panel4: TPanel;
|
||
ToolBar2: TToolBar;
|
||
ToolButton1: TToolButton;
|
||
ToolButton2: TToolButton;
|
||
Label20: TLabel;
|
||
Panel5: TPanel;
|
||
Panel6: TPanel;
|
||
Label21: TLabel;
|
||
ToolBar3: TToolBar;
|
||
ToolButton3: TToolButton;
|
||
ToolButton4: TToolButton;
|
||
TV1Column1: TcxGridDBColumn;
|
||
Tv2Column1: TcxGridDBColumn;
|
||
TV1Column2: TcxGridDBColumn;
|
||
Tv2Column2: TcxGridDBColumn;
|
||
ToolButton5: TToolButton;
|
||
ToolButton6: TToolButton;
|
||
Label23: TLabel;
|
||
C_MachLongitudeDensity: TEdit;
|
||
Label24: TLabel;
|
||
C_ReedQty1: TEdit;
|
||
C_ReedQty2: TEdit;
|
||
Label25: TLabel;
|
||
Label27: TLabel;
|
||
C_YarnQty2: TEdit;
|
||
C_YarnQty1: TEdit;
|
||
Label28: TLabel;
|
||
Label29: TLabel;
|
||
C_Width2: TEdit;
|
||
C_Width1: TEdit;
|
||
Label30: TLabel;
|
||
Label32: TLabel;
|
||
C_FinishGramWeight: TEdit;
|
||
Label33: TLabel;
|
||
C_FinishWidth: TEdit;
|
||
Label34: TLabel;
|
||
WB_Code: TBtnEditC;
|
||
WB_Spec: TEdit;
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBSaveClick(Sender: TObject);
|
||
procedure cxGridDBColumn1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure v2Column11PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
procedure OrdPieceLenChange(Sender: TObject);
|
||
procedure OrdPieceChange(Sender: TObject);
|
||
procedure C_CodeKeyPress(Sender: TObject; var Key: Char);
|
||
procedure ConNoKeyPress(Sender: TObject; var Key: Char);
|
||
procedure MCTypeBtnUpClick(Sender: TObject);
|
||
procedure CustNameBtnUpClick(Sender: TObject);
|
||
procedure C_CodeBtnUpClick(Sender: TObject);
|
||
procedure ConNoBtnUpClick(Sender: TObject);
|
||
procedure CustNameBtnDnClick(Sender: TObject);
|
||
procedure OurCoNameBtnUpClick(Sender: TObject);
|
||
procedure FtyCoNameBtnUpClick(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure ToolButton4Click(Sender: TObject);
|
||
procedure ToolButton5Click(Sender: TObject);
|
||
procedure ToolButton6Click(Sender: TObject);
|
||
procedure cxGridDBColumn4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
private
|
||
FXS, FGridFlag: Integer;
|
||
procedure InitData();
|
||
procedure CALCYarnQty();
|
||
function SaveData(): Boolean;
|
||
|
||
procedure InitClothYarn(MC_Code: string);
|
||
{ Private declarations }
|
||
public
|
||
PState, FCopyInt: Integer;
|
||
FConNo, FMainId, FSubId: string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmTatPlanInPut: TfrmTatPlanInPut;
|
||
newh: hwnd;
|
||
|
||
implementation
|
||
|
||
uses
|
||
U_DataLink, U_ZDYHelp, U_RTFun, U_TatClothInfoSel, U_CompanySel, U_YarnInfoSel;
|
||
|
||
{$R *.dfm}
|
||
procedure TfrmTatPlanInPut.InitClothYarn(MC_Code: string);
|
||
begin
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.* from Bs_Cloth_Info A');
|
||
sql.Add(' where A.C_Code=''' + Trim(MC_Code) + '''');
|
||
Open;
|
||
end;
|
||
WB_Code.Text := ADOQueryTemp.FieldByName('WB_Code').AsString;
|
||
WB_Spec.Text := ADOQueryTemp.FieldByName('WB_Spec').AsString;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,MainId=cast('''' as varchar(30)),SubId=cast('''' as varchar(30)) from BS_Cloth_Yarn A inner join Bs_Cloth_Info B on A.BCIID=B.BCIID');
|
||
sql.Add(' where A.YRType=''<27><>˿'' and B.C_Code=''' + Trim(MC_Code) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryTemp, CDS_1);
|
||
SInitCDSData(ADOQueryTemp, CDS_1);
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.*,MainId=cast('''' as varchar(30)),SubId=cast('''' as varchar(30)) from BS_Cloth_Yarn A inner join Bs_Cloth_Info B on A.BCIID=B.BCIID');
|
||
sql.Add(' where A.YRType=''γ˿'' and B.C_Code=''' + Trim(MC_Code) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryTemp, CDS_2);
|
||
SInitCDSData(ADOQueryTemp, CDS_2);
|
||
|
||
CALCYarnQty();
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.CALCYarnQty();
|
||
var
|
||
MYarnQty, MOrdQty, MWidth, MMachLatitudeDensity: Double;
|
||
begin
|
||
MYarnQty := STRTOFLOATDEF(C_YarnQty.Text, 0);
|
||
MOrdQty := STRTOFLOATDEF(OrdQty.Text, 0);
|
||
MWidth := STRTOFLOATDEF(StringReplace(C_Width.Text, 'CM', '', [rfReplaceAll, rfIgnoreCase]), 0);
|
||
MMachLatitudeDensity := STRTOFLOATDEF(C_MachLatitudeDensity.Text, 0);
|
||
with CDS_1 do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
Edit;
|
||
FieldByName('Y_Qty').Value := MYarnQty * MOrdQty * FieldByName('Y_Ratio').AsFloat / 100 / 9000 * FieldByName('Denier').AsFloat / 1000;
|
||
Next;
|
||
end;
|
||
EnableControls;
|
||
end;
|
||
|
||
with CDS_2 do
|
||
begin
|
||
DisableControls;
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
Edit;
|
||
FieldByName('Y_Qty').Value := MMachLatitudeDensity * MOrdQty * MWidth * FieldByName('Y_Ratio').AsFloat / 100 / 9000 * FieldByName('Denier').AsFloat / 1000;
|
||
Next;
|
||
end;
|
||
EnableControls;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.TBCloseClick(Sender: TObject);
|
||
begin
|
||
ModalResult := 1;
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.InitData();
|
||
var
|
||
PBNO, PBFlag: string;
|
||
begin
|
||
if PState = 1 then
|
||
begin
|
||
ConNo.enabled := false;
|
||
end;
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from Tat_Plan_Main A where A.MainId=''' + Trim(FMainId) + '''');
|
||
Open;
|
||
end;
|
||
SCSHData(ADOQueryTemp, ScrollBox1, 0);
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from Tat_Plan_Sub A where A.MainId=''' + Trim(FMainId) + '''');
|
||
Open;
|
||
end;
|
||
SCSHData(ADOQueryTemp, ScrollBox1, 2);
|
||
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.* from Tat_Plan_Yarn A ');
|
||
sql.Add(' where YRType=''<27><>˿'' and A.MainId=''' + Trim(FMainId) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryTemp, CDS_1);
|
||
SInitCDSData(ADOQueryTemp, CDS_1);
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select A.* from Tat_Plan_Yarn A ');
|
||
sql.Add(' where YRType=''γ˿'' and A.MainId=''' + Trim(FMainId) + '''');
|
||
Open;
|
||
end;
|
||
SCreateCDS(ADOQueryTemp, CDS_2);
|
||
SInitCDSData(ADOQueryTemp, CDS_2);
|
||
if FCopyInt = 1 then
|
||
begin
|
||
FConNo := '';
|
||
FMainId := '';
|
||
FSubId := '';
|
||
OrderNo.Text := '';
|
||
ClearCDSColumn(CDS_1, ['MainId', 'SubId', 'YRId']);
|
||
ClearCDSColumn(CDS_2, ['MainId', 'SubId', 'YRId']);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.FormShow(Sender: TObject);
|
||
begin
|
||
InitData();
|
||
end;
|
||
|
||
function TfrmTatPlanInPut.SaveData(): Boolean;
|
||
var
|
||
maxno, maxsubno, maxpbno, maxpzno, maxsjno: string;
|
||
begin
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
if Trim(FMainId) = '' then
|
||
begin
|
||
if GetLSNo(ADOQueryCmd, maxno, 'SZ', 'Tat_Plan_Main', 4, 1) = False then
|
||
raise Exception.Create('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>');
|
||
|
||
OrderNo.Text := maxno;
|
||
end
|
||
else
|
||
begin
|
||
maxno := Trim(FMainId);
|
||
end;
|
||
////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //////////////////////////
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from Tat_Plan_Main where MainId=''' + Trim(FMainId) + '''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if Trim(FMainId) = '' then
|
||
begin
|
||
Append;
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
FieldByName('Editer').Value := Trim(DName);
|
||
FieldByName('EditTime').Value := SGetServerDateTime(ADOQueryTemp);
|
||
end;
|
||
FieldByName('MainId').Value := Trim(maxno);
|
||
RTSetsavedata(ADOQueryCmd, 'Tat_Plan_Main', ScrollBox1, 0);
|
||
Post;
|
||
end;
|
||
////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //////////////////////////
|
||
///
|
||
////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD> //////////////////////////
|
||
if Trim(FSubId) = '' then
|
||
begin
|
||
if GetLSNo(ADOQueryTemp, maxsubno, 'SZS', 'Tat_Plan_Sub', 4, 1) = False then
|
||
raise Exception.Create('ȡ<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>');
|
||
|
||
end
|
||
else
|
||
begin
|
||
maxsubno := Trim(FSubId);
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from Tat_Plan_Sub where ');
|
||
sql.Add(' SubId=''' + Trim(maxsubno) + '''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if Trim(FSubId) = '' then
|
||
Append
|
||
else
|
||
Edit;
|
||
FieldByName('MainId').Value := Trim(maxno);
|
||
FieldByName('SubId').Value := Trim(maxsubno);
|
||
RTSetsavedata(ADOQueryCmd, 'Tat_Plan_Sub', ScrollBox1, 2);
|
||
Post;
|
||
end;
|
||
////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD> //////////////////////////
|
||
|
||
////////////////////////// <20><><EFBFBD>澭˿<E6BEAD><CBBF><EFBFBD>ȱ<EFBFBD> //////////////////////////
|
||
with CDS_1 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(CDS_1.fieldbyname('YRId').AsString) = '' then
|
||
begin
|
||
if GetLSNo(ADOQueryTemp, maxpbno, 'RJ', 'Tat_Plan_Yarn', 4, 1) = False then
|
||
raise Exception.Create('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>');
|
||
|
||
end
|
||
else
|
||
begin
|
||
maxpbno := Trim(CDS_1.fieldbyname('YRId').AsString);
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from Tat_Plan_Yarn where ');
|
||
sql.Add(' YRId=''' + Trim(maxpbno) + '''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if Trim(CDS_1.fieldbyname('YRId').AsString) = '' then
|
||
begin
|
||
Append;
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('FillTime').Value := SGetServerDateTime(ADOQueryTemp);
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
FieldByName('Editer').Value := Trim(DName);
|
||
FieldByName('EditTime').Value := SGetServerDateTime(ADOQueryTemp);
|
||
end;
|
||
FieldByName('YRType').Value := '<27><>˿';
|
||
FieldByName('MainId').Value := Trim(maxno);
|
||
FieldByName('SubId').Value := Trim(maxsubno);
|
||
FieldByName('YRId').Value := Trim(maxpbno);
|
||
RTSetSaveDataCDS(ADOQueryCmd, Tv2, CDS_1, 'Tat_Plan_Yarn', 0);
|
||
Post;
|
||
end;
|
||
CDS_1.Edit;
|
||
CDS_1.FieldByName('SubId').Value := Trim(maxsubno);
|
||
CDS_1.FieldByName('MainId').Value := Trim(maxno);
|
||
CDS_1.FieldByName('YRId').Value := Trim(maxpbno);
|
||
|
||
Next;
|
||
end;
|
||
end;
|
||
////////////////////////// <20><><EFBFBD>澭˿<E6BEAD><CBBF><EFBFBD>ȱ<EFBFBD> //////////////////////////
|
||
//////////////////////
|
||
////////////////////////// <20><><EFBFBD><EFBFBD>γ˿<CEB3><CBBF><EFBFBD>ȱ<EFBFBD> //////////////////////////
|
||
with CDS_2 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(CDS_2.fieldbyname('YRId').AsString) = '' then
|
||
begin
|
||
if GetLSNo(ADOQueryTemp, maxpbno, 'RJ', 'Tat_Plan_Yarn', 4, 1) = False then
|
||
raise Exception.Create('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>');
|
||
|
||
end
|
||
else
|
||
begin
|
||
maxpbno := Trim(CDS_2.fieldbyname('YRId').AsString);
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from Tat_Plan_Yarn where ');
|
||
sql.Add(' YRId=''' + Trim(maxpbno) + '''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if Trim(CDS_2.fieldbyname('YRId').AsString) = '' then
|
||
begin
|
||
Append;
|
||
FieldByName('Filler').Value := Trim(DName);
|
||
FieldByName('FillTime').Value := SGetServerDateTime(ADOQueryTemp);
|
||
end
|
||
else
|
||
begin
|
||
Edit;
|
||
FieldByName('Editer').Value := Trim(DName);
|
||
FieldByName('EditTime').Value := SGetServerDateTime(ADOQueryTemp);
|
||
end;
|
||
FieldByName('YRType').Value := 'γ˿';
|
||
FieldByName('MainId').Value := Trim(maxno);
|
||
FieldByName('SubId').Value := Trim(maxsubno);
|
||
FieldByName('YRId').Value := Trim(maxpbno);
|
||
RTSetSaveDataCDS(ADOQueryCmd, Tv2, CDS_2, 'Tat_Plan_Yarn', 0);
|
||
Post;
|
||
end;
|
||
CDS_2.Edit;
|
||
CDS_2.FieldByName('SubId').Value := Trim(maxsubno);
|
||
CDS_2.FieldByName('MainId').Value := Trim(maxno);
|
||
CDS_2.FieldByName('YRId').Value := Trim(maxpbno);
|
||
|
||
Next;
|
||
end;
|
||
end;
|
||
////////////////////////// <20><><EFBFBD><EFBFBD>γ˿<CEB3><CBBF><EFBFBD>ȱ<EFBFBD> //////////////////////////
|
||
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
FMainId := Trim(maxno);
|
||
FSubId := Trim(maxsubno);
|
||
Result := True;
|
||
except
|
||
Result := False;
|
||
CDS_1.EnableControls;
|
||
CDS_2.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
application.MessageBox(PChar(Exception(ExceptObject).Message), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
|
||
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.TBSaveClick(Sender: TObject);
|
||
var
|
||
FReal: Double;
|
||
maxConNo: string;
|
||
begin
|
||
OrdDate.SetFocus;
|
||
CALCYarnQty();
|
||
|
||
if Trim(CustName.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Trim(C_Name.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27><>Ʒ<EFBFBD><C6B7><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Trim(C_Code.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27><>Ʒ<EFBFBD><C6B7><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if Trim(OrdQty.Text) = '' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Trim(OrdPieceLen.Text) = '' then
|
||
begin
|
||
Application.MessageBox('ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if Trim(OrdPiece.Text) = '' then
|
||
begin
|
||
Application.MessageBox('ƥ<><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if TryStrToFloat(OrdQty.Text, FReal) = False then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if TryStrToFloat(OrdPiecelen.Text, FReal) = False then
|
||
begin
|
||
Application.MessageBox('ƥ<><C6A5><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
if TryStrToFloat(OrdPiece.Text, FReal) = False then
|
||
begin
|
||
Application.MessageBox('ƥ<><C6A5><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
|
||
Exit;
|
||
end;
|
||
|
||
if SaveData() then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>', '<27><>ʾ', 0);
|
||
ModalResult := 1;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
|
||
try
|
||
frmYarnInfoSel := TfrmYarnInfoSel.Create(Application);
|
||
with frmYarnInfoSel do
|
||
begin
|
||
if ShowModal = 1 then
|
||
begin
|
||
with self.CDS_1 do
|
||
begin
|
||
Append;
|
||
FieldByName('Brand').Value := frmYarnInfoSel.CDS_1.fieldbyname('Brand').Value;
|
||
FieldByName('Y_Code').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Code').Value;
|
||
FieldByName('Y_Name').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Name').Value;
|
||
FieldByName('Y_Spec').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Spec').Value;
|
||
FieldByName('Y_Color').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Color').Value;
|
||
FieldByName('Denier').Value := frmYarnInfoSel.CDS_1.fieldbyname('Denier').Value;
|
||
FieldByName('Y_Ratio').Value := 0;
|
||
Post;
|
||
end;
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmYarnInfoSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
if CDS_1.IsEmpty then
|
||
Exit;
|
||
if Trim(CDS_1.fieldbyname('YRId').AsString) <> '' then
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Tat_Plan_Yarn where YRId=''' + Trim(CDS_1.fieldbyname('YRId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
CDS_1.Delete;
|
||
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
|
||
try
|
||
frmYarnInfoSel := TfrmYarnInfoSel.Create(Application);
|
||
with frmYarnInfoSel do
|
||
begin
|
||
if ShowModal = 1 then
|
||
begin
|
||
with self.CDS_2 do
|
||
begin
|
||
Append;
|
||
FieldByName('Brand').Value := frmYarnInfoSel.CDS_1.fieldbyname('Brand').Value;
|
||
FieldByName('Y_Code').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Code').Value;
|
||
FieldByName('Y_Name').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Name').Value;
|
||
FieldByName('Y_Spec').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Spec').Value;
|
||
FieldByName('Y_Color').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Color').Value;
|
||
FieldByName('Denier').Value := frmYarnInfoSel.CDS_1.fieldbyname('Denier').Value;
|
||
FieldByName('Y_Ratio').Value := 0;
|
||
Post;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmYarnInfoSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.ToolButton4Click(Sender: TObject);
|
||
begin
|
||
if CDS_2.IsEmpty then
|
||
Exit;
|
||
if Trim(CDS_2.fieldbyname('YRId').AsString) <> '' then
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
||
Exit;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete Tat_Plan_Yarn where YRId=''' + Trim(CDS_2.fieldbyname('YRId').AsString) + '''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
CDS_2.Delete;
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.ToolButton5Click(Sender: TObject);
|
||
begin
|
||
OrdDate.SetFocus;
|
||
CALCYarnQty();
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.ToolButton6Click(Sender: TObject);
|
||
begin
|
||
OrdDate.SetFocus;
|
||
CALCYarnQty();
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.cxGridDBColumn1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmYarnInfoSel := TfrmYarnInfoSel.Create(Application);
|
||
with frmYarnInfoSel do
|
||
begin
|
||
if ShowModal = 1 then
|
||
begin
|
||
with self.CDS_2 do
|
||
begin
|
||
Edit;
|
||
FieldByName('Brand').Value := frmYarnInfoSel.CDS_1.fieldbyname('Brand').Value;
|
||
FieldByName('Y_Code').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Code').Value;
|
||
FieldByName('Y_Name').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Name').Value;
|
||
FieldByName('Y_Spec').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Spec').Value;
|
||
FieldByName('Y_Color').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Color').Value;
|
||
FieldByName('Denier').Value := frmYarnInfoSel.CDS_1.fieldbyname('Denier').Value;
|
||
Post;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmYarnInfoSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.cxGridDBColumn4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmYarnInfoSel := TfrmYarnInfoSel.Create(Application);
|
||
with frmYarnInfoSel do
|
||
begin
|
||
if ShowModal = 1 then
|
||
begin
|
||
with self.CDS_1 do
|
||
begin
|
||
Append;
|
||
FieldByName('Brand').Value := frmYarnInfoSel.CDS_1.fieldbyname('Brand').Value;
|
||
FieldByName('Y_Code').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Code').Value;
|
||
FieldByName('Y_Name').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Name').Value;
|
||
FieldByName('Y_Spec').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Spec').Value;
|
||
FieldByName('Y_Color').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Color').Value;
|
||
FieldByName('Denier').Value := frmYarnInfoSel.CDS_1.fieldbyname('Denier').Value;
|
||
|
||
Post;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmYarnInfoSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.v2Column11PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmCompanySel := TfrmCompanySel.Create(Application);
|
||
with frmCompanySel do
|
||
begin
|
||
|
||
if ShowModal = 1 then
|
||
begin
|
||
with Self.CDS_1 do
|
||
begin
|
||
Edit;
|
||
FieldByName('GYSName').Value := Trim(CDS_1.fieldbyname('CoName').AsString);
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmCompanySel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.OrdPieceLenChange(Sender: TObject);
|
||
var
|
||
FOrdQty, FOrdPieceLen: Double;
|
||
begin
|
||
FOrdQty := StrToFloatDef(OrdQty.Text, 0);
|
||
FOrdPieceLen := StrToFloatDef(OrdPieceLen.Text, 0);
|
||
if FOrdPieceLen > 0 then
|
||
OrdPiece.Text := IntToStr(Ceil(FOrdQty / FOrdPieceLen));
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.OurCoNameBtnUpClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmCompanySel := TfrmCompanySel.Create(Application);
|
||
with frmCompanySel do
|
||
begin
|
||
FCoType := '<27><>˾';
|
||
if ShowModal = 1 then
|
||
begin
|
||
OurCoName.TxtCode := Trim(CDS_1.fieldbyname('CoCode').AsString);
|
||
OurCoName.Text := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
|
||
FtyCoName.TxtCode := Trim(CDS_1.fieldbyname('CoCode').AsString);
|
||
FtyCoName.Text := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmCompanySel.Free;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.OrdPieceChange(Sender: TObject);
|
||
var
|
||
FOrdQty, FOrdPieceLen, FOrdPiece: Double;
|
||
begin
|
||
FOrdPieceLen := StrToFloatDef(OrdPieceLen.Text, 0);
|
||
FOrdPiece := StrToFloatDef(OrdPiece.Text, 0);
|
||
if FOrdPiece > 0 then
|
||
OrdQty.Text := FloatToStr(FOrdPieceLen * FOrdPiece)
|
||
else
|
||
OrdQty.Text := '0';
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.C_CodeKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
Key := #0;
|
||
SelectNext(ActiveControl as TWinControl, True, True);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.MCTypeBtnUpClick(Sender: TObject);
|
||
var
|
||
fsj: string;
|
||
FWZ: Integer;
|
||
begin
|
||
fsj := Trim(TBtnEditC(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
|
||
TBtnEditC(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.ConNoKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key = #13 then
|
||
begin
|
||
Key := #0;
|
||
SelectNext(ActiveControl as TWinControl, True, True);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.FtyCoNameBtnUpClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmCompanySel := TfrmCompanySel.Create(Application);
|
||
with frmCompanySel do
|
||
begin
|
||
FCoType := '<27><>Ӧ<EFBFBD><D3A6>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
FtyCoName.TxtCode := Trim(CDS_1.fieldbyname('CoCode').AsString);
|
||
FtyCoName.Text := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmCompanySel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.ConNoBtnUpClick(Sender: TObject);
|
||
begin
|
||
// try
|
||
// frmContractListNXSel := TfrmContractListNXSel.Create(Application);
|
||
// with frmContractListNXSel do
|
||
// begin
|
||
// if ShowModal = 1 then
|
||
// begin
|
||
// self.ConNo.Text := frmContractListNXSel.Order_Main.fieldbyname('ConNo').AsString; //<2F><>ͬ<EFBFBD><CDAC>
|
||
// self.Custname.Text := frmContractListNXSel.Order_Main.fieldbyname('CustomerNoName').AsString; //<2F>ͻ<EFBFBD>
|
||
// self.YWY.Text := frmContractListNXSel.Order_Main.fieldbyname('ConPerson1').AsString; //<2F>µ<EFBFBD>Ա
|
||
// self.KHConNo.Text := frmContractListNXSel.Order_Main.fieldbyname('KHConNo').AsString; //<2F>ͻ<EFBFBD>
|
||
// self.ConMainId.Text := frmContractListNXSel.ClientDataSet2.fieldbyname('MainId').AsString; //ConMainId
|
||
// self.ConSubId.Text := frmContractListNXSel.ClientDataSet2.fieldbyname('SubID').AsString; //ConSubId
|
||
//
|
||
// self.C_Code.Text := frmContractListNXSel.ClientDataSet2.fieldbyname('PrtCode').AsString; //<2F><><EFBFBD><EFBFBD>
|
||
// self.C_Name.Text := frmContractListNXSel.ClientDataSet2.fieldbyname('PrtCodeName').AsString; //Ʒ<><C6B7>
|
||
// self.C_Spec.Text := frmContractListNXSel.ClientDataSet2.fieldbyname('prtspec').AsString; //<2F><><EFBFBD><EFBFBD>
|
||
// self.C_Color.Text := frmContractListNXSel.ClientDataSet2.fieldbyname('PRTColor').AsString; //<2F><>ɫ
|
||
// self.MF.Text := frmContractListNXSel.ClientDataSet2.fieldbyname('prtmf').AsString; //<2F>ŷ<EFBFBD>
|
||
// self.KZ.Text := frmContractListNXSel.ClientDataSet2.fieldbyname('prtkz').AsString; //<2F><><EFBFBD><EFBFBD>
|
||
//
|
||
//
|
||
// self.OrdPiece.Text := frmContractListNXSel.ClientDataSet2.fieldbyname('pishu').AsString; //ƥ<><C6A5>
|
||
// self.OrdPieceWeight.Text := frmContractListNXSel.ClientDataSet2.fieldbyname('OrdTare').AsString; //ƥ<><C6A5>
|
||
// self.OrdQty.Text := frmContractListNXSel.ClientDataSet2.fieldbyname('PRTOrderQty').AsString; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||
// end;
|
||
// end;
|
||
// finally
|
||
// frmContractListNXSel.Free;
|
||
// end;
|
||
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.C_CodeBtnUpClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmTatClothInfoSel := TfrmTatClothInfoSel.Create(Application);
|
||
with frmTatClothInfoSel do
|
||
begin
|
||
if ShowModal = 1 then
|
||
begin
|
||
Self.C_Code.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_Code').AsString;
|
||
Self.C_Name.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_Name').AsString;
|
||
Self.C_Width.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_Width').AsString;
|
||
Self.C_GramWeight.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_GramWeight').AsString;
|
||
|
||
Self.C_MachLatitudeDensity.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_MachLatitudeDensity').AsString;
|
||
|
||
Self.C_FinishLatitudeDensity.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_FinishLatitudeDensity').AsString;
|
||
Self.C_FinishLongitudeDensity.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_FinishLongitudeDensity').AsString;
|
||
|
||
Self.C_LatitudeSpec.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_LatitudeSpec').AsString;
|
||
Self.C_LongitudeSpec.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_LongitudeSpec').AsString;
|
||
|
||
Self.C_YarnQty.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_YarnQty').AsString;
|
||
Self.C_ReedNo.Text := frmTatClothInfoSel.CDS_1.fieldbyname('C_ReedNo').AsString;
|
||
|
||
InitClothYarn(frmTatClothInfoSel.CDS_1.fieldbyname('C_Code').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmTatClothInfoSel.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.CustNameBtnDnClick(Sender: TObject);
|
||
begin
|
||
TBtnEditC(Sender).TxtCode := '';
|
||
TBtnEditC(Sender).Text := '';
|
||
end;
|
||
|
||
procedure TfrmTatPlanInPut.CustNameBtnUpClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmCompanySel := TfrmCompanySel.Create(Application);
|
||
with frmCompanySel do
|
||
begin
|
||
FCoType := '<27>ͻ<EFBFBD>';
|
||
if ShowModal = 1 then
|
||
begin
|
||
CustName.TxtCode := Trim(CDS_1.fieldbyname('CoCode').AsString);
|
||
CustName.Text := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmCompanySel.Free;
|
||
end;
|
||
|
||
end;
|
||
|
||
end.
|
||
|