unit U_FtyOrderInPut; 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, cxCalendar, StrUtils, cxCurrencyEdit, cxGridCustomPopupMenu, cxGridPopupMenu, cxDropDownEdit, RM_Common, RM_Preview, RM_System, RM_Class, RM_GridReport, RM_Dataset, Menus, cxSplitter, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, cxCheckBox, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, dxBarBuiltInMenu, cxPC, System.ImageList, Vcl.ImgList, U_BaseInput, cxImage, cxDBEdit, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdExplicitTLSClientServerBase, IdFTP, ShellAPI; type TfrmTradePlanInPut = class(TfrmBaseInput) ToolBar1: TToolBar; TBSave: TToolButton; TBClose: TToolButton; ScrollBox1: TScrollBox; FONo: TEdit; ADOTemp: TADOQuery; ADOCmd: TADOQuery; DS_1: TDataSource; CDS_1: TClientDataSet; Label3: TLabel; FODate: TDateTimePicker; Label25: TLabel; DLYDate: TDateTimePicker; FONote: TMemo; Label23: TLabel; GPM_1: TcxGridPopupMenu; ADOQueryLabel: TADOQuery; Label51: TLabel; Label7: TLabel; ToolButton3: TToolButton; Label1: TLabel; cxGrid1: TcxGrid; Tv1: TcxGridDBTableView; v1Column11: TcxGridDBColumn; v1Column4: TcxGridDBColumn; v1PRTColor: TcxGridDBColumn; v1Column5: TcxGridDBColumn; VC_PRTPs: TcxGridDBColumn; v1PRTOrderQty: TcxGridDBColumn; cxGrid1Level1: TcxGridLevel; ToolBar2: TToolBar; btnConSel: TToolButton; ToolButton1: TToolButton; ToolButton2: TToolButton; ToolButton5: TToolButton; Tv1Column2: TcxGridDBColumn; Tv1Column3: TcxGridDBColumn; Tv1Column1: TcxGridDBColumn; Tv1Column4: TcxGridDBColumn; Tv1Column5: TcxGridDBColumn; Tv1Column6: TcxGridDBColumn; Tv1Column7: TcxGridDBColumn; Tv1Column8: TcxGridDBColumn; Tv1Column9: TcxGridDBColumn; Tv1Column10: TcxGridDBColumn; Tv1Column12: TcxGridDBColumn; Workshop: TComboBox; Label2: TLabel; procedure TBCloseClick(Sender: TObject); procedure FormShow(Sender: TObject); procedure TBSaveClick(Sender: TObject); procedure ToolButton1Click(Sender: TObject); procedure ToolButton2Click(Sender: TObject); procedure CustomerNoNameBtnDnClick(Sender: TObject); procedure v1OrderUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure v1PriceUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure YCLFactoryBtnUpClick(Sender: TObject); procedure ScrollBox1Click(Sender: TObject); procedure HYTTBtnUpClick(Sender: TObject); procedure KYTTBtnUpClick(Sender: TObject); procedure btnConSelClick(Sender: TObject); procedure edtGYBtnUpClick(Sender: TObject); procedure v1OrderUnitPropertiesEditValueChanged(Sender: TObject); procedure Tv1Column4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure SYRNameBtnUpClick(Sender: TObject); procedure ToolButton3Click(Sender: TObject); procedure OurCoNameBtnDnClick(Sender: TObject); procedure ToolButton5Click(Sender: TObject); private FSCXDH: string; procedure InitData(); procedure ZDYHelp(FButn: TcxButtonEdit; LType: string); function SaveData(): Boolean; function getFONo(fconNo: string): string; { Private declarations } public PState, CopyInt, PriceFlag: Integer; FFOMId, FFFOMId, FFONo: string; FXS: Integer; canshu1: string; fFlileFlag: string; { Public declarations } end; var frmTradePlanInPut: TfrmTradePlanInPut; newh: hwnd; implementation uses U_DataLink, U_ZDYHelp, U_RTFun, U_SalesContractSel, U_CompanySel, U_ClothInfoSel; {$R *.dfm} function TfrmTradePlanInPut.getFONo(fconNo: string): string; var str1: string; i: integer; begin str1 := trim(fconNo) + '01'; with ADOTemp do begin close; sql.Clear; sql.Add('select FOMId from Fty_Order_Main where FONo=' + quotedstr(trim(str1))); open; end; if not ADOTemp.IsEmpty then begin for i := 1 to 99 do begin str1 := trim(fconNo) + rightstr(inttostr(100 + i), 2); with ADOCmd do begin close; sql.Clear; sql.Add('select FOMId from Fty_Order_Main where FONo=' + quotedstr(trim(str1))); open; end; if ADOCmd.IsEmpty then break; end; end; result := str1; end; procedure TfrmTradePlanInPut.TBCloseClick(Sender: TObject); begin Close; end; procedure TfrmTradePlanInPut.InitData(); var FDate: TDateTime; begin FDate := SGetServerDateTime(ADOTemp); FODate.DateTime := FDate; DlyDate.DateTime := FDate; with ADOTemp do begin Close; sql.Clear; sql.Add('select * from Fty_Order_Main where FOMId=''' + Trim(FFOMId) + ''''); Open; end; SCSHData(ADOTemp, ScrollBox1, 2); with ADOTemp do begin Close; SQL.Clear; sql.Add(' select * from Fty_Order_Sub where 1=1 '); if PState = 1 then begin sql.Add(' and FOMId=''' + Trim(FFOMId) + ''''); end; if PState = 0 then begin sql.Add(' and 1<>1'); end; Open; end; SCreateCDS(ADOTemp, CDS_1); SInitCDSData(ADOTemp, CDS_1); if PState = 0 then begin FODate.DateTime := SGetServerDateTime(ADOTemp); DlyDate.DateTime := FODate.DateTime; FONo.Text := ''; FONo.Enabled := True; end else begin end; if CopyInt = 99 then begin PState := 0; FFOMId := ''; FONo.Text := ''; FONo.Enabled := True; FODate.DateTime := FDate; with CDS_1 do begin First; while not Eof do begin Edit; FieldByName('FOMId').Value := ''; FieldByName('FOSId').Value := ''; Post; Next; end; end; end; end; procedure TfrmTradePlanInPut.ZDYHelp(FButn: TcxButtonEdit; LType: string); var FType, ZDYName, FText: string; begin end; procedure TfrmTradePlanInPut.FormShow(Sender: TObject); var i: Integer; begin inherited; readCxGrid(TRIM(SELF.Caption), Tv1, '生产指示单管理'); FONo.Text := ''; fFlileFlag := UserDataFlag + 'HX'; InitData(); end; function TfrmTradePlanInPut.SaveData(): Boolean; var maxno, Smaxno, maxFONo, MaxFNo: string; begin try ADOCmd.Connection.BeginTrans; ///保存主表 if Trim(FFOMId) = '' then begin if GetLSNo(ADOCmd, maxno, 'TZ', 'Fty_Order_Main', 3, 1) = False then raise Exception.Create('取最大号失败!'); FONo.Text := maxno; end else begin maxno := Trim(FFOMId); end; with ADOCmd do begin Close; sql.Clear; SQL.Add('select * from Fty_Order_Main where FOMId=''' + Trim(FFOMId) + ''''); Open; end; with ADOCmd do begin if Trim(FFOMId) = '' then begin Append; FieldByName('FillId').Value := Trim(DCode); FieldByName('Filler').Value := Trim(DName); end else begin Edit; FieldByName('EditId').Value := Trim(DCode); FieldByName('Editer').Value := Trim(DName); FieldByName('EditTime').Value := SGetServerDateTime(ADOTemp); end; RTSetsavedata(ADOCmd, 'Fty_Order_Main', ScrollBox1, 2); FieldByName('FOMId').Value := Trim(maxno); Post; end; ///////////////////// 保存子表 /////////////////////////// with CDS_1 do begin First; while not Eof do begin if Trim(CDS_1.fieldbyname('FOSId').AsString) = '' then begin if GetLSNo(ADOCmd, Smaxno, 'JS', 'Fty_Order_Sub', 4, 1) = False then raise Exception.Create('取子流水号失败!'); end else begin Smaxno := Trim(CDS_1.fieldbyname('FOSId').AsString); end; with ADOCmd do begin Close; SQL.Clear; sql.Add('select * from Fty_Order_Sub where FOMId=''' + Trim(maxno) + ''''); sql.Add(' and FOSId=''' + Trim(Smaxno) + ''''); Open; end; with ADOCmd do begin if Trim(CDS_1.fieldbyname('FOSId').AsString) = '' then Append else Edit; RTSetSaveDataCDS(ADOCmd, Tv1, CDS_1, 'Fty_Order_Sub', 0); RTSetsavedata(ADOCmd, 'Fty_Order_Sub', ScrollBox1, 7); FieldByName('FOMId').Value := Trim(maxno); FieldByName('FOSId').Value := Trim(Smaxno); FieldByName('ConSId').Value := Trim(CDS_1.fieldbyname('ConSId').AsString); FieldByName('ConMId').Value := Trim(CDS_1.fieldbyname('ConMId').AsString); Post; with CDS_1 do begin Edit; fieldbyname('FOSId').Value := Trim(Smaxno); Post; end; end; Next; end; end; ///////////////////// 保存子表 /////////////////////////// with ADOCmd do begin Close; sql.Clear; sql.Add('select * from Fty_Order_Main where FONo=''' + Trim(FONo.Text) + ''''); Open; end; if ADOCmd.RecordCount > 1 then raise Exception.Create('订单号重复!'); FFOMId := Trim(maxno); ADOCmd.Connection.CommitTrans; Result := True; except Result := False; ADOCmd.Connection.RollbackTrans; application.MessageBox(PChar(Exception(ExceptObject).Message), '提示信息', 0); if pos('KEY 约束', Exception(ExceptObject).Message) > 0 then begin if GetLSNo(ADOCmd, Smaxno, 'JS', 'Fty_Order_Sub', 4, 1) = False then begin Application.MessageBox('重新取子流水号失败!', '提示', 0); Exit; end; end; end; end; procedure TfrmTradePlanInPut.TBSaveClick(Sender: TObject); var MAXNO1: string; begin if PState <> 1 then begin FODate.SetFocus; end; if CDS_1.IsEmpty then begin Application.MessageBox('明细不能为空!', '提示', 0); Exit; end; if CDS_1.Locate('OrdQty', null, []) then begin Application.MessageBox('数量不能为空!', '提示', 0); Exit; end; if CDS_1.Locate('C_Color', null, []) then begin Application.MessageBox('颜色不能为空!', '提示', 0); Exit; end; if SaveData() then begin Application.MessageBox('保存成功!', '提示', 0); // ModalResult := 1; end; end; procedure TfrmTradePlanInPut.ToolButton1Click(Sender: TObject); var i: Integer; begin CopyAddRow(Tv1, CDS_1); with CDS_1 do begin Edit; FieldByName('SSel').Value := false; // FieldByName('hxFile').Value := ''; // FieldByName('TPPS').Value := 0; Post; end; end; procedure TfrmTradePlanInPut.ToolButton2Click(Sender: TObject); begin if CDS_1.IsEmpty then Exit; if CDS_1.Locate('SSel', True, []) = False then begin Application.MessageBox('没有选择数据!', '提示', 0); Exit; end; if Application.MessageBox('确定要删除选择的数据吗?', '提示', 32 + 4) <> IDYES then exit; CDS_1.DisableControls; with CDS_1 do begin First; while Locate('SSel', True, []) do begin // with ADOTemp do // begin // Close; // sql.Clear; // sql.Add('select * from Trade_Cloth_Inspect where isnull(FOSId,'''')<>'''' and FOSId=''' + Trim(CDS_1.fieldbyname('FOSId').AsString) + ''''); // Open; // end; // if ADOTemp.IsEmpty = False then // begin // Application.MessageBox('已检验不能删除数据!', '提示', 0); // Exit; // end; if Trim(CDS_1.fieldbyname('FOSId').AsString) <> '' then begin with ADOCmd do begin Close; sql.Clear; sql.Add('delete Fty_Order_Sub where FOSId=''' + Trim(CDS_1.fieldbyname('FOSId').AsString) + ''''); ExecSQL; end; end; Delete; end; end; CDS_1.EnableControls; end; procedure TfrmTradePlanInPut.ToolButton3Click(Sender: TObject); begin WriteCxGrid(TRIM(SELF.Caption), Tv1, '生产指示单管理'); end; procedure TfrmTradePlanInPut.ToolButton5Click(Sender: TObject); begin try frmClothInfoSel := TfrmClothInfoSel.Create(Application); with frmClothInfoSel do begin if ShowModal = 1 then begin while CDS_1.locate('SSel', true, []) do begin if self.CDS_1.locate('ConFOSId', trim(CDS_1.Fieldbyname('FOSId').AsString), []) then begin CDS_1.Edit; CDS_1.fieldbyname('SSel').value := false; continue; end; with self.CDS_1 do begin append; FieldByName('SSel').Value := false; Fieldbyname('C_Code').value := trim(frmSalesContractSel.CDS_1.Fieldbyname('C_Code').AsString); Fieldbyname('C_Name').value := trim(frmSalesContractSel.CDS_1.Fieldbyname('C_Name').AsString); Fieldbyname('C_Spec').value := trim(frmSalesContractSel.CDS_1.Fieldbyname('C_Spec').AsString); Fieldbyname('C_Composition').value := trim(frmSalesContractSel.CDS_1.Fieldbyname('C_Composition').AsString); Fieldbyname('C_Width').value := trim(frmSalesContractSel.CDS_1.Fieldbyname('C_Width').AsString); Fieldbyname('C_GramWeight').value := trim(frmSalesContractSel.CDS_1.Fieldbyname('C_GramWeight').AsString); Fieldbyname('C_ColorNo').value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_ColorNo').AsString); Fieldbyname('C_Color').value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Color').AsString); Fieldbyname('C_Pattern').value := trim(frmClothInfoSel.CDS_1.Fieldbyname('C_Pattern').AsString); Fieldbyname('OrdQty').value := frmClothInfoSel.CDS_1.Fieldbyname('ConQty').AsFloat; Fieldbyname('DDQtyUnit').value := frmClothInfoSel.CDS_1.Fieldbyname('SCSUnit').AsString; Fieldbyname('OrderUnit').value := trim(frmClothInfoSel.CDS_1.Fieldbyname('SCSUnit').AsString); end; CDS_1.Edit; CDS_1.fieldbyname('SSel').value := false; end; end; end; finally frmClothInfoSel.Free; end; end; procedure TfrmTradePlanInPut.edtGYBtnUpClick(Sender: TObject); var fsj: string; FWZ: Integer; i: integer; begin // fsj := Trim(TBtnEditC(Sender).Hint); // FWZ := Pos('/', fsj); // i := 0; // try // frmZDYHelpSel := TfrmZDYHelpSel.Create(Application); // with frmZDYHelpSel do // begin // flag := Copy(fsj, 1, FWZ - 1); // flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ); // if ShowModal = 1 then // begin // TBtnEditC(Sender).text := ''; // with ClientDataSet1 do // begin // First; // while not Eof do // begin // if FieldByName('SSel').AsBoolean = True then // begin // i := i + 1; // if TBtnEditC(Sender).text = '' then // TBtnEditC(Sender).text := FieldByName('ZDYName').AsString // else // TBtnEditC(Sender).text := TBtnEditC(Sender).text + ',' + FieldByName('ZDYName').AsString; //inttostr(i)+'.'+ // end; // Next; // end; // end; // end; // end; // finally // frmZDYHelpSel.Free; // end; end; procedure TfrmTradePlanInPut.CustomerNoNameBtnDnClick(Sender: TObject); begin TBtnEditC(Sender).Text := ''; TBtnEditC(Sender).TxtCode := ''; end; procedure TfrmTradePlanInPut.v1OrderUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); var mvalues: string; begin mvalues := tv1.Columns[tv1.Controller.FocusedColumn.index].DataBinding.FieldName; try frmZDYHelp := TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag := 'OrderUnit'; flagname := '数量单位'; if ShowModal = 1 then begin Self.CDS_1.Edit; Self.CDS_1.FieldByName(mvalues).Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmTradePlanInPut.v1OrderUnitPropertiesEditValueChanged(Sender: TObject); var mvalue, FFieldName, YValue: string; FDDQty, FCPCDXS, FQty, FDKCQty: Double; begin mvalue := TcxComboBox(Sender).EditingText; //变化后单位 FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName); with CDS_1 do begin Edit; FieldByName(FFieldName).Value := mvalue; Post; YValue := FieldByName('DDQtyUnit').AsString; //原单位=订单单位 FDDQty := FieldByName('DDQty').AsFloat; //订单数量 FCPCDXS := FieldByName('CPCDXS').AsFloat; FDKCQty := FieldByName('DKCQty').AsFloat; FQty := FieldByName('PRTOrderQty').AsFloat; end; if mvalue = 'Kg' then begin if YValue = 'Y' then begin FQty := FDDQty * 0.9144 / FCPCDXS; end; if YValue = 'M' then begin FQty := FDDQty / FCPCDXS; end; if YValue = 'Kg' then begin FQty := FDDQty; end; end; if mvalue = 'M' then begin if YValue = 'Y' then begin FQty := FDDQty * 0.9144; end; if YValue = 'Kg' then begin FQty := FDDQty * FCPCDXS; end; if YValue = 'M' then begin FQty := FDDQty; end; end; if mvalue = 'Y' then begin if YValue = 'M' then begin FQty := FDDQty / 0.9144; end; if YValue = 'Kg' then begin FQty := FDDQty * FCPCDXS / 0.9144; end; if YValue = 'Y' then begin FQty := FDDQty; end; end; with CDS_1 do begin Edit; FieldByName('PRTOrderQty').Value := FQty - FDKCQty; Post; end; Tv1.Controller.EditingController.ShowEdit(); end; procedure TfrmTradePlanInPut.v1PriceUnitPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); begin try frmZDYHelp := TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag := 'PriceUnit'; flagname := '价格单位'; if Trim(DParameters1) <> '高权限' then begin TBAdd.Visible := False; TBEdit.Visible := False; TBDel.Visible := False; end; if ShowModal = 1 then begin Self.CDS_1.Edit; Self.CDS_1.FieldByName('PriceUnit').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmTradePlanInPut.YCLFactoryBtnUpClick(Sender: TObject); var fsj: string; FWZ: Integer; begin fsj := Trim(TEdit(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 TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmTradePlanInPut.btnConSelClick(Sender: TObject); var FConFOMId, FMPRTCode: string; begin try frmSalesContractSel := TfrmSalesContractSel.Create(Application); with frmSalesContractSel do begin if ShowModal = 1 then begin while CDS_1.locate('SSel', true, []) do begin if self.CDS_1.locate('ConSId', trim(CDS_1.Fieldbyname('ConSId').AsString), []) then begin CDS_1.Edit; CDS_1.fieldbyname('SSel').value := false; continue; end; with self.CDS_1 do begin Append; FieldByName('SSel').Value := false; Fieldbyname('ConNo').value := trim(frmSalesContractSel.CDS_1.Fieldbyname('ConNo').AsString); Fieldbyname('ConMId').value := trim(frmSalesContractSel.CDS_1.Fieldbyname('ConMId').AsString); Fieldbyname('ConSId').value := trim(frmSalesContractSel.CDS_1.Fieldbyname('ConSId').AsString); Fieldbyname('C_Code').value := trim(frmSalesContractSel.CDS_1.Fieldbyname('C_Code').AsString); Fieldbyname('C_Name').value := trim(frmSalesContractSel.CDS_1.Fieldbyname('C_Name').AsString); Fieldbyname('C_Spec').value := trim(frmSalesContractSel.CDS_1.Fieldbyname('C_Spec').AsString); Fieldbyname('C_Composition').value := trim(frmSalesContractSel.CDS_1.Fieldbyname('C_Composition').AsString); Fieldbyname('C_Width').value := trim(frmSalesContractSel.CDS_1.Fieldbyname('C_Width').AsString); Fieldbyname('C_GramWeight').value := trim(frmSalesContractSel.CDS_1.Fieldbyname('C_GramWeight').AsString); Fieldbyname('OrdUnit').value := frmSalesContractSel.CDS_1.fieldbyname('ConUnit').AsString; Fieldbyname('C_ColorNo').value := trim(frmSalesContractSel.CDS_1.Fieldbyname('C_ColorNo').AsString); Fieldbyname('C_Color').value := trim(frmSalesContractSel.CDS_1.Fieldbyname('C_Color').AsString); Fieldbyname('C_Pattern').value := trim(frmSalesContractSel.CDS_1.Fieldbyname('C_Pattern').AsString); Fieldbyname('OrdQty').value := frmSalesContractSel.CDS_1.Fieldbyname('ConQty').AsFloat; Fieldbyname('OrdUnit').value := trim(frmSalesContractSel.CDS_1.Fieldbyname('ConUnit').AsString); end; CDS_1.Edit; CDS_1.fieldbyname('SSel').value := false; end; end; end; finally frmSalesContractSel.Free; end; end; procedure TfrmTradePlanInPut.ScrollBox1Click(Sender: TObject); begin FODate.SetFocus; end; procedure TfrmTradePlanInPut.OurCoNameBtnDnClick(Sender: TObject); begin TBtnEditC(Sender).Text := ''; TBtnEditC(Sender).TxtCode := ''; end; procedure TfrmTradePlanInPut.SYRNameBtnUpClick(Sender: TObject); var fsj: string; FWZ: Integer; begin fsj := Trim(TEdit(Sender).Hint); FWZ := Pos('/', fsj); try frmZDYHelp := TfrmZDYHelp.Create(Application); with frmZDYHelp do begin fnote := True; flag := Copy(fsj, 1, FWZ - 1); flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ); if ShowModal = 1 then begin TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmTradePlanInPut.Tv1Column4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); begin frmClothInfoSel := TfrmClothInfoSel.Create(self); with frmClothInfoSel do begin if showmodal = 1 then begin CDS_1.Edit; CDS_1.fieldbyname('MPRTCode').Value := CDS_1.fieldbyname('CYNO').asstring; CDS_1.fieldbyname('MPRTCodeName').Value := CDS_1.fieldbyname('CYName').asstring; CDS_1.fieldbyname('MPRTSpec').Value := CDS_1.fieldbyname('CYSpec').asstring; CDS_1.fieldbyname('MPRTCF').Value := CDS_1.fieldbyname('CYCF').asstring; CDS_1.fieldbyname('PRTColor').Value := CDS_1.fieldbyname('CYColor').asstring; CDS_1.fieldbyname('PRTHX').Value := CDS_1.fieldbyname('CYHX').asstring; CDS_1.fieldbyname('MPRTMF').Value := CDS_1.fieldbyname('CYMF').asstring; CDS_1.fieldbyname('MPRTKZ').Value := CDS_1.fieldbyname('CYKZ').asstring; CDS_1.fieldbyname('OrderUnit').Value := CDS_1.fieldbyname('CYPUnit').asstring; CDS_1.fieldbyname('SuoLv').Value := CDS_1.fieldbyname('SuoLv').asstring; CDS_1.fieldbyname('GcHuaNo').Value := CDS_1.fieldbyname('GcHua').asstring; CDS_1.fieldbyname('GsHuaNo').Value := CDS_1.fieldbyname('GsHua').asstring; CDS_1.Post; end; free; end; end; procedure TfrmTradePlanInPut.HYTTBtnUpClick(Sender: TObject); var fsj: string; FWZ: Integer; begin fsj := Trim(TEdit(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 TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmTradePlanInPut.KYTTBtnUpClick(Sender: TObject); var fsj: string; FWZ: Integer; begin fsj := Trim(TEdit(Sender).Hint); FWZ := Pos('/', fsj); try frmZDYHelp := TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag := Copy(fsj, 1, FWZ - 1); flagname := Copy(fsj, FWZ + 1, Length(fsj) - FWZ); if Trim(flag) = 'OrdDefStr2' then begin V1Name.Caption := '中文名称'; V1Note.Caption := '英文名称'; fnote := True; end; if ShowModal = 1 then begin TEdit(Sender).Text := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; end.