D7DJalisi/检验管理/U_BQ.pas
DESKTOP-E401PHE\Administrator 1c2ac93a7e ~
2025-07-10 16:20:00 +08:00

121 lines
3.5 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_BQ;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
cxStyles, cxCustomData, cxFilter, cxData, cxDataStorage, cxEdit, cxNavigator,
DB, cxDBData, cxGridCustomTableView, cxGridTableView, cxGridDBTableView,
DBClient, cxGridLevel, cxClasses, cxGridCustomView, cxGrid, ADODB,
RM_System, RM_Common, RM_Class, RM_GridReport;
type
TfrmBQ = class(TForm)
cxGrid1DBTableView1: TcxGridDBTableView;
cxGrid1Level1: TcxGridLevel;
cxGrid1: TcxGrid;
DataSource1: TDataSource;
Order_Main: TClientDataSet;
cxGrid1DBTableView1Column1: TcxGridDBColumn;
ADOQueryMain: TADOQuery;
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
ADOQueryPrint: TADOQuery;
ADOQueryCmd: TADOQuery;
RM1: TRMGridReport;
procedure FormShow(Sender: TObject);
procedure cxGrid1DBTableView1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frmBQ: TfrmBQ;
implementation
uses
U_DataLink, U_Fun;
{$R *.dfm}
procedure TfrmBQ.FormShow(Sender: TObject);
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Close;
sql.Clear;
sql.add('select * from RT_FileUpdate ');
// Sql.add('inner join JYOrder_Sub B on B.Mainid=A.Mainid ');
sql.add('where filepath=''report'' ');
// sql.add('and A.Filltime<''' + Trim(FormatDatetime('yyyy-MM-dd', EndDate.DateTime + 1)) + ''' ');
Open;
end;
SCreateCDS20(ADOQueryMain, Order_Main);
SInitCDSData20(ADOQueryMain, Order_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
procedure TfrmBQ.cxGrid1DBTableView1CellClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean);
var
fPrintFile: string;
Txt, fImagePath: string;
Moudle: THandle;
Makebar: TMakebar;
Mixtext: TMixtext;
begin
if Order_Main.IsEmpty then
exit;
// if trim(Order_Main.fieldbyname('SLbName').AsString) = '' then
// exit;
with ADOQueryPrint do
begin
Close;
SQL.Clear;
sql.Add('exec P_Print_Cs_Roll_copy1 ');
sql.Add('@mainID=''JS2302020003'' ');
Open;
end;
try
Moudle := LoadLibrary('MakeQRBarcode.dll');
@Makebar := GetProcAddress(Moudle, 'Make');
@Mixtext := GetProcAddress(Moudle, 'MixText');
Txt := '1';
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;
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(Order_Main.fieldbyname('filename').AsString);
ExportFtErpFile(Trim(Order_Main.fieldbyname('filename').AsString), ADOQueryCmd);
if FileExists(fPrintFile) then
begin
RMVariables['QRBARCODE'] := fImagePath;
RM1.LoadFromFile(fPrintFile);
RM1.ShowReport;
end
else
begin
Application.MessageBox(PChar(<><C3BB><EFBFBD>ҵ<EFBFBD>' + trim(fPrintFile)), '<27><>ʾ<EFBFBD><CABE>Ϣ', 0);
end;
end;
end.