RTFormwork/项目代码/RTBasicsV1/D01针织生产计划/U_KnitPlanInPut.pas
“ddf” b5fbedfd26 1
2024-08-08 16:35:41 +08:00

1442 lines
44 KiB
ObjectPascal
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_KnitPlanInPut;
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, dxSkinWXI, dxScrollbarAnnotations, dxCore, cxDateUtils;
type
TfrmKnitPlanInPut = class(TfrmBaseInput)
ToolBar1: TToolBar;
TBSave: TToolButton;
TBClose: TToolButton;
ScrollBox1: TScrollBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label11: TLabel;
Label14: TLabel;
ADOQueryTemp: TADOQuery;
Label18: TLabel;
Panel2: TPanel;
DataSource2: TDataSource;
CDS_YuanLiao: TClientDataSet;
Label22: TLabel;
ADOQueryCmd: TADOQuery;
Label5: TLabel;
Label8: TLabel;
Label12: TLabel;
OrdPieceWeight: TcxTextEdit;
OrdPiece: TcxTextEdit;
Label13: TLabel;
OrdQty: TcxTextEdit;
Label16: TLabel;
cxPageControl1: TcxPageControl;
cxTabSheet1: TcxTabSheet;
cxTabSheet2: TcxTabSheet;
cxGrid2: TcxGrid;
Tv2: TcxGridDBTableView;
cxGridDBColumn1: TcxGridDBColumn;
v2Column2: TcxGridDBColumn;
v2Column4: TcxGridDBColumn;
cxGridDBColumn6: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
Panel1: TPanel;
Panel3: TPanel;
ClientDataSet5: TClientDataSet;
DataSource3: TDataSource;
ClientDataSet3: TClientDataSet;
DataSource5: TDataSource;
Label26: TLabel;
v2Column1: TcxGridDBColumn;
v2Column3: TcxGridDBColumn;
v2Column5: TcxGridDBColumn;
v2Column6: TcxGridDBColumn;
Label31: TLabel;
OrdPieceWeightRange: TcxTextEdit;
Label37: TLabel;
OrdSNote: TRichEdit;
v2Column7: TcxGridDBColumn;
v2Column8: TcxGridDBColumn;
Label41: TLabel;
v2Column10: TcxGridDBColumn;
Label47: TLabel;
Label33: TLabel;
Label54: TLabel;
C_GramWeight: TcxTextEdit;
C_Width: TcxTextEdit;
C_Name: TcxTextEdit;
Label43: TLabel;
Label59: TLabel;
YarnArrangement: TRichEdit;
cxGrid5: TcxGrid;
TV5: TcxGridDBTableView;
cxGridDBColumn32: TcxGridDBColumn;
cxGridDBColumn34: TcxGridDBColumn;
cxGridDBColumn35: TcxGridDBColumn;
cxGridDBColumn36: TcxGridDBColumn;
cxGridDBColumn37: TcxGridDBColumn;
cxGridDBColumn38: TcxGridDBColumn;
cxGridDBColumn39: TcxGridDBColumn;
cxGridDBColumn40: TcxGridDBColumn;
cxGridDBColumn43: TcxGridDBColumn;
cxGridDBColumn44: TcxGridDBColumn;
cxGridDBColumn45: TcxGridDBColumn;
cxGridDBColumn46: TcxGridDBColumn;
cxGridDBColumn47: TcxGridDBColumn;
cxGridDBColumn48: TcxGridDBColumn;
cxGridDBColumn49: TcxGridDBColumn;
cxGridDBColumn50: TcxGridDBColumn;
cxGridDBColumn51: TcxGridDBColumn;
cxGridDBColumn52: TcxGridDBColumn;
cxGridDBColumn53: TcxGridDBColumn;
cxGridDBColumn54: TcxGridDBColumn;
cxGridDBColumn55: TcxGridDBColumn;
cxGridDBColumn56: TcxGridDBColumn;
cxGridDBColumn57: TcxGridDBColumn;
cxGridDBColumn58: TcxGridDBColumn;
cxGridDBColumn59: TcxGridDBColumn;
cxGridDBColumn60: TcxGridDBColumn;
cxGridDBColumn61: TcxGridDBColumn;
cxGridDBColumn62: TcxGridDBColumn;
cxGridDBColumn63: TcxGridDBColumn;
cxGridDBColumn64: TcxGridDBColumn;
cxGridDBColumn65: TcxGridDBColumn;
cxGridDBColumn66: TcxGridDBColumn;
cxGridDBColumn67: TcxGridDBColumn;
cxGridDBColumn68: TcxGridDBColumn;
cxGridDBColumn69: TcxGridDBColumn;
cxGridDBColumn70: TcxGridDBColumn;
cxGridDBColumn71: TcxGridDBColumn;
cxGridDBColumn72: TcxGridDBColumn;
cxGridDBColumn73: TcxGridDBColumn;
cxGridDBColumn74: TcxGridDBColumn;
cxGridDBColumn75: TcxGridDBColumn;
cxGridDBColumn76: TcxGridDBColumn;
cxGridDBColumn77: TcxGridDBColumn;
cxGridDBColumn78: TcxGridDBColumn;
cxGridDBColumn79: TcxGridDBColumn;
cxGridDBColumn80: TcxGridDBColumn;
cxGridDBColumn81: TcxGridDBColumn;
cxGridDBColumn82: TcxGridDBColumn;
cxGridDBColumn83: TcxGridDBColumn;
cxGridDBColumn84: TcxGridDBColumn;
cxGridDBColumn85: TcxGridDBColumn;
cxGridDBColumn86: TcxGridDBColumn;
cxGridDBColumn87: TcxGridDBColumn;
cxGridDBColumn88: TcxGridDBColumn;
cxGridDBColumn89: TcxGridDBColumn;
cxGridDBColumn90: TcxGridDBColumn;
cxGridDBColumn91: TcxGridDBColumn;
cxGridDBColumn92: TcxGridDBColumn;
cxGridDBColumn93: TcxGridDBColumn;
cxGridDBColumn94: TcxGridDBColumn;
cxGridDBColumn95: TcxGridDBColumn;
cxGridDBColumn96: TcxGridDBColumn;
cxGridDBColumn97: TcxGridDBColumn;
cxGridDBColumn98: TcxGridDBColumn;
cxGridDBColumn99: TcxGridDBColumn;
cxGridDBColumn100: TcxGridDBColumn;
cxGridDBColumn101: TcxGridDBColumn;
cxGridDBColumn102: TcxGridDBColumn;
cxGridDBColumn103: TcxGridDBColumn;
cxGridDBColumn104: TcxGridDBColumn;
cxGridDBColumn105: TcxGridDBColumn;
cxGridDBColumn106: TcxGridDBColumn;
cxGridDBColumn107: TcxGridDBColumn;
cxGridDBColumn108: TcxGridDBColumn;
cxGridDBColumn109: TcxGridDBColumn;
cxGridDBColumn110: TcxGridDBColumn;
cxGridDBColumn111: TcxGridDBColumn;
cxGridDBColumn112: TcxGridDBColumn;
cxGridDBColumn113: TcxGridDBColumn;
cxGridDBColumn114: TcxGridDBColumn;
cxGridDBColumn115: TcxGridDBColumn;
cxGridDBColumn116: TcxGridDBColumn;
cxGridDBColumn117: TcxGridDBColumn;
cxGridDBColumn118: TcxGridDBColumn;
cxGridDBColumn119: TcxGridDBColumn;
cxGridLevel6: TcxGridLevel;
cxGrid3: TcxGrid;
Tv3: TcxGridDBTableView;
v3Column37: TcxGridDBColumn;
v3Column38: TcxGridDBColumn;
v3Column1: TcxGridDBColumn;
v3Column2: TcxGridDBColumn;
v3Column3: TcxGridDBColumn;
v3Column4: TcxGridDBColumn;
v3Column5: TcxGridDBColumn;
v3Column6: TcxGridDBColumn;
v3Column7: TcxGridDBColumn;
v3Column8: TcxGridDBColumn;
v3Column9: TcxGridDBColumn;
v3Column10: TcxGridDBColumn;
v3Column11: TcxGridDBColumn;
v3Column12: TcxGridDBColumn;
v3Column13: TcxGridDBColumn;
v3Column14: TcxGridDBColumn;
v3Column15: TcxGridDBColumn;
v3Column16: TcxGridDBColumn;
v3Column17: TcxGridDBColumn;
v3Column18: TcxGridDBColumn;
v3Column19: TcxGridDBColumn;
v3Column20: TcxGridDBColumn;
v3Column21: TcxGridDBColumn;
v3Column22: TcxGridDBColumn;
v3Column23: TcxGridDBColumn;
v3Column24: TcxGridDBColumn;
v3Column25: TcxGridDBColumn;
v3Column26: TcxGridDBColumn;
v3Column27: TcxGridDBColumn;
v3Column28: TcxGridDBColumn;
v3Column29: TcxGridDBColumn;
v3Column30: TcxGridDBColumn;
v3Column31: TcxGridDBColumn;
v3Column32: TcxGridDBColumn;
v3Column33: TcxGridDBColumn;
v3Column34: TcxGridDBColumn;
v3Column35: TcxGridDBColumn;
v3Column36: TcxGridDBColumn;
v3Column39: TcxGridDBColumn;
v3Column40: TcxGridDBColumn;
v3Column41: TcxGridDBColumn;
v3Column42: TcxGridDBColumn;
v3Column43: TcxGridDBColumn;
v3Column44: TcxGridDBColumn;
v3Column45: TcxGridDBColumn;
v3Column46: TcxGridDBColumn;
v3Column47: TcxGridDBColumn;
v3Column48: TcxGridDBColumn;
v3Column49: TcxGridDBColumn;
v3Column50: TcxGridDBColumn;
v3Column51: TcxGridDBColumn;
v3Column52: TcxGridDBColumn;
v3Column53: TcxGridDBColumn;
v3Column54: TcxGridDBColumn;
v3Column55: TcxGridDBColumn;
v3Column56: TcxGridDBColumn;
v3Column57: TcxGridDBColumn;
v3Column58: TcxGridDBColumn;
v3Column59: TcxGridDBColumn;
v3Column60: TcxGridDBColumn;
v3Column61: TcxGridDBColumn;
v3Column62: TcxGridDBColumn;
v3Column63: TcxGridDBColumn;
v3Column64: TcxGridDBColumn;
v3Column65: TcxGridDBColumn;
v3Column66: TcxGridDBColumn;
v3Column67: TcxGridDBColumn;
v3Column68: TcxGridDBColumn;
v3Column69: TcxGridDBColumn;
v3Column70: TcxGridDBColumn;
v3Column71: TcxGridDBColumn;
v3Column72: TcxGridDBColumn;
v3Column73: TcxGridDBColumn;
v3Column74: TcxGridDBColumn;
v3Column75: TcxGridDBColumn;
v3Column76: TcxGridDBColumn;
v3Column77: TcxGridDBColumn;
v3Column78: TcxGridDBColumn;
v3Column79: TcxGridDBColumn;
v3Column80: TcxGridDBColumn;
v3Column81: TcxGridDBColumn;
v3Column82: TcxGridDBColumn;
v3Column83: TcxGridDBColumn;
v3Column84: TcxGridDBColumn;
v3Column85: TcxGridDBColumn;
v3Column86: TcxGridDBColumn;
v3Column87: TcxGridDBColumn;
v3Column88: TcxGridDBColumn;
v3Column89: TcxGridDBColumn;
v3Column90: TcxGridDBColumn;
v3Column91: TcxGridDBColumn;
v3Column92: TcxGridDBColumn;
v3Column93: TcxGridDBColumn;
v3Column94: TcxGridDBColumn;
v3Column95: TcxGridDBColumn;
v3Column96: TcxGridDBColumn;
v3Column97: TcxGridDBColumn;
v3Column98: TcxGridDBColumn;
v3Column99: TcxGridDBColumn;
v3Column100: TcxGridDBColumn;
v3Column101: TcxGridDBColumn;
v3Column102: TcxGridDBColumn;
v3Column103: TcxGridDBColumn;
v3Column104: TcxGridDBColumn;
v3Column105: TcxGridDBColumn;
v3Column106: TcxGridDBColumn;
v3Column107: TcxGridDBColumn;
v3Column108: TcxGridDBColumn;
v3Column109: TcxGridDBColumn;
v3Column110: TcxGridDBColumn;
cxGridLevel2: TcxGridLevel;
v3Column111: TcxGridDBColumn;
v3Column112: TcxGridDBColumn;
v3Column113: TcxGridDBColumn;
v3Column114: TcxGridDBColumn;
v3Column115: TcxGridDBColumn;
v3Column116: TcxGridDBColumn;
v3Column117: TcxGridDBColumn;
v3Column118: TcxGridDBColumn;
v3Column119: TcxGridDBColumn;
v3Column120: TcxGridDBColumn;
v3Column121: TcxGridDBColumn;
v3Column122: TcxGridDBColumn;
v3Column123: TcxGridDBColumn;
v3Column124: TcxGridDBColumn;
v3Column125: TcxGridDBColumn;
v3Column126: TcxGridDBColumn;
v3Column127: TcxGridDBColumn;
v3Column128: TcxGridDBColumn;
v3Column129: TcxGridDBColumn;
v3Column130: TcxGridDBColumn;
v3Column131: TcxGridDBColumn;
v3Column132: TcxGridDBColumn;
v3Column133: TcxGridDBColumn;
v3Column134: TcxGridDBColumn;
v3Column135: TcxGridDBColumn;
v3Column136: TcxGridDBColumn;
v3Column137: TcxGridDBColumn;
v3Column138: TcxGridDBColumn;
v3Column139: TcxGridDBColumn;
v3Column140: TcxGridDBColumn;
v3Column141: TcxGridDBColumn;
v3Column142: TcxGridDBColumn;
v3Column143: TcxGridDBColumn;
v3Column144: TcxGridDBColumn;
v3Column145: TcxGridDBColumn;
v3Column146: TcxGridDBColumn;
v2Column12: TcxGridDBColumn;
lbl2: TLabel;
Saleser: TcxTextEdit;
Label7: TLabel;
OrderNo: TcxTextEdit;
C_Spec: TRichEdit;
ToolBar3: TToolBar;
ToolButton3: TToolButton;
ToolButton4: TToolButton;
Label4: TLabel;
ToolButton8: TToolButton;
PM_3: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
PM_5: TPopupMenu;
MenuItem1: TMenuItem;
MenuItem2: TMenuItem;
ConMId: TcxTextEdit;
ConSId: TcxTextEdit;
ToolButton1: TToolButton;
Label6: TLabel;
Label17: TLabel;
Label9: TLabel;
Label20: TLabel;
Label10: TLabel;
Label24: TLabel;
RuleBeforeTare: TcxTextEdit;
Coefficient: TcxTextEdit;
RuleLaterTare: TcxTextEdit;
AddWet: TcxTextEdit;
Label15: TLabel;
Label19: TLabel;
Label21: TLabel;
Label23: TLabel;
Looms: TcxTextEdit;
Label25: TLabel;
Label27: TLabel;
C_GPGramWeight: TcxTextEdit;
C_GPWidth: TcxTextEdit;
Label28: TLabel;
C_BJWidth: TcxTextEdit;
Label29: TLabel;
TotalStitches: TcxTextEdit;
Tv2Column1: TcxGridDBColumn;
Tv2Column2: TcxGridDBColumn;
Tv2Column3: TcxGridDBColumn;
Tv2Column4: TcxGridDBColumn;
Tv2Column5: TcxGridDBColumn;
Tv2Column6: TcxGridDBColumn;
Label32: TLabel;
Label34: TLabel;
TurnsQty: TcxTextEdit;
Label35: TLabel;
TurnsQtyAvg: TcxTextEdit;
Label36: TLabel;
Label38: TLabel;
C_Composition: TcxTextEdit;
Label39: TLabel;
C_Color: TcxTextEdit;
Label40: TLabel;
RollType: TcxTextEdit;
Label42: TLabel;
PacketType: TcxTextEdit;
Label44: TLabel;
Label45: TLabel;
C_Type: TcxTextEdit;
Label46: TLabel;
Label48: TLabel;
Price: TcxTextEdit;
Label49: TLabel;
YarnLength: TRichEdit;
Label50: TLabel;
Label30: TLabel;
ToolButton2: TToolButton;
Workshop: TcxComboBox;
CustName: TcxButtonEdit;
ConNo: TcxButtonEdit;
C_Code: TcxButtonEdit;
NeedleShape: TcxButtonEdit;
MCType: TcxButtonEdit;
SellType: TcxButtonEdit;
PacketNote: TcxButtonEdit;
Strain: TcxButtonEdit;
PackType: TcxButtonEdit;
Repairer: TcxButtonEdit;
OurCoName: TcxButtonEdit;
FtyCoName: TcxButtonEdit;
BusinessType: TcxButtonEdit;
Technics: TcxButtonEdit;
OrdType: TcxComboBox;
RuleLenUnit: TcxComboBox;
RuleConversion: TcxComboBox;
SendBack: TcxComboBox;
DlyDate: TcxDateEdit;
OrdDate: TcxDateEdit;
ZJDate: TcxDateEdit;
KJDate: TcxDateEdit;
procedure TBCloseClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure TBSaveClick(Sender: TObject);
procedure ToolButton3Click(Sender: TObject);
procedure ToolButton4Click(Sender: TObject);
procedure Tv3MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure Tv5MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure v2Column11PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure OrdPieceChange(Sender: TObject);
procedure CustName1BtnDnClick(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure MenuItem1Click(Sender: TObject);
procedure MenuItem2Click(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure ToolButton2Click(Sender: TObject);
procedure OrdPieceWeightExit(Sender: TObject);
procedure CustNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure FtyCoNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure OurCoNamePropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure RepairerPropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure ConNoPropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
procedure C_CodePropertiesChange(Sender: TObject);
procedure C_CodePropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
private
FXS, FGridFlag: Integer;
procedure InitData();
procedure CALCYarnQty();
procedure InitClothYarn(MC_Code: string);
function SaveData(): Boolean;
{ Private declarations }
public
PState, FCopyInt: Integer;
FMainId, FConNo, PType, FSubId: string;
{ Public declarations }
end;
var
frmKnitPlanInPut: TfrmKnitPlanInPut;
newh: hwnd;
implementation
uses
U_DataLink, U_ZDYHelp, U_RTFun, U_KnitClothInfoSel, U_CompanySel,
U_YarnInfoSel, U_KnitSalesContractSel;
{$R *.dfm}
procedure TfrmKnitPlanInPut.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 TfrmKnitPlanInPut.CALCYarnQty();
var
MOrdQty: Double;
begin
MOrdQty := STRTOFLOATDEF(OrdQty.Text, 0);
with CDS_YuanLiao do
begin
DisableControls;
First;
while not Eof do
begin
Edit;
FieldByName('Y_Qty').Value := MOrdQty * FieldByName('Y_Ratio').AsFloat / 100 * (100 + FieldByName('Y_Loss').AsFloat) / 100;
Next;
end;
EnableControls;
end;
end;
procedure TfrmKnitPlanInPut.TBCloseClick(Sender: TObject);
begin
ModalResult := 1;
end;
procedure TfrmKnitPlanInPut.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 knit_Plan_Main A where A.MainId=''' + Trim(FMainId) + '''');
Open;
end;
SCSHData(ADOQueryTemp, ScrollBox1, 0);
//CustName.TxtCode := ADOQueryTemp.FieldByName('CustNo').AsString;
CustName.Properties.LookupItems.Text := ADOQueryTemp.FieldByName('CustNo').AsString;
//FtyCoName.TxtCode := ADOQueryTemp.FieldByName('FtyCoNo').AsString;
FtyCoName.Properties.LookupItems.Text := ADOQueryTemp.FieldByName('FtyCoNo').AsString;
//OurCoName.TxtCode := ADOQueryTemp.FieldByName( 'OurCoNo').AsString;
OurCoName.Properties.LookupItems.Text := ADOQueryTemp.FieldByName('OurCoNo').AsString;
with ADOQueryTemp do
begin
Close;
SQL.Clear;
sql.Add('select * from knit_Plan_Sub A where A.MainId=''' + Trim(FMainId) + '''');
Open;
end;
SCSHData(ADOQueryTemp, ScrollBox1, 2);
with ADOQueryTemp do
begin
Close;
SQL.Clear;
sql.Add('select * from knit_Cloth_Inspect_Rule ');
sql.Add(' where RuleID=''' + Trim(FMainId) + '''');
Open;
end;
SCSHData(ADOQueryTemp, ScrollBox1, 9);
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select A.* ');
// sql.Add(',YLQty=Cast(OrdQty*Y_Ratio*0.01*(1+isnull(ZPSH,0)*0.01) as decimal(18,1))');
sql.Add('from knit_Plan_Yarn A ');
sql.Add('inner join knit_Plan_Sub B on A.SubId=B.SubId');
SQL.Add(' inner join knit_Plan_Main C on B.Mainid=C.MainId');
sql.Add(' where A.MainId=''' + Trim(FMainId) + '''');
Open;
end;
SCreateCDS(ADOQueryTemp, CDS_YuanLiao);
SInitCDSData(ADOQueryTemp, CDS_YuanLiao);
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from knit_Plan_Arrange where MainId=''' + Trim(FMainId) + '''');
sql.Add(' and PZType=''<27><><EFBFBD><EFBFBD>'' ');
Open;
end;
SCreateCDS(ADOQueryTemp, ClientDataSet3);
SInitCDSData(ADOQueryTemp, ClientDataSet3);
if ClientDataSet3.IsEmpty then
begin
with ClientDataSet3 do
begin
Append;
Post;
Append;
Post;
end;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from knit_Plan_Arrange where MainId=''' + Trim(FMainId) + '''');
sql.Add(' and PZType=''<27><><EFBFBD><EFBFBD>'' ');
Open;
end;
SCreateCDS(ADOQueryTemp, ClientDataSet5);
SInitCDSData(ADOQueryTemp, ClientDataSet5);
if PState = 0 then
begin
with ADOQueryTemp do
begin
Close;
SQL.Clear;
sql.Add('select Top 1* from knit_Plan_Main order by FillTime desc ');
Open;
end;
OrdDate.Date := SGetServerDate(ADOQueryTemp);
//OrdDate.Checked := True;
DlyDate.Date := OrdDate.Date;
end;
if FCopyInt = 1 then
begin
FMainId := '';
ConNo.Text := '';
ConNo.enabled := true;
CDS_YuanLiao.DisableControls;
with CDS_YuanLiao do
begin
First;
while not Eof do
begin
Edit;
FieldByName('MainId').Value := '';
FieldByName('SubId').Value := '';
FieldByName('YRId').Value := '';
FieldByName('BegPBQty').Value := Null;
Post;
Next;
end;
end;
CDS_YuanLiao.EnableControls;
ClientDataSet3.DisableControls;
with ClientDataSet3 do
begin
First;
while not Eof do
begin
Edit;
FieldByName('MainId').Value := '';
FieldByName('SubId').Value := '';
FieldByName('PZId').Value := '';
Post;
Next;
end;
end;
ClientDataSet3.EnableControls;
ClientDataSet5.DisableControls;
with ClientDataSet5 do
begin
First;
while not Eof do
begin
Edit;
FieldByName('MainId').Value := '';
FieldByName('SubId').Value := '';
FieldByName('PZId').Value := '';
Post;
Next;
end;
end;
ClientDataSet5.EnableControls;
end;
end;
procedure TfrmKnitPlanInPut.FormShow(Sender: TObject);
begin
InitData();
end;
procedure TfrmKnitPlanInPut.FtyCoNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
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.Properties.LookupItems.Text := Trim(CDS_1.fieldbyname('CoCode').AsString);
FtyCoName.Text := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
end;
end;
finally
frmCompanySel.Free;
end;
end;
function TfrmKnitPlanInPut.SaveData(): Boolean;
var
maxno, maxsubno, maxpbno, maxpzno, maxsjno: string;
begin
try
ADOQueryCmd.Connection.BeginTrans;
if Trim(FMainId) = '' then
begin
if GetLSNo(ADOQueryCmd, maxno, 'KM', 'knit_Plan_Main', 4, 1) = False then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD><ECB3A3>', '<27><>ʾ', 0);
exit;
end;
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 knit_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, 'knit_Plan_Main', ScrollBox1, 0);
//FieldByName('CustNo').Value := CustName.TxtCode;
FieldByName('CustNo').Value := Trim(CustName.Properties.LookupItems.Text);
//FieldByName('FtyCoNo').Value := FtyCoName.TxtCode;
FieldByName('FtyCoNo').Value := FtyCoName.Properties.LookupItems.Text;
//FieldByName('OurCoNo').Value := OurCoName.TxtCode;
FieldByName('OurCoNo').Value := OurCoName.Properties.LookupItems.Text;
Post;
end;
////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //////////////////////////
///
////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD> //////////////////////////
if Trim(FSubId) = '' then
begin
if GetLSNo(ADOQueryTemp, maxsubno, 'KS', 'knit_Plan_Sub', 4, 1) = False then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
end
else
begin
maxsubno := Trim(FSubId);
end;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from knit_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, 'knit_Plan_Sub', ScrollBox1, 2);
Post;
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add('update Knit_Cloth_Inspect set C_Name=X.C_Name,C_Composition=X.C_Composition,C_Spec=X.C_Spec,C_Width=X.C_Width,C_GramWeight=X.C_GramWeight from Knit_Plan_Sub X where X.SubId=Knit_Cloth_Inspect.SubId and Knit_Cloth_Inspect.SubId=' + QUOTEDSTR(maxsubno));
SQL.Add('update Knit_Cloth_Stock set C_Name=X.C_Name,C_Composition=X.C_Composition,C_Spec=X.C_Spec,C_Width=X.C_Width,C_GramWeight=X.C_GramWeight from Knit_Plan_Sub X where X.SubId=Knit_Cloth_Stock.SubId and Knit_Cloth_Stock.SubId=' + QUOTEDSTR(maxsubno));
ExecSQL;
end;
////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD>ӱ<EFBFBD> //////////////////////////
///
/////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ///////////////
with ADOQueryCmd do
begin
Close;
sql.Clear;
SQL.Add('select * from knit_Cloth_Inspect_Rule where RuleID=''' + Trim(maxno) + '''');
Open;
end;
with ADOQueryCmd do
begin
if ADOQueryCmd.IsEmpty then
begin
Append;
end
else
Edit;
RTSetsavedata(ADOQueryCmd, 'knit_Cloth_Inspect_Rule', ScrollBox1, 9);
FieldByName('RuleID').Value := Trim(maxno);
Post;
end;
/////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ///////////////
///
////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȱ<EFBFBD> //////////////////////////
with CDS_YuanLiao do
begin
First;
while not Eof do
begin
if Trim(CDS_YuanLiao.fieldbyname('YRId').AsString) = '' then
begin
if GetLSNo(ADOQueryTemp, maxpbno, 'PB', 'knit_Plan_Yarn', 4, 1) = False then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
end
else
begin
maxpbno := Trim(CDS_YuanLiao.fieldbyname('YRId').AsString);
end;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from knit_Plan_Yarn ');
sql.Add(' where YRId=''' + Trim(maxpbno) + '''');
Open;
end;
with ADOQueryCmd do
begin
if Trim(CDS_YuanLiao.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('MainId').Value := Trim(maxno);
FieldByName('SubId').Value := Trim(maxsubno);
FieldByName('YRId').Value := Trim(maxpbno);
RTSetSaveDataCDS(ADOQueryCmd, Tv2, CDS_YuanLiao, 'knit_Plan_Yarn', 0);
Post;
end;
CDS_YuanLiao.Edit;
CDS_YuanLiao.FieldByName('SubId').Value := Trim(maxsubno);
CDS_YuanLiao.FieldByName('MainId').Value := Trim(maxno);
CDS_YuanLiao.FieldByName('YRId').Value := Trim(maxpbno);
Next;
end;
end;
////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȱ<EFBFBD> //////////////////////////
///
////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //////////////////////////
ClientDataSet3.DisableControls;
with ClientDataSet3 do
begin
First;
while not Eof do
begin
if Trim(ClientDataSet3.fieldbyname('PZId').AsString) = '' then
begin
if GetLSNo(ADOQueryCmd, maxpzno, 'PZ', 'knit_Plan_Arrange', 4, 1) = False then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
end
else
begin
maxpzno := Trim(ClientDataSet3.fieldbyname('PZId').AsString);
end;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from knit_Plan_Arrange where ');
sql.Add(' PZId=''' + Trim(maxpzno) + '''');
Open;
end;
with ADOQueryCmd do
begin
if Trim(ClientDataSet3.fieldbyname('PZId').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('MainId').Value := Trim(maxno);
FieldByName('SubId').Value := Trim(maxsubno);
FieldByName('PZId').Value := Trim(maxpzno);
RTSetSaveDataCDS(ADOQueryCmd, Tv3, ClientDataSet3, 'knit_Plan_Arrange', 0);
FieldByName('PZType').Value := '<27><><EFBFBD><EFBFBD>';
FieldByName('PZName').Value := ClientDataSet3.fieldbyname('PZName').AsString;
Post;
end;
ClientDataSet3.Edit;
ClientDataSet3.FieldByName('PZId').Value := Trim(maxpzno);
Next;
end;
end;
ClientDataSet3.EnableControls;
////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //////////////////////////
///
////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DZ<EFBFBD> //////////////////////////
ClientDataSet5.DisableControls;
with ClientDataSet5 do
begin
First;
while not Eof do
begin
if Trim(ClientDataSet5.fieldbyname('PZId').AsString) = '' then
begin
if GetLSNo(ADOQueryCmd, maxsjno, 'PZ', 'knit_Plan_Arrange', 4, 1) = False then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
Exit;
end;
end
else
begin
maxsjno := Trim(ClientDataSet5.fieldbyname('PZId').AsString);
end;
with ADOQueryCmd do
begin
Close;
SQL.Clear;
sql.Add('select * from knit_Plan_Arrange where ');
sql.Add(' PZId=''' + Trim(maxsjno) + '''');
Open;
end;
with ADOQueryCmd do
begin
if Trim(ClientDataSet5.fieldbyname('PZId').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('MainId').Value := Trim(maxno);
FieldByName('SubId').Value := Trim(maxsubno);
FieldByName('PZId').Value := Trim(maxsjno);
RTSetSaveDataCDS(ADOQueryCmd, Tv5, ClientDataSet5, 'knit_Plan_Arrange', 0);
FieldByName('PZType').Value := '<27><><EFBFBD><EFBFBD>';
Post;
end;
ClientDataSet5.Edit;
ClientDataSet5.FieldByName('PZId').Value := Trim(maxsjno);
Next;
end;
end;
ClientDataSet5.EnableControls;
////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DZ<EFBFBD> //////////////////////////
ADOQueryCmd.Connection.CommitTrans;
FMainId := Trim(maxno);
FSubId := Trim(maxsubno);
Result := True;
except
Result := False;
ClientDataSet3.EnableControls;
ClientDataSet5.EnableControls;
CDS_YuanLiao.EnableControls;
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
end;
end;
procedure TfrmKnitPlanInPut.TBSaveClick(Sender: TObject);
var
FReal: Double;
maxConNo: string;
begin
OrdDate.SetFocus;
CALCYarnQty();
if Trim(ConNo.Text) = '' then
begin
if GetLSNo(ADOQueryCmd, maxConNo, 'MS', 'knit_Plan_Main', 3, 1) = False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD><ECB3A3>', '<27><>ʾ', 0);
exit;
end;
ConNo.Text := maxConNo;
end;
if Trim(ConNo.Text) = '' then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!', '<27><>ʾ', 0);
Exit;
end;
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(OrdPieceWeight.Text) = '' then
begin
Application.MessageBox(<>ز<EFBFBD><D8B2><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(OrdPieceWeight.Text, FReal) = False then
begin
Application.MessageBox(<>طǷ<D8B7><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 CDS_YuanLiao.Locate('Y_Name', Null, []) = True then
begin
Application.MessageBox(<><D4AD><EFBFBD><EFBFBD><EFBFBD>Ʋ<EFBFBD><C6B2><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 TfrmKnitPlanInPut.ToolButton1Click(Sender: TObject);
begin
OrdDate.SetFocus;
CALCYarnQty();
end;
procedure TfrmKnitPlanInPut.ToolButton2Click(Sender: TObject);
begin
with CDS_YuanLiao do
begin
Append;
FieldByName('Y_Ratio').Value := 0;
Post;
end;
end;
procedure TfrmKnitPlanInPut.ToolButton3Click(Sender: TObject);
begin
if cxPageControl1.ActivePageIndex <> 0 then
Exit;
try
frmYarnInfoSel := TfrmYarnInfoSel.Create(Application);
with frmYarnInfoSel do
begin
if ShowModal = 1 then
begin
while frmYarnInfoSel.CDS_1.Locate('ssel', True, []) do
begin
with CDS_YuanLiao 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;
frmYarnInfoSel.CDS_1.Delete;
end;
end;
end;
finally
frmYarnInfoSel.Free;
end;
end;
procedure TfrmKnitPlanInPut.ToolButton4Click(Sender: TObject);
begin
if CDS_YuanLiao.IsEmpty then
Exit;
if Trim(CDS_YuanLiao.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 knit_Plan_Yarn where YRId=''' + Trim(CDS_YuanLiao.fieldbyname('YRId').AsString) + '''');
ExecSQL;
end;
end;
CDS_YuanLiao.Delete;
end;
procedure TfrmKnitPlanInPut.Tv3MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
FGridFlag := 1;
end;
procedure TfrmKnitPlanInPut.Tv5MouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
FGridFlag := 2;
end;
procedure TfrmKnitPlanInPut.v2Column11PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmCompanySel := TfrmCompanySel.Create(Application);
with frmCompanySel do
begin
if ShowModal = 1 then
begin
with Self.CDS_YuanLiao do
begin
Edit;
FieldByName('GYSName').Value := Trim(CDS_1.fieldbyname('CoName').AsString);
end;
end;
end;
finally
frmCompanySel.Free;
end;
end;
procedure TfrmKnitPlanInPut.OurCoNamePropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
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.Properties.LookupItems.Text := Trim(CDS_1.fieldbyname('CoCode').AsString);
OurCoName.Text := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
//FtyCoName.TxtCode := Trim(CDS_1.fieldbyname('CoCode').AsString);
FtyCoName.Properties.LookupItems.Text := Trim(CDS_1.fieldbyname('CoCode').AsString);
FtyCoName.Text := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
end;
end;
finally
frmCompanySel.Free;
end;
end;
procedure TfrmKnitPlanInPut.RepairerPropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
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 TfrmKnitPlanInPut.OrdPieceChange(Sender: TObject);
var
FOrdQty, FOrdPieceWeight, FOrdPiece: Double;
begin
// FOrdPieceWeight := StrToFloatDef(OrdPieceWeight.Text, 0);
// FOrdPiece := StrToFloatDef(OrdPiece.Text, 0);
// if FOrdPiece > 0 then
// OrdQty.Text := FloatToStr(FOrdPieceWeight * FOrdPiece)
// else
// OrdQty.Text := '0';
end;
procedure TfrmKnitPlanInPut.OrdPieceWeightExit(Sender: TObject);
var
FOrdQty, FOrdPieceWeight: Double;
begin
FOrdQty := StrToFloatDef(OrdQty.Text, 0);
FOrdPieceWeight := StrToFloatDef(OrdPieceWeight.Text, 0);
if FOrdPieceWeight > 0 then
OrdPiece.Text := IntToStr(Ceil(FOrdQty / FOrdPieceWeight));
end;
procedure TfrmKnitPlanInPut.MenuItem1Click(Sender: TObject);
begin
with ClientDataSet5 do
begin
Append;
Post;
end;
end;
procedure TfrmKnitPlanInPut.MenuItem2Click(Sender: TObject);
begin
if ClientDataSet5.IsEmpty then
Exit;
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('delete knit_Plan_Arrange where PZID=''' + Trim(ClientDataSet5.fieldbyname('PZID').AsString) + '''');
ExecSQL;
end;
ClientDataSet5.Delete;
end;
procedure TfrmKnitPlanInPut.N1Click(Sender: TObject);
begin
with ClientDataSet3 do
begin
Append;
Post;
end;
end;
procedure TfrmKnitPlanInPut.N2Click(Sender: TObject);
begin
if ClientDataSet3.IsEmpty then
Exit;
if Application.MessageBox(<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
Exit;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('delete knit_Plan_Arrange where PZID=''' + Trim(ClientDataSet3.fieldbyname('PZID').AsString) + '''');
ExecSQL;
end;
ClientDataSet3.Delete;
end;
procedure TfrmKnitPlanInPut.C_CodePropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
begin
try
frmKnitClothInfoSel := TfrmKnitClothInfoSel.Create(Application);
with frmKnitClothInfoSel do
begin
if ShowModal = 1 then
begin
Self.C_Code.Text := frmKnitClothInfoSel.CDS_1.fieldbyname('C_Code').AsString;
Self.C_Name.Text := frmKnitClothInfoSel.CDS_1.fieldbyname('C_Name').AsString;
Self.C_Spec.Text := frmKnitClothInfoSel.CDS_1.fieldbyname('C_Spec').AsString;
Self.C_Width.Text := frmKnitClothInfoSel.CDS_1.fieldbyname('C_Width').AsString;
Self.C_GramWeight.Text := frmKnitClothInfoSel.CDS_1.fieldbyname('C_GramWeight').AsString;
Self.C_Composition.Text := frmKnitClothInfoSel.CDS_1.fieldbyname('C_Composition').AsString;
Self.C_Type.Text := frmKnitClothInfoSel.CDS_1.fieldbyname('CTName').AsString;
end;
end;
finally
frmKnitClothInfoSel.Free;
end;
end;
procedure TfrmKnitPlanInPut.C_CodePropertiesChange(Sender: TObject);
begin
try
frmKnitClothInfoSel := TfrmKnitClothInfoSel.Create(Application);
with frmKnitClothInfoSel do
begin
if ShowModal = 1 then
begin
Self.C_Code.Text := frmKnitClothInfoSel.CDS_1.fieldbyname('C_Code').AsString;
Self.C_Name.Text := frmKnitClothInfoSel.CDS_1.fieldbyname('C_Name').AsString;
Self.C_Spec.Text := frmKnitClothInfoSel.CDS_1.fieldbyname('C_Spec').AsString;
Self.C_Width.Text := frmKnitClothInfoSel.CDS_1.fieldbyname('C_Width').AsString;
Self.C_GramWeight.Text := frmKnitClothInfoSel.CDS_1.fieldbyname('C_GramWeight').AsString;
Self.C_Composition.Text := frmKnitClothInfoSel.CDS_1.fieldbyname('C_Composition').AsString;
Self.C_Type.Text := frmKnitClothInfoSel.CDS_1.fieldbyname('CTName').AsString;
end;
end;
finally
frmKnitClothInfoSel.Free;
end;
end;
procedure TfrmKnitPlanInPut.ConNoPropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer);
begin
inherited;
try
frmKnitSalesContractSel := TfrmKnitSalesContractSel.Create(Application);
with frmKnitSalesContractSel do
begin
if ShowModal = 1 then
begin
self.ConNo.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('ConNo').AsString; //<2F><>ͬ<EFBFBD><CDAC>
//self.Custname.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('BuyName').AsString; //<2F>ͻ<EFBFBD>
//self.Custname.TxtCode := frmKnitSalesContractSel.CDS_1.fieldbyname('BuyNo').AsString; //<2F>ͻ<EFBFBD>
self.Custname.Properties.LookupItems.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('BuyName').AsString;
self.Custname.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('BuyNo').AsString;
self.Saleser.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('Saleser').AsString; //<2F>µ<EFBFBD>Ա
self.ConMId.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('ConMId').AsString; //ConMainId
self.ConSId.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('ConSId').AsString; //ConSubId
self.C_Code.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('C_Code').AsString; //<2F><><EFBFBD><EFBFBD>
self.C_Name.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('C_Name').AsString; //Ʒ<><C6B7>
self.C_Spec.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('C_Spec').AsString; //<2F><><EFBFBD><EFBFBD>
self.C_Composition.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('C_Composition').AsString; //<2F>ɷ<EFBFBD>
self.C_Width.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('C_Width').AsString; //<2F>ŷ<EFBFBD>
self.C_GramWeight.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('C_GramWeight').AsString; //<2F><><EFBFBD><EFBFBD>
// self.OrdPiece.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('pishu').AsString; //ƥ<><C6A5>
// self.OrdPieceWeight.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('OrdTare').AsString; //ƥ<><C6A5>
self.OrdQty.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('ConQty').AsString; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
end;
end;
finally
frmKnitSalesContractSel.Free;
end;
end;
procedure TfrmKnitPlanInPut.CustName1BtnDnClick(Sender: TObject);
begin
TBtnEditC(Sender).TxtCode := '';
TBtnEditC(Sender).Text := '';
end;
procedure TfrmKnitPlanInPut.CustNamePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
try
frmCompanySel := TfrmCompanySel.Create(Application);
with frmCompanySel do
begin
FCoType := '<27>ͻ<EFBFBD>';
if ShowModal = 1 then
begin
CustName.Properties.LookupItems.Text := Trim(CDS_1.fieldbyname('CoCode').AsString);
CustName.Text := Trim(CDS_1.fieldbyname('CoAbbrName').AsString);
end;
end;
finally
frmCompanySel.Free;
end;
end;
end.