261 lines
6.6 KiB
ObjectPascal
261 lines
6.6 KiB
ObjectPascal
![]() |
unit U_JBData; //<2F><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>ϵͳ<CFB5><CDB3>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD>ࡣ
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, DB, ADODB, StdCtrls, Buttons, ExtCtrls;
|
|||
|
|
|||
|
type
|
|||
|
TfrmJBData = class(TForm)
|
|||
|
Button1: TButton;
|
|||
|
MJLen: TEdit;
|
|||
|
Label1: TLabel;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
Label2: TLabel;
|
|||
|
Panel3: TPanel;
|
|||
|
SpeedButton1: TSpeedButton;
|
|||
|
SpeedButton2: TSpeedButton;
|
|||
|
SpeedButton3: TSpeedButton;
|
|||
|
SpeedButton4: TSpeedButton;
|
|||
|
SpeedButton5: TSpeedButton;
|
|||
|
SpeedButton6: TSpeedButton;
|
|||
|
SpeedButton7: TSpeedButton;
|
|||
|
SpeedButton8: TSpeedButton;
|
|||
|
SpeedButton9: TSpeedButton;
|
|||
|
SpeedButton10: TSpeedButton;
|
|||
|
SpeedButton12: TSpeedButton;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
Button2: TButton;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure SpeedButton1Click(Sender: TObject);
|
|||
|
procedure SpeedButton12Click(Sender: TObject);
|
|||
|
procedure Button1Click(Sender: TObject);
|
|||
|
procedure Button2Click(Sender: TObject);
|
|||
|
private
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmJBData: TfrmJBData;
|
|||
|
|
|||
|
implementation
|
|||
|
Uses
|
|||
|
U_DataLink,U_Fun,U_ZDYHelp,U_iniParam;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmJBData.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmJBData:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJBData.FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
begin
|
|||
|
|
|||
|
Action:=caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJBData.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
MJLen.SetFocus;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJBData.SpeedButton1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
MJLen.Text:=Trim(MJLen.Text)+Trim(TSpeedButton(Sender).Caption);
|
|||
|
MJLen.SelectAll;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJBData.SpeedButton12Click(Sender: TObject);
|
|||
|
begin
|
|||
|
if Trim(MJLen.Text)<>'' then
|
|||
|
begin
|
|||
|
MJLen.Text:=Copy(Trim(MJLen.Text),1,Length(Trim(MJLen.Text))-1);
|
|||
|
MJLen.SelectAll;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJBData.Button1Click(Sender: TObject);
|
|||
|
var
|
|||
|
FFMJLen:Double;
|
|||
|
MJIDInt:Integer;
|
|||
|
maxno,maxno10,FBanZu,maxno100,maxno200,maxno300:String;
|
|||
|
begin
|
|||
|
if Trim(MJLen.Text)='' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
|
|||
|
MJLen.SetFocus;
|
|||
|
exit;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select isnull(Max(Cast(MJID as int)),0) MJIDInt from WFB_MJJY');
|
|||
|
if Trim(SCXFlag)<>'' then
|
|||
|
begin
|
|||
|
sql.Add(' where JTType='''+Trim(SCXFlag)+'''');
|
|||
|
end;
|
|||
|
Open;
|
|||
|
end;
|
|||
|
|
|||
|
MJIDInt:=ADOQueryTemp.fieldbyname('MJIDInt').Value;
|
|||
|
maxno100:=Trim(FormatDateTime('yyyyMMdd',SGetServerDateTime(ADOQueryTemp)));
|
|||
|
maxno100:=Trim(SCXFlag)+Trim(Copy(maxno100,3,6));
|
|||
|
maxno200:=IntToStr(MJIDInt);
|
|||
|
maxno200:=Copy(maxno200,1,7);
|
|||
|
if StrToInt(maxno100)>StrToInt(maxno200) then
|
|||
|
begin
|
|||
|
maxno300:=Trim(maxno100)+'01';
|
|||
|
end else
|
|||
|
begin
|
|||
|
maxno300:=IntToStr(MJIDInt+1);
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from WFB_JYResult where MJID='''+Trim(maxno300)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty then
|
|||
|
begin
|
|||
|
Application.MessageBox('δ<><CEB4><EFBFBD>鲻<EFBFBD>ܽ<EFBFBD><DCBD>࣡','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
// <20><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>ϵͳ<CFB5><CDB3>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD>ࡣ
|
|||
|
if MJIDInt>0 then
|
|||
|
begin
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from WFB_JB where MJID='''+Trim(Inttostr(MJIDInt+1))+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if ADOQueryTemp.IsEmpty=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѵǼǣ<C7BC>','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
if Application.MessageBox('ȷ<><C8B7>Ҫִ<D2AA>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݽ<EFBFBD><DDBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<DEB8>','<27><>ʾ',32+4)<>IDYES then
|
|||
|
begin
|
|||
|
MJLen.Text:='';
|
|||
|
MJLen.SetFocus;
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
try
|
|||
|
ADOQueryCmd.Connection.BeginTrans;
|
|||
|
//<2F><><EFBFBD>潻<EFBFBD><E6BDBB><EFBFBD><EFBFBD>
|
|||
|
if GetLSNo(ADOQueryCmd,maxno,'JB','WFB_JB',2,1)=False then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD>ID<49>쳣<EFBFBD><ECB3A3>','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('select * from SY_User where UserId='''+Trim(DCode)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
FBanZu:=Trim(ADOQueryTemp.fieldbyname('BanZu').AsString);
|
|||
|
FFMJLen:=StrToFloat(MJLen.Text);
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from WFB_JB where 1<>1');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('JBID').Value:=Trim(maxno);
|
|||
|
FieldByName('MJID').Value:=Trim(maxno300);
|
|||
|
FieldByName('MJLen').Value:=FFMJLen;
|
|||
|
FieldByName('Filler').Value:=Trim(DName);
|
|||
|
FieldByName('BanZu').Value:=Trim(FBanZu);
|
|||
|
if Trim(SCXFlag)<>'' then
|
|||
|
begin
|
|||
|
FieldByName('JTType').Value:=Trim(SCXFlag);
|
|||
|
end;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
//<2F><><EFBFBD>潻<EFBFBD><E6BDBB><EFBFBD><EFBFBD>
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from SY_User where BanZu='''+Trim(FBanZu)+'''');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not eof do
|
|||
|
begin
|
|||
|
if GetLSNo(ADOQueryCmd,maxno10,'BZ','WFB_BanZu',4,1)=False then
|
|||
|
begin
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select * from WFB_BanZu where 1<>1');
|
|||
|
open;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
FieldByName('BZID').Value:=Trim(maxno10);
|
|||
|
FieldByName('BanZu').Value:=Trim(FBanZu);
|
|||
|
FieldByName('MJID').Value:=Trim(maxno300);
|
|||
|
// FieldByName('MJID').Value:=Trim(IntToStr(MJIDInt+1));
|
|||
|
FieldByName('MJLen').Value:=StrToFloat(MJLen.Text);
|
|||
|
FieldByName('UserId').Value:=Trim(ADOQueryTemp.fieldbyname('UserId').AsString);
|
|||
|
FieldByName('UserName').Value:=Trim(ADOQueryTemp.fieldbyname('UserName').AsString);
|
|||
|
FieldByName('Filler').Value:=Trim(DName);
|
|||
|
FieldByName('JBID').Value:=Trim(maxno);
|
|||
|
Post;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
ADOQueryCmd.Connection.CommitTrans;
|
|||
|
//Application.MessageBox('<27>Ǽdzɹ<C7B3>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
except
|
|||
|
|
|||
|
ADOQueryCmd.Connection.RollbackTrans;
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><ECB3A3>','<27><>ʾ',0);
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9><EFBFBD>࣡','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmJBData.Button2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|