371 lines
8.8 KiB
ObjectPascal
371 lines
8.8 KiB
ObjectPascal
|
|
unit U_BQDY;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
|
|||
|
|
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, cxGraphics,
|
|||
|
|
cxControls, cxLookAndFeels, cxLookAndFeelPainters, cxStyles, dxSkinsCore,
|
|||
|
|
dxSkinsDefaultPainters, cxCustomData, cxFilter, cxData, cxDataStorage, cxEdit,
|
|||
|
|
cxNavigator, dxDateRanges, Data.DB, cxDBData, cxGridLevel, cxClasses,
|
|||
|
|
cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
|
|||
|
|
cxGrid, Vcl.ExtCtrls, Vcl.StdCtrls, Datasnap.DBClient, Data.Win.ADODB,
|
|||
|
|
dxScrollbarAnnotations;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
TfrmBQDY = class(TForm)
|
|||
|
|
Panel1: TPanel;
|
|||
|
|
TV1: TcxGridDBTableView;
|
|||
|
|
cxGrid1Level1: TcxGridLevel;
|
|||
|
|
cxGrid1: TcxGrid;
|
|||
|
|
ADOQueryMain: TADOQuery;
|
|||
|
|
ADOQueryTemp: TADOQuery;
|
|||
|
|
CDS_Main: TClientDataSet;
|
|||
|
|
DataSource1: TDataSource;
|
|||
|
|
ADOQueryCmd: TADOQuery;
|
|||
|
|
TV1Column1: TcxGridDBColumn;
|
|||
|
|
TV1Column2: TcxGridDBColumn;
|
|||
|
|
TV1Column3: TcxGridDBColumn;
|
|||
|
|
TV1Column4: TcxGridDBColumn;
|
|||
|
|
cxStyleRepository1: TcxStyleRepository;
|
|||
|
|
cxStyle1: TcxStyle;
|
|||
|
|
Panel2: TPanel;
|
|||
|
|
Label1: TLabel;
|
|||
|
|
Label2: TLabel;
|
|||
|
|
Label3: TLabel;
|
|||
|
|
Label4: TLabel;
|
|||
|
|
Label5: TLabel;
|
|||
|
|
Label6: TLabel;
|
|||
|
|
Label7: TLabel;
|
|||
|
|
Label8: TLabel;
|
|||
|
|
Label9: TLabel;
|
|||
|
|
Label10: TLabel;
|
|||
|
|
Label11: TLabel;
|
|||
|
|
Label12: TLabel;
|
|||
|
|
Button1: TButton;
|
|||
|
|
Label13: TLabel;
|
|||
|
|
Label14: TLabel;
|
|||
|
|
Label15: TLabel;
|
|||
|
|
Label16: TLabel;
|
|||
|
|
MJXH: TEdit;
|
|||
|
|
MJQty4: TEdit;
|
|||
|
|
MJLen: TEdit;
|
|||
|
|
MJMaoZ: TEdit;
|
|||
|
|
ADOCmd: TADOQuery;
|
|||
|
|
ADOTmp: TADOQuery;
|
|||
|
|
Button2: TButton;
|
|||
|
|
ADOQueryPrint: TADOQuery;
|
|||
|
|
Button3: TButton;
|
|||
|
|
Label17: TLabel;
|
|||
|
|
Label18: TLabel;
|
|||
|
|
Label19: TLabel;
|
|||
|
|
Label20: TLabel;
|
|||
|
|
Button4: TButton;
|
|||
|
|
Edit1: TEdit;
|
|||
|
|
Label21: TLabel;
|
|||
|
|
Label22: TLabel;
|
|||
|
|
procedure FormShow(Sender: TObject);
|
|||
|
|
procedure Button1Click(Sender: TObject);
|
|||
|
|
procedure Button2Click(Sender: TObject);
|
|||
|
|
procedure Button3Click(Sender: TObject);
|
|||
|
|
procedure MJXHKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
procedure MJQty4KeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
procedure MJLenKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
procedure MJMaoZKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
procedure Button4Click(Sender: TObject);
|
|||
|
|
procedure Edit1Click(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
{ Private declarations }
|
|||
|
|
PState: Integer;
|
|||
|
|
FFFMJID: string;
|
|||
|
|
function SaveData(): Boolean;
|
|||
|
|
// procedure PrtData(FFFMJID: string);
|
|||
|
|
public
|
|||
|
|
{ Public declarations }
|
|||
|
|
FBCIOID, FC_Name, FC_Spec, FC_Width, FC_GramWeight, FC_Code, FC_Color, FC_ColorNo, FC_StyleNo, FC_Pattern, FC_Composition, FFromcontractNO, FFromC_ConNo, FFromoperationNO, FFromPurNo,FFromBuyConNoHZ: string;
|
|||
|
|
FPiece: double;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frmBQDY: TfrmBQDY;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
U_DataLink, U_RTFun, U_ZDYHelp, U_LabelPrint;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
//procedure TfrmBQDY.PrtData(FFFMJID: string);
|
|||
|
|
//var
|
|||
|
|
// fPrintFile: string;
|
|||
|
|
// Txt, fImagePath: string;
|
|||
|
|
// Moudle: THandle;
|
|||
|
|
// Makebar: TMakebar;
|
|||
|
|
// Mixtext: TMixtext;
|
|||
|
|
//begin
|
|||
|
|
// with ADOQueryPrint do
|
|||
|
|
// begin
|
|||
|
|
// Close;
|
|||
|
|
// SQL.Clear;
|
|||
|
|
// sql.Add('select A.*,B.* ');
|
|||
|
|
// sql.Add(' from WFB_MJJY A');
|
|||
|
|
// sql.Add(' inner join BS_Cloth_IO B On A.BCIOID=B.BCIOID');
|
|||
|
|
// SQL.Add(' where A.MJID=''' + Trim(FFFMJID) + '''');
|
|||
|
|
// Open;
|
|||
|
|
// end;
|
|||
|
|
//
|
|||
|
|
//end;
|
|||
|
|
|
|||
|
|
function TfrmBQDY.SaveData(): Boolean;
|
|||
|
|
var
|
|||
|
|
maxno, FMJID: string;
|
|||
|
|
begin
|
|||
|
|
// if PState = 1 then
|
|||
|
|
// FMJID := ''
|
|||
|
|
// else if PState = 2 then
|
|||
|
|
// FMJID := Trim(CDS_MJID.fieldbyname('MJID').AsString)
|
|||
|
|
// else if PState < 1 then
|
|||
|
|
// Exit;
|
|||
|
|
|
|||
|
|
result := false;
|
|||
|
|
if PState = 2 then
|
|||
|
|
begin
|
|||
|
|
FMJID := Trim(CDS_Main.fieldbyname('MJID').AsString)
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
try
|
|||
|
|
ADOCmd.Connection.BeginTrans;
|
|||
|
|
// ADOCmd.DisableControls;
|
|||
|
|
with ADOCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
SQL.Add('select * from WFB_MJJY where MJId=''' + Trim(FMJID) + '''');
|
|||
|
|
// showmessage(sql.text);
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
with ADOCmd do
|
|||
|
|
begin
|
|||
|
|
// if Trim(FMJID) = '' then
|
|||
|
|
// begin
|
|||
|
|
Append;
|
|||
|
|
if GetLSNo(ADOTmp, maxno, 'MJ', 'WFB_MJJY', 4, 1) = False then
|
|||
|
|
begin
|
|||
|
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE><EFBFBD>쳣<EFBFBD><ECB3A3>', '<27><>ʾ', 0);
|
|||
|
|
exit;
|
|||
|
|
end;
|
|||
|
|
// end
|
|||
|
|
// else
|
|||
|
|
// begin
|
|||
|
|
// maxno := Trim(FMJID);
|
|||
|
|
// Edit;
|
|||
|
|
// end;
|
|||
|
|
FieldByName('MJID').Value := Trim(maxno);
|
|||
|
|
FieldByName('BCIOID').Value := Trim(FBCIOID);
|
|||
|
|
FieldByName('MJXH').Value := Trim(MJXH.Text);
|
|||
|
|
FieldByName('MJQty4').Value := Trim(MJQty4.Text);
|
|||
|
|
FieldByName('MJLen').Value := strtofloatdef(Trim(MJLen.Text), 0);
|
|||
|
|
FieldByName('MJMaoZ').Value := strtofloatdef(Trim(MJMaoZ.Text), 0);
|
|||
|
|
FieldByName('CKflag').Value := '<27><><EFBFBD><EFBFBD>';
|
|||
|
|
FieldByName('FillTime').Value := SGetServerDateTime(ADOTmp);
|
|||
|
|
Post;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
FFFMJID := Trim(maxno);
|
|||
|
|
ADOCmd.Connection.CommitTrans;
|
|||
|
|
Result := True;
|
|||
|
|
except
|
|||
|
|
Result := False;
|
|||
|
|
ADOCmd.Connection.RollbackTrans;
|
|||
|
|
// ADOCmd.EnableControls;
|
|||
|
|
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ', 0);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBQDY.Button1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if SaveData() then
|
|||
|
|
begin
|
|||
|
|
// Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!', '<27><>ʾ', 0);
|
|||
|
|
//ModalResult:=1;
|
|||
|
|
// Exit;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
exit;
|
|||
|
|
Button2.Click;
|
|||
|
|
|
|||
|
|
if Trim(Edit1.Text) = '<27><>' then
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
|||
|
|
with frmLabelPrint do
|
|||
|
|
begin
|
|||
|
|
FLMType := 'bqPrint';
|
|||
|
|
// FFiltration1 := QuotedStr(Trim(Self.CDS_1.fieldbyname('ConMID').AsString));
|
|||
|
|
FFiltration1 := QuotedStr(Trim(FFFMJID));
|
|||
|
|
// FFiltration1 := FFFMJID ;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
// Self.InitGrid();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmLabelPrint.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
|
|||
|
|
// if Key = #13 then
|
|||
|
|
// begin
|
|||
|
|
MJXH.SetFocus;
|
|||
|
|
// end;
|
|||
|
|
// PrtData(FFFMJID);
|
|||
|
|
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBQDY.Button2Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
ADOQueryMain.DisableControls;
|
|||
|
|
with ADOQueryMain do
|
|||
|
|
begin
|
|||
|
|
Filtered := False;
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.Add('select ');
|
|||
|
|
|
|||
|
|
sql.Add(' A.* from WFB_MJJY A where BCIOID=''' + Trim(FBCIOID) + '''');
|
|||
|
|
sql.Add(' order by FillTime desc');
|
|||
|
|
Open;
|
|||
|
|
end;
|
|||
|
|
// SDofilter(ADOQueryMain, SGetFilters(Panel1, 1, 2));
|
|||
|
|
SCreateCDS(ADOQueryMain, CDS_Main);
|
|||
|
|
SInitCDSData(ADOQueryMain, CDS_Main);
|
|||
|
|
|
|||
|
|
finally
|
|||
|
|
ADOQueryMain.EnableControls;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBQDY.Button3Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if CDS_Main.IsEmpty then
|
|||
|
|
exit;
|
|||
|
|
|
|||
|
|
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲ<EFBFBD><DDB2>ָܻ<DCBB><D6B8><EFBFBD>', '<27><>ʾ', 32 + 4) <> IDYES then
|
|||
|
|
Exit;
|
|||
|
|
//
|
|||
|
|
|
|||
|
|
with ADOQueryCmd do
|
|||
|
|
begin
|
|||
|
|
Close;
|
|||
|
|
sql.Clear;
|
|||
|
|
sql.add('insert into WFB_MJJY_DEL select * from WFB_MJJY where MJID=''' + trim(CDS_Main.fieldbyname('MJID').AsString) + ''' ');
|
|||
|
|
sql.Add('DELETE from WFB_MJJY where MJID=''' + trim(CDS_Main.fieldbyname('MJID').AsString) + ''' ');
|
|||
|
|
|
|||
|
|
ExecSQL;
|
|||
|
|
end;
|
|||
|
|
Button2.Click;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBQDY.Button4Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
try
|
|||
|
|
frmLabelPrint := TfrmLabelPrint.Create(Application);
|
|||
|
|
with frmLabelPrint do
|
|||
|
|
begin
|
|||
|
|
FLMType := 'bqPrint';
|
|||
|
|
// FFiltration1 := QuotedStr(Trim(Self.CDS_1.fieldbyname('ConMID').AsString));
|
|||
|
|
FFiltration1 := QuotedStr(Trim(CDS_Main.fieldbyname('MJID').AsString));
|
|||
|
|
// FFiltration1 := FFFMJID ;
|
|||
|
|
if ShowModal = 1 then
|
|||
|
|
begin
|
|||
|
|
// Self.InitGrid();
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
finally
|
|||
|
|
frmLabelPrint.Free;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBQDY.Edit1Click(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if Trim(Edit1.Text) = '' then
|
|||
|
|
begin
|
|||
|
|
Edit1.Text := '<27><>';
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
Edit1.Text := '';
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBQDY.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
Label1.Caption := '<27><><EFBFBD>ⵥ<EFBFBD><E2B5A5>:' + FBCIOID;
|
|||
|
|
Label17.Caption := '<27><>ͬ<EFBFBD><CDAC>:' + FFromPurNo;
|
|||
|
|
Label18.Caption := '<27><>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>:' + FFromcontractNO;
|
|||
|
|
Label19.Caption := '<27><>ϸ<EFBFBD><CFB8>ͬ<EFBFBD><CDAC>:' + FFromC_ConNo;
|
|||
|
|
Label20.Caption := '<27><>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD>:' + FFromoperationNO;
|
|||
|
|
Label22.Caption := '<27>ܿͻ<DCBF><CDBB><EFBFBD><EFBFBD><EFBFBD>:' + FFromBuyConNoHZ;
|
|||
|
|
Label2.Caption := 'Ʒ<><C6B7>:' + FC_Name;
|
|||
|
|
Label3.Caption := '<27><><EFBFBD><EFBFBD>:' + FC_Spec;
|
|||
|
|
Label4.Caption := '<27>ŷ<EFBFBD>:' + FC_Width;
|
|||
|
|
Label5.Caption := '<27><><EFBFBD><EFBFBD>:' + FC_GramWeight;
|
|||
|
|
Label6.Caption := '<27>ɷ<EFBFBD>:' + FC_Composition;
|
|||
|
|
Label7.Caption := '<27><><EFBFBD><EFBFBD>:' + FC_Code;
|
|||
|
|
Label8.Caption := 'ƥ<><C6A5>:' + floattostr(FPiece);
|
|||
|
|
Label9.Caption := '<27><>ɫ:' + FC_Color;
|
|||
|
|
Label10.Caption := 'ɫ<><C9AB>:' + FC_ColorNo;
|
|||
|
|
Label11.Caption := '<27><><EFBFBD><EFBFBD>:' + FC_StyleNo;
|
|||
|
|
Label12.Caption := '<27><><EFBFBD><EFBFBD>:' + FC_Pattern;
|
|||
|
|
|
|||
|
|
Button2.Click;
|
|||
|
|
MJXH.SetFocus;
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBQDY.MJLenKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
begin
|
|||
|
|
if Key = #13 then
|
|||
|
|
begin
|
|||
|
|
MJMaoZ.SetFocus;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBQDY.MJMaoZKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
begin
|
|||
|
|
if Key = #13 then
|
|||
|
|
begin
|
|||
|
|
Button1.Click;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBQDY.MJQty4KeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
begin
|
|||
|
|
if Key = #13 then
|
|||
|
|
begin
|
|||
|
|
MJLen.SetFocus;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrmBQDY.MJXHKeyPress(Sender: TObject; var Key: Char);
|
|||
|
|
begin
|
|||
|
|
if Key = #13 then
|
|||
|
|
begin
|
|||
|
|
MJQty4.SetFocus;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|
|||
|
|
|