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=''经丝'' 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=''排针'' '); 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=''三角'' '); 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 := '供应商'; 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('生成流水号异常!', '提示', 0); exit; end; OrderNo.Text := maxno; end else begin maxno := Trim(FMainId); end; ////////////////////////// 保存主表 ////////////////////////// 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; ////////////////////////// 保存主表 ////////////////////////// /// ////////////////////////// 保存子表 ////////////////////////// if Trim(FSubId) = '' then begin if GetLSNo(ADOQueryTemp, maxsubno, 'KS', 'knit_Plan_Sub', 4, 1) = False then begin ADOQueryCmd.Connection.RollbackTrans; Application.MessageBox('取子流水号失败!', '提示', 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; ////////////////////////// 保存子表 ////////////////////////// /// /////////////// 保存打卷设置 /////////////// 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; /////////////// 保存打卷设置 /////////////// /// ////////////////////////// 保存配比表 ////////////////////////// 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('取配比子流水号失败!', '提示', 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; ////////////////////////// 保存配比表 ////////////////////////// /// ////////////////////////// 保存排针表 ////////////////////////// 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('取排针流水号失败!', '提示', 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 := '排针'; FieldByName('PZName').Value := ClientDataSet3.fieldbyname('PZName').AsString; Post; end; ClientDataSet3.Edit; ClientDataSet3.FieldByName('PZId').Value := Trim(maxpzno); Next; end; end; ClientDataSet3.EnableControls; ////////////////////////// 保存排针表 ////////////////////////// /// ////////////////////////// 保存三角表 ////////////////////////// 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('取三角流水号失败!', '提示', 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 := '三角'; Post; end; ClientDataSet5.Edit; ClientDataSet5.FieldByName('PZId').Value := Trim(maxsjno); Next; end; end; ClientDataSet5.EnableControls; ////////////////////////// 保存三角表 ////////////////////////// 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('保存失败!', '提示', 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('生成流水号异常!', '提示', 0); exit; end; ConNo.Text := maxConNo; end; if Trim(ConNo.Text) = '' then begin Application.MessageBox('订单号不能为空!', '提示', 0); Exit; end; if Trim(CustName.Text) = '' then begin Application.MessageBox('客户不能为空!', '提示', 0); Exit; end; if Trim(C_Name.Text) = '' then begin Application.MessageBox('产品名称不能为空!', '提示', 0); Exit; end; if Trim(C_Code.Text) = '' then begin Application.MessageBox('产品编号不能为空!', '提示', 0); Exit; end; if Trim(OrdQty.Text) = '' then begin Application.MessageBox('总数量不能为空!', '提示', 0); Exit; end; if Trim(OrdPieceWeight.Text) = '' then begin Application.MessageBox('匹重不能为空!', '提示', 0); Exit; end; if Trim(OrdPiece.Text) = '' then begin Application.MessageBox('匹数不能为空!', '提示', 0); Exit; end; if TryStrToFloat(OrdQty.Text, FReal) = False then begin Application.MessageBox('总数量非法数字!', '提示', 0); Exit; end; if TryStrToFloat(OrdPieceWeight.Text, FReal) = False then begin Application.MessageBox('匹重非法数字!', '提示', 0); Exit; end; if TryStrToFloat(OrdPiece.Text, FReal) = False then begin Application.MessageBox('匹数非法数字!', '提示', 0); Exit; end; if CDS_YuanLiao.Locate('Y_Name', Null, []) = True then begin Application.MessageBox('原料名称不能为空!', '提示', 0); Exit; end; if SaveData() then begin Application.MessageBox('保存成功!', '提示', 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('确定要删除数据吗?', '提示', 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 := '我司'; 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('确定要删除三角数据吗?', '提示', 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('确定要删除排针数据吗?', '提示', 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; //合同号 //self.Custname.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('BuyName').AsString; //客户 //self.Custname.TxtCode := frmKnitSalesContractSel.CDS_1.fieldbyname('BuyNo').AsString; //客户 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; //下单员 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; //编号 self.C_Name.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('C_Name').AsString; //品名 self.C_Spec.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('C_Spec').AsString; //规格 self.C_Composition.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('C_Composition').AsString; //成分 self.C_Width.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('C_Width').AsString; //门幅 self.C_GramWeight.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('C_GramWeight').AsString; //克重 // self.OrdPiece.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('pishu').AsString; //匹数 // self.OrdPieceWeight.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('OrdTare').AsString; //匹重 self.OrdQty.Text := frmKnitSalesContractSel.CDS_1.fieldbyname('ConQty').AsString; //总重量 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 := '客户'; 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.