499 lines
		
	
	
		
			13 KiB
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
		
		
			
		
	
	
			499 lines
		
	
	
		
			13 KiB
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
|   | unit U_StopWorkInPut; | |||
|  | 
 | |||
|  | interface | |||
|  | 
 | |||
|  | uses | |||
|  |   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, | |||
|  |   Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, | |||
|  |   cxDataStorage, cxEdit, DB, cxDBData, cxCalendar, cxTimeEdit, | |||
|  |   cxButtonEdit, cxGridLevel, cxGridCustomTableView, cxGridTableView, | |||
|  |   cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid, | |||
|  |   StdCtrls, ComCtrls, ExtCtrls, ToolWin, ADODB, DBClient, | |||
|  |   cxGridCustomPopupMenu, cxGridPopupMenu, cxGridBandedTableView, | |||
|  |   cxGridDBBandedTableView, cxDropDownEdit; | |||
|  | 
 | |||
|  | type | |||
|  |   TfrmStopWorkInPut = class(TForm) | |||
|  |     Panel1: TPanel; | |||
|  |     Label5: TLabel; | |||
|  |     cxGrid5: TcxGrid; | |||
|  |     cxGridLevel4: TcxGridLevel; | |||
|  |     DataSource1: TDataSource; | |||
|  |     cxGridPopupMenu1: TcxGridPopupMenu; | |||
|  |     CDS_Main: TClientDataSet; | |||
|  |     ADOTemp: TADOQuery; | |||
|  |     ADOCmd: TADOQuery; | |||
|  |     ADOQuery1: TADOQuery; | |||
|  |     cxStyleRepository1: TcxStyleRepository; | |||
|  |     cxStyle1: TcxStyle; | |||
|  |     cxStyle2: TcxStyle; | |||
|  |     cxStyle3: TcxStyle; | |||
|  |     cxStyle4: TcxStyle; | |||
|  |     SWReason: TComboBox; | |||
|  |     ADOQueryMain: TADOQuery; | |||
|  |     Button1: TButton; | |||
|  |     Button2: TButton; | |||
|  |     Tv1: TcxGridDBTableView; | |||
|  |     v1Column1: TcxGridDBColumn; | |||
|  |     v1Column2: TcxGridDBColumn; | |||
|  |     v1Column3: TcxGridDBColumn; | |||
|  |     v1Column4: TcxGridDBColumn; | |||
|  |     v1Column5: TcxGridDBColumn; | |||
|  |     Button3: TButton; | |||
|  |     Button4: TButton; | |||
|  |     Button5: TButton; | |||
|  |     Button6: TButton; | |||
|  |     procedure FormDestroy(Sender: TObject); | |||
|  |     procedure FormClose(Sender: TObject; var Action: TCloseAction); | |||
|  |     procedure FormShow(Sender: TObject); | |||
|  |     procedure v1Column7PropertiesButtonClick(Sender: TObject; | |||
|  |       AButtonIndex: Integer); | |||
|  |     procedure TBDelClick(Sender: TObject); | |||
|  |     procedure ToolButton5Click(Sender: TObject); | |||
|  |     procedure Button1Click(Sender: TObject); | |||
|  |     procedure ToolButton12Click(Sender: TObject); | |||
|  |     procedure Button2Click(Sender: TObject); | |||
|  |     procedure ToolButton7Click(Sender: TObject); | |||
|  |     procedure Button3Click(Sender: TObject); | |||
|  |     procedure Button4Click(Sender: TObject); | |||
|  |     procedure Button5Click(Sender: TObject); | |||
|  |     procedure Button6Click(Sender: TObject); | |||
|  |   private | |||
|  |     { Private declarations } | |||
|  |     procedure ComboxData(v1Column310:TcxGridDBBandedColumn;ii:Integer); | |||
|  |     procedure InitGrid(); | |||
|  |   public | |||
|  |     { Public declarations } | |||
|  |   end; | |||
|  | 
 | |||
|  | var | |||
|  |   frmStopWorkInPut: TfrmStopWorkInPut; | |||
|  | 
 | |||
|  | implementation | |||
|  | uses | |||
|  |   U_DataLink,U_Fun,U_ZDYHelp,U_iniParam; | |||
|  | 
 | |||
|  | {$R *.dfm} | |||
|  | 
 | |||
|  | procedure TfrmStopWorkInPut.FormDestroy(Sender: TObject); | |||
|  | begin | |||
|  |   frmStopWorkInPut:=nil; | |||
|  | end; | |||
|  | 
 | |||
|  | procedure TfrmStopWorkInPut.FormClose(Sender: TObject; | |||
|  |   var Action: TCloseAction); | |||
|  | begin | |||
|  | 
 | |||
|  |   Action:=caFree; | |||
|  | end; | |||
|  | 
 | |||
|  | procedure TfrmStopWorkInPut.FormShow(Sender: TObject); | |||
|  | 
 | |||
|  | begin | |||
|  |   ReadCxGrid('ͣ<><CDA3><EFBFBD><EFBFBD>¼',Tv1,'<27>IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>'); | |||
|  |   DataLink_WFBProducttion.ADOLink.Connected:=False; | |||
|  |   DataLink_WFBProducttion.ADOLink.Connected:=True; | |||
|  |   InitGrid(); | |||
|  |   DataLink_WFBProducttion.ADOLink.Connected:=False; | |||
|  | end; | |||
|  | procedure TfrmStopWorkInPut.InitGrid(); | |||
|  | var | |||
|  |   sql:string; | |||
|  | begin | |||
|  |   try | |||
|  |     ADOQueryMain.DisableControls; | |||
|  |     with ADOQueryMain do | |||
|  |     begin | |||
|  |       Filtered:=False; | |||
|  |       Close; | |||
|  |       sql.Clear; | |||
|  |       SQL.Add('select Top 20* from WFB_StopWorkList '); | |||
|  |       if Trim(SCXFlag)<>'' then | |||
|  |       begin | |||
|  |         sql.Add(' where SWType='''+Trim(SCXFlag)+''''); | |||
|  |       end; | |||
|  |       sql.Add('Order by SWBegTime desc'); | |||
|  |       Open; | |||
|  |     end; | |||
|  |     SCreateCDS20(ADOQueryMain,CDS_Main); | |||
|  |     SInitCDSData20(ADOQueryMain,CDS_Main); | |||
|  |   finally | |||
|  |     ADOQueryMain.EnableControls; | |||
|  |   end; | |||
|  | end; | |||
|  | procedure TfrmStopWorkInPut.ComboxData(v1Column310:TcxGridDBBandedColumn;ii:Integer); | |||
|  | var | |||
|  |   i:Integer; | |||
|  |   j:string; | |||
|  | begin | |||
|  |   (v1Column310.Properties as TcxComboBoxProperties).Items.Clear; | |||
|  |   for i:=0 to ii do | |||
|  |   begin | |||
|  |     if i<10 then | |||
|  |       j:='0'+trim(IntToStr(i)) | |||
|  |     else | |||
|  |       j:=Trim(IntToStr(i)); | |||
|  |     (v1Column310.Properties as TcxComboBoxProperties).Items.Add(Trim(j)); | |||
|  |   end; | |||
|  | end; | |||
|  | 
 | |||
|  | procedure TfrmStopWorkInPut.v1Column7PropertiesButtonClick(Sender: TObject; | |||
|  |   AButtonIndex: Integer); | |||
|  | begin | |||
|  |   try | |||
|  |     frmZDYHelp:=TfrmZDYHelp.Create(Application); | |||
|  |     with frmZDYHelp do | |||
|  |     begin | |||
|  |       flag:='SWReason'; | |||
|  |       flagname:='ͣ<><CDA3>ԭ<EFBFBD><D4AD>'; | |||
|  |       if ShowModal=1 then | |||
|  |       begin | |||
|  |         Self.CDS_Main.Edit; | |||
|  |         Self.CDS_Main.FieldByName('SWReason').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString) | |||
|  |       end; | |||
|  |     end; | |||
|  |   finally | |||
|  |     frmZDYHelp.Free; | |||
|  |   end; | |||
|  | end; | |||
|  | 
 | |||
|  | procedure TfrmStopWorkInPut.TBDelClick(Sender: TObject); | |||
|  | begin | |||
|  |   if Trim(CDS_Main.fieldbyname('SWID').AsString)<>'' then | |||
|  |   begin | |||
|  |     if Trim(DCode)<>'ADMIN' then | |||
|  |     begin | |||
|  |       if Trim(DName)<>Trim(CDS_Main.fieldbyname('SWPerson').AsString) then | |||
|  |       begin | |||
|  |         Application.MessageBox('<27><><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD>˼<EFBFBD>¼<EFBFBD><C2BC>','<27><>ʾ',0); | |||
|  |         Exit; | |||
|  |       end; | |||
|  |     end; | |||
|  |     if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit; | |||
|  |     with ADOCmd do | |||
|  |     begin | |||
|  |       Close; | |||
|  |       sql.Clear; | |||
|  |       sql.Add('delete WFB_StopWorkList where SWID='''+Trim(CDS_Main.fieldbyname('SWID').AsString)+''''); | |||
|  |       ExecSQL; | |||
|  |     end; | |||
|  |   end; | |||
|  |   CDS_Main.Delete; | |||
|  | end; | |||
|  | 
 | |||
|  | procedure TfrmStopWorkInPut.ToolButton5Click(Sender: TObject); | |||
|  | var | |||
|  |   sql:String; | |||
|  | begin | |||
|  |   DataLink_WFBProducttion.ADOLink.Connected:=False; | |||
|  |   DataLink_WFBProducttion.ADOLink.Connected:=True; | |||
|  |   with ADOCmd do | |||
|  |   begin | |||
|  |     Close; | |||
|  |     sql.Clear; | |||
|  |     sql.Add('select * from WFB_StopWorkList where SWEndtime is null'); | |||
|  |     Open; | |||
|  |   end; | |||
|  |   if ADOCmd.IsEmpty=False then | |||
|  |   begin | |||
|  |     Application.MessageBox('<27>ϴ<EFBFBD>ͣ<EFBFBD><CDA3>δ<EFBFBD><CEB4><EFBFBD>п<EFBFBD><D0BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',0); | |||
|  |     Exit; | |||
|  |   end; | |||
|  |   Panel1.Visible:=True; | |||
|  |   sql:='select distinct(ZdyName) Name from KH_Zdy where Type=''SWReason'' '; | |||
|  |   SInitComBoxBySql(ADOTemp,SWReason,False,sql); | |||
|  |   DataLink_WFBProducttion.ADOLink.Connected:=False; | |||
|  | end; | |||
|  | 
 | |||
|  | procedure TfrmStopWorkInPut.Button1Click(Sender: TObject); | |||
|  | var | |||
|  |   maxno,FBZ:String; | |||
|  | begin | |||
|  |   if Trim(SWReason.Text)='' then | |||
|  |   begin | |||
|  |     Application.MessageBox('ͣ<><CDA3>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0); | |||
|  |     Exit; | |||
|  |   end; | |||
|  |   if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA><D6B4>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit; | |||
|  |   DataLink_WFBProducttion.ADOLink.Connected:=False; | |||
|  |   DataLink_WFBProducttion.ADOLink.Connected:=True; | |||
|  |   with ADOTemp do | |||
|  |   begin | |||
|  |     Close; | |||
|  |     sql.Clear; | |||
|  |     sql.Add('select * from SY_User where UserId='''+Trim(DCode)+''''); | |||
|  |     Open; | |||
|  |   end; | |||
|  |   FBZ:=Trim(ADOTemp.fieldbyname('BanZu').AsString); | |||
|  |   try | |||
|  |     ADOCmd.Connection.BeginTrans; | |||
|  |     if GetLSNo(ADOCmd,maxno,'SW','WFB_StopWorkList',2,1)=False then | |||
|  |     begin | |||
|  |       ADOCmd.Connection.RollbackTrans; | |||
|  |       Application.MessageBox('ȡͣ<C8A1><CDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0); | |||
|  |       Exit; | |||
|  |     end; | |||
|  |     with ADOCmd do | |||
|  |     begin | |||
|  |       Close; | |||
|  |       SQL.Clear; | |||
|  |       sql.Add('select * from WFB_StopWorkList where 1<>1 '); | |||
|  |       Open; | |||
|  |     end; | |||
|  |     with ADOCmd do | |||
|  |     begin | |||
|  |       Append; | |||
|  |       FieldByName('SWID').Value:=Trim(maxno); | |||
|  |       FieldByName('SWBegtime').Value:=SGetServerDateTime(ADOTemp); | |||
|  |       FieldByName('SWReason').Value:=Trim(SWReason.Text); | |||
|  |       FieldByName('SWPerson').Value:=Trim(DName); | |||
|  |       FieldByName('SWPersonBZ').Value:=Trim(FBZ); | |||
|  |       FieldByName('SWType').Value:=Trim(SCXFlag); | |||
|  |       Post; | |||
|  |     end; | |||
|  |     with CDS_Main do | |||
|  |     begin | |||
|  |       Append; | |||
|  |       FieldByName('SWID').Value:=Trim(maxno); | |||
|  |       FieldByName('SWBegtime').Value:=SGetServerDateTime(ADOTemp); | |||
|  |       FieldByName('SWReason').Value:=Trim(SWReason.Text); | |||
|  |       FieldByName('SWPerson').Value:=Trim(DName); | |||
|  |       FieldByName('SWPersonBZ').Value:=Trim(FBZ); | |||
|  |       Post; | |||
|  |     end; | |||
|  |     ADOCmd.Connection.CommitTrans; | |||
|  |     Panel1.Visible:=False; | |||
|  |     //Application.MessageBox('ͣ<><CDA3><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0);
 | |||
|  |     Exit; | |||
|  |   except | |||
|  |     ADOCmd.Connection.RollbackTrans; | |||
|  |     DataLink_WFBProducttion.ADOLink.Connected:=False; | |||
|  |     Application.MessageBox('ͣ<><CDA3><EFBFBD>쳣<EFBFBD><ECB3A3>','<27><>ʾ',0); | |||
|  |     Exit; | |||
|  |   end; | |||
|  |   DataLink_WFBProducttion.ADOLink.Connected:=False; | |||
|  | end; | |||
|  | 
 | |||
|  | procedure TfrmStopWorkInPut.ToolButton12Click(Sender: TObject); | |||
|  | begin | |||
|  |   Close; | |||
|  |   WriteCxGrid('ͣ<><CDA3><EFBFBD><EFBFBD>¼',Tv1,'<27>IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>'); | |||
|  | end; | |||
|  | 
 | |||
|  | procedure TfrmStopWorkInPut.Button2Click(Sender: TObject); | |||
|  | begin | |||
|  |   Panel1.Visible:=False; | |||
|  | end; | |||
|  | 
 | |||
|  | procedure TfrmStopWorkInPut.ToolButton7Click(Sender: TObject); | |||
|  | var | |||
|  |   FBZ,MaxNo:String; | |||
|  | begin | |||
|  |   DataLink_WFBProducttion.ADOLink.Connected:=False; | |||
|  |   DataLink_WFBProducttion.ADOLink.Connected:=True; | |||
|  |   with ADOTemp do | |||
|  |   begin | |||
|  |     Close; | |||
|  |     sql.Clear; | |||
|  |     sql.Add('select * from SY_User where UserId='''+Trim(DCode)+''''); | |||
|  |     Open; | |||
|  |   end; | |||
|  |   FBZ:=Trim(ADOTemp.fieldbyname('BanZu').AsString); | |||
|  |   with ADOTemp do | |||
|  |   begin | |||
|  |     Close; | |||
|  |     SQL.Clear; | |||
|  |     sql.Add('select * from WFB_StopWorkList where SWEndtime is null'); | |||
|  |     Open; | |||
|  |   end; | |||
|  |   if ADOTemp.IsEmpty=True then | |||
|  |   begin | |||
|  |     Application.MessageBox('δ<>Ǽ<EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>','<27><>ʾ',0); | |||
|  |     exit; | |||
|  |   end; | |||
|  |   if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>п<EFBFBD><D0BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit; | |||
|  |   with ADOTemp do | |||
|  |   begin | |||
|  |     Close; | |||
|  |     SQL.Clear; | |||
|  |     SQL.Add('select Top 1*  from WFB_StopWorkList where SWEndtime is null order by SWBegtime desc'); | |||
|  |     Open; | |||
|  |   end; | |||
|  |   MaxNo:=Trim(ADOTemp.fieldbyname('SWID').AsString); | |||
|  |   try | |||
|  |     ADOCmd.Connection.BeginTrans; | |||
|  |     with ADOCmd do | |||
|  |     begin | |||
|  |       Close; | |||
|  |       SQL.Clear; | |||
|  |       sql.Add('select * from WFB_StopWorkList where SWID='''+Trim(ADOTemp.fieldbyname('SWID').AsString)+''''); | |||
|  |       Open; | |||
|  |     end; | |||
|  | 
 | |||
|  |     with ADOCmd do | |||
|  |     begin | |||
|  |       Edit; | |||
|  |       FieldByName('SWEPerson').Value:=Trim(DName); | |||
|  |       FieldByName('SWPersonBZ').Value:=Trim(FBZ); | |||
|  |       FieldByName('SWEndtime').Value:=SGetServerDateTime(ADOTemp); | |||
|  |       Post; | |||
|  |     end; | |||
|  |     ADOCmd.Connection.CommitTrans; | |||
|  |     Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0); | |||
|  |     CDS_Main.Locate('SWID',Trim(MaxNo),[]); | |||
|  |     with CDS_Main do | |||
|  |     begin | |||
|  |       Edit; | |||
|  |       FieldByName('SWEndtime').Value:=SGetServerDateTime(ADOTemp); | |||
|  |       FieldByName('SWEPerson').Value:=Trim(DName); | |||
|  |       //FieldByName('SWEPersonBZ').Value:=Trim(FBZ);
 | |||
|  |       Post; | |||
|  |     end; | |||
|  |   except | |||
|  |     ADOCmd.Connection.RollbackTrans; | |||
|  |     DataLink_WFBProducttion.ADOLink.Connected:=False; | |||
|  |     Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>','<27><>ʾ',0); | |||
|  |   end; | |||
|  |   DataLink_WFBProducttion.ADOLink.Connected:=False; | |||
|  | end; | |||
|  | 
 | |||
|  | procedure TfrmStopWorkInPut.Button3Click(Sender: TObject); | |||
|  | begin | |||
|  |  { try | |||
|  |     frmZDYHelp:=TfrmZDYHelp.Create(Application); | |||
|  |     with frmZDYHelp do | |||
|  |     begin | |||
|  |       flag:='SWReason'; | |||
|  |       flagname:='ͣ<><CDA3>ԭ<EFBFBD><D4AD>'; | |||
|  |       if ShowModal=1 then | |||
|  |       begin | |||
|  |       end; | |||
|  |     end; | |||
|  |   finally | |||
|  |     frmZDYHelp.Free; | |||
|  |   end;} | |||
|  | end; | |||
|  | 
 | |||
|  | procedure TfrmStopWorkInPut.Button4Click(Sender: TObject); | |||
|  | var | |||
|  |   sql:String; | |||
|  | begin | |||
|  |   DataLink_WFBProducttion.ADOLink.Connected:=False; | |||
|  |   DataLink_WFBProducttion.ADOLink.Connected:=True; | |||
|  |   with ADOCmd do | |||
|  |   begin | |||
|  |     Close; | |||
|  |     sql.Clear; | |||
|  |     sql.Add('select * from WFB_StopWorkList '); | |||
|  |     sql.Add('where SWEndtime is null'); | |||
|  |     if Trim(SCXFlag)<>'' then | |||
|  |     begin | |||
|  |       sql.Add(' and SWType='''+Trim(SCXFlag)+''''); | |||
|  |     end; | |||
|  | 
 | |||
|  |     Open; | |||
|  |   end; | |||
|  |   if ADOCmd.IsEmpty=False then | |||
|  |   begin | |||
|  |     Application.MessageBox('<27>ϴ<EFBFBD>ͣ<EFBFBD><CDA3>δ<EFBFBD><CEB4><EFBFBD>п<EFBFBD><D0BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',0); | |||
|  |     Exit; | |||
|  |   end; | |||
|  |   Panel1.Visible:=True; | |||
|  |   sql:='select ZdyName Name from KH_Zdy where Type=''SWReason'' order by orderno '; | |||
|  |   SInitComBoxBySql(ADOTemp,SWReason,False,sql); | |||
|  |   SWReason.SetFocus; | |||
|  |   SWReason.DroppedDown:=True; | |||
|  |   //SWReason.
 | |||
|  |   DataLink_WFBProducttion.ADOLink.Connected:=False; | |||
|  | end; | |||
|  | 
 | |||
|  | procedure TfrmStopWorkInPut.Button5Click(Sender: TObject); | |||
|  | var | |||
|  |   FBZ,MaxNo:String; | |||
|  | begin | |||
|  |   DataLink_WFBProducttion.ADOLink.Connected:=False; | |||
|  |   DataLink_WFBProducttion.ADOLink.Connected:=True; | |||
|  |   with ADOTemp do | |||
|  |   begin | |||
|  |     Close; | |||
|  |     sql.Clear; | |||
|  |     sql.Add('select * from SY_User where UserId='''+Trim(DCode)+''''); | |||
|  |     Open; | |||
|  |   end; | |||
|  |   FBZ:=Trim(ADOTemp.fieldbyname('BanZu').AsString); | |||
|  |   with ADOTemp do | |||
|  |   begin | |||
|  |     Close; | |||
|  |     SQL.Clear; | |||
|  |     sql.Add('select * from WFB_StopWorkList'); | |||
|  |     sql.Add(' where SWEndtime is null'); | |||
|  |     if Trim(SCXFlag)<>'' then | |||
|  |     begin | |||
|  |       sql.Add(' and SWType='''+Trim(SCXFlag)+''''); | |||
|  |     end; | |||
|  |     Open; | |||
|  |   end; | |||
|  |   if ADOTemp.IsEmpty=True then | |||
|  |   begin | |||
|  |     Application.MessageBox('δ<>Ǽ<EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>','<27><>ʾ',0); | |||
|  |     exit; | |||
|  |   end; | |||
|  |   if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>п<EFBFBD><D0BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit; | |||
|  |   with ADOTemp do | |||
|  |   begin | |||
|  |     Close; | |||
|  |     SQL.Clear; | |||
|  |     SQL.Add('select Top 1*  from WFB_StopWorkList where SWEndtime is null '); | |||
|  |     if Trim(SCXFlag)<>'' then | |||
|  |     begin | |||
|  |       sql.Add(' and SWType='''+Trim(SCXFlag)+''''); | |||
|  |     end; | |||
|  |     sql.Add(' order by SWBegtime desc'); | |||
|  |     Open; | |||
|  |   end; | |||
|  |   MaxNo:=Trim(ADOTemp.fieldbyname('SWID').AsString); | |||
|  |   try | |||
|  |     ADOCmd.Connection.BeginTrans; | |||
|  |     with ADOCmd do | |||
|  |     begin | |||
|  |       Close; | |||
|  |       SQL.Clear; | |||
|  |       sql.Add('select * from WFB_StopWorkList where SWID='''+Trim(ADOTemp.fieldbyname('SWID').AsString)+''''); | |||
|  |       Open; | |||
|  |     end; | |||
|  | 
 | |||
|  |     with ADOCmd do | |||
|  |     begin | |||
|  |       Edit; | |||
|  |       FieldByName('SWEPerson').Value:=Trim(DName); | |||
|  |       FieldByName('SWPersonBZ').Value:=Trim(FBZ); | |||
|  |       FieldByName('SWEndtime').Value:=SGetServerDateTime(ADOTemp); | |||
|  |       Post; | |||
|  |     end; | |||
|  |     ADOCmd.Connection.CommitTrans; | |||
|  |     //Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0);
 | |||
|  |     CDS_Main.Locate('SWID',Trim(MaxNo),[]); | |||
|  |     with CDS_Main do | |||
|  |     begin | |||
|  |       Edit; | |||
|  |       FieldByName('SWEndtime').Value:=SGetServerDateTime(ADOTemp); | |||
|  |       FieldByName('SWEPerson').Value:=Trim(DName); | |||
|  |       //FieldByName('SWEPersonBZ').Value:=Trim(FBZ);
 | |||
|  |       Post; | |||
|  |     end; | |||
|  |   except | |||
|  |     ADOCmd.Connection.RollbackTrans; | |||
|  |     DataLink_WFBProducttion.ADOLink.Connected:=False; | |||
|  |     Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>','<27><>ʾ',0); | |||
|  |   end; | |||
|  |   DataLink_WFBProducttion.ADOLink.Connected:=False; | |||
|  | end; | |||
|  | 
 | |||
|  | procedure TfrmStopWorkInPut.Button6Click(Sender: TObject); | |||
|  | begin | |||
|  |   Close; | |||
|  |   WriteCxGrid('ͣ<><CDA3><EFBFBD><EFBFBD>¼',Tv1,'<27>IJ<DEB7><C4B2><EFBFBD><EFBFBD><EFBFBD>'); | |||
|  | end; | |||
|  | 
 | |||
|  | end. |