D7wmguihua/桂华管理系统/U_JYResult.pas
DESKTOP-E401PHE\Administrator b4b5840f18 1
2025-01-18 16:22:10 +08:00

481 lines
11 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_JYResult;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DB, ADODB, Buttons, ExtCtrls;
type
TfrmJYResult = class(TForm)
Label1: TLabel;
KZ1: TEdit;
KZ2: TEdit;
KZ3: TEdit;
KZ4: TEdit;
KZ5: TEdit;
Label2: TLabel;
HD1: TEdit;
HD2: TEdit;
HD3: TEdit;
HD4: TEdit;
HD5: TEdit;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
XSWater: TComboBox;
Label6: TLabel;
QiWei: TComboBox;
Button1: TButton;
Button2: TButton;
ADOQueryCmd: TADOQuery;
ADOQueryTemp: TADOQuery;
Panel3: TPanel;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton6: TSpeedButton;
SpeedButton7: TSpeedButton;
SpeedButton8: TSpeedButton;
SpeedButton9: TSpeedButton;
SpeedButton10: TSpeedButton;
SpeedButton11: TSpeedButton;
SpeedButton12: TSpeedButton;
Label7: TLabel;
SeLD: TComboBox;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormDestroy(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure KZ1Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton12Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure KZ2Click(Sender: TObject);
procedure KZ3Click(Sender: TObject);
procedure KZ4Click(Sender: TObject);
procedure KZ5Click(Sender: TObject);
procedure HD1Click(Sender: TObject);
procedure HD2Click(Sender: TObject);
procedure HD3Click(Sender: TObject);
procedure HD4Click(Sender: TObject);
procedure HD5Click(Sender: TObject);
private
Fint:Integer;
{ Private declarations }
public
{ Public declarations }
end;
var
frmJYResult: TfrmJYResult;
implementation
uses
U_DataLink,U_Fun,U_iniParam;
{$R *.dfm}
procedure TfrmJYResult.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
DataLink_WFBProducttion.ADOLink.Connected:=False;
Action:=caFree;
end;
procedure TfrmJYResult.FormDestroy(Sender: TObject);
begin
frmJYResult:=nil;
end;
procedure TfrmJYResult.Button1Click(Sender: TObject);
var
MJIDInt:Integer;
maxno,maxno10,maxno20,FBanZu:String;
begin
if( (Trim(KZ1.Text)<>'') and (Trim(KZ2.Text)<>'') and (Trim(KZ3.Text)<>'') and
(Trim(KZ4.Text)<>'') and (Trim(KZ5.Text)<>'') )=False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD>ȫ<EFBFBD><C8AB>','<27><>ʾ',0);
Exit;
end;
if( (Trim(HD1.Text)<>'') and (Trim(HD2.Text)<>'') and (Trim(HD3.Text)<>'') and
(Trim(HD4.Text)<>'') and (Trim(HD5.Text)<>'') )=False then
begin
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD>ȫ<EFBFBD><C8AB>','<27><>ʾ',0);
Exit;
end;
if Trim(XSWater.Text)='' then
begin
Application.MessageBox('<27><>ˮ<EFBFBD><CBAE><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
if Trim(QiWei.Text)='' then
begin
Application.MessageBox('<27><>ζ<EFBFBD><CEB6><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
if Trim(SeLD.Text)='' then
begin
Application.MessageBox(<>ζȲ<CEB6><C8B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
DataLink_WFBProducttion.ADOLink.Connected:=False;
DataLink_WFBProducttion.ADOLink.Connected:=True;
with ADOQueryTemp do
begin
Close;
sql.Clear;
SQL.Add('select * from WFB_MJJY where Cast(MJID as int)=');
sql.Add('(select Max(Cast(MJID as int) ) from WFB_JYResult');
if Trim(SCXFlag)<>'' then
begin
sql.Add(' where JTType='''+Trim(SCXFlag)+'''');
end;
sql.Add(')');
if Trim(SCXFlag)<>'' then
begin
sql.Add(' and JTType='''+Trim(SCXFlag)+'''');
end;
Open;
end;
if ADOQueryTemp.IsEmpty then
begin
with ADOQueryCmd do
begin
close;
SQL.Clear;
SQL.Add('select Top 1* from WFB_JYResult');
if Trim(SCXFlag)<>'' then
begin
sql.Add(' where JTType='''+Trim(SCXFlag)+'''');
end;
Open;
end;
if ADOQueryCmd.IsEmpty=False then
begin
Application.MessageBox('<27>Ͼ<EFBFBD>δ<EFBFBD><CEB4>ӡ<EFBFBD><D3A1>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD><EFBFBD><EFBFBD><EFBFBD>飡','<27><>ʾ',0);
Exit;
end;
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 Exit;
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;
// 112091201 20120914
MJIDInt:=ADOQueryTemp.fieldbyname('MJIDInt').Value;
maxno10:=Trim(FormatDateTime('yyyyMMdd',SGetServerDateTime(ADOQueryTemp)));
maxno10:=Trim(SCXFlag)+Trim(Copy(maxno10,3,6));
maxno20:=IntToStr(MJIDInt);
maxno20:=Copy(maxno20,1,7);
try
ADOQueryCmd.Connection.BeginTrans;
if MJIDInt>0 then
begin
if StrToInt(maxno10)>StrToInt(maxno20) then
begin
if GetLSNo(ADOQueryCmd,maxno,Trim(SCXFlag),'WFB_MJJY',2,1)=False then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
end else
maxno:=Trim(IntToStr(MJIDInt+1))
end else
begin
with ADOQueryTemp do
begin
Close;
SQL.Clear;
SQL.Add('select * from WFB_JB ');
Open;
end;
if ADOQueryTemp.IsEmpty then
begin
if GetLSNo(ADOQueryCmd,maxno,Trim(SCXFlag),'WFB_MJJY',2,1)=False then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox(<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
Exit;
end;
end else
begin
maxno:=Trim(ADOQueryTemp.fieldbyname('MJID').AsString);
end;
end;
with ADOQueryTemp do
begin
Close;
sql.Clear;
sql.Add('select * from WFB_JYResult where MJID='''+Trim(maxno)+'''');
Open;
end;
if ADOQueryTemp.IsEmpty=False then
begin
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD>飡','<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);
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('select * from WFB_JYResult where 1<>1');
Open;
end;
with ADOQueryCmd do
begin
Append;
FieldByName('MJID').Value:=Trim(maxno);
FieldByName('Filler').Value:=Trim(DName);
FieldByName('BanZu').Value:=Trim(FBanZu);
FieldByName('KZ1').Value:=Trim(KZ1.Text);
FieldByName('KZ2').Value:=Trim(KZ2.Text);
FieldByName('KZ3').Value:=Trim(KZ3.Text);
FieldByName('KZ4').Value:=Trim(KZ4.Text);
FieldByName('KZ5').Value:=Trim(KZ5.Text);
FieldByName('HD1').Value:=Trim(HD1.Text);
FieldByName('HD2').Value:=Trim(HD2.Text);
FieldByName('HD3').Value:=Trim(HD3.Text);
FieldByName('HD4').Value:=Trim(HD4.Text);
FieldByName('HD5').Value:=Trim(HD5.Text);
FieldByName('XSWater').Value:=Trim(XSWater.Text);
FieldByName('QiWei').Value:=Trim(QiWei.Text);
FieldByName('SeLD').Value:=Trim(SeLD.Text);
if Trim(SCXFlag)<>'' then
begin
FieldByName('JTType').Value:=Trim(SCXFlag);
end;
Post;
end;
ADOQueryCmd.Connection.CommitTrans;
//Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0);
Exit;
except
DataLink_WFBProducttion.ADOLink.Connected:=False;
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><ECB3A3>','<27><>ʾ',0);
end;
DataLink_WFBProducttion.ADOLink.Connected:=False;
end;
procedure TfrmJYResult.Button2Click(Sender: TObject);
begin
Close;
end;
procedure TfrmJYResult.KZ1Click(Sender: TObject);
begin
Fint:=1;
end;
procedure TfrmJYResult.SpeedButton1Click(Sender: TObject);
begin
if Fint=1 then
begin
KZ1.Text:=Trim(KZ1.Text)+Trim(TSpeedButton(Sender).Caption);
KZ1.SelectAll;
end else
if Fint=2 then
begin
KZ2.Text:=Trim(KZ2.Text)+Trim(TSpeedButton(Sender).Caption);
KZ2.SelectAll;
end else
if Fint=3 then
begin
KZ3.Text:=Trim(KZ3.Text)+Trim(TSpeedButton(Sender).Caption);
KZ3.SelectAll;
end else
if Fint=4 then
begin
KZ4.Text:=Trim(KZ4.Text)+Trim(TSpeedButton(Sender).Caption);
KZ4.SelectAll;
end else
if Fint=5 then
begin
KZ5.Text:=Trim(KZ5.Text)+Trim(TSpeedButton(Sender).Caption);
KZ5.SelectAll;
end else
if Fint=6 then
begin
HD1.Text:=Trim(HD1.Text)+Trim(TSpeedButton(Sender).Caption);
HD1.SelectAll;
end else
if Fint=7 then
begin
HD2.Text:=Trim(HD2.Text)+Trim(TSpeedButton(Sender).Caption);
HD2.SelectAll;
end else
if Fint=8 then
begin
HD3.Text:=Trim(HD3.Text)+Trim(TSpeedButton(Sender).Caption);
HD3.SelectAll;
end else
if Fint=9 then
begin
HD4.Text:=Trim(HD4.Text)+Trim(TSpeedButton(Sender).Caption);
HD4.SelectAll;
end else
if Fint=10 then
begin
HD5.Text:=Trim(HD5.Text)+Trim(TSpeedButton(Sender).Caption);
HD5.SelectAll;
end;
end;
procedure TfrmJYResult.SpeedButton12Click(Sender: TObject);
begin
if Fint=1 then
begin
if Trim(KZ1.Text)<>'' then
begin
KZ1.Text:=Copy(Trim(KZ1.Text),1,Length(Trim(KZ1.Text))-1);
KZ1.SelectAll;
end;
end else
if Fint=2 then
begin
if Trim(KZ2.Text)<>'' then
begin
KZ2.Text:=Copy(Trim(KZ2.Text),1,Length(Trim(KZ2.Text))-1);
KZ2.SelectAll;
end;
end else
if Fint=3 then
begin
if Trim(KZ3.Text)<>'' then
begin
KZ3.Text:=Copy(Trim(KZ3.Text),1,Length(Trim(KZ3.Text))-1);
KZ3.SelectAll;
end;
end else
if Fint=4 then
begin
if Trim(KZ4.Text)<>'' then
begin
KZ4.Text:=Copy(Trim(KZ4.Text),1,Length(Trim(KZ4.Text))-1);
KZ4.SelectAll;
end;
end else
if Fint=5 then
begin
if Trim(KZ5.Text)<>'' then
begin
KZ5.Text:=Copy(Trim(KZ5.Text),1,Length(Trim(KZ5.Text))-1);
KZ5.SelectAll;
end;
end else
if Fint=6 then
begin
if Trim(HD1.Text)<>'' then
begin
HD1.Text:=Copy(Trim(HD1.Text),1,Length(Trim(HD1.Text))-1);
HD1.SelectAll;
end;
end else
if Fint=7 then
begin
if Trim(HD2.Text)<>'' then
begin
HD2.Text:=Copy(Trim(HD2.Text),1,Length(Trim(HD2.Text))-1);
HD2.SelectAll;
end;
end else
if Fint=8 then
begin
if Trim(HD3.Text)<>'' then
begin
HD3.Text:=Copy(Trim(HD3.Text),1,Length(Trim(HD3.Text))-1);
HD3.SelectAll;
end;
end else
if Fint=9 then
begin
if Trim(HD4.Text)<>'' then
begin
HD4.Text:=Copy(Trim(HD4.Text),1,Length(Trim(HD4.Text))-1);
HD4.SelectAll;
end;
end else
if Fint=10 then
begin
if Trim(HD5.Text)<>'' then
begin
HD5.Text:=Copy(Trim(HD5.Text),1,Length(Trim(HD5.Text))-1);
HD5.SelectAll;
end;
end;
end;
procedure TfrmJYResult.FormShow(Sender: TObject);
begin
Fint:=1;
KZ1.SetFocus;
end;
procedure TfrmJYResult.KZ2Click(Sender: TObject);
begin
Fint:=2;
end;
procedure TfrmJYResult.KZ3Click(Sender: TObject);
begin
Fint:=3;
end;
procedure TfrmJYResult.KZ4Click(Sender: TObject);
begin
Fint:=4;
end;
procedure TfrmJYResult.KZ5Click(Sender: TObject);
begin
Fint:=5;
end;
procedure TfrmJYResult.HD1Click(Sender: TObject);
begin
Fint:=6;
end;
procedure TfrmJYResult.HD2Click(Sender: TObject);
begin
Fint:=7;
end;
procedure TfrmJYResult.HD3Click(Sender: TObject);
begin
Fint:=8;
end;
procedure TfrmJYResult.HD4Click(Sender: TObject);
begin
Fint:=9;
end;
procedure TfrmJYResult.HD5Click(Sender: TObject);
begin
Fint:=10;
end;
end.