unit U_TatClothInfoInput; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, ADODB, DBClient, cxGridLevel, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid, ComCtrls, ToolWin, cxGridCustomPopupMenu, cxGridPopupMenu, cxTextEdit, cxButtonEdit, StdCtrls, ExtCtrls, cxCurrencyEdit, BtnEdit, U_BaseList, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore, dxSkinsDefaultPainters, cxNavigator, dxDateRanges, dxBarBuiltInMenu, cxPC, System.ImageList, Vcl.ImgList, U_BaseInput, cxCheckBox, dxSkinBasic, dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkroom, dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis, dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinOffice2016Colorful, dxSkinOffice2016Dark, dxSkinOffice2019Black, dxSkinOffice2019Colorful, dxSkinOffice2019DarkGray, dxSkinOffice2019White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringtime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinTheBezier, dxSkinValentine, dxSkinVisualStudio2013Blue, dxSkinVisualStudio2013Dark, dxSkinVisualStudio2013Light, dxSkinVS2010, dxSkinWhiteprint, dxSkinWXI, dxSkinXmas2008Blue, dxScrollbarAnnotations, cxContainer, cxMemo, cxMaskEdit; type TfrmTatClothInfoInput = class(TfrmBaseInput) ToolBar1: TToolBar; ToolButton1: TToolButton; TBClose: TToolButton; ADOQueryCmd: TADOQuery; ADOQueryTemp: TADOQuery; ScrollBox1: TScrollBox; Label1: TLabel; Label5: TLabel; Label3: TLabel; ToolButton6: TToolButton; BCIID: TEdit; CDS_1: TClientDataSet; DS_1: TDataSource; CDS_2: TClientDataSet; DS_2: TDataSource; ADOConnection1: TADOConnection; ImageList1: TImageList; Label16: TLabel; Label55: TLabel; cxPageControl3: TcxPageControl; cxTabSheet1: TcxTabSheet; GroupBox1: TGroupBox; Y_Note_PLJ: TMemo; Panel1: TPanel; cxPageControl2: TcxPageControl; cxGrid1: TcxGrid; TV1: TcxGridDBTableView; cxGridDBColumn3: TcxGridDBColumn; cxGridDBColumn4: TcxGridDBColumn; cxGridDBColumn5: TcxGridDBColumn; cxGridDBColumn8: TcxGridDBColumn; cxGridLevel2: TcxGridLevel; cxTabSheet2: TcxTabSheet; GroupBox2: TGroupBox; Y_Note_PLW: TMemo; Panel2: TPanel; cxPageControl1: TcxPageControl; cxGrid2: TcxGrid; Tv2: TcxGridDBTableView; v2Column10: TcxGridDBColumn; cxGridDBColumn1: TcxGridDBColumn; v2Column2: TcxGridDBColumn; v2Column6: TcxGridDBColumn; cxGridLevel1: TcxGridLevel; cxTabSheet3: TcxTabSheet; cxGrid4: TcxGrid; TV4: TcxGridDBTableView; TV4Column1: TcxGridDBColumn; cxGridDBColumn16: TcxGridDBColumn; cxGridDBColumn17: TcxGridDBColumn; cxGridLevel5: TcxGridLevel; Panel8: TPanel; ToolBar4: TToolBar; ToolButton9: TToolButton; ToolButton10: TToolButton; Panel7: TPanel; Label49: TLabel; Edit1: TEdit; CDS_4: TClientDataSet; DS_4: TDataSource; GPM_1: TcxGridPopupMenu; GPM_2: TcxGridPopupMenu; GPM_4: TcxGridPopupMenu; ToolButton11: TToolButton; CINote: TcxMemo; ThroughHealdOrder: TcxMemo; C_Code: TcxTextEdit; Label2: TLabel; Label4: TLabel; Label6: TLabel; Label7: TLabel; Label8: TLabel; Label9: TLabel; Label10: TLabel; LoomType: TcxTextEdit; C_Name: TcxTextEdit; C_YarnQty: TcxTextEdit; C_ReedWidth: TcxTextEdit; C_ReedNo: TcxTextEdit; C_GramWeight: TcxTextEdit; C_TestGramWeight: TcxTextEdit; C_FinishLatitudeDensity: TcxTextEdit; TV1Column7: TcxGridDBColumn; Tv2Column7: TcxGridDBColumn; TV1Column1: TcxGridDBColumn; TV1Column2: TcxGridDBColumn; TV1Column3: TcxGridDBColumn; TV1Column4: TcxGridDBColumn; TV1Column5: TcxGridDBColumn; TV1Column6: TcxGridDBColumn; TV1Column8: TcxGridDBColumn; TV1Column9: TcxGridDBColumn; TV1Column10: TcxGridDBColumn; Tv2Column1: TcxGridDBColumn; Tv2Column2: TcxGridDBColumn; Tv2Column3: TcxGridDBColumn; Tv2Column4: TcxGridDBColumn; Tv2Column5: TcxGridDBColumn; Tv2Column6: TcxGridDBColumn; Tv2Column8: TcxGridDBColumn; Tv2Column9: TcxGridDBColumn; Tv2Column10: TcxGridDBColumn; lbl1: TLabel; lbl2: TLabel; WB_Code: TcxButtonEdit; WB_Name: TcxTextEdit; procedure FormShow(Sender: TObject); procedure TBCloseClick(Sender: TObject); procedure ToolButton1Click(Sender: TObject); procedure CYColorKeyPress(Sender: TObject; var Key: Char); procedure CYMFExit(Sender: TObject); procedure FormCreate(Sender: TObject); procedure CYJGGYBtnDnClick(Sender: TObject); procedure C_WidthBtnDnClick(Sender: TObject); procedure C_WidthBtnUpClick(Sender: TObject); procedure ToolButton6Click(Sender: TObject); procedure ToolButton7Click(Sender: TObject); procedure ToolButton9Click(Sender: TObject); procedure ToolButton10Click(Sender: TObject); procedure Edit1KeyPress(Sender: TObject; var Key: Char); procedure ToolButton11Click(Sender: TObject); procedure cxGridDBColumn3PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure v2Column10PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure cxGridDBColumn4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure cxGridDBColumn1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); procedure WB_CodePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); private canshu1: string; Fint: Integer; procedure InitGrid(); function SaveData(): Boolean; { Private declarations } public FBCIID, FCTID: string; CopyInt: Integer; { Public declarations } end; var frmTatClothInfoInput: TfrmTatClothInfoInput; implementation uses U_DataLink, U_RTFun, U_iniParam, U_ZDYHelp, U_AttachmentUpload, U_YarnInfoSel, U_WBSpecSel; {$R *.dfm} procedure TfrmTatClothInfoInput.InitGrid(); begin with ADOQueryTemp do begin Close; SQL.Clear; SQL.Add('select * from BS_Cloth_Info where BCIID=''' + Trim(FBCIID) + ''''); Open; end; SCSHData(ADOQueryTemp, ScrollBox1, 2); SCSHData(ADOQueryTemp, ScrollBox1, 0); with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select A.* from BS_Cloth_Yarn A '); sql.Add(' where YRType=''经丝'' and A.BCIID=''' + Trim(FBCIID) + ''''); Open; end; SCreateCDS(ADOQueryTemp, CDS_1); SInitCDSData(ADOQueryTemp, CDS_1); with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select A.* from BS_Cloth_Yarn A '); sql.Add(' where YRType=''纬丝'' and A.BCIID=''' + Trim(FBCIID) + ''''); Open; end; SCreateCDS(ADOQueryTemp, CDS_2); SInitCDSData(ADOQueryTemp, CDS_2); if FBCIID = '' then begin with CDS_1 do begin Append; FieldByName('RowNo').Value := 'A'; Post; Append; FieldByName('RowNo').Value := 'B'; Post; Append; FieldByName('RowNo').Value := 'C'; Post; Append; FieldByName('RowNo').Value := 'D'; Post; Append; FieldByName('RowNo').Value := 'E'; Post; Append; FieldByName('RowNo').Value := 'F'; Post; Append; FieldByName('RowNo').Value := 'G'; Post; end; with CDS_2 do begin Append; FieldByName('RowNo').Value := 'A'; Post; Append; FieldByName('RowNo').Value := 'B'; Post; Append; FieldByName('RowNo').Value := 'C'; Post; Append; FieldByName('RowNo').Value := 'D'; Post; Append; FieldByName('RowNo').Value := 'E'; Post; Append; FieldByName('RowNo').Value := 'F'; Post; Append; FieldByName('RowNo').Value := 'G'; Post; end; end; /////////////////刷新起综工艺单信息///////////////////////// with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select * from BS_CLoth_QZ where BCIID=''' + Trim(FBCIID) + ''''); Open; end; SCreateCDS(ADOQueryTemp, CDS_4); SInitCDSData(ADOQueryTemp, CDS_4); /////////////////刷新起综工艺单信息///////////////////////// /// end; procedure TfrmTatClothInfoInput.FormShow(Sender: TObject); begin readCxGrid(self.Caption + 'TV1', Tv1, '样品管理'); readCxGrid(self.Caption + 'TV2', Tv2, '样品管理'); readCxGrid(self.Caption + 'TV4', Tv4, '样品管理'); InitGrid(); if CopyInt = 1 then begin FBCIID := ''; BCIID.text := ''; C_Code.text := ''; end; end; procedure TfrmTatClothInfoInput.TBCloseClick(Sender: TObject); begin Close; end; function TfrmTatClothInfoInput.SaveData(): Boolean; var maxId, maxpbno, maxQZID: string; begin try ADOQueryCmd.Connection.BeginTrans; if Trim(FBCIID) = '' then begin if GetLSNo(ADOQueryCmd, maxId, 'Y', 'BS_Cloth_Info', 4, 1) = False then begin Result := False; ADOQueryCmd.Connection.RollbackTrans; Application.MessageBox('取最大号失败!', '提示', 0); Exit; end; BCIID.Text := trim(maxId); end else begin maxId := Trim(FBCIID); end; with ADOQueryCmd do begin Close; SQL.Clear; sql.Add('select * from BS_Cloth_Info where BCIID=''' + Trim(FBCIID) + ''''); Open; end; with ADOQueryCmd do begin if Trim(FBCIID) = '' then begin Append; FieldByName('CTID').Value := Trim(FCTID); FieldByName('FILLID').Value := Trim(DCode); 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('BCIID').Value := Trim(maxId); if trim(C_Code.Text) = '' then C_Code.Text := Trim(maxId); RTSetsavedata(ADOQueryCmd, 'BS_Cloth_Info', ScrollBox1, 2); Post; end; with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select count(*) as AA from BS_Cloth_Info where C_Code=''' + Trim(C_Code.Text) + ''''); Open; if FieldByName('AA').AsInteger > 1 then begin ADOQueryCmd.Connection.RollbackTrans; Result := False; Application.MessageBox('编号重复!', '提示', 0); Exit; end; end; ////////////////////////// 保存经丝配比表 ////////////////////////// with CDS_1 do begin First; while not Eof do begin if Trim(CDS_1.fieldbyname('YRId').AsString) = '' then begin if GetLSNo(ADOQueryTemp, maxpbno, 'RJ', 'BS_Cloth_Yarn', 4, 1) = False then begin ADOQueryCmd.Connection.RollbackTrans; Application.MessageBox('取配比子流水号失败!', '提示', 0); Exit; end; end else begin maxpbno := Trim(CDS_1.fieldbyname('YRId').AsString); end; with ADOQueryCmd do begin Close; SQL.Clear; sql.Add('select * from BS_Cloth_Yarn where '); sql.Add(' YRId=''' + Trim(maxpbno) + ''''); Open; end; with ADOQueryCmd do begin if Trim(CDS_1.fieldbyname('YRId').AsString) = '' then begin Append; FieldByName('Filler').Value := Trim(DName); FieldByName('FillTime').Value := SGetServerDateTime(ADOQueryTemp); end else begin Edit; FieldByName('Editer').Value := Trim(DName); FieldByName('EditTime').Value := SGetServerDateTime(ADOQueryTemp); end; FieldByName('YRType').Value := '经丝'; FieldByName('BCIID').Value := Trim(maxId); FieldByName('YRId').Value := Trim(maxpbno); RTSetSaveDataCDS(ADOQueryCmd, Tv2, CDS_1, 'BS_Cloth_Yarn', 0); Post; end; CDS_1.Edit; CDS_1.FieldByName('BCIID').Value := Trim(maxId); CDS_1.FieldByName('YRId').Value := Trim(maxpbno); Next; end; end; ////////////////////////// 保存经丝配比表 ////////////////////////// ////////////////////////// 保存纬丝配比表 ////////////////////////// with CDS_2 do begin First; while not Eof do begin if Trim(CDS_2.fieldbyname('YRId').AsString) = '' then begin if GetLSNo(ADOQueryTemp, maxpbno, 'RJ', 'BS_Cloth_Yarn', 4, 1) = False then begin ADOQueryCmd.Connection.RollbackTrans; Application.MessageBox('取配比子流水号失败!', '提示', 0); Exit; end; end else begin maxpbno := Trim(CDS_2.fieldbyname('YRId').AsString); end; with ADOQueryCmd do begin Close; SQL.Clear; sql.Add('select * from BS_Cloth_Yarn where '); sql.Add(' YRId=''' + Trim(maxpbno) + ''''); Open; end; with ADOQueryCmd do begin if Trim(CDS_2.fieldbyname('YRId').AsString) = '' then begin Append; FieldByName('Filler').Value := Trim(DName); FieldByName('FillTime').Value := SGetServerDateTime(ADOQueryTemp); end else begin Edit; FieldByName('Editer').Value := Trim(DName); FieldByName('EditTime').Value := SGetServerDateTime(ADOQueryTemp); end; FieldByName('YRType').Value := '纬丝'; FieldByName('BCIID').Value := Trim(maxId); FieldByName('YRId').Value := Trim(maxpbno); RTSetSaveDataCDS(ADOQueryCmd, Tv2, CDS_2, 'BS_Cloth_Yarn', 0); Post; end; CDS_2.Edit; CDS_2.FieldByName('BCIID').Value := Trim(maxId); CDS_2.FieldByName('YRId').Value := Trim(maxpbno); Next; end; end; ////////////////////////// 保存纬丝配比表 ////////////////////////// ////////////////////////// 保存起综 ////////////////////////// with CDS_4 do begin First; while not Eof do begin if Trim(CDS_4.fieldbyname('QZID').AsString) = '' then begin if GetLSNo(ADOQueryTemp, maxQZID, 'QZ', 'BS_CLoth_QZ', 4, 1) = False then raise Exception.Create('取配比子流水号失败!'); end else begin maxQZID := Trim(CDS_4.fieldbyname('QZID').AsString); end; with ADOQueryCmd do begin Close; SQL.Clear; sql.Add('select * from BS_CLoth_QZ where '); sql.Add(' QZID=''' + Trim(maxQZID) + ''''); Open; end; with ADOQueryCmd do begin if Trim(CDS_4.fieldbyname('QZID').AsString) = '' then begin Append; end else begin Edit; end; FieldByName('BCIID').Value := Trim(maxId); FieldByName('QZID').Value := Trim(maxQZID); RTSetSaveDataCDS(ADOQueryCmd, Tv4, CDS_4, 'BS_CLoth_QZ', 0); Post; end; CDS_4.Edit; CDS_4.FieldByName('BCIID').Value := Trim(maxId); CDS_4.FieldByName('QZID').Value := Trim(maxQZID); Next; end; end; ////////////////////////// 保存起综 ////////////////////////// ADOQueryCmd.Connection.CommitTrans; FBCIID := maxId; Result := True; except Result := False; ADOQueryCmd.Connection.RollbackTrans; Application.MessageBox('保存失败!', '提示', 0); end; end; procedure TfrmTatClothInfoInput.CYJGGYBtnDnClick(Sender: TObject); begin TBtnEditC(Sender).Text := ''; end; procedure TfrmTatClothInfoInput.ToolButton10Click(Sender: TObject); begin if CDS_4.IsEmpty then exit; if CDS_4.Locate('ssel', True, []) = False then begin Application.MessageBox('没有选择数据!', '提示', 0); Exit; end; if Application.MessageBox('确定要作废数据吗?作废后数据不能恢复。', '提示', 32 + 4) <> IDYES then Exit; CDS_4.DisableControls; with CDS_4 do begin First; while not Eof do begin if CDS_4.FieldByName('SSel').AsBoolean = True then begin if Trim(CDS_4.fieldbyname('QZID').AsString) <> '' then with ADOQueryCmd do begin Close; sql.Clear; sql.Add('delete BS_CLoth_QZ where QZID=''' + Trim(CDS_4.fieldbyname('QZID').AsString) + ''''); ExecSQL; end; CDS_4.Delete; end else Next; end; end; CDS_4.EnableControls; end; procedure TfrmTatClothInfoInput.ToolButton11Click(Sender: TObject); begin WriteCxGrid(self.Caption + 'TV1', Tv1, '样品管理'); WriteCxGrid(self.Caption + 'TV2', Tv2, '样品管理'); WriteCxGrid(self.Caption + 'TV4', Tv4, '样品管理'); end; procedure TfrmTatClothInfoInput.ToolButton1Click(Sender: TObject); var MC_Code: string; begin C_Name.SetFocus; if C_Name.Text = '' then begin Application.MessageBox('产品名称不能为空!', '提示', 0); Exit; end; if trim(C_Code.Text) = '' then begin if GetLSNo(ADOQueryCmd, MC_Code, 'C', 'BS_Cloth_Info', 4, 0) = False then begin Application.MessageBox('取最成品编号失败!', '提示', 0); Exit; end; C_Code.Text := MC_Code; end; if SaveData() then begin Application.MessageBox('保存成功!', '提示', 0); ModalResult := 1; end; end; procedure TfrmTatClothInfoInput.cxGridDBColumn1PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); begin try frmZDYHelp := TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag := 'Y_Name'; flagname := '原料名称'; if ShowModal = 1 then begin Self.CDS_2.Edit; Self.CDS_2.FieldByName('Y_Name').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmTatClothInfoInput.cxGridDBColumn3PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); begin try frmYarnInfoSel := TfrmYarnInfoSel.Create(Application); with frmYarnInfoSel do begin if ShowModal = 1 then begin with self.CDS_1 do begin Edit; FieldByName('Brand').Value := frmYarnInfoSel.CDS_1.fieldbyname('Brand').Value; FieldByName('Y_Code').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Code').Value; FieldByName('Y_Name').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Name').Value; FieldByName('Y_Color').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Color').Value; Post; end; end; end; finally frmYarnInfoSel.Free; end; end; procedure TfrmTatClothInfoInput.cxGridDBColumn4PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); begin try frmZDYHelp := TfrmZDYHelp.Create(Application); with frmZDYHelp do begin flag := 'Y_Name'; flagname := '原料名称'; if ShowModal = 1 then begin Self.CDS_1.Edit; Self.CDS_1.FieldByName('Y_Name').Value := Trim(ClientDataSet1.fieldbyname('ZDYName').AsString); end; end; finally frmZDYHelp.Free; end; end; procedure TfrmTatClothInfoInput.CYColorKeyPress(Sender: TObject; var Key: Char); begin if Key = #13 then begin Key := #0; SelectNext(ActiveControl as TWinControl, True, True); end; end; procedure TfrmTatClothInfoInput.C_WidthBtnDnClick(Sender: TObject); begin TBtnEditC(Sender).Text := ''; TBtnEditC(Sender).TxtCode := ''; end; procedure TfrmTatClothInfoInput.C_WidthBtnUpClick(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 TfrmTatClothInfoInput.Edit1KeyPress(Sender: TObject; var Key: Char); var i, j: Integer; begin if Key = #13 then begin if Edit1.Text <> '' then begin i := CDS_4.RecordCount; i := i + 1; with CDS_4 do begin Append; FieldByName('SSEL').Value := FALSE; FieldByName('XuNO').Value := i; FieldByName('DZZQZGL').Value := Trim(Edit1.Text); Post; end; Edit1.Text := ''; end; end; end; procedure TfrmTatClothInfoInput.CYMFExit(Sender: TObject); begin // if pos('"', trim(CYMF.Text)) = 0 then // begin // if pos('CM', trim(CYMF.Text)) = 0 then // CYMF.Text := trim(CYMF.Text) + 'CM'; // end; end; procedure TfrmTatClothInfoInput.FormCreate(Sender: TObject); begin inherited; try with ADOConnection1 do begin Connected := false; ConnectionString := DConString; Connected := true; end; ADOQueryBaseCmd.Connection := ADOConnection1; ADOQueryBaseTemp.Connection := ADOConnection1; except application.MessageBox('网络连接失败!', '提示信息'); end; // LaYangDate.DateTime := SGetServerDateTime(ADOQueryTemp); end; procedure TfrmTatClothInfoInput.ToolButton6Click(Sender: TObject); begin if trim(C_Code.Text) = '' then Exit; try frmAttachmentUpload := TfrmAttachmentUpload.Create(Application); with frmAttachmentUpload do begin FEditAuthority := True; fkeyNO := trim(C_Code.Text); fType := '成品档案'; if ShowModal = 1 then begin end; end; finally frmAttachmentUpload.Free; end; end; procedure TfrmTatClothInfoInput.ToolButton7Click(Sender: TObject); begin // if CDS_2.IsEmpty then // Exit; // if Trim(CDS_2.fieldbyname('YRId').AsString) <> '' then // begin // if Application.MessageBox('确定要删除数据吗?', '提示', 32 + 4) <> IDYES then // Exit; // with ADOQueryCmd do // begin // Close; // sql.Clear; // sql.Add('delete BS_Cloth_Yarn where YRId=''' + Trim(CDS_2.fieldbyname('YRId').AsString) + ''''); // ExecSQL; // end; // end; // CDS_2.Delete; end; procedure TfrmTatClothInfoInput.ToolButton9Click(Sender: TObject); var i, j: Integer; begin for j := 0 to 5 do begin i := CDS_4.RecordCount; i := i + 1; with CDS_4 do begin Append; FieldByName('SSEL').Value := FALSE; FieldByName('XuNO').Value := i; Post; end; end; end; procedure TfrmTatClothInfoInput.v2Column10PropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); begin try frmYarnInfoSel := TfrmYarnInfoSel.Create(Application); with frmYarnInfoSel do begin if ShowModal = 1 then begin with self.CDS_2 do begin Edit; FieldByName('Brand').Value := frmYarnInfoSel.CDS_1.fieldbyname('Brand').Value; FieldByName('Y_Code').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Code').Value; FieldByName('Y_Name').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Name').Value; FieldByName('Y_Color').Value := frmYarnInfoSel.CDS_1.fieldbyname('Y_Color').Value; Post; end; end; end; finally frmYarnInfoSel.Free; end; end; procedure TfrmTatClothInfoInput.WB_CodePropertiesButtonClick(Sender: TObject; AButtonIndex: Integer); begin try frmWBSpecSel := TfrmWBSpecSel.Create(Application); with frmWBSpecSel do begin if ShowModal = 1 then begin Self.WB_Code.Text := Trim(frmWBSpecSel.CDS_1.fieldbyname('WB_Code').AsString); Self.WB_Name.Text := Trim(frmWBSpecSel.CDS_1.fieldbyname('WB_Name').AsString); end; end; finally frmWBSpecSel.Free; end; end; end.