unit U_DJBRKList; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB, cxDBData, cxGridCustomTableView, cxGridTableView, cxGridBandedTableView, cxGridDBBandedTableView, cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGridDBTableView, cxGrid, StdCtrls, ComCtrls, ExtCtrls, ToolWin, cxGridCustomPopupMenu, cxGridPopupMenu, ADODB, DBClient, cxDropDownEdit, cxCheckBox, RM_Common, RM_Class, RM_e_Xls, RM_Dataset, RM_System, RM_GridReport, Menus, cxCalendar, cxButtonEdit, cxTextEdit, BtnEdit; type TfrmDJBRKList = class(TForm) ToolBar1: TToolBar; TBRafresh: TToolButton; TBFind: TToolButton; TBExport: TToolButton; TBClose: TToolButton; Panel1: TPanel; ADOQueryCmd: TADOQuery; ADOQueryMain: TADOQuery; ADOQueryTemp: TADOQuery; DataSource1: TDataSource; cxGridPopupMenu1: TcxGridPopupMenu; Label1: TLabel; Label2: TLabel; BegDate: TDateTimePicker; EndDate: TDateTimePicker; CDS_Main: TClientDataSet; RM1: TRMGridReport; RMDBMain: TRMDBDataSet; RMXLSExport1: TRMXLSExport; TBDel: TToolButton; PopupMenu1: TPopupMenu; N1: TMenuItem; N2: TMenuItem; TBAdd: TToolButton; TBEdit: TToolButton; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label8: TLabel; SPName: TEdit; FactoryName: TEdit; SPID: TEdit; SPSpec: TEdit; Label6: TLabel; SPCF: TEdit; Label7: TLabel; OrderNo: TEdit; cxGrid2: TcxGrid; Tv1: TcxGridDBTableView; v1Column6: TcxGridDBColumn; v1Column2: TcxGridDBColumn; v1Column4: TcxGridDBColumn; v1Column15: TcxGridDBColumn; v1Column17: TcxGridDBColumn; v1Column14: TcxGridDBColumn; v2Column1: TcxGridDBColumn; v1Column8: TcxGridDBColumn; v1Column7: TcxGridDBColumn; v1Column1: TcxGridDBColumn; v1Column10: TcxGridDBColumn; v1Column9: TcxGridDBColumn; v2Column6: TcxGridDBColumn; v1Column3: TcxGridDBColumn; cxGrid2Level1: TcxGridLevel; Label9: TLabel; ToFactoryName: TEdit; Label12: TLabel; CRType: TComboBox; Label10: TLabel; KuWei: TEdit; v1Column19: TcxGridDBColumn; Label11: TLabel; RCGangNo: TEdit; Label13: TLabel; SPColor: TEdit; Label15: TLabel; SPHX: TEdit; v1Column20: TcxGridDBColumn; Filler: TEdit; Label16: TLabel; v1Column24: TcxGridDBColumn; TBPrint: TToolButton; ADOQueryPrint: TADOQuery; v1Column5: TcxGridDBColumn; v1Column11: TcxGridDBColumn; RMDB_Main: TRMDBDataSet; RM2: TRMGridReport; TBPrint1: TToolButton; v1Column13: TcxGridDBColumn; v1Column18: TcxGridDBColumn; batchNo: TEdit; Label14: TLabel; begTime: TDateTimePicker; endTime: TDateTimePicker; v1Column21: TcxGridDBColumn; v1Column22: TcxGridDBColumn; Panel5: TPanel; Label28: TLabel; Button5: TButton; Button6: TButton; factoryName1: TBtnEditA; TBTSedit: TToolButton; Label17: TLabel; Com_CRype: TComboBox; Button1: TButton; Label18: TLabel; edit_batchNo: TEdit; edit_gangNo: TEdit; Label19: TLabel; Button2: TButton; Button3: TButton; GYSType: TComboBox; Label20: TLabel; v1Column23: TcxGridDBColumn; SPKZ1: TEdit; Label21: TLabel; C_CodeNameZW: TEdit; Label22: TLabel; v1Column12: TcxGridDBColumn; note: TEdit; Label23: TLabel; edit_note: TEdit; Label24: TLabel; Button4: TButton; procedure FormDestroy(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormCreate(Sender: TObject); procedure TBRafreshClick(Sender: TObject); procedure ConNoMChange(Sender: TObject); procedure TBCloseClick(Sender: TObject); procedure FormShow(Sender: TObject); procedure TBExportClick(Sender: TObject); procedure TBFindClick(Sender: TObject); procedure N1Click(Sender: TObject); procedure N2Click(Sender: TObject); procedure TBDelClick(Sender: TObject); procedure TBAddClick(Sender: TObject); procedure TBEditClick(Sender: TObject); procedure SPIDKeyPress(Sender: TObject; var Key: Char); procedure SPIDChange(Sender: TObject); procedure SPSpecChange(Sender: TObject); procedure FactoryNameChange(Sender: TObject); procedure TBPrintClick(Sender: TObject); procedure TBPrint1Click(Sender: TObject); procedure factoryName1BtnClick(Sender: TObject); procedure Button6Click(Sender: TObject); procedure Button5Click(Sender: TObject); procedure TBTSeditClick(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure Button4Click(Sender: TObject); private canshu1,canshu2:string; procedure InitGrid(); Procedure PrintData(fMJID:string); { Private declarations } public fckName:string; { Public declarations } end; var frmDJBRKList: TfrmDJBRKList; implementation uses U_DataLink,U_RTFun,U_DJBCKInPut, U_DJBRK_Edit, U_ZdyAttachGYS; {$R *.dfm} Procedure TfrmDJBRKList.PrintData(fMJID:string); var fPrintFile:String; Txt,fImagePath:string; Moudle: THandle; Makebar:TMakebar; Mixtext:TMixtext; begin try Moudle:=LoadLibrary('MakeQRBarcode.dll'); @Makebar:=GetProcAddress(Moudle,'Make'); @Mixtext:=GetProcAddress(Moudle,'MixText'); Txt:=Trim(fMJID); fImagePath:=ExtractFilePath(Application.ExeName)+'image\temp.bmp' ; if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName)+'image')) then CreateDirectory(pchar(ExtractFilePath(Application.ExeName)+'image'),nil); if FileExists(fImagePath) then DeleteFile(fImagePath); Makebar(pchar(Txt),Length(Txt),3,3,0,PChar(fImagePath),3); except application.MessageBox('条形码生成失败!','提示信息',MB_ICONERROR); exit; end; with ADOQueryPrint do begin Close; SQL.Clear; sql.Add('select A.*,C_CodeNameZW=(select Top 1 defnote3 from KH_Zdy_Attachment X where X.ZdyName=A.C_CodeName and Type=''CP'') '); sql.Add(',C_colorName=(select Top 1 DEFstr6 from KH_Zdy_Attachment X where X.ZdyName=A.C_CodeName and X.DEFstr3=A.C_Color and Type=''CP'') '); sql.Add(',factoryNameJZ=(select Top 1 zdyNameZ from KH_Zdy_Attachment X where X.ZdyName=A.factoryName and Type=''GYS'') '); sql.Add(' from WFB_MJJY A') ; SQL.Add(' where A.MJID='''+Trim(fMJID)+''''); Open; end; fPrintFile:=ExtractFilePath(Application.ExeName)+'Report\通用标签.rmf' ; if FileExists(fPrintFile) then begin RMVariables['QRBARCODE']:=fImagePath; RM2.LoadFromFile(fPrintFile); RM2.DefaultCopies:=1; RM2.PrintReport; end else begin Application.MessageBox(PChar('没有找到'+trim(fPrintFile)),'提示',0); end; end; procedure TfrmDJBRKList.FormDestroy(Sender: TObject); begin frmDJBRKList:=nil; end; procedure TfrmDJBRKList.FormClose(Sender: TObject; var Action: TCloseAction); begin Action:=caFree; end; procedure TfrmDJBRKList.FormCreate(Sender: TObject); begin //cxGrid1.Align:=alClient; canshu1:=Trim(DParameters1); canshu2:=Trim(DParameters2); EndDate.DateTime:=SGetServerDate10(ADOQueryTemp); BegDate.DateTime:=SGetServerDate10(ADOQueryTemp); end; procedure TfrmDJBRKList.InitGrid(); var mBegdate,mEnddate:string; begin mbegdate:=FormatDateTime('yyyy-MM-dd',begdate.Date)+' '+FormatDateTime('HH:nn',begTime.Time); menddate:=FormatDateTime('yyyy-MM-dd',enddate.Date)+' '+FormatDateTime('HH:nn',endTime.Time); try ADOQueryMain.DisableControls; with ADOQueryMain do begin Close; Filtered:=False; sql.Clear; sql.Add(' select A.*,cast(spkz as varchar) as spkz1 '); sql.Add(' ,C_CodeNameZW=(select Top 1 defnote3 from KH_Zdy_Attachment X where X.ZdyName=A.SPName and Type=''CP'') '); sql.Add(' ,GYSType=(select Top 1 defstr5 from KH_Zdy_Attachment X where X.zdyName=A.FactoryName and Type=''GYS'') '); sql.Add(' ,MJLen=(select sum(MJlen) from WFB_MJJY X where X.APID=A.SPID ) '); sql.Add(' from CK_SXPB_CR A'); sql.add(' where A.CRTime>='''+FormatDateTime('yyyy-MM-dd',begdate.Date)+''' '); sql.add(' and A.CRTime<'''+FormatDateTime('yyyy-MM-dd',enddate.Date+1)+''' '); sql.Add(' and isnull(CKName,'''')='''+trim(fckName)+''''); SQL.Add(' and CRFlag=''入库'' '); Open; // ShowMessage(SQL.Text); end; SCreateCDS20(ADOQueryMain,CDS_Main); SInitCDSData20(ADOQueryMain,CDS_Main); finally ADOQueryMain.EnableControls; tbfind.Click; end; end; procedure TfrmDJBRKList.TBRafreshClick(Sender: TObject); begin BegDate.SetFocus; InitGrid(); end; procedure TfrmDJBRKList.ConNoMChange(Sender: TObject); begin if ADOQueryMain.Active then begin SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2)); end; end; procedure TfrmDJBRKList.TBCloseClick(Sender: TObject); begin WriteCxGrid('待检布入库列表',Tv1,'待检布仓库'); Close; end; procedure TfrmDJBRKList.FormShow(Sender: TObject); begin if Trim(canshu2)='查看' then begin TBAdd.Visible:=False; TBDel.Visible:=False; TBEdit.Visible:=False; TBtsedit.Visible:=false; end else begin TBAdd.Visible:=True; TBDel.Visible:=True; TBEdit.Visible:=True; TBtsedit.Visible:=True; end; ReadCxGrid('待检布入库列表',Tv1,'待检布仓库'); InitGrid(); end; procedure TfrmDJBRKList.TBExportClick(Sender: TObject); begin if ADOQueryMain.IsEmpty then exit; TcxGridToExcel('待检布入库列表',cxGrid2); end; procedure TfrmDJBRKList.TBFindClick(Sender: TObject); begin if ADOQueryMain.Active then begin SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2)); SCreateCDS20(ADOQueryMain,CDS_Main); SInitCDSData20(ADOQueryMain,CDS_Main); end; end; procedure TfrmDJBRKList.N1Click(Sender: TObject); begin SelOKNo(CDS_Main,True); end; procedure TfrmDJBRKList.N2Click(Sender: TObject); begin SelOKNo(CDS_Main,False); end; procedure TfrmDJBRKList.TBDelClick(Sender: TObject); begin if CDS_Main.IsEmpty then Exit; with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select APID from CK_BanCP_CR where isnull(APID,'''')='''+Trim(CDS_Main.fieldbyname('SPID').AsString)+''''); Open; end; if not ADOQueryTemp.IsEmpty then begin Application.MessageBox('已入库不能删除数据!','提示',0); Exit; end; { if Trim(CDS_Main.fieldbyname('SPID').AsString)<>'' then begin if Trim(CDS_Main.fieldbyname('CRType').AsString)='平移入库' then begin Application.MessageBox('平移入库的数据为自动生成,不能删除!','提示',0); Exit; end; with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select * from CK_SXPB_CR where FZSPID='''+Trim(CDS_Main.fieldbyname('SPID').AsString)+''''); sql.Add(' and CRQtyFlag=-1'); Open; end; if ADOQueryTemp.IsEmpty=False then begin Application.MessageBox('已有出库记录,不能删除!','提示',0); Exit; end; } if Application.MessageBox('确定要删除数据吗?','提示',32+4)<>IDYES then Exit; try ADOQueryCmd.Connection.BeginTrans; with ADOQueryCmd do begin Close; sql.Clear; sql.Add('delete CK_SXPB_CR where SPID='''+Trim(CDS_Main.fieldbyname('SPID').AsString)+''''); sql.Add('delete from WFB_MJJY where not exists(select SPID from CK_SXPB_CR X where X.SPID=WFB_MJJY.APID)'); if Trim(CDS_Main.fieldbyname('CRType').AsString)='客户退货' then begin sql.Add('delete from YF_Money_CR '); sql.Add(' where mainID='''+Trim(CDS_Main.fieldbyname('SPID').AsString)+''''); end; ExecSQL; end; ADOQueryCmd.Connection.CommitTrans; CDS_Main.Delete; except ADOQueryCmd.Connection.RollbackTrans; Application.MessageBox('删除异常!','提示',0); end; end; procedure TfrmDJBRKList.TBAddClick(Sender: TObject); begin { try frmDJBCKInPut:=TfrmDJBCKInPut.Create(Application); with frmDJBCKInPut do begin FBCId:=''; fckName:=self.fckName; if ShowModal=1 then begin Self.InitGrid(); end; end; finally frmDJBCKInPut.Free; end;} try frmDJBRK_Edit:=TfrmDJBRK_Edit.Create(Application); with frmDJBRK_Edit do begin fkeyNo:=''; fckName:=self.fckName; if ShowModal=1 then begin Self.InitGrid(); end; end; finally frmDJBRK_Edit.Free; end; end; procedure TfrmDJBRKList.TBEditClick(Sender: TObject); begin if CDS_Main.IsEmpty then Exit; if Trim(CDS_Main.fieldbyname('CRType').AsString)='平移入库' then begin Application.MessageBox('平移入库的数据为自动生成,不能修改!','提示',0); Exit; end; with ADOQueryTemp do begin Close; sql.Clear; sql.Add('select APID from CK_BanCP_CR where isnull(APID,'''')='''+Trim(CDS_Main.fieldbyname('SPID').AsString)+''''); Open; end; if not ADOQueryTemp.IsEmpty then begin Application.MessageBox('已入库不能修改数据!','提示',0); Exit; end; { try frmDJBCKInPut:=TfrmDJBCKInPut.Create(Application); with frmDJBCKInPut do begin FBCId:=Trim(CDS_Main.fieldbyname('SPID').AsString); TBDel.Visible:=False; TBAdd.Visible:=False; fckName:=self.fckName; if ShowModal=1 then begin Self.InitGrid(); end; end; finally frmDJBCKInPut.Free; end; } try frmDJBRK_Edit:=TfrmDJBRK_Edit.Create(Application); with frmDJBRK_Edit do begin fkeyNo:=Trim(self.CDS_Main.fieldbyname('SPID').AsString); fckName:=self.fckName; TBDel.Visible:=False; TBAdd.Visible:=False; if ShowModal=1 then begin Self.InitGrid(); end; end; finally frmDJBRK_Edit.Free; end; end; procedure TfrmDJBRKList.SPIDKeyPress(Sender: TObject; var Key: Char); begin if Key=#13 then begin {if Length(Trim(SPID.Text))<4 then Exit; try ADOQueryMain.DisableControls; with ADOQueryMain do begin Filtered:=False; Close; sql.Clear; sql.Add(' select A.* '); sql.Add(',ConNo=(select ConNo from Contract_Main CM where CM.MainId=A.CGMainId)'); //sql.Add(' ,ConNo=(select ConNo from Contract_Main CM where CM.MainId=A.CGMainId )'); sql.Add(' from CK_SXPB_CR A'); sql.add(' where SPID like :SXID'); Parameters.ParamByName('SXID').Value:='%'+Trim(SXID.Text)+'%'; Open; //ShowMessage(SQL.Text); end; SCreateCDS20(ADOQueryMain,CDS_Main); SInitCDSData20(ADOQueryMain,CDS_Main); finally ADOQueryMain.EnableControls; end; } end; end; procedure TfrmDJBRKList.SPIDChange(Sender: TObject); begin if Length(Trim(SPID.Text))<4 then begin if Trim(SPID.Text)<>'' then Exit; end; TBFind.Click; end; procedure TfrmDJBRKList.SPSpecChange(Sender: TObject); begin TBFind.Click; end; procedure TfrmDJBRKList.FactoryNameChange(Sender: TObject); begin TBFind.Click; end; procedure TfrmDJBRKList.TBPrintClick(Sender: TObject); var fPrintFile:string; Txt,fImagePath:string; Moudle: THandle; Makebar:TMakebar; Mixtext:TMixtext; begin if CDS_Main.IsEmpty then Exit; //if Trim(CDS_Main.fieldbyname('CRType').AsString)<>'检验出库' then Exit; if CDS_Main.Locate('SSel',True,[])=False then begin Application.MessageBox('没有选择数据!','提示',0); Exit; end; fPrintFile:= ExtractFilePath(Application.ExeName) + 'Report\检验指示单标签.rmf' ; CDS_Main.DisableControls; with CDS_Main do begin First; while CDS_Main.Locate('SSel',True,[]) do begin with ADOQueryPrint do begin Close; sql.Clear; sql.Add(' select A.* '); sql.Add(' from CK_SXPB_CR A'); sql.Add(' where A.SPId='''+Trim(CDS_Main.fieldbyname('SPId').AsString)+''''); Open; end; try Moudle:=LoadLibrary('MakeQRBarcode.dll'); @Makebar:=GetProcAddress(Moudle,'Make'); @Mixtext:=GetProcAddress(Moudle,'MixText'); Txt:=Trim(ADOQueryPrint.fieldbyname('SPID').AsString); fImagePath:=ExtractFilePath(Application.ExeName)+'image\temp.bmp' ; if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName)+'image')) then CreateDirectory(pchar(ExtractFilePath(Application.ExeName)+'image'),nil); if FileExists(fImagePath) then DeleteFile(fImagePath); Makebar(pchar(Txt),Length(Txt),3,3,0,PChar(fImagePath),3); except CDS_Main.EnableControls; application.MessageBox('条形码生成失败!','提示信息',MB_ICONERROR); exit; end; if FileExists(fPrintFile) then begin RMVariables['QRBARCODE']:=fImagePath; RM1.LoadFromFile(fPrintFile); //RM1.ShowReport; RM1.PrintReport; end else begin CDS_Main.EnableControls; Application.MessageBox(PChar('没有找'+ExtractFilePath(Application.ExeName)+'Report\检验指示单标签.rmf'),'提示',0); Exit; end; Edit; FieldByName('SSel').Value:=False; Post; end; end; CDS_Main.EnableControls; end; procedure TfrmDJBRKList.TBPrint1Click(Sender: TObject); begin IF CDS_Main.IsEmpty then exit; with ADOQueryTemp do begin close; sql.Clear; sql.Add('select MJID from WFB_MJJY'); sql.Add('where APID='''+trim(CDS_Main.fieldbyName('SPID').AsString)+''' '); open; end; IF ADOQueryTemp.IsEmpty then exit; while not ADOQueryTemp.Eof do begin sleep(200); Printdata(ADOQueryTemp.fieldbyName('MJID').AsString); ADOQueryTemp.next; end; end; procedure TfrmDJBRKList.factoryName1BtnClick(Sender: TObject); begin try frmZdyAttachGYS:=TfrmZdyAttachGYS.Create(Application); with frmZdyAttachGYS do begin if ShowModal=1 then begin factoryName1.Text:=Trim(frmZdyAttachGYS.CDS_HZ.fieldbyname('ZdyName').AsString); end; end; finally frmZdyAttachGYS.Free; end; end; procedure TfrmDJBRKList.Button6Click(Sender: TObject); begin Panel5.Visible:=false; end; procedure TfrmDJBRKList.Button5Click(Sender: TObject); begin IF CDS_Main.IsEmpty then exit; IF trim(factoryName1.Text)='' then begin application.MessageBox('加工厂不能为空!','提示信息',0); exit; end; if Application.MessageBox('确定要修改加工厂吗?','提示',32+4)<>IDYES then Exit; try with ADOQueryCmd do begin Close; sql.Clear; sql.Add('update CK_SXPB_CR SET factoryName='''+trim(factoryName1.Text)+''' where SPID='''+Trim(CDS_Main.fieldbyname('SPID').AsString)+''''); sql.Add('update WFB_MJJY SET factoryName='''+trim(factoryName1.Text)+''' where APID='''+Trim(CDS_Main.fieldbyname('SPID').AsString)+''''); ExecSQL; end; Application.MessageBox('保存成功!','提示',0); Panel5.Visible:=false; except Application.MessageBox('保存失败!','提示',0); end; end; procedure TfrmDJBRKList.TBTSeditClick(Sender: TObject); begin factoryName1.Text:=''; Com_CRype.Text:=''; edit_batchNo.Text:=''; edit_gangNo.Text:=''; edit_note.Text:=''; Panel5.Left:=(self.Width-Panel5.Width) div 2; Panel5.Visible:=true; end; procedure TfrmDJBRKList.Button1Click(Sender: TObject); begin IF CDS_Main.IsEmpty then exit; IF trim(Com_CRype.Text)='' then begin application.MessageBox('入库类型不能为空!','提示信息',0); exit; end; if Application.MessageBox('确定要修改入库类型吗?','提示',32+4)<>IDYES then Exit; try with ADOQueryCmd do begin Close; sql.Clear; sql.Add('update CK_SXPB_CR SET CRType='''+trim(Com_CRype.Text)+''' where SPID='''+Trim(CDS_Main.fieldbyname('SPID').AsString)+''''); ExecSQL; end; Application.MessageBox('保存成功!','提示',0); Panel5.Visible:=false; except Application.MessageBox('保存失败!','提示',0); end; end; procedure TfrmDJBRKList.Button2Click(Sender: TObject); begin IF CDS_Main.IsEmpty then exit; if Application.MessageBox('确定要修改白坯编号吗?','提示',32+4)<>IDYES then Exit; try with ADOQueryCmd do begin Close; sql.Clear; sql.Add('update CK_SXPB_CR SET batchNo='''+trim(edit_batchNo.Text)+''' where SPID='''+Trim(CDS_Main.fieldbyname('SPID').AsString)+''''); sql.Add('update WFB_MJJY SET batchNo='''+trim(edit_batchNo.Text)+''' where APID='''+Trim(CDS_Main.fieldbyname('SPID').AsString)+''''); sql.Add('update CK_BanCP_CR SET batchNo='''+trim(edit_batchNo.Text)+''' where APID='''+Trim(CDS_Main.fieldbyname('SPID').AsString)+''''); sql.Add('update CK_BanCP_KC SET batchNo='''+trim(edit_batchNo.Text)+''' '); sql.Add('from CK_BanCP_KC A '); sql.Add('inner join CK_BanCP_CR B on B.BCID=A.BCID '); sql.Add('where B.APID='''+Trim(CDS_Main.fieldbyname('SPID').AsString)+''' '); ExecSQL; end; Application.MessageBox('保存成功!','提示',0); Panel5.Visible:=false; except Application.MessageBox('保存失败!','提示',0); end; end; procedure TfrmDJBRKList.Button3Click(Sender: TObject); begin IF CDS_Main.IsEmpty then exit; if Application.MessageBox('确定要修改缸号吗?','提示',32+4)<>IDYES then Exit; try with ADOQueryCmd do begin Close; sql.Clear; sql.Add('update CK_SXPB_CR SET RCGangNo='''+trim(edit_gangNo.Text)+''' where SPID='''+Trim(CDS_Main.fieldbyname('SPID').AsString)+''''); sql.Add('update WFB_MJJY SET RCGangNo='''+trim(edit_gangNo.Text)+''',BCGangNo='''+trim(edit_gangNo.Text)+''' where APID='''+Trim(CDS_Main.fieldbyname('SPID').AsString)+''''); sql.Add('update CK_BanCP_CR SET RCGangNo='''+trim(edit_gangNo.Text)+''',BCGangNo='''+trim(edit_gangNo.Text)+''' where APID='''+Trim(CDS_Main.fieldbyname('SPID').AsString)+''''); sql.Add('update CK_BanCP_KC SET RCGangNo='''+trim(edit_gangNo.Text)+''',BCGangNo='''+trim(edit_gangNo.Text)+''' '); sql.Add('from CK_BanCP_KC A '); sql.Add('inner join CK_BanCP_CR B on B.BCID=A.BCID '); sql.Add('where B.APID='''+Trim(CDS_Main.fieldbyname('SPID').AsString)+''' '); ExecSQL; end; Application.MessageBox('保存成功!','提示',0); Panel5.Visible:=false; except Application.MessageBox('保存失败!','提示',0); end; end; procedure TfrmDJBRKList.Button4Click(Sender: TObject); begin IF CDS_Main.IsEmpty then exit; if Application.MessageBox('确定要修改备注吗?','提示',32+4)<>IDYES then Exit; try with ADOQueryCmd do begin Close; sql.Clear; sql.Add('update CK_SXPB_CR SET note='''+trim(edit_note.Text)+''' where SPID='''+Trim(CDS_Main.fieldbyname('SPID').AsString)+''''); ExecSQL; end; Application.MessageBox('保存成功!','提示',0); Panel5.Visible:=false; except Application.MessageBox('保存失败!','提示',0); end; end; end.