D7gmYushang/染整计划(DyeingFinishingPlan.dll)/U_TableInspection.pas
DESKTOP-E401PHE\Administrator 1d94a89439 0
2025-09-24 13:13:14 +08:00

294 lines
7.7 KiB
ObjectPascal
Raw Permalink 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_TableInspection;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, cxCalendar, cxGridLevel,
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
cxControls, cxGridCustomView, cxGrid, RM_Common, RM_Class, RM_GridReport,
RM_System, RM_Dataset, ADODB, DBClient, cxGridCustomPopupMenu, cxGridPopupMenu,
ExtCtrls, ComCtrls, ToolWin, cxTextEdit, Buttons, cxSplitter, cxCheckBox,
MovePanel, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, RM_Preview;
type
TfrmTableInspection = class(TForm)
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
cxStyle2: TcxStyle;
cxGridPopupMenu1: TcxGridPopupMenu;
ADOCmd: TADOQuery;
RMDB_Main: TRMDBDataSet;
RM2: TRMGridReport;
cxGrid3: TcxGrid;
Tv3: TcxGridDBTableView;
cxGridDBColumn1: TcxGridDBColumn;
cxGridLevel2: TcxGridLevel;
DataSource3: TDataSource;
CDS_MJID: TClientDataSet;
ADOQueryPrint: TADOQuery;
v3Column1: TcxGridDBColumn;
v3Column2: TcxGridDBColumn;
v3Column3: TcxGridDBColumn;
v3Column4: TcxGridDBColumn;
v3Column5: TcxGridDBColumn;
ADOTmp: TADOQuery;
Panel6: TPanel;
Label39: TLabel;
Edit8: TEdit;
Button5: TButton;
Button3: TButton;
Button1: TButton;
Panel1: TPanel;
Label1: TLabel;
edtSBQ: TEdit;
Button2: TButton;
Button4: TButton;
Button6: TButton;
Button7: TButton;
Button8: TButton;
Button9: TButton;
Button10: TButton;
Button11: TButton;
Button12: TButton;
Button13: TButton;
Button14: TButton;
Button15: TButton;
Tv3Column1: TcxGridDBColumn;
ADOQueryMain: TADOQuery;
RMPreview1: TRMPreview;
ADOQueryLabel: TADOQuery;
RM3: TRMGridReport;
cxStyleRepository2: TcxStyleRepository;
cxStyle3: TcxStyle;
procedure Button5Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Edit8Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Tv3CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
procedure Button15Click(Sender: TObject);
private
{ Private declarations }
procedure InitDDYGrid(JT: string);
procedure PrtData(FMJID, ZCTS: string);
public
fmanage: string;
{ Public declarations }
end;
var
frmTableInspection: TfrmTableInspection;
newh, newh1: hwnd;
implementation
uses
U_DataLink, U_Fun, U_ZDYHelp, U_iniParam, U_ProductOrderListSel, U_WBQBD;
{$R *.dfm}
procedure TfrmTableInspection.InitDDYGrid(JT: string);
begin
with ADOQueryMain do
begin
Close;
SQL.Clear;
sql.Add('select A.*');
sql.Add('from WFB_MJJY A where isnull(BaoID,'''')='''' ');
sql.Add(' and JTType=''' + Trim(JT) + '''');
Open;
end;
SCreateCDS20(ADOQueryMain, CDS_MJID);
SInitCDSData20(ADOQueryMain, CDS_MJID);
end;
procedure TfrmTableInspection.PrtData(FMJID, ZCTS: string);
var
fPrintFile: string;
Txt, fImagePath: string;
Moudle: THandle;
Makebar: TMakebar;
Mixtext: TMixtext;
begin
with ADOQueryPrint do
begin
Close;
SQL.Clear;
sql.Add(' EXEC P_Print_JYLab ');
SQL.Add(' @MJID=''' + Trim(FMJID) + '''');
Open;
end;
if ADOQueryPrint.IsEmpty then
begin
application.MessageBox('<27><>ǩ<EFBFBD><C7A9><EFBFBD><EFBFBD>δ<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
exit;
end;
try
Moudle := LoadLibrary('MakeQRBarcode.dll');
@Makebar := GetProcAddress(Moudle, 'Make');
@Mixtext := GetProcAddress(Moudle, 'MixText');
Txt := Trim(ADOQueryPrint.fieldbyname('MJID').AsString);
fImagePath := ExtractFilePath(Application.ExeName) + 'image\temp.bmp';
if not DirectoryExists(pchar(ExtractFilePath(Application.ExeName) + 'image')) then
CreateDirectory(pchar(ExtractFilePath(Application.ExeName) + 'image'), nil);
if FileExists(fImagePath) then
DeleteFile(fImagePath);
Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
except
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>', '<27><>ʾ<EFBFBD><CABE>Ϣ', MB_ICONERROR);
exit;
end;
if Trim(ADOQueryPrint.fieldbyname('THBQ').AsString) <> '' then
begin
ExportFtErpFile(Trim(ADOQueryPrint.fieldbyname('THBQ').AsString) + '.rmf', ADOTmp);
if Trim(ADOQueryPrint.fieldbyname('THBQ').AsString) <> '' then
begin
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('THBQ').AsString) + '.rmf'
end
else
begin
ExportFtErpFile(<><CDA8>Ӣ<EFBFBD>ı<EFBFBD>ǩ.rmf', ADOTmp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\ͨ<><CDA8>Ӣ<EFBFBD>ı<EFBFBD>ǩ.rmf';
end;
end
else
begin
ExportFtErpFile(Trim(ADOQueryPrint.fieldbyname('LBName').AsString) + '.rmf', ADOTmp);
if Trim(ADOQueryPrint.fieldbyname('LBName').AsString) <> '' then
begin
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('LBName').AsString) + '.rmf'
end
else
begin
ExportFtErpFile(<><CDA8>Ӣ<EFBFBD>ı<EFBFBD>ǩ.rmf', ADOTmp);
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\ͨ<><CDA8>Ӣ<EFBFBD>ı<EFBFBD>ǩ.rmf';
end;
end;
if FileExists(fPrintFile) then
begin
RMVariables['QRBARCODE'] := fImagePath;
if ZCTS = <><D4A4>' then
begin
RM3.LoadFromFile(fPrintFile);
RM3.DefaultCopies := 1;
RM3.Preview := RMPreview1;
RM3.ShowReport;
end;
if ZCTS = '<27><>ӡ' then
begin
RM2.LoadFromFile(fPrintFile);
if Trim(edtSBQ.Text) <> '' then
Rm2.DefaultCopies := 2
else
Rm2.DefaultCopies := 1;
RM2.PrintReport;
end;
end
else
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD><EFBFBD>' + fPrintFile), '<27><>ʾ', 0);
end;
end;
procedure TfrmTableInspection.Button5Click(Sender: TObject);
var
fPrintFile: string;
i: Integer;
mvalue: Double;
begin
if Trim(Edit8.Text) <> '' then
begin
if CDS_MJID.IsEmpty then
Exit;
with CDS_MJID do
begin
First;
while not Eof do
begin
with ADOCmd do
begin
Close;
SQL.Clear;
SQL.Add(' update WFB_MJJY set BaoID=MJID where MJID=' + Quotedstr(Trim(CDS_MJID.fieldbyname('MJID').AsString)));
ExecSQL;
end;
PrtData(CDS_MJID.fieldbyname('MJID').AsString, '<27><>ӡ');
Next;
end;
end;
end
else
begin
CDS_MJID.First;
with ADOCmd do
begin
Close;
SQL.Clear;
SQL.Add(' update WFB_MJJY set BaoID=MJID where MJID=' + Quotedstr(Trim(CDS_MJID.fieldbyname('MJID').AsString)));
ExecSQL;
end;
PrtData(CDS_MJID.fieldbyname('MJID').AsString, '<27><>ӡ');
end;
end;
procedure TfrmTableInspection.Button3Click(Sender: TObject);
begin
Close;
end;
procedure TfrmTableInspection.Edit8Click(Sender: TObject);
begin
if Trim(TEdit(Sender).Text) = '' then
begin
TEdit(Sender).Text := '<27><>';
end
else
begin
TEdit(Sender).Text := '';
end;
end;
procedure TfrmTableInspection.Button1Click(Sender: TObject);
begin
InitDDYGrid(TButton(Sender).Hint);
end;
procedure TfrmTableInspection.FormDestroy(Sender: TObject);
begin
frmTableInspection := nil;
end;
procedure TfrmTableInspection.Tv3CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
begin
PrtData(CDS_MJID.fieldbyname('MJID').AsString, <><D4A4>');
end;
procedure TfrmTableInspection.Button15Click(Sender: TObject);
begin
try
frmWBQBD := TfrmWBQBD.Create(Application);
with frmWBQBD do
begin
if ShowModal = 1 then
begin
end;
end;
finally
frmWBQBD.Free;
end;
end;
end.