通过chkbox判断是否能打印

This commit is contained in:
DESKTOP-E401PHE\Administrator 2025-10-11 13:30:56 +08:00
parent f7cbfd3267
commit 0148a8eeda
2 changed files with 24 additions and 11 deletions

View File

@ -151,7 +151,7 @@ object frmClothSCDCGAnPai: TfrmClothSCDCGAnPai
end end
object Label5: TLabel object Label5: TLabel
Left = 826 Left = 826
Top = 10 Top = 11
Width = 132 Width = 132
Height = 21 Height = 21
Caption = #8594#24050#23433#25490#21305#25968 Caption = #8594#24050#23433#25490#21305#25968
@ -164,7 +164,7 @@ object frmClothSCDCGAnPai: TfrmClothSCDCGAnPai
end end
object Label8: TLabel object Label8: TLabel
Left = 1064 Left = 1064
Top = 10 Top = 11
Width = 88 Width = 88
Height = 21 Height = 21
Caption = #21305#25968#19978#38480 Caption = #21305#25968#19978#38480
@ -177,7 +177,7 @@ object frmClothSCDCGAnPai: TfrmClothSCDCGAnPai
end end
object Label10: TLabel object Label10: TLabel
Left = 696 Left = 696
Top = 10 Top = 11
Width = 66 Width = 66
Height = 21 Height = 21
Caption = #35746#21333#21495 Caption = #35746#21333#21495
@ -228,7 +228,7 @@ object frmClothSCDCGAnPai: TfrmClothSCDCGAnPai
end end
object APPS: TEdit object APPS: TEdit
Left = 958 Left = 958
Top = 6 Top = 7
Width = 91 Width = 91
Height = 29 Height = 29
Font.Charset = GB2312_CHARSET Font.Charset = GB2312_CHARSET
@ -254,6 +254,16 @@ object frmClothSCDCGAnPai: TfrmClothSCDCGAnPai
ReadOnly = True ReadOnly = True
TabOrder = 1 TabOrder = 1
end end
object chksave: TCheckBox
Left = 1272
Top = 14
Width = 49
Height = 17
Caption = 'save'
Checked = True
State = cbChecked
TabOrder = 6
end
end end
object Panel2: TPanel object Panel2: TPanel
Left = 689 Left = 689

View File

@ -111,6 +111,7 @@ type
ADOQuery1: TADOQuery; ADOQuery1: TADOQuery;
Tv3Column1: TcxGridDBColumn; Tv3Column1: TcxGridDBColumn;
ToolButton4: TToolButton; ToolButton4: TToolButton;
chksave: TCheckBox;
procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TBCloseClick(Sender: TObject); procedure TBCloseClick(Sender: TObject);
procedure TBRafreshClick(Sender: TObject); procedure TBRafreshClick(Sender: TObject);
@ -216,7 +217,7 @@ begin
finally finally
ADOQueryMain.EnableControls; ADOQueryMain.EnableControls;
end; end;
Button2.Enabled := true; chksave.Checked := true;
cxGrid3.Enabled := true; cxGrid3.Enabled := true;
end; end;
@ -291,13 +292,16 @@ var
FFDS: Integer; FFDS: Integer;
FGYCarNo: string; FGYCarNo: string;
begin begin
Button2.Enabled := False; if not chksave.Checked then
Exit;
chksave.Checked := False;
if ClientDataSet3.IsEmpty then if ClientDataSet3.IsEmpty then
Exit; Exit;
if ClientDataSet3.Locate('SSel', True, []) = False then if ClientDataSet3.Locate('SSel', True, []) = False then
begin begin
Application.MessageBox('没有选择数据!', '提示', 0); Application.MessageBox('没有选择数据!', '提示', 0);
Button2.Enabled := True; chksave.Checked := True;
Exit; Exit;
end end
else else
@ -343,13 +347,13 @@ begin
if Trim(PS.Text) = '' then if Trim(PS.Text) = '' then
begin begin
Application.MessageBox('匹数不能为空!', '提示', 0); Application.MessageBox('匹数不能为空!', '提示', 0);
Button2.Enabled := True; chksave.Checked := True;
Exit; Exit;
end; end;
if TryStrToInt(Trim(PS.Text), FFDS) = False then if TryStrToInt(Trim(PS.Text), FFDS) = False then
begin begin
Application.MessageBox('匹数非法', '提示', 0); Application.MessageBox('匹数非法', '提示', 0);
Button2.Enabled := True; chksave.Checked := True;
Exit; Exit;
end; end;
// if Trim(JXPerson.Text) = '' then // if Trim(JXPerson.Text) = '' then
@ -382,7 +386,7 @@ begin
if FFDS * strtoint(PS.Text) + strtoint(APPS.Text) > StrToInt(PSSX.Text) then if FFDS * strtoint(PS.Text) + strtoint(APPS.Text) > StrToInt(PSSX.Text) then
begin begin
Application.MessageBox('安排匹数过多,不允许保存!', '提示', 0); Application.MessageBox('安排匹数过多,不允许保存!', '提示', 0);
Button2.Enabled := True; chksave.Checked := True;
Exit; Exit;
end; end;
@ -1099,7 +1103,6 @@ procedure TfrmClothSCDCGAnPai.PSKeyPress(Sender: TObject; var Key: Char);
begin begin
if Key = #13 then if Key = #13 then
begin begin
Button2.Enabled := False;
Button2.Click; Button2.Click;
end; end;
end; end;