unit U_DyeCardList; 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, cxImage, cxDBEdit, Menus, RM_Common, RM_Class, RM_e_Xls, RM_Dataset, RM_System, RM_GridReport, cxGridCustomPopupMenu, cxGridPopupMenu, cxPC, cxSplitter, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdFTP, ShellAPI, cxCheckBox, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu, dxSkinsCore, dxSkinsDefaultPainters, dxDateRanges, IdExplicitTLSClientServerBase, U_BaseList; type TfrmDyeCardList = class(TfrmBaseList) ToolBar1: TToolBar; TBRafresh: TToolButton; TBFind: TToolButton; TBAdd: TToolButton; TBDel: TToolButton; TBPrint: TToolButton; TBClose: TToolButton; Panel1: TPanel; BegDate: TDateTimePicker; EndDate: TDateTimePicker; Label1: TLabel; Tv1: TcxGridDBTableView; cxGrid1Level1: TcxGridLevel; cxGrid1: TcxGrid; GPM_1: TcxGridPopupMenu; ADOQueryCmd: TADOQuery; ADOQueryMain: TADOQuery; ADOQueryTemp: TADOQuery; DS_1: TDataSource; Label3: TLabel; OrderNo: TEdit; TBExport: TToolButton; v1MPRTSpec: TcxGridDBColumn; CDS_1: TClientDataSet; RM1: TRMGridReport; RMDB_1: TRMDBDataSet; v1CustomerNoName: TcxGridDBColumn; Label4: TLabel; CustName: TEdit; v1MPRTCodeName: TcxGridDBColumn; v1MPRTMF: TcxGridDBColumn; Label8: TLabel; C_Name: TEdit; Label9: TLabel; ConNo: TEdit; v1MPRTKZ: TcxGridDBColumn; Label10: TLabel; C_Spec: TEdit; Label12: TLabel; MPRTKZ: TEdit; ADOQueryPrint: TADOQuery; v1Column1: TcxGridDBColumn; v1Column2: TcxGridDBColumn; v1Column3: TcxGridDBColumn; Tchk: TToolButton; Tnochk: TToolButton; v1Column9: TcxGridDBColumn; v1Column10: TcxGridDBColumn; v1Column11: TcxGridDBColumn; ThreeColorBase: TcxStyleRepository; SHuangSe: TcxStyle; SkyBlue: TcxStyle; Default: TcxStyle; QHuangSe: TcxStyle; Red: TcxStyle; FontBlue: TcxStyle; TextSHuangSe: TcxStyle; FonePurple: TcxStyle; FoneClMaroon: TcxStyle; FoneRed: TcxStyle; RowColor: TcxStyle; handBlack: TcxStyle; cxBlue: TcxStyle; cxStyle1: TcxStyle; v1Column12: TcxGridDBColumn; PCID: TEdit; Label2: TLabel; v1Column13: TcxGridDBColumn; v1Column14: TcxGridDBColumn; v1Column17: TcxGridDBColumn; v1Column19: TcxGridDBColumn; v1Column20: TcxGridDBColumn; C_ColorNo: TEdit; Label5: TLabel; C_Color: TEdit; Label6: TLabel; Tv1Column2: TcxGridDBColumn; Tv1Column3: TcxGridDBColumn; Tv1Column6: TcxGridDBColumn; Tv1Column13: TcxGridDBColumn; Tv1Column19: TcxGridDBColumn; Tv1Column20: TcxGridDBColumn; ToolButton6: TToolButton; cxTabControl1: TcxTabControl; PM_1: TPopupMenu; N1: TMenuItem; N2: TMenuItem; Tv1Column1: TcxGridDBColumn; Tv1Column4: TcxGridDBColumn; Tv1Column5: TcxGridDBColumn; Tv1Column7: TcxGridDBColumn; Tv1Column8: TcxGridDBColumn; Tv1Column9: TcxGridDBColumn; btnWC: TToolButton; btnnowc: TToolButton; tbedit: TToolButton; ToolButton1: TToolButton; Tv1Column10: TcxGridDBColumn; Tv1Column11: TcxGridDBColumn; Tv1Column12: TcxGridDBColumn; Tv1Column14: TcxGridDBColumn; Tv1Column15: TcxGridDBColumn; Tv1Column16: TcxGridDBColumn; Tv1Column17: TcxGridDBColumn; Tv1Column18: TcxGridDBColumn; ToolButton2: TToolButton; procedure FormDestroy(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormCreate(Sender: TObject); procedure TBCloseClick(Sender: TObject); procedure TBFindClick(Sender: TObject); procedure TBDelClick(Sender: TObject); procedure TBExportClick(Sender: TObject); procedure TBPrintClick(Sender: TObject); procedure TBRafreshClick(Sender: TObject); procedure OrderNoChange(Sender: TObject); procedure FormShow(Sender: TObject); procedure CheckBox2Click(Sender: TObject); procedure N1Click(Sender: TObject); procedure cxTabControl1Change(Sender: TObject); procedure TchkClick(Sender: TObject); procedure TnochkClick(Sender: TObject); procedure Label2DblClick(Sender: TObject); procedure ToolButton6Click(Sender: TObject); procedure N2Click(Sender: TObject); procedure TBAddClick(Sender: TObject); procedure btnWCClick(Sender: TObject); procedure btnnowcClick(Sender: TObject); procedure tbeditClick(Sender: TObject); procedure ToolButton1Click(Sender: TObject); procedure ToolButton2Click(Sender: TObject); private DQdate: TDateTime; procedure InitGrid(); procedure SetStatus(); procedure InitForm(); function DelData(): Boolean; // procedure SetStatus(); { Private declarations } public FFInt, FCloth: Integer; canshu1, canshu2, FWorkshop: string; fFlileFlag: string; { Public declarations } end; var frmDyeCardList: TfrmDyeCardList; implementation uses U_DataLink, U_RTFun, U_DyeCardInput, U_DyeInspSet, U_LabelPrint; {$R *.dfm} procedure TfrmDyeCardList.SetStatus(); begin tchk.Enabled := false; tnochk.Enabled := false; tbadd.Enabled := false; tbedit.Enabled := false; tbdel.Enabled := false; btnWC.Enabled := false; btnnowc.Enabled := false; tbadd.Enabled := true; if Trim(canshu1) = '录入' then begin case cxTabControl1.TabIndex of 0: begin tbedit.Enabled := true; tbdel.Enabled := true; tchk.Enabled := true; end; 1: begin tnochk.Enabled := true; btnWC.Enabled := true; end; 2: begin btnnowc.Enabled := true; end; 3: begin end; end; end; if Trim(canshu1) = '管理' then begin case cxTabControl1.TabIndex of 0: begin tbedit.Enabled := true; tbdel.Enabled := true; tchk.Enabled := true; end; 1: begin tnochk.Enabled := true; btnWC.Enabled := true; end; 2: begin btnnowc.Enabled := true; end; 3: begin end; end; end; end; procedure TfrmDyeCardList.FormDestroy(Sender: TObject); begin inherited; frmDyeCardList := nil; end; procedure TfrmDyeCardList.FormClose(Sender: TObject; var Action: TCloseAction); begin inherited; Action := caFree; end; procedure TfrmDyeCardList.FormCreate(Sender: TObject); begin inherited; DQdate := SGetServerDate(ADOQueryTemp); canshu1 := trim(Self.fParameters1); canshu2 := trim(Self.fParameters2); FWorkshop := trim(Self.fParameters3); end; procedure TfrmDyeCardList.TBAddClick(Sender: TObject); begin try frmDyeCardInput := TfrmDyeCardInput.Create(Application); with frmDyeCardInput do begin FPCIDS := ''; FWorkshop := self.FWorkshop; if ShowModal = 1 then begin InitGrid(); end; end; finally frmDyeCardInput.Free; end; end; procedure TfrmDyeCardList.TBCloseClick(Sender: TObject); begin Close; end; procedure TfrmDyeCardList.InitGrid(); var strwhere: string; begin with ADOQueryCmd do begin Close; sql.Clear; sql.Add('exec P_Dye_Card_PSC '); execsql; end; try ADOQueryMain.DisableControls; with ADOQueryMain do begin Close; Filtered := False; sql.Clear; sql.Add('select A.* '); sql.Add(',GlideList=[dbo].[F_Dye_Card_GlideList](A.PCID) '); sql.Add('from Dye_Plan_Card A '); sql.Add('where A.PCTime>=''' + formatdateTime('yyyy-MM-dd', begdate.Date) + ''' '); sql.Add('and A.PCTime<''' + formatdateTime('yyyy-MM-dd', enddate.Date + 1) + ''' '); case cxTabControl1.TabIndex of 0: begin sql.Add(' and isnull(A.status,''0'')=''0'' '); end; 1: begin sql.Add(' and isnull(A.status,''0'')=''9'' '); end; 2: begin sql.Add(' and isnull(A.status,''0'')=''10'' '); end; end; if trim(FWorkshop) <> '' then sql.Add(' and A.Workshop=''' + trim(FWorkshop) + ''' '); if Trim(canshu1) = '' then sql.Add(' and A.Filler=''' + trim(DName) + ''' '); Open; end; SCreateCDS(ADOQueryMain, CDS_1); SInitCDSData(ADOQueryMain, CDS_1); finally ADOQueryMain.EnableControls; TBFind.Click; end; end; procedure TfrmDyeCardList.Label2DblClick(Sender: TObject); var I: Integer; Column: TcxGridDBColumn; FieldNames: TStringList; begin FieldNames := TStringList.Create; try for I := 0 to Tv1.ColumnCount - 1 do begin Column := Tv1.Columns[I]; FieldNames.Add(Column.Caption + ':' + Column.DataBinding.FieldName); end; ShowMessage(FieldNames.Text); finally FieldNames.Free; end; end; procedure TfrmDyeCardList.InitForm(); begin ReadCxGrid(self.Caption + 'TV1', Tv1, '生产指示单管理'); BegDate.DateTime := SGetServerDate(ADOQueryTemp) - 3; EndDate.DateTime := SGetServerDate(ADOQueryTemp); SetStatus(); InitGrid() end; procedure TfrmDyeCardList.TBFindClick(Sender: TObject); begin if ADOQueryMain.Active = False then Exit; SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2)); SCreateCDS(ADOQueryMain, CDS_1); SInitCDSData(ADOQueryMain, CDS_1); end; procedure TfrmDyeCardList.TBDelClick(Sender: TObject); begin if CDS_1.IsEmpty then Exit; if (Trim(CDS_1.fieldbyname('Filler').AsString) <> Trim(DName)) and (dname <> 'ADMIN') then begin Application.MessageBox('不能操作他人的数据!', '提示', 0); Exit; end; if CDS_1.Locate('SSel', True, []) = False then begin Application.MessageBox('没有选择数据!', '提示', 0); Exit; end; if Application.MessageBox('确定要删除数据吗?', '提示', 32 + 4) <> IDYES then Exit; try with CDS_1 do begin DisableControls; First; while not Eof do begin if Fieldbyname('Ssel').AsBoolean then begin try ADOQueryCmd.Connection.BeginTrans; with ADOQueryCmd do begin Close; Sql.Clear; Sql.Add('exec P_Dye_Card_Del '); Sql.Add('@PCIDS=' + quotedstr(Trim(CDS_1.fieldbyname('PCID').AsString))); Sql.Add(',@DCode=' + quotedstr(Trim(DCode))); Sql.Add(',@DName=' + quotedstr(Trim(DName))); Open; end; if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString))); if (Trim(CDS_1.fieldbyname('PCType').AsString) = '正常卡') or (Trim(CDS_1.fieldbyname('PCType').AsString) = '前道卡') then begin with ADOQueryCmd do begin Close; Sql.Clear; Sql.Add('exec P_Dye_GreyCloth_Out_Del '); Sql.Add('@PCID=' + quotedstr(Trim(CDS_1.fieldbyname('PCID').AsString))); Open; end; if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString))); end else begin with ADOQueryCmd do begin Close; Sql.Clear; Sql.Add('exec P_Dye_Card_Move_Del '); Sql.Add('@PCID=' + quotedstr(Trim(CDS_1.fieldbyname('PCID').AsString))); Open; end; if ADOQueryCmd.FieldByName('intReturn').AsInteger = -1 then raise Exception.Create(pchar(trim(ADOQueryCmd.FieldByName('ShowMsg').AsString))); end; ADOQueryCmd.Connection.CommitTrans; except ADOQueryCmd.Connection.RollbackTrans; raise Exception.Create(PChar(Exception(ExceptObject).Message)); end; end; Next; end; EnableControls; end; TBRafresh.Click; except CDS_1.EnableControls; application.MessageBox(PChar(Exception(ExceptObject).Message), '提示信息', 0); end; end; procedure TfrmDyeCardList.tbeditClick(Sender: TObject); var MPCIDS: string; begin with CDS_1 do begin DisableControls; First; while not Eof do begin if Fieldbyname('Ssel').AsBoolean then begin MPCIDS := MPCIDS + trim(CDS_1.FieldByName('PCID').AsString) + ';'; end; Next; end; EnableControls; end; try frmDyeCardInput := TfrmDyeCardInput.Create(Application); with frmDyeCardInput do begin FPCIDS := MPCIDS; FWorkshop := self.FWorkshop; if ShowModal = 1 then begin InitGrid(); end; end; finally frmDyeCardInput.Free; end; end; function TfrmDyeCardList.DelData(): Boolean; begin try Result := false; ADOQueryCmd.Connection.BeginTrans; with ADOQueryCmd do begin Close; sql.Clear; sql.Add(' delete Dye_Plan_Card where PCID=''' + Trim(CDS_1.fieldbyname('PCID').AsString) + ''''); sql.Add(' exec P_Do_PbOut_Del @PCID=''' + Trim(CDS_1.fieldbyname('PCID').AsString) + ''''); sql.Add(' insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( '); sql.Add(' ' + quotedstr(trim(DName))); sql.Add(',getdate() '); sql.Add(',' + quotedstr(trim(self.Caption))); sql.Add(',' + quotedstr(trim('流程卡删除'))); sql.Add(',' + quotedstr(trim('指示单号:' + trim(CDS_1.FieldByName('PCID').AsString)))); sql.Add(',' + quotedstr(trim('成功'))); sql.Add(')'); ExecSQL; end; ADOQueryCmd.Connection.CommitTrans; Result := True; except ADOQueryCmd.Connection.RollbackTrans; Application.MessageBox('数据删除异常!', '提示', 0); end; end; procedure TfrmDyeCardList.TBExportClick(Sender: TObject); begin if ADOQueryMain.IsEmpty then Exit; // SelExportData(Tv1,ADOQueryMain,self.Caption); end; procedure TfrmDyeCardList.TBPrintClick(Sender: TObject); var WSql: string; begin WSql := ''; if CDS_1.IsEmpty then Exit; if CDS_1.Locate('SSel', True, []) = False then begin Application.MessageBox('没有选择数据!', '提示', 0); Exit; end; with CDS_1 do begin DisableControls; First; while not Eof do begin if Fieldbyname('Ssel').AsBoolean then begin if WSql = '' then WSql := trim(CDS_1.fieldbyname('PCID').AsString) else WSql := WSql + ',' + trim(CDS_1.fieldbyname('PCID').AsString); end; Next; end; EnableControls; end; try frmLabelPrint := TfrmLabelPrint.Create(Application); with frmLabelPrint do begin FLMType := 'DyeCardPrint'; FFiltration1 := WSql; if ShowModal = 1 then begin with ADOQueryCmd do begin close; sql.Clear; sql.Add('update Dye_Plan_Card SET status=''9'' ,chker=''' + trim(DName) + ''',Chktime=getdate() '); sql.Add(' where EXISTS(select X.RTValue from [dbo].[F_Tool_SplitString](' + quotedstr(WSql) + ','','') X where X.RTValue=Dye_Plan_Card.PCID ) '); execsql; end; end; end; finally frmLabelPrint.Free; end; InitGrid(); end; procedure TfrmDyeCardList.TBRafreshClick(Sender: TObject); begin InitGrid(); end; procedure TfrmDyeCardList.OrderNoChange(Sender: TObject); begin if ADOQueryMain.Active = False then Exit; SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2)); SCreateCDS(ADOQueryMain, CDS_1); SInitCDSData(ADOQueryMain, CDS_1); end; procedure TfrmDyeCardList.FormShow(Sender: TObject); begin inherited; fFlileFlag := UserDataFlag + 'HX'; canshu1 := self.fParameters1; canshu2 := self.fParameters3; FWorkshop := self.fParameters3; InitForm(); end; procedure TfrmDyeCardList.CheckBox2Click(Sender: TObject); begin TBRafresh.Click; end; procedure TfrmDyeCardList.N1Click(Sender: TObject); begin SelOKNo(CDS_1, true); end; procedure TfrmDyeCardList.N2Click(Sender: TObject); begin SelOKNo(CDS_1, False); end; procedure TfrmDyeCardList.btnWCClick(Sender: TObject); begin if CDS_1.IsEmpty then exit; if CDS_1.Locate('SSel', True, []) = False then begin Application.MessageBox('没有选择数据!', '提示', 0); Exit; end; try ADOQueryCmd.Connection.BeginTrans; with CDS_1 do begin DisableControls; First; while not Eof do begin if Fieldbyname('Ssel').AsBoolean then begin with ADOQueryCmd do begin close; sql.Clear; sql.Add('update Dye_Plan_Card SET status=''10'' '); sql.Add('where PCID=' + quotedstr(trim(CDS_1.fieldbyname('PCID').AsString))); sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( '); sql.Add(' ' + quotedstr(trim(DName))); sql.Add(',getdate() '); sql.Add(',' + quotedstr(trim(self.Caption))); sql.Add(',' + quotedstr(trim('流程卡完成'))); sql.Add(',' + quotedstr(trim('流程卡号:' + trim(CDS_1.FieldByName('PCID').AsString)))); sql.Add(',' + quotedstr(trim('成功'))); sql.Add(')'); execsql; end; end; Next; end; EnableControls; end; ADOQueryCmd.Connection.CommitTrans; application.MessageBox('操作成功!', '提示信息'); TBRafresh.Click; except ADOQueryCmd.Connection.RollbackTrans; application.MessageBox('操作失败!', '提示信息', 0); end; end; procedure TfrmDyeCardList.btnnowcClick(Sender: TObject); begin if CDS_1.IsEmpty then exit; if CDS_1.Locate('SSel', True, []) = False then begin Application.MessageBox('没有选择数据!', '提示', 0); Exit; end; try ADOQueryCmd.Connection.BeginTrans; with CDS_1 do begin DisableControls; First; while not Eof do begin if Fieldbyname('Ssel').AsBoolean then begin with ADOQueryCmd do begin close; sql.Clear; sql.Add('update Dye_Plan_Card SET status=''9'' '); sql.Add('where PCID=' + quotedstr(trim(CDS_1.fieldbyname('PCID').AsString))); sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( '); sql.Add(' ' + quotedstr(trim(DName))); sql.Add(',getdate() '); sql.Add(',' + quotedstr(trim(self.Caption))); sql.Add(',' + quotedstr(trim('流程卡撤销完成'))); sql.Add(',' + quotedstr(trim('流程卡号:' + trim(CDS_1.FieldByName('PCID').AsString)))); sql.Add(',' + quotedstr(trim('成功'))); sql.Add(')'); execsql; end; end; Next; end; EnableControls; end; ADOQueryCmd.Connection.CommitTrans; application.MessageBox('操作成功!', '提示信息'); TBRafresh.Click; except ADOQueryCmd.Connection.RollbackTrans; application.MessageBox('操作失败!', '提示信息', 0); end; end; procedure TfrmDyeCardList.ToolButton1Click(Sender: TObject); var MPCIDS: string; begin if CDS_1.Locate('SSel', True, []) = False then begin Application.MessageBox('没有选择数据!', '提示', 0); Exit; end; with CDS_1 do begin DisableControls; First; while not Eof do begin if Fieldbyname('Ssel').AsBoolean then begin MPCIDS := MPCIDS + Trim(CDS_1.fieldbyname('PCID').AsString) + ','; end; Next; end; EnableControls; end; try frmDyeInspSet := TfrmDyeInspSet.Create(Application); with frmDyeInspSet do begin FDataID := MPCIDS; if ShowModal = 1 then begin end; end; finally frmDyeInspSet.Free; end; end; procedure TfrmDyeCardList.ToolButton2Click(Sender: TObject); begin try frmDyeCardInput := TfrmDyeCardInput.Create(Application); with frmDyeCardInput do begin FPCIDS := ''; FWorkshop := self.FWorkshop; edt_Width.Text := trim(Self.CDS_1.FieldByName('C_Width').AsString); edt_GramWeight.Text := trim(Self.CDS_1.FieldByName('C_GramWeight').AsString); edt_Color.Text := trim(Self.CDS_1.FieldByName('C_Color').AsString); edt_ColorNo.Text := trim(Self.CDS_1.FieldByName('C_ColorNo').AsString); processRequirements.Text := trim(Self.CDS_1.FieldByName('processRequirements').AsString); if ShowModal = 1 then begin InitGrid(); end; end; finally frmDyeCardInput.Free; end; end; procedure TfrmDyeCardList.ToolButton6Click(Sender: TObject); begin WriteCxGrid(self.Caption + 'TV1', Tv1, '生产指示单管理'); end; procedure TfrmDyeCardList.cxTabControl1Change(Sender: TObject); begin SetStatus(); InitGrid(); end; procedure TfrmDyeCardList.TchkClick(Sender: TObject); begin if CDS_1.IsEmpty then exit; if CDS_1.Locate('SSel', True, []) = False then begin Application.MessageBox('没有选择数据!', '提示', 0); Exit; end; try ADOQueryCmd.Connection.BeginTrans; with CDS_1 do begin DisableControls; First; while not Eof do begin if Fieldbyname('Ssel').AsBoolean then begin with ADOQueryCmd do begin close; sql.Clear; sql.Add('update Dye_Plan_Card SET status=''9'' '); sql.Add('where PCID=' + quotedstr(trim(CDS_1.fieldbyname('PCID').AsString))); sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( '); sql.Add(' ' + quotedstr(trim(DName))); sql.Add(',getdate() '); sql.Add(',' + quotedstr(trim(self.Caption))); sql.Add(',' + quotedstr(trim('流程卡审核'))); sql.Add(',' + quotedstr(trim('流程卡号:' + trim(CDS_1.FieldByName('PCID').AsString)))); sql.Add(',' + quotedstr(trim('成功'))); sql.Add(')'); execsql; end; end; Next; end; EnableControls; end; ADOQueryCmd.Connection.CommitTrans; application.MessageBox('审核成功!', '提示信息'); TBRafresh.Click; except ADOQueryCmd.Connection.RollbackTrans; application.MessageBox('审核失败!', '提示信息', 0); end; end; procedure TfrmDyeCardList.TnochkClick(Sender: TObject); begin if CDS_1.IsEmpty then exit; if CDS_1.Locate('SSel', True, []) = False then begin Application.MessageBox('没有选择数据!', '提示', 0); Exit; end; try ADOQueryCmd.Connection.BeginTrans; with CDS_1 do begin DisableControls; First; while not Eof do begin if Fieldbyname('Ssel').AsBoolean then begin with ADOQueryCmd do begin close; sql.Clear; sql.Add('update Dye_Plan_Card SET status=''0'' '); sql.Add('where PCID=' + quotedstr(trim(CDS_1.fieldbyname('PCID').AsString))); sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( '); sql.Add(' ' + quotedstr(trim(DName))); sql.Add(',getdate() '); sql.Add(',' + quotedstr(trim(self.Caption))); sql.Add(',' + quotedstr(trim('流程卡审核'))); sql.Add(',' + quotedstr(trim('流程卡号:' + trim(CDS_1.FieldByName('PCID').AsString)))); sql.Add(',' + quotedstr(trim('成功'))); sql.Add(')'); execsql; end; end; Next; end; EnableControls; end; ADOQueryCmd.Connection.CommitTrans; application.MessageBox('撤销审核成功!', '提示信息'); TBRafresh.Click; except ADOQueryCmd.Connection.RollbackTrans; application.MessageBox('撤销审核失败!', '提示信息', 0); end; end; end.