D10DJkaimengwenshang/项目代码/wenshangkm/G03贸易布匹检验/U_frameBads.pas
DESKTOP-E401PHE\Administrator 74d01e92e1 ~
2025-09-27 14:24:10 +08:00

239 lines
5.5 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_frameBads;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
System.Classes,
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, cxGraphics, cxControls,
cxLookAndFeels, cxLookAndFeelPainters, cxContainer, cxEdit,
Vcl.StdCtrls, Vcl.ExtCtrls, cxTextEdit, MovePanel, Vcl.Buttons,
cxGeometry, dxFramedControl, Vcl.Menus, cxButtons, dxPanel, cxScrollBox,
dxLayoutcxEditAdapters, dxLayoutContainer, cxClasses, dxLayoutControl,
Data.DB, Data.Win.ADODB, cxCheckBox;
type
TframeBads = class(TFrame)
dxPanel1: TdxPanel;
RadioGroup1: TRadioGroup;
dxPanel3: TdxPanel;
cxButton1: TcxButton;
cxButton2: TcxButton;
CIFBeg: TcxTextEdit;
CIFEnd: TcxTextEdit;
CIFQty: TcxTextEdit;
CIFNumber: TcxTextEdit;
dxLayoutControl1Group_Root: TdxLayoutGroup;
dxLayoutControl1: TdxLayoutControl;
dxLayoutGroup1: TdxLayoutGroup;
dxLayoutGroup2: TdxLayoutGroup;
dxLayoutItem2: TdxLayoutItem;
lblCIFName: TdxLayoutLabeledItem;
dxLayoutEmptySpaceItem1: TdxLayoutEmptySpaceItem;
dxLayoutLabeledItem1: TdxLayoutLabeledItem;
dxLayoutItem1: TdxLayoutItem;
dxLayoutItem3: TdxLayoutItem;
dxLayoutItem4: TdxLayoutItem;
dxLayoutItem5: TdxLayoutItem;
dxLayoutItem6: TdxLayoutItem;
lblLenUnit1: TdxLayoutLabeledItem;
ADOTmp: TADOQuery;
IsSubtract: TcxCheckBox;
cxScrollBox1: TcxScrollBox;
SubtractQty: TcxTextEdit;
dxLayoutAutoCreatedGroup1: TdxLayoutAutoCreatedGroup;
cxCheck_len: TcxCheckBox;
dxLayoutItem_checkLen: TdxLayoutItem;
procedure cxButton2Click(Sender: TObject);
procedure cxButton1Click(Sender: TObject);
procedure CIFBegPropertiesEditValueChanged(Sender: TObject);
procedure IsSubtractClick(Sender: TObject);
procedure SubtractQtyPropertiesEditValueChanged(Sender: TObject);
procedure CIFEndPropertiesChange(Sender: TObject);
private
procedure SpeedButtonClick(Sender: TObject);
public
fBadBtnSize: Integer;
fRowNumber: Integer;
procedure InitBadPanel();
end;
implementation
uses
U_DataLink;
{$R *.dfm}
procedure TframeBads.CIFBegPropertiesEditValueChanged(Sender: TObject);
var
mvalue: Double;
begin
if Trim(CIFBeg.Text) <> '' then
begin
if TryStrToFloat(CIFBeg.Text, mvalue) = False then
begin
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end
else
begin
Exit;
end;
if Trim(CIFEnd.Text) = '' then
begin
CIFQty.Text := '';
exit;
end ;
CIFQty.Text := FloatToStr(StrToFloat(CIFEnd.Text) - StrToFloat(CIFBeg.Text));
end;
procedure TframeBads.CIFEndPropertiesChange(Sender: TObject);
var
mvalue: Double;
begin
if Trim(CIFEnd.Text) <> '' then
begin
if TryStrToFloat(CIFEnd.Text, mvalue) = False then
begin
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end ;
if trim(CIFBeg.Text)='' then
CIFQty.Text :=''
else
CIFQty.Text := FloatToStr(StrToFloatDef(trim(CIFEnd.Text),0) - StrToFloatdef(trim(CIFBeg.Text),0));
end;
procedure TframeBads.cxButton1Click(Sender: TObject);
begin
RadioGroup1.ItemIndex := -1;
end;
procedure TframeBads.cxButton2Click(Sender: TObject);
var
mvalue: Double;
begin
if Trim(CIFBeg.Text) <> '' then
begin
if Trim(CIFEnd.Text) <> '' then
begin
if StrToFloat(CIFEnd.Text) < StrToFloat(CIFBeg.Text) then
begin
Application.MessageBox('<27>õ<EFBFBD>λ<EFBFBD><CEBB>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end;
end;
if CIFQty.Text <> '' then
begin
if TryStrToFloat(CIFQty.Text, mvalue) = False then
begin
Application.MessageBox('<27>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>!', '<27><>ʾ', 0);
Exit;
end;
end;
if strTofloatdef(Trim(SubtractQty.Text),0)>0 then
begin
IsSubtract.Checked:=true;
end
else
begin
IsSubtract.Checked:=false;
end;
end;
procedure TframeBads.InitBadPanel();
var
speedBtn: TSpeedButton;
zdyName: string;
i, k, j: Integer;
begin
with ADOTmp do
begin
Close;
sql.Clear;
sql.Add('select ZDYName from KH_Zdy where Type=''WFBCD'' order by ZDYNO ');
Open;
end;
if ADOTmp.IsEmpty then
begin
Application.MessageBox(<>ж<EFBFBD><D0B6><EFBFBD><EFBFBD>õ㣡', '<27><>ʾ', 0);
Exit;
end;
if fRowNumber = 0 then
fRowNumber := 5;
j := fRowNumber;
if fBadBtnSize < 30 then
fBadBtnSize := 40;
cxScrollBox1.DisableAlign;
with ADOTmp do
begin
First;
i := 0;
while not Eof do
begin
k := i div j;
zdyName := Trim(fieldbyname('ZDYName').AsString);
speedBtn := TSpeedButton.Create(self);
speedBtn.OnClick := SpeedButtonClick;
speedBtn.Width := fBadBtnSize;
speedBtn.Height := fBadBtnSize;
speedBtn.Left := 5 + (i mod j) * speedBtn.Width;
speedBtn.Top := 3 + k * speedBtn.Height;
speedBtn.Parent := cxScrollBox1;
speedBtn.Hint := zdyName;
if Length(zdyName) > 4 then
begin
speedBtn.Caption := Copy(zdyName, 1, 4) + #13 +
Copy(zdyName, 5, Length(zdyName) - 4);
end
else
speedBtn.Caption := zdyName;
i := i + 1;
Next;
end;
end;
cxScrollBox1.EnableAlign;
end;
procedure TframeBads.IsSubtractClick(Sender: TObject);
begin
end;
//
procedure TframeBads.SpeedButtonClick(Sender: TObject);
begin
dxPanel1.Visible := true;
lblCIFName.Caption := Trim(TSpeedButton(Sender).Hint);
// CIFNumber.SetFocus;
end;
procedure TframeBads.SubtractQtyPropertiesEditValueChanged(Sender: TObject);
begin
if trim(SubtractQty.Text)<>'' then
isSubTract.Checked:=true
else
isSubTract.Checked:=false;
end;
end.