10.25
This commit is contained in:
parent
7738aa2a58
commit
75d7afdabb
3880
A00标签打印/U_ClientPrintRmf.dfm
Normal file
3880
A00标签打印/U_ClientPrintRmf.dfm
Normal file
File diff suppressed because it is too large
Load Diff
296
A00标签打印/U_ClientPrintRmf.pas
Normal file
296
A00标签打印/U_ClientPrintRmf.pas
Normal file
|
|
@ -0,0 +1,296 @@
|
|||
unit U_ClientPrintRmf;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
||||
cxEdit, DB, cxDBData, ToolWin, ComCtrls, cxGridCustomTableView,
|
||||
cxGridTableView, cxGridDBTableView, cxGridLevel, cxClasses, cxControls,
|
||||
cxGridCustomView, cxGrid, DBClient, ADODB, ImgList, StdCtrls, ExtCtrls,
|
||||
cxTextEdit, cxGridCustomPopupMenu, cxGridPopupMenu, cxLookAndFeels,
|
||||
cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu, RM_Common, RM_Class,
|
||||
RM_GridReport, RM_Dataset, RM_E_llPDF, RM_BarCode, RM_e_Graphic, RM_e_Jpeg,
|
||||
RM_e_Xls, cxContainer, cxMaskEdit, cxDropDownEdit, cxMRUEdit, dxSkinsCore,
|
||||
dxSkinsDefaultPainters, cxProgressBar, cxButtons, RM_System;
|
||||
|
||||
type
|
||||
TfrmClientPrintRmf = class(TForm)
|
||||
ADOQueryTemp: TADOQuery;
|
||||
ADOConnection1: TADOConnection;
|
||||
ImageList1: TImageList;
|
||||
RMDB_1: TRMDBDataSet;
|
||||
RM1: TRMGridReport;
|
||||
RMDB_2: TRMDBDataSet;
|
||||
CDS_Label: TClientDataSet;
|
||||
ADO_Prt: TADOQuery;
|
||||
RMDB_3: TRMDBDataSet;
|
||||
RMXLSExport1: TRMXLSExport;
|
||||
RMJPEGExport1: TRMJPEGExport;
|
||||
RMBarCodeObject1: TRMBarCodeObject;
|
||||
ADOQueryCmd: TADOQuery;
|
||||
ADO_While: TADOQuery;
|
||||
RMDB_4: TRMDBDataSet;
|
||||
RMDB_5: TRMDBDataSet;
|
||||
ADOQueryReport: TADOQuery;
|
||||
CDS_1: TClientDataSet;
|
||||
CDS_2: TClientDataSet;
|
||||
CDS_3: TClientDataSet;
|
||||
CDS_4: TClientDataSet;
|
||||
CDS_5: TClientDataSet;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure TV1DblClick(Sender: TObject);
|
||||
private
|
||||
IsDebug, FPreviewPrint, fIsPreview: Boolean;
|
||||
FLMType, FLBName, FQrCodeField: string;
|
||||
FExportFileType, FExportFileName: string;
|
||||
SqlStr1, SqlStr2, SqlStr3, SqlStr4, SqlStr5: string;
|
||||
FSuccessfulFun: string;
|
||||
FparamBlclid: string;
|
||||
procedure PrintReport();
|
||||
procedure ExportReport();
|
||||
procedure GetPrtData(Ado: TADOQuery; Cds: TClientDataSet; SqlStr: string);
|
||||
procedure InitArgs();
|
||||
|
||||
{ Private declarations }
|
||||
public
|
||||
FPrintJson: PChar;
|
||||
FJsonOut: PChar;
|
||||
DConString, DCode, DName: string;
|
||||
constructor Create(AOwner: TComponent; JsonArgs: PChar);
|
||||
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmClientPrintRmf: TfrmClientPrintRmf;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
U_RTFun, U_Fun, superobject, U_QrCodeFun;
|
||||
|
||||
{$R *.dfm}
|
||||
constructor TfrmClientPrintRmf.Create(AOwner: TComponent; JsonArgs: PChar);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FPrintJson := JsonArgs;
|
||||
end;
|
||||
// 创建二维码存放目录(如果不存在)
|
||||
|
||||
procedure TfrmClientPrintRmf.InitArgs;
|
||||
var
|
||||
JSONObject, item: ISuperObject;
|
||||
jsonArray: TSuperArray;
|
||||
i, loopCount: Integer;
|
||||
begin
|
||||
// 解析 JSON 字符串
|
||||
JSONObject := SO(FPrintJson);
|
||||
if JSONObject = nil then
|
||||
begin
|
||||
Application.MessageBox('PrintJson格式异常!', '提示', 0);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
// 提取基础字段
|
||||
fIsPreview := JSONObject.B['IsPreview'];
|
||||
IsDebug := JSONObject.B['IsDebug'];
|
||||
FSuccessfulFun := JSONObject.S['SuccessfulFun'];
|
||||
FLMType := JSONObject.S['LMType'];
|
||||
FPreviewPrint := JSONObject.B['PreviewPrint'];
|
||||
FLBName := JSONObject.S['LBName'];
|
||||
FExportFileType := JSONObject.S['ExportFileType'];
|
||||
FExportFileName := JSONObject.S['ExportFileName'];
|
||||
FQrCodeField := JSONObject.S['QrCodeField'];
|
||||
DConString := JSONObject.S['DConString'];
|
||||
DCode := JSONObject.S['DCode'];
|
||||
DName := JSONObject.S['DName'];
|
||||
|
||||
// 设置默认导出文件名
|
||||
if Trim(FExportFileName) = '' then
|
||||
FExportFileName := FLBName;
|
||||
|
||||
|
||||
|
||||
// 初始化 SQL 字符串变量
|
||||
SqlStr1 := '';
|
||||
SqlStr2 := '';
|
||||
SqlStr3 := '';
|
||||
SqlStr4 := '';
|
||||
SqlStr5 := '';
|
||||
|
||||
// 获取并处理 PrtArgs 数组
|
||||
jsonArray := JSONObject.A['PrtArgs'];
|
||||
if Assigned(jsonArray) then
|
||||
begin
|
||||
// 确定循环次数(最多5个元素)
|
||||
loopCount := jsonArray.Length;
|
||||
|
||||
for i := 0 to loopCount - 1 do
|
||||
begin
|
||||
item := jsonArray.O[i];
|
||||
case i of
|
||||
0:
|
||||
SqlStr1 := item.S['SqlStr'];
|
||||
1:
|
||||
SqlStr2 := item.S['SqlStr'];
|
||||
2:
|
||||
SqlStr3 := item.S['SqlStr'];
|
||||
3:
|
||||
SqlStr4 := item.S['SqlStr'];
|
||||
4:
|
||||
SqlStr5 := item.S['SqlStr'];
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
// 设置报表预览按钮
|
||||
// if FPreviewPrint then
|
||||
// RM1.PreviewButtons := [rmpbZoom, rmpbLoad, rmpbSave, rmpbPrint, rmpbFind, rmpbPageSetup, rmpbExit, rmpbSaveToXLS, rmpbExport, rmpbNavigator]
|
||||
// else
|
||||
// RM1.PreviewButtons := [rmpbZoom, rmpbLoad, rmpbSave, rmpbFind, rmpbPageSetup, rmpbExit, rmpbSaveToXLS, rmpbExport, rmpbNavigator];
|
||||
end;
|
||||
|
||||
procedure TfrmClientPrintRmf.GetPrtData(Ado: TADOQuery; Cds: TClientDataSet; SqlStr: string);
|
||||
begin
|
||||
if Trim(SqlStr) = '' then
|
||||
Exit;
|
||||
|
||||
// 执行ADO查询
|
||||
with Ado do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
SQL.Add(SqlStr);
|
||||
if IsDebug then
|
||||
ShowMessage(sql.Text);
|
||||
Open;
|
||||
end;
|
||||
IintCDS(Ado, Cds);
|
||||
SetQrCodePath(Cds, FQrCodeField);
|
||||
end;
|
||||
|
||||
procedure TfrmClientPrintRmf.ExportReport();
|
||||
var
|
||||
fPrintFile, fExportPath: string;
|
||||
begin
|
||||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + FLBName + '.rmf';
|
||||
if FileExists(fPrintFile) then
|
||||
begin
|
||||
RM1.LoadFromFile(fPrintFile);
|
||||
RMVariables['LBPrtCode'] := dcode;
|
||||
RMVariables['LBPrtName'] := dname;
|
||||
|
||||
fExportPath := ExtractFilePath(Application.ExeName) + FExportFileName + '.' + FExportFileType;
|
||||
if not DirectoryExists(ExtractFileDir(fExportPath)) then
|
||||
CreateDir(ExtractFileDir(fExportPath));
|
||||
RM1.PrepareReport; //直接导出
|
||||
// if FExportFileType = 'pdf' then
|
||||
// RM1.ExportTo(RMllPDFExport1, fExportPath)
|
||||
// else
|
||||
RM1.ExportTo(RMXLSExport1, fExportPath);
|
||||
|
||||
FJsonOut := '{"success":true,"message":"导出成功!"}';
|
||||
end
|
||||
else
|
||||
begin
|
||||
FJsonOut := '{"success":false,"message":"报表文件没找到!"}';
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmClientPrintRmf.PrintReport();
|
||||
var
|
||||
fPrintFile: string;
|
||||
begin
|
||||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + FLBName + '.rmf';
|
||||
if FileExists(fPrintFile) then
|
||||
begin
|
||||
RM1.LoadFromFile(fPrintFile);
|
||||
// RM1.DefaultCopies := StrToIntDef(ComboBox1.Text, 1);
|
||||
RMVariables['LBPrtCode'] := dcode;
|
||||
RMVariables['LBPrtName'] := dname;
|
||||
if fIsPreview then
|
||||
RM1.ShowReport
|
||||
else
|
||||
RM1.PrintReport;
|
||||
|
||||
FJsonOut := '{"success":true,"message":"打印成功!"}';
|
||||
end
|
||||
else
|
||||
begin
|
||||
FJsonOut := '{"success":false,"message":"报表文件没找到!"}';
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmClientPrintRmf.FormCreate(Sender: TObject);
|
||||
begin
|
||||
FPreviewPrint := True;
|
||||
InitArgs();
|
||||
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected := false;
|
||||
ConnectionString := DConString;
|
||||
Connected := true;
|
||||
end;
|
||||
// 导出文件操作(保持不变)
|
||||
ExportFtErpFile(FLBName + '.rmf', ADOQueryReport);
|
||||
EnsureQrCodeDirectory();
|
||||
ClearQrCodeDirectory();
|
||||
end;
|
||||
|
||||
procedure TfrmClientPrintRmf.FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
begin
|
||||
|
||||
Action := cafree;
|
||||
end;
|
||||
|
||||
procedure TfrmClientPrintRmf.FormShow(Sender: TObject);
|
||||
begin
|
||||
|
||||
if flbName = '' then
|
||||
begin
|
||||
FJsonOut := '{"success":false,"message":"未传入打印标签!"}';
|
||||
self.Close;
|
||||
exit;
|
||||
end;
|
||||
if SqlStr1 = '' then
|
||||
begin
|
||||
FJsonOut := '{"success":false,"message":"未传入打印语句!"}';
|
||||
self.Close;
|
||||
exit;
|
||||
end;
|
||||
|
||||
GetPrtData(ADO_Prt, CDS_1, SqlStr1);
|
||||
GetPrtData(ADO_Prt, CDS_2, SqlStr2);
|
||||
GetPrtData(ADO_Prt, CDS_3, SqlStr3);
|
||||
GetPrtData(ADO_Prt, CDS_4, SqlStr4);
|
||||
GetPrtData(ADO_Prt, CDS_5, SqlStr5);
|
||||
|
||||
if FExportFileType = '' then
|
||||
begin
|
||||
PrintReport();
|
||||
end
|
||||
else
|
||||
ExportReport();
|
||||
|
||||
self.Close;
|
||||
end;
|
||||
|
||||
procedure TfrmClientPrintRmf.TV1DblClick(Sender: TObject);
|
||||
begin
|
||||
ModalResult := 1;
|
||||
end;
|
||||
|
||||
procedure TfrmClientPrintRmf.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
frmClientPrintRmf := nil;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
18245
A00标签打印/U_LabelMapSet.dfm
Normal file
18245
A00标签打印/U_LabelMapSet.dfm
Normal file
File diff suppressed because it is too large
Load Diff
398
A00标签打印/U_LabelMapSet.pas
Normal file
398
A00标签打印/U_LabelMapSet.pas
Normal file
|
|
@ -0,0 +1,398 @@
|
|||
unit U_LabelMapSet;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
|
||||
cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin, StdCtrls,
|
||||
cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
|
||||
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
|
||||
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
|
||||
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
|
||||
IdTCPClient, IdFTP, ShellAPI, IniFiles, cxCheckBox, cxCalendar, cxButtonEdit,
|
||||
cxTextEdit, cxPC, cxCheckComboBox, cxDropDownEdit, Menus, RM_e_Xls,
|
||||
cxLookAndFeels, cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu,
|
||||
dxSkinsCore, dxSkinsDefaultPainters, cxContainer, dxSkinBlack, dxSkinBlue,
|
||||
dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide,
|
||||
dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
|
||||
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
|
||||
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
|
||||
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
|
||||
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
|
||||
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
|
||||
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray,
|
||||
dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic,
|
||||
dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringTime, dxSkinStardust,
|
||||
dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinValentine, dxSkinVS2010,
|
||||
dxSkinWhiteprint, dxSkinXmas2008Blue, dxSkinscxPCPainter, ImgList;
|
||||
|
||||
type
|
||||
TfrmLabelMapSet = class(Tform)
|
||||
ToolBar1: TToolBar;
|
||||
TBRafresh: TToolButton;
|
||||
TBClose: TToolButton;
|
||||
ADOQueryTemp: TADOQuery;
|
||||
ADOQueryCmd: TADOQuery;
|
||||
ToolButton2: TToolButton;
|
||||
ADOQueryMain: TADOQuery;
|
||||
cxGrid1: TcxGrid;
|
||||
Tv1: TcxGridDBTableView;
|
||||
cxGridLevel1: TcxGridLevel;
|
||||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||||
DS_1: TDataSource;
|
||||
CDS_1: TClientDataSet;
|
||||
Panel1: TPanel;
|
||||
v2Column8: TcxGridDBColumn;
|
||||
Label1: TLabel;
|
||||
v2Column12: TcxGridDBColumn;
|
||||
ToolButton4: TToolButton;
|
||||
ToolButton5: TToolButton;
|
||||
Label2: TLabel;
|
||||
v2Column1: TcxGridDBColumn;
|
||||
Tv1Column1: TcxGridDBColumn;
|
||||
ToolButton1: TToolButton;
|
||||
Tv1Column2: TcxGridDBColumn;
|
||||
ADOConnection1: TADOConnection;
|
||||
cxGrid2: TcxGrid;
|
||||
TV2: TcxGridDBTableView;
|
||||
cxGridLevel2: TcxGridLevel;
|
||||
DS_2: TDataSource;
|
||||
ToolBar2: TToolBar;
|
||||
ToolButton12: TToolButton;
|
||||
ToolButton6: TToolButton;
|
||||
ToolButton7: TToolButton;
|
||||
ToolButton3: TToolButton;
|
||||
ADO_2: TADOQuery;
|
||||
PM_2: TPopupMenu;
|
||||
N3: TMenuItem;
|
||||
Tv1Column3: TcxGridDBColumn;
|
||||
LMName: TcxTextEdit;
|
||||
LMType: TcxTextEdit;
|
||||
Tv1Column4: TcxGridDBColumn;
|
||||
Tv1Column5: TcxGridDBColumn;
|
||||
ToolButton8: TToolButton;
|
||||
ToolButton9: TToolButton;
|
||||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||||
ThreeImgList: TImageList;
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure TBCloseClick(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure TBRafreshClick(Sender: TObject);
|
||||
procedure ToolButton2Click(Sender: TObject);
|
||||
procedure cxTabControl1Change(Sender: TObject);
|
||||
procedure v2Column8PropertiesEditValueChanged(Sender: TObject);
|
||||
procedure ToolButton4Click(Sender: TObject);
|
||||
procedure ToolButton5Click(Sender: TObject);
|
||||
procedure ToolButton1Click(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure ToolButton12Click(Sender: TObject);
|
||||
procedure ToolButton6Click(Sender: TObject);
|
||||
procedure ToolButton7Click(Sender: TObject);
|
||||
procedure ToolButton3Click(Sender: TObject);
|
||||
procedure TextEdit(Sender: TObject);
|
||||
procedure LMNamePropertiesChange(Sender: TObject);
|
||||
procedure ToolButton8Click(Sender: TObject);
|
||||
procedure ToolButton9Click(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
procedure InitGrid();
|
||||
procedure Getfields(MSql: Integer);
|
||||
procedure InitAdo(Ado: TADOQuery; IsSql: Boolean; LMSql, FFiltration: string);
|
||||
public
|
||||
IsSql1, IsSql2, IsSql3, IsSql4, IsSql5: Boolean;
|
||||
FLMType: string;
|
||||
FFiltration1, FFiltration2, FFiltration3, FFiltration4, FFiltration5: string;
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmLabelMapSet: TfrmLabelMapSet;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
U_DataLink, U_RTFun, superobject;
|
||||
|
||||
{$R *.dfm}
|
||||
procedure TfrmLabelMapSet.InitAdo(Ado: TADOQuery; IsSql: Boolean; LMSql, FFiltration: string);
|
||||
begin
|
||||
with Ado do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
if IsSql then
|
||||
begin
|
||||
sql.add('exec ' + trim(CDS_1.fieldbyname(LMSql).AsString));
|
||||
sql.add(FFiltration);
|
||||
end
|
||||
else
|
||||
begin
|
||||
sql.add('exec ' + trim(CDS_1.fieldbyname(LMSql).AsString) + ' ' + quotedstr(Trim(FFiltration)));
|
||||
end;
|
||||
Open;
|
||||
end;
|
||||
TV2.BeginUpdate();
|
||||
TV2.ClearItems; //清空数据
|
||||
(TV2.DataController as IcxCustomGridDataController).DeleteAllItems; //删除所有列
|
||||
(TV2.DataController as IcxCustomGridDataController).CreateAllItems(false); //创建数据源中的所有列
|
||||
TV2.EndUpdate;
|
||||
TV2.ApplyBestFit; //让列宽自适应 .BestFitMaxWidth;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.Getfields(MSql: Integer);
|
||||
begin
|
||||
|
||||
case MSql of
|
||||
1:
|
||||
begin
|
||||
if trim(CDS_1.fieldbyname('LMSql1').AsString) <> '' then
|
||||
InitAdo(ADO_2, IsSql1, 'LMSql1', FFiltration1);
|
||||
end;
|
||||
2:
|
||||
begin
|
||||
if trim(CDS_1.fieldbyname('LMSql2').AsString) <> '' then
|
||||
InitAdo(ADO_2, IsSql2, 'LMSql2', FFiltration2);
|
||||
end;
|
||||
3:
|
||||
begin
|
||||
if trim(CDS_1.fieldbyname('LMSql3').AsString) <> '' then
|
||||
InitAdo(ADO_2, IsSql3, 'LMSql3', FFiltration3);
|
||||
end;
|
||||
4:
|
||||
begin
|
||||
if trim(CDS_1.fieldbyname('LMSql4').AsString) <> '' then
|
||||
InitAdo(ADO_2, IsSql4, 'LMSql4', FFiltration4);
|
||||
end;
|
||||
5:
|
||||
begin
|
||||
if trim(CDS_1.fieldbyname('LMSql5').AsString) <> '' then
|
||||
InitAdo(ADO_2, IsSql5, 'LMSql5', FFiltration5);
|
||||
end;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.InitGrid();
|
||||
begin
|
||||
try
|
||||
ADOQueryMain.DisableControls;
|
||||
with ADOQueryMain do
|
||||
begin
|
||||
Close;
|
||||
SQL.Clear;
|
||||
sql.Add(' select A.* from BS_Label_Map A ');
|
||||
sql.Add(' where LMType=' + quotedstr(FLMType));
|
||||
Open;
|
||||
end;
|
||||
SCreateCDS20(ADOQueryMain, CDS_1);
|
||||
SInitCDSData20(ADOQueryMain, CDS_1);
|
||||
finally
|
||||
ADOQueryMain.EnableControls;
|
||||
ToolButton2.Click;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.LMNamePropertiesChange(Sender: TObject);
|
||||
begin
|
||||
ToolButton2.Click;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
|
||||
frmLabelMapSet := nil;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
begin
|
||||
|
||||
Action := caFree;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.FormCreate(Sender: TObject);
|
||||
begin
|
||||
try
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected := false;
|
||||
ConnectionString := DConString;
|
||||
Connected := true;
|
||||
end;
|
||||
// ADOQueryBaseCmd.Connection := ADOConnection1;
|
||||
// ADOQueryBaseTemp.Connection := ADOConnection1;
|
||||
except
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.TBCloseClick(Sender: TObject);
|
||||
begin
|
||||
ModalResult := 1;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.FormShow(Sender: TObject);
|
||||
begin
|
||||
ReadCxGrid(Trim(Self.Caption), Tv1, '标签管理');
|
||||
InitGrid();
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.TBRafreshClick(Sender: TObject);
|
||||
begin
|
||||
InitGrid();
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.ToolButton12Click(Sender: TObject);
|
||||
begin
|
||||
Getfields(1);
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.ToolButton1Click(Sender: TObject);
|
||||
begin
|
||||
WriteCxGrid(Trim(Self.Caption), Tv1, '标签管理');
|
||||
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.ToolButton2Click(Sender: TObject);
|
||||
var
|
||||
sql: string;
|
||||
begin
|
||||
if ADOQueryMain.Active then
|
||||
begin
|
||||
sql := SGetFilters(Panel1, 1, 2);
|
||||
SDofilter(ADOQueryMain, sql);
|
||||
SCreateCDS20(ADOQueryMain, CDS_1);
|
||||
SInitCDSData20(ADOQueryMain, CDS_1);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.ToolButton3Click(Sender: TObject);
|
||||
begin
|
||||
TcxGridToExcel('sql字段', cxgrid2);
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.cxTabControl1Change(Sender: TObject);
|
||||
begin
|
||||
InitGrid;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.v2Column8PropertiesEditValueChanged(Sender: TObject);
|
||||
var
|
||||
mvalue, FFieldName: string;
|
||||
begin
|
||||
mvalue := TcxTextEdit(Sender).EditingText;
|
||||
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||||
try
|
||||
ADOQueryCmd.Connection.BeginTrans;
|
||||
with CDS_1 do
|
||||
begin
|
||||
Edit;
|
||||
FieldByName(FFieldName).Value := Trim(mvalue);
|
||||
Post;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('UPdate BS_Label_Map ');
|
||||
sql.Add(' Set ' + FFieldName + '=''' + Trim(mvalue) + '''');
|
||||
sql.Add(' , Editer=''' + Trim(DName) + '''');
|
||||
sql.Add(' , Edittime=getdate()');
|
||||
sql.Add(' where LMID=' + quotedstr(CDS_1.fieldbyname('LMID').AsString));
|
||||
ExecSQL;
|
||||
end;
|
||||
ADOQueryCmd.Connection.CommitTrans;
|
||||
tv1.Controller.EditingController.ShowEdit();
|
||||
except
|
||||
tv1.Controller.EditingController.ShowEdit();
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
Application.MessageBox('保存失败!', '提示', 0);
|
||||
end
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.ToolButton4Click(Sender: TObject);
|
||||
begin
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('insert into BS_Label_Map(LMType,Filler) values(' + quotedstr(Trim(FLMType)) + ',' + quotedstr(Trim(dname)) + ')');
|
||||
ExecSQL;
|
||||
end;
|
||||
InitGrid();
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.ToolButton5Click(Sender: TObject);
|
||||
begin
|
||||
if CDS_1.IsEmpty then
|
||||
Exit;
|
||||
if Application.MessageBox('确定要删除数据吗?', '提示', 32 + 4) <> IDYES then
|
||||
Exit;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('delete BS_Label_Map where LMID=' + QuotedStr(CDS_1.FieldByName('LMID').AsString));
|
||||
ExecSQL;
|
||||
end;
|
||||
CDS_1.Delete;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.ToolButton6Click(Sender: TObject);
|
||||
begin
|
||||
Getfields(2);
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.ToolButton7Click(Sender: TObject);
|
||||
begin
|
||||
Getfields(3);
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.ToolButton8Click(Sender: TObject);
|
||||
begin
|
||||
Getfields(4);
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.ToolButton9Click(Sender: TObject);
|
||||
begin
|
||||
Getfields(5);
|
||||
end;
|
||||
|
||||
procedure TfrmLabelMapSet.TextEdit(Sender: TObject);
|
||||
var
|
||||
mvalue, FFieldName: string;
|
||||
begin
|
||||
mvalue := TcxTextEdit(Sender).EditingText;
|
||||
FFieldName := Trim(Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||||
try
|
||||
ADOQueryCmd.Connection.BeginTrans;
|
||||
with CDS_1 do
|
||||
begin
|
||||
Edit;
|
||||
FieldByName(FFieldName).Value := Trim(mvalue);
|
||||
Post;
|
||||
end;
|
||||
with ADOQueryCmd do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.Add('UPdate BS_Label_Map ');
|
||||
sql.Add(' Set ' + FFieldName + '=' + Trim(mvalue));
|
||||
sql.Add(' , Editer=''' + Trim(DName) + '''');
|
||||
sql.Add(' , Edittime=getdate()');
|
||||
sql.Add(' where LMID=' + quotedstr(CDS_1.fieldbyname('LMID').AsString));
|
||||
ExecSQL;
|
||||
end;
|
||||
ADOQueryCmd.Connection.CommitTrans;
|
||||
tv1.Controller.EditingController.ShowEdit();
|
||||
except
|
||||
tv1.Controller.EditingController.ShowEdit();
|
||||
ADOQueryCmd.Connection.RollbackTrans;
|
||||
Application.MessageBox('保存失败!', '提示', 0);
|
||||
end
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
4013
A00标签打印/U_LabelPrint.dfm
Normal file
4013
A00标签打印/U_LabelPrint.dfm
Normal file
File diff suppressed because it is too large
Load Diff
423
A00标签打印/U_LabelPrint.pas
Normal file
423
A00标签打印/U_LabelPrint.pas
Normal file
|
|
@ -0,0 +1,423 @@
|
|||
unit U_LabelPrint;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage,
|
||||
Printers, cxEdit, DB, cxDBData, ToolWin, ComCtrls, cxGridCustomTableView,
|
||||
cxGridTableView, cxGridDBTableView, cxGridLevel, cxClasses, cxControls,
|
||||
cxGridCustomView, cxGrid, DBClient, ADODB, ImgList, StdCtrls, ExtCtrls,
|
||||
cxTextEdit, cxGridCustomPopupMenu, cxGridPopupMenu, cxLookAndFeels,
|
||||
cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu, RM_Common, RM_Class,
|
||||
RM_GridReport, RM_Dataset, RM_E_llPDF, RM_BarCode, RM_e_Graphic, RM_e_Jpeg,
|
||||
RM_e_Xls, cxContainer, cxMaskEdit, cxDropDownEdit, cxMRUEdit, dxSkinsCore,
|
||||
dxSkinsDefaultPainters, cxProgressBar, cxButtons, dxSkinBlack, dxSkinBlue,
|
||||
dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide,
|
||||
dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
|
||||
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
|
||||
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
|
||||
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
|
||||
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
|
||||
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
|
||||
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray,
|
||||
dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic,
|
||||
dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringTime, dxSkinStardust,
|
||||
dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinValentine, dxSkinVS2010,
|
||||
dxSkinWhiteprint, dxSkinXmas2008Blue, RM_System, Buttons;
|
||||
|
||||
type
|
||||
TfrmLabelPrint = class(TForm)
|
||||
ADOQueryTemp: TADOQuery;
|
||||
ADOConnection1: TADOConnection;
|
||||
Panel1: TPanel;
|
||||
ImageList1: TImageList;
|
||||
RMDB_1: TRMDBDataSet;
|
||||
RM1: TRMGridReport;
|
||||
RMDB_2: TRMDBDataSet;
|
||||
CDS_Label: TClientDataSet;
|
||||
ADO_Prt: TADOQuery;
|
||||
btnShow: TSpeedButton;
|
||||
RMDB_3: TRMDBDataSet;
|
||||
RMXLSExport1: TRMXLSExport;
|
||||
RMJPEGExport1: TRMJPEGExport;
|
||||
RMBarCodeObject1: TRMBarCodeObject;
|
||||
CheckBox1: TCheckBox;
|
||||
Label1: TLabel;
|
||||
cbbLab: TcxMRUEdit;
|
||||
CheckBox2: TCheckBox;
|
||||
ADOQueryCmd: TADOQuery;
|
||||
ADO_While: TADOQuery;
|
||||
ComboBox1: TcxComboBox;
|
||||
btnPrint: TSpeedButton;
|
||||
RMDB_4: TRMDBDataSet;
|
||||
RMDB_5: TRMDBDataSet;
|
||||
CDS_1: TClientDataSet;
|
||||
CDS_2: TClientDataSet;
|
||||
CDS_3: TClientDataSet;
|
||||
CDS_4: TClientDataSet;
|
||||
CDS_5: TClientDataSet;
|
||||
ComboBox_Print: TComboBox;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure TV1DblClick(Sender: TObject);
|
||||
procedure btnPrintClick(Sender: TObject);
|
||||
procedure btnShowClick(Sender: TObject);
|
||||
procedure cbbLabPropertiesButtonClick(Sender: TObject);
|
||||
private
|
||||
IsDebug, FPreviewPrint, IsSql1, IsSql2, IsSql3, IsSql4, IsSql5: Boolean;
|
||||
FLMType, FQrCodeField: string;
|
||||
FFiltration1, FFiltration2, FFiltration3, FFiltration4, FFiltration5: string;
|
||||
FSuccessfulFun: string;
|
||||
FparamBlclid: string;
|
||||
procedure InitGrid();
|
||||
procedure PrintLabel(MIsShow: Boolean);
|
||||
procedure GetPrtData(Ado: TADOQuery; Cds: TClientDataSet; IsSql: Boolean; LMSql, FFiltration: string);
|
||||
procedure InitArgs();
|
||||
{ Private declarations }
|
||||
public
|
||||
FPrintJson: PChar;
|
||||
FJsonOut: PChar;
|
||||
DConString, DCode, DName: string;
|
||||
constructor Create(AOwner: TComponent; JsonArgs: PChar);
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmLabelPrint: TfrmLabelPrint;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
U_RTFun, U_LabelMapSet, superobject, U_QrCodeFun, U_Fun ;
|
||||
|
||||
{$R *.dfm}
|
||||
constructor TfrmLabelPrint.Create(AOwner: TComponent; JsonArgs: PChar);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FPrintJson := JsonArgs;
|
||||
// fFormID := mFormID;
|
||||
// fBLCLID := recid;
|
||||
// if CopyNumber > 0 then
|
||||
// fCopyNumber := CopyNumber
|
||||
// else
|
||||
// fCopyNumber := 1;
|
||||
// fIsPreview := IsPreview;
|
||||
// fprinterIndex := printerIndex;
|
||||
// fexportFileType := exportFileType;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelPrint.InitArgs;
|
||||
var
|
||||
JSONObject, item: ISuperObject; // SuperObject 接口类型
|
||||
jsonArray: TSuperArray;
|
||||
i: Integer;
|
||||
begin
|
||||
// 解析 JSON 字符串
|
||||
JSONObject := SO(FPrintJson);
|
||||
if JSONObject = nil then
|
||||
begin
|
||||
Application.MessageBox('PrintJson格式异常!', '提示', 0);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
// 提取基础字段
|
||||
IsDebug := JSONObject.B['IsDebug'];
|
||||
FSuccessfulFun := JSONObject.S['SuccessfulFun'];
|
||||
FLMType := JSONObject.S['LMType'];
|
||||
FPreviewPrint := JSONObject.B['PreviewPrint'];
|
||||
FQrCodeField := JSONObject.S['QrCodeField'];
|
||||
DConString := JSONObject.S['DConString'];
|
||||
DCode := JSONObject.S['DCode'];
|
||||
DName := JSONObject.S['DName'];
|
||||
|
||||
|
||||
|
||||
// 获取数组
|
||||
jsonArray := JSONObject.A['PrtArgs'];
|
||||
if jsonArray = nil then // 处理数组不存在的情况
|
||||
begin
|
||||
Application.MessageBox('PrtArgs数组缺失!', '提示', 0);
|
||||
Exit;
|
||||
end;
|
||||
|
||||
// 初始化变量避免未定义行为
|
||||
FFiltration1 := '';
|
||||
FFiltration2 := '';
|
||||
FFiltration3 := '';
|
||||
FFiltration4 := '';
|
||||
FFiltration5 := '';
|
||||
|
||||
// 遍历JSON数组(最多处理5个元素)
|
||||
for i := 0 to jsonArray.Length - 1 do
|
||||
begin
|
||||
item := jsonArray.O[i];
|
||||
case i of
|
||||
0:
|
||||
begin
|
||||
IsSql1 := item.B['IsSql'];
|
||||
FFiltration1 := item.S['Filtration'];
|
||||
end;
|
||||
1:
|
||||
begin
|
||||
IsSql2 := item.B['IsSql'];
|
||||
FFiltration2 := item.S['Filtration'];
|
||||
end;
|
||||
2:
|
||||
begin
|
||||
IsSql3 := item.B['IsSql'];
|
||||
FFiltration3 := item.S['Filtration'];
|
||||
end;
|
||||
3:
|
||||
begin
|
||||
IsSql4 := item.B['IsSql'];
|
||||
FFiltration4 := item.S['Filtration'];
|
||||
end;
|
||||
4:
|
||||
begin
|
||||
IsSql5 := item.B['IsSql'];
|
||||
FFiltration5 := item.S['Filtration'];
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
// 空值回退逻辑
|
||||
if Trim(FFiltration2) = '' then
|
||||
begin
|
||||
IsSql2 := IsSql1;
|
||||
FFiltration2 := FFiltration1;
|
||||
end;
|
||||
|
||||
if Trim(FFiltration3) = '' then
|
||||
begin
|
||||
IsSql3 := IsSql1;
|
||||
FFiltration3 := FFiltration1;
|
||||
end;
|
||||
|
||||
if Trim(FFiltration4) = '' then
|
||||
begin
|
||||
IsSql4 := IsSql1;
|
||||
FFiltration4 := FFiltration1;
|
||||
end;
|
||||
|
||||
if Trim(FFiltration5) = '' then
|
||||
begin
|
||||
IsSql5 := IsSql1;
|
||||
FFiltration5 := FFiltration1;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelPrint.GetPrtData(Ado: TADOQuery; Cds: TClientDataSet; IsSql: Boolean; LMSql, FFiltration: string);
|
||||
begin
|
||||
with Ado do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
if IsSql then
|
||||
begin
|
||||
sql.add('exec ' + trim(CDS_Label.fieldbyname(LMSql).AsString));
|
||||
sql.add(FFiltration);
|
||||
end
|
||||
else
|
||||
begin
|
||||
sql.add('exec ' + trim(CDS_Label.fieldbyname(LMSql).AsString) + ' ' + quotedstr(Trim(FFiltration)));
|
||||
end;
|
||||
if IsDebug then
|
||||
ShowMessage(sql.Text);
|
||||
Open;
|
||||
end;
|
||||
|
||||
IintCDS(Ado, Cds);
|
||||
SetQrCodePath(Cds, FQrCodeField);
|
||||
end;
|
||||
|
||||
procedure TfrmLabelPrint.PrintLabel(MIsShow: Boolean);
|
||||
var
|
||||
fPrintFile, fPrintFile10, FMainID, LBName: string;
|
||||
begin
|
||||
if CDS_Label.IsEmpty then
|
||||
begin
|
||||
Application.MessageBox(PChar('类型' + FLMType + '没有设置标签!'), '提示', 0);
|
||||
Exit;
|
||||
end;
|
||||
RMJPEGExport1.ShowDialog := CheckBox2.Checked;
|
||||
RMXLSExport1.ShowDialog := CheckBox2.Checked;
|
||||
RM1.ShowPrintDialog := CheckBox1.Checked;
|
||||
|
||||
LBName := cbbLab.text;
|
||||
ExportFtErpFile(LBName + '.rmf', ADOQueryTemp);
|
||||
|
||||
if CDS_Label.Locate('LMName', LBName, []) then
|
||||
begin
|
||||
if trim(CDS_Label.fieldbyname('LMSql1').AsString) <> '' then
|
||||
GetPrtData(ADO_Prt, CDS_1, IsSql1, 'LMSql1', FFiltration1);
|
||||
|
||||
if trim(CDS_Label.fieldbyname('LMSql2').AsString) <> '' then
|
||||
GetPrtData(ADO_Prt, CDS_2, IsSql2, 'LMSql2', FFiltration2);
|
||||
|
||||
if trim(CDS_Label.fieldbyname('LMSql3').AsString) <> '' then
|
||||
GetPrtData(ADO_Prt, CDS_3, IsSql3, 'LMSql3', FFiltration3);
|
||||
|
||||
if trim(CDS_Label.fieldbyname('LMSql4').AsString) <> '' then
|
||||
GetPrtData(ADO_Prt, CDS_4, IsSql4, 'LMSql4', FFiltration4);
|
||||
|
||||
if trim(CDS_Label.fieldbyname('LMSql5').AsString) <> '' then
|
||||
GetPrtData(ADO_Prt, CDS_5, IsSql5, 'LMSql5', FFiltration5);
|
||||
end;
|
||||
|
||||
fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + LBName + '.rmf';
|
||||
if FileExists(fPrintFile) then
|
||||
begin
|
||||
RM1.LoadFromFile(fPrintFile);
|
||||
RM1.DefaultCopies := StrToIntDef(ComboBox1.Text, 1);
|
||||
RMVariables['LBPrtCode'] := dcode;
|
||||
RMVariables['LBPrtName'] := dname;
|
||||
if MIsShow then
|
||||
RM1.ShowReport
|
||||
else
|
||||
RM1.PrintReportL(ComboBox_Print.Text);
|
||||
;
|
||||
end
|
||||
else
|
||||
begin
|
||||
Application.MessageBox(PChar('没有找' + fPrintFile), '提示', 0);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelPrint.FormCreate(Sender: TObject);
|
||||
begin
|
||||
|
||||
FPreviewPrint := True;
|
||||
|
||||
ComboBox_Print.Items.Assign(Printer.Printers);
|
||||
// ComboBox2.ItemIndex := 0; //指向第一台打印机
|
||||
ComboBox_Print.Items.Add('默认打印机');
|
||||
ComboBox_Print.ItemIndex := Self.ComboBox_Print.Items.IndexOf(trim('默认打印机'));
|
||||
|
||||
InitArgs();
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected := false;
|
||||
ConnectionString := DConString;
|
||||
Connected := true;
|
||||
end;
|
||||
EnsureQrCodeDirectory();
|
||||
ClearQrCodeDirectory();
|
||||
end;
|
||||
|
||||
procedure TfrmLabelPrint.btnPrintClick(Sender: TObject);
|
||||
begin
|
||||
PrintLabel(False);
|
||||
FJsonOut := '{"success":true}';
|
||||
ModalResult := 1;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelPrint.btnShowClick(Sender: TObject);
|
||||
begin
|
||||
|
||||
PrintLabel(true);
|
||||
FJsonOut := '{"success":true,"ShowFlag":true}';
|
||||
end;
|
||||
|
||||
procedure TfrmLabelPrint.cbbLabPropertiesButtonClick(Sender: TObject);
|
||||
begin
|
||||
|
||||
try
|
||||
frmLabelMapSet := TfrmLabelMapSet.Create(Application);
|
||||
with frmLabelMapSet do
|
||||
begin
|
||||
IsSql1 := self.IsSql1;
|
||||
IsSql2 := self.IsSql2;
|
||||
IsSql3 := self.IsSql3;
|
||||
IsSql4 := self.IsSql4;
|
||||
IsSql5 := self.IsSql5;
|
||||
FFiltration1 := self.FFiltration1;
|
||||
FFiltration2 := self.FFiltration2;
|
||||
FFiltration3 := self.FFiltration3;
|
||||
FFiltration4 := self.FFiltration4;
|
||||
FFiltration5 := self.FFiltration5;
|
||||
FLMType := self.FLMType;
|
||||
if ShowModal = 1 then
|
||||
begin
|
||||
Self.InitGrid();
|
||||
end;
|
||||
end;
|
||||
finally
|
||||
frmLabelMapSet.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelPrint.FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
begin
|
||||
|
||||
Action := cahide;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelPrint.InitGrid();
|
||||
begin
|
||||
|
||||
with ADOQueryTemp do
|
||||
begin
|
||||
close;
|
||||
sql.Clear;
|
||||
sql.Add('select LMName name from BS_Label_Map where LMType=' + QuotedStr(TRIM(FLMType)));
|
||||
sql.Add(' order by SerialNo ');
|
||||
Open;
|
||||
if isEmpty then
|
||||
begin
|
||||
exit;
|
||||
end;
|
||||
cbbLab.Properties.LookupItems.Clear;
|
||||
while not Eof do
|
||||
begin
|
||||
|
||||
cbbLab.Properties.LookupItems.Add(Trim(fieldByName('Name').AsString));
|
||||
Next;
|
||||
end;
|
||||
|
||||
cbbLab.ItemIndex := 0;
|
||||
end;
|
||||
|
||||
with ADOQueryTemp do
|
||||
begin
|
||||
Filtered := False;
|
||||
Close;
|
||||
sql.Clear;
|
||||
Sql.Add('select * from BS_Label_Map where LMType=' + QuotedStr(TRIM(FLMType)));
|
||||
Open;
|
||||
end;
|
||||
SCreateCDS20(ADOQueryTemp, CDS_Label);
|
||||
SInitCDSData20(ADOQueryTemp, CDS_Label);
|
||||
if CDS_Label.IsEmpty then
|
||||
begin
|
||||
Application.MessageBox(PChar('类型' + FLMType + '没有设置标签!'), '提示', 0);
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelPrint.FormShow(Sender: TObject);
|
||||
begin
|
||||
|
||||
|
||||
// if FPreviewPrint then
|
||||
// RM1.PreviewButtons := [rmpbZoom, rmpbLoad, rmpbSave, rmpbPrint, rmpbFind, rmpbPageSetup, rmpbExit, rmpbSaveToXLS, rmpbExport, rmpbNavigator]
|
||||
// else
|
||||
// RM1.PreviewButtons := [rmpbZoom, rmpbLoad, rmpbSave, rmpbFind, rmpbPageSetup, rmpbExit, rmpbSaveToXLS, rmpbExport, rmpbNavigator];
|
||||
// ComboBox_Print.Properties.Items.Assign(printer.Printers);
|
||||
InitGrid();
|
||||
end;
|
||||
|
||||
procedure TfrmLabelPrint.TV1DblClick(Sender: TObject);
|
||||
begin
|
||||
ModalResult := 1;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelPrint.FormDestroy(Sender: TObject);
|
||||
begin
|
||||
frmLabelPrint := nil;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
38
A00标签打印/U_LabelPrintFun.pas
Normal file
38
A00标签打印/U_LabelPrintFun.pas
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
unit U_LabelPrintFun;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Forms, U_LabelPrint, U_ClientPrintRmf;
|
||||
|
||||
function FormPrint(App: Tapplication; JsonArgs: PChar): PChar;
|
||||
|
||||
function FunPrint(App: Tapplication; JsonArgs: PChar): PChar;
|
||||
|
||||
implementation
|
||||
|
||||
//'{ "LMType": "LMType","PreviewPrint": true,"DConString": "'+DConString+'","DCode": "'+DCode+'","DName": "'+DName+'", "PrtArgs": [ { "IsSql": true, "Filtration": "Filtration1" }] }';
|
||||
|
||||
function FormPrint(App: Tapplication; JsonArgs: PChar): PChar;
|
||||
begin
|
||||
with TfrmLabelPrint.Create(App, PChar(JsonArgs)) do
|
||||
begin
|
||||
if ShowModal = 1 then
|
||||
Result := FJsonOut
|
||||
else
|
||||
Result := FJsonOut;
|
||||
end;
|
||||
end;
|
||||
// '{ "LBName": "²âÊÔ","QrCodeField": "ssid","DConString": "'+DConString+'","DCode": "'+DCode+'","DName": "'+DName+'","IsPreview": true,"printerIndex": 0,"ExportFileType": "", "PrtArgs": [ {"SqlStr": "EXEC p_test ''22'' " }] }';
|
||||
|
||||
function FunPrint(App: Tapplication; JsonArgs: PChar): PChar;
|
||||
begin
|
||||
with TfrmClientPrintRmf.Create(App, JsonArgs) do
|
||||
begin
|
||||
Show;
|
||||
Result := FJsonOut;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
236
A00标签打印/U_QrCodeFun.pas
Normal file
236
A00标签打印/U_QrCodeFun.pas
Normal file
|
|
@ -0,0 +1,236 @@
|
|||
unit U_QrCodeFun;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, SysUtils, DB, Controls, Forms, DBClient, ADODB, ExtCtrls,
|
||||
RM_GridReport, RM_Dataset, RM_E_llPDF, RM_BarCode, RM_e_Graphic, RM_e_Jpeg,
|
||||
RM_e_Xls, RM_System;
|
||||
|
||||
type
|
||||
TMakebar = procedure(ucData: pchar; nDataLen: integer; nErrLevel: integer; nMask: integer; nBarEdition: integer; szBmpFileName: pchar; nScale: integer); stdcall;
|
||||
|
||||
TMixtext = procedure(szSrcBmpFileName: PChar; szDstBmpFileName: PChar; sztext: PChar; fontsize, txtheight, hmargin, vmargin, txtcntoneline: integer); stdcall;
|
||||
|
||||
function EnsureQrCodeDirectory: Boolean;
|
||||
|
||||
function ClearQrCodeDirectory: Boolean;
|
||||
|
||||
procedure IintCDS(SADOQry: TADOQuery; mClientDataset: TclientDataSet);
|
||||
|
||||
function GetQrCode(Txt: string): string;
|
||||
|
||||
procedure SetQrCodePath(Cds: TclientDataSet; FQrCodeField: string);
|
||||
|
||||
implementation
|
||||
|
||||
procedure SetQrCodePath(Cds: TClientDataSet; FQrCodeField: string);
|
||||
var
|
||||
QrCodeIdField: TField;
|
||||
CurrentQrCodeId, LastQrCodeId, LastQrCodePath: string;
|
||||
begin
|
||||
// 检查二维码ID字段是否存在
|
||||
QrCodeIdField := Cds.FindField(FQrCodeField);
|
||||
if QrCodeIdField = nil then
|
||||
Exit;
|
||||
|
||||
// 初始化变量
|
||||
LastQrCodeId := '';
|
||||
LastQrCodePath := '';
|
||||
|
||||
with Cds do
|
||||
begin
|
||||
DisableControls;
|
||||
try
|
||||
First;
|
||||
while not Eof do
|
||||
begin
|
||||
CurrentQrCodeId := QrCodeIdField.AsString;
|
||||
|
||||
// 如果当前内容与上一条相同,则复用二维码路径
|
||||
if (CurrentQrCodeId = LastQrCodeId) and (LastQrCodePath <> '') then
|
||||
begin
|
||||
Edit;
|
||||
FieldByName('QRBARCODE').AsString := LastQrCodePath;
|
||||
Post;
|
||||
end
|
||||
else
|
||||
begin
|
||||
// 生成新的二维码并记录路径
|
||||
Edit;
|
||||
LastQrCodePath := GetQrCode(CurrentQrCodeId);
|
||||
FieldByName('QRBARCODE').AsString := LastQrCodePath;
|
||||
Post;
|
||||
LastQrCodeId := CurrentQrCodeId;
|
||||
end;
|
||||
|
||||
Next;
|
||||
end;
|
||||
finally
|
||||
First;
|
||||
EnableControls;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function EnsureQrCodeDirectory: Boolean;
|
||||
var
|
||||
QrCodeDir: string;
|
||||
begin
|
||||
Result := False;
|
||||
QrCodeDir := ExtractFilePath(Application.ExeName) + 'QrCode\';
|
||||
|
||||
try
|
||||
if not DirectoryExists(QrCodeDir) then
|
||||
begin
|
||||
if not ForceDirectories(QrCodeDir) then
|
||||
raise Exception.Create('无法创建二维码目录: ' + QrCodeDir);
|
||||
end;
|
||||
Result := True;
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
Application.MessageBox(PChar('创建二维码目录失败: ' + E.Message), '错误', MB_ICONERROR);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
// 清空二维码目录中的所有文件
|
||||
function ClearQrCodeDirectory: Boolean;
|
||||
var
|
||||
QrCodeDir: string;
|
||||
SearchRec: TSearchRec;
|
||||
begin
|
||||
Result := False;
|
||||
QrCodeDir := ExtractFilePath(Application.ExeName) + 'QrCode\';
|
||||
|
||||
try
|
||||
if not DirectoryExists(QrCodeDir) then
|
||||
Exit; // 目录不存在视为成功
|
||||
// 删除目录下所有.bmp文件
|
||||
if FindFirst(QrCodeDir + '*.bmp', faAnyFile, SearchRec) = 0 then
|
||||
begin
|
||||
repeat
|
||||
DeleteFile(QrCodeDir + SearchRec.Name);
|
||||
until FindNext(SearchRec) <> 0;
|
||||
FindClose(SearchRec);
|
||||
end;
|
||||
|
||||
Result := True;
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
Application.MessageBox(PChar('清空二维码目录失败: ' + E.Message), '错误', MB_ICONERROR);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure IintCDS(SADOQry: TADOQuery; mClientDataset: TclientDataSet);
|
||||
var
|
||||
i, k: integer;
|
||||
mfieldName: string;
|
||||
mSize: integer;
|
||||
begin
|
||||
mfieldName := '';
|
||||
mClientDataset.FieldDefs.Clear;
|
||||
with SADOQry do
|
||||
begin
|
||||
for i := 0 to fieldCount - 1 do
|
||||
begin
|
||||
if (Fields[i].DataType = ftString) and (Fields[i].Size = 0) then
|
||||
begin
|
||||
mSize := 1;
|
||||
end
|
||||
else
|
||||
mSize := Fields[i].Size;
|
||||
mfieldName := trim(fields[i].FieldName);
|
||||
mClientDataset.FieldDefs.Add(mfieldName, Fields[i].DataType, mSize);
|
||||
|
||||
end;
|
||||
end;
|
||||
mClientDataset.FieldDefs.Add('QRBARCODE', ftString, 200);
|
||||
mClientDataset.Close;
|
||||
mClientDataset.CreateDataSet;
|
||||
|
||||
if SADOQry.IsEmpty then
|
||||
exit;
|
||||
|
||||
SADOQry.first;
|
||||
k := 1;
|
||||
try
|
||||
mClientDataset.DisableControls;
|
||||
mClientDataset.Filtered := false;
|
||||
|
||||
while not SADOQry.Eof do
|
||||
begin
|
||||
with mClientDataset do
|
||||
begin
|
||||
Append;
|
||||
for i := 0 to SADOQry.FieldCount - 1 do
|
||||
begin
|
||||
fields[i].value := SADOQry.Fields[i].Value;
|
||||
end;
|
||||
|
||||
fieldByName('QRBARCODE').value := '';
|
||||
inc(k);
|
||||
Post;
|
||||
end;
|
||||
SADOQry.Next;
|
||||
end;
|
||||
if not mClientDataset.IsEmpty then
|
||||
begin
|
||||
mClientDataset.First;
|
||||
end;
|
||||
finally
|
||||
mClientDataset.EnableControls;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
function GetQrCode(Txt: string): string;
|
||||
var
|
||||
fPrintFile: string;
|
||||
fImagePath: string;
|
||||
Moudle: THandle;
|
||||
Makebar: TMakebar;
|
||||
Mixtext: TMixtext;
|
||||
CurRow: Integer;
|
||||
TimeStamp: string;
|
||||
begin
|
||||
Result := ''; // 初始化返回路径
|
||||
|
||||
try
|
||||
Moudle := LoadLibrary('MakeQRBarcode.dll');
|
||||
if Moudle = 0 then
|
||||
RaiseLastOSError;
|
||||
|
||||
@Makebar := GetProcAddress(Moudle, 'Make');
|
||||
if not Assigned(Makebar) then
|
||||
raise Exception.Create('找不到 Make 函数');
|
||||
|
||||
@Mixtext := GetProcAddress(Moudle, 'MixText');
|
||||
if not Assigned(Mixtext) then
|
||||
raise Exception.Create('找不到 MixText 函数');
|
||||
|
||||
// 生成时间戳文件名 (格式: YYYYMMDD_HHMMSSZZZ)
|
||||
Sleep(10);
|
||||
TimeStamp := FormatDateTime('yyyymmdd_hhnnsszzz', Now) + '_' + IntToStr(Random(1000));
|
||||
fImagePath := ExtractFilePath(Application.ExeName) + 'QrCode\' + TimeStamp + '.bmp';
|
||||
|
||||
// 确保目录存在
|
||||
if not DirectoryExists(ExtractFilePath(fImagePath)) then
|
||||
ForceDirectories(ExtractFilePath(fImagePath));
|
||||
|
||||
Makebar(pchar(Txt), Length(Txt), 3, 3, 0, PChar(fImagePath), 3);
|
||||
|
||||
Result := fImagePath; // 返回生成的文件路径
|
||||
except
|
||||
on E: Exception do
|
||||
begin
|
||||
application.MessageBox(PChar('条形码生成失败:' + E.Message), '错误', MB_ICONERROR);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
object frmJCDJLIST: TfrmJCDJLIST
|
||||
Left = 192
|
||||
Top = 48
|
||||
Left = 781
|
||||
Top = 530
|
||||
Width = 1382
|
||||
Height = 754
|
||||
Caption = #26816#27979#30331#35760
|
||||
|
|
@ -20,7 +20,7 @@ object frmJCDJLIST: TfrmJCDJLIST
|
|||
object ToolBar1: TToolBar
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 1366
|
||||
Width = 1374
|
||||
Height = 31
|
||||
ButtonHeight = 30
|
||||
ButtonWidth = 83
|
||||
|
|
@ -128,7 +128,7 @@ object frmJCDJLIST: TfrmJCDJLIST
|
|||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Top = 31
|
||||
Width = 1366
|
||||
Width = 1374
|
||||
Height = 50
|
||||
Align = alTop
|
||||
BevelInner = bvRaised
|
||||
|
|
@ -235,8 +235,8 @@ object frmJCDJLIST: TfrmJCDJLIST
|
|||
object cxGrid2: TcxGrid
|
||||
Left = 0
|
||||
Top = 103
|
||||
Width = 1366
|
||||
Height = 612
|
||||
Width = 1374
|
||||
Height = 620
|
||||
Align = alClient
|
||||
TabOrder = 2
|
||||
object Tv2: TcxGridDBTableView
|
||||
|
|
@ -310,6 +310,12 @@ object frmJCDJLIST: TfrmJCDJLIST
|
|||
HeaderAlignmentHorz = taCenter
|
||||
Width = 190
|
||||
end
|
||||
object Tv2Filler: TcxGridDBColumn
|
||||
Caption = #25805#20316#20154
|
||||
DataBinding.FieldName = 'Filler'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 70
|
||||
end
|
||||
end
|
||||
object cxGridLevel1: TcxGridLevel
|
||||
GridView = Tv2
|
||||
|
|
@ -318,7 +324,7 @@ object frmJCDJLIST: TfrmJCDJLIST
|
|||
object cxTabControl1: TcxTabControl
|
||||
Left = 0
|
||||
Top = 81
|
||||
Width = 1366
|
||||
Width = 1374
|
||||
Height = 22
|
||||
Align = alTop
|
||||
TabOrder = 3
|
||||
|
|
@ -332,7 +338,7 @@ object frmJCDJLIST: TfrmJCDJLIST
|
|||
#20840#37096)
|
||||
OnChange = cxTabControl1Change
|
||||
ClientRectBottom = 22
|
||||
ClientRectRight = 1366
|
||||
ClientRectRight = 1374
|
||||
ClientRectTop = 19
|
||||
end
|
||||
object ADOQueryTemp: TADOQuery
|
||||
|
|
|
|||
|
|
@ -13,7 +13,20 @@ uses
|
|||
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
|
||||
IdTCPClient, IdFTP, ShellAPI, IniFiles, cxCheckBox, cxCalendar, cxButtonEdit,
|
||||
cxTextEdit, cxPC, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
|
||||
dxBarBuiltInMenu;
|
||||
dxBarBuiltInMenu, dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinBlueprint,
|
||||
dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide,
|
||||
dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
|
||||
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
|
||||
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
|
||||
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
|
||||
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
|
||||
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
|
||||
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray,
|
||||
dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic,
|
||||
dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringTime, dxSkinStardust,
|
||||
dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinsDefaultPainters,
|
||||
dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue,
|
||||
dxSkinscxPCPainter, DateUtils;
|
||||
|
||||
type
|
||||
TfrmJCDJLIST = class(TForm)
|
||||
|
|
@ -63,6 +76,7 @@ type
|
|||
Tv2Column2: TcxGridDBColumn;
|
||||
Label1: TLabel;
|
||||
C_Code: TEdit;
|
||||
Tv2Filler: TcxGridDBColumn;
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure TBCloseClick(Sender: TObject);
|
||||
|
|
@ -319,8 +333,8 @@ procedure TfrmJCDJLIST.FormShow(Sender: TObject);
|
|||
begin
|
||||
ReadCxGrid(Self.Caption + Tv2.Name, Tv2);
|
||||
Enddate.DateTime := SGetServerDate(ADOQueryTemp);
|
||||
begdate.DateTime := Enddate.DateTime;
|
||||
|
||||
// ÉèÖÿªÊ¼ÈÕÆÚΪһÄêǰ
|
||||
begdate.DateTime := IncYear(Enddate.DateTime, -1);
|
||||
SetStatus();
|
||||
initGrid();
|
||||
end;
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ object frmContractDCList: TfrmContractDCList
|
|||
Left = 0
|
||||
Top = 0
|
||||
Width = 1140
|
||||
Height = 62
|
||||
Height = 92
|
||||
AutoSize = True
|
||||
ButtonHeight = 30
|
||||
ButtonWidth = 95
|
||||
|
|
@ -103,52 +103,52 @@ object frmContractDCList: TfrmContractDCList
|
|||
Top = 0
|
||||
Caption = #23457#26680#20154#23450#20041
|
||||
ImageIndex = 76
|
||||
Wrap = True
|
||||
Visible = False
|
||||
OnClick = ToolButton5Click
|
||||
end
|
||||
object ToolButton4: TToolButton
|
||||
Left = 536
|
||||
Top = 0
|
||||
Left = 0
|
||||
Top = 30
|
||||
AutoSize = True
|
||||
Caption = #36865#23457
|
||||
ImageIndex = 6
|
||||
OnClick = ToolButton4Click
|
||||
end
|
||||
object ToolButton9: TToolButton
|
||||
Left = 599
|
||||
Top = 0
|
||||
Left = 63
|
||||
Top = 30
|
||||
AutoSize = True
|
||||
Caption = #25764#38144#36865#23457
|
||||
ImageIndex = 7
|
||||
OnClick = ToolButton9Click
|
||||
end
|
||||
object ToolButton10: TToolButton
|
||||
Left = 686
|
||||
Top = 0
|
||||
Left = 150
|
||||
Top = 30
|
||||
AutoSize = True
|
||||
Caption = #23457#26680
|
||||
ImageIndex = 16
|
||||
OnClick = ToolButton10Click
|
||||
end
|
||||
object ToolButton11: TToolButton
|
||||
Left = 749
|
||||
Top = 0
|
||||
Left = 213
|
||||
Top = 30
|
||||
AutoSize = True
|
||||
Caption = #25764#38144#23457#26680
|
||||
ImageIndex = 17
|
||||
OnClick = ToolButton11Click
|
||||
end
|
||||
object ToolButton13: TToolButton
|
||||
Left = 836
|
||||
Top = 0
|
||||
Left = 300
|
||||
Top = 30
|
||||
AutoSize = True
|
||||
Caption = #30830#35748
|
||||
ImageIndex = 16
|
||||
Wrap = True
|
||||
OnClick = ToolButton13Click
|
||||
end
|
||||
object TBDel: TToolButton
|
||||
Left = 0
|
||||
Left = 363
|
||||
Top = 30
|
||||
AutoSize = True
|
||||
Caption = #21024#38500
|
||||
|
|
@ -156,7 +156,7 @@ object frmContractDCList: TfrmContractDCList
|
|||
OnClick = TBDelClick
|
||||
end
|
||||
object ToolButton14: TToolButton
|
||||
Left = 63
|
||||
Left = 426
|
||||
Top = 30
|
||||
AutoSize = True
|
||||
Caption = #21462#28040#30830#35748
|
||||
|
|
@ -164,17 +164,18 @@ object frmContractDCList: TfrmContractDCList
|
|||
OnClick = ToolButton14Click
|
||||
end
|
||||
object ToolButton8: TToolButton
|
||||
Left = 150
|
||||
Left = 513
|
||||
Top = 30
|
||||
AutoSize = True
|
||||
Caption = #20462#25913#21407#22240
|
||||
ImageIndex = 25
|
||||
Wrap = True
|
||||
Visible = False
|
||||
OnClick = ToolButton8Click
|
||||
end
|
||||
object ToolButton6: TToolButton
|
||||
Left = 237
|
||||
Top = 30
|
||||
Left = 0
|
||||
Top = 60
|
||||
AutoSize = True
|
||||
Caption = #19978#20256
|
||||
ImageIndex = 8
|
||||
|
|
@ -182,8 +183,8 @@ object frmContractDCList: TfrmContractDCList
|
|||
OnClick = ToolButton6Click
|
||||
end
|
||||
object ToolButton7: TToolButton
|
||||
Left = 300
|
||||
Top = 30
|
||||
Left = 63
|
||||
Top = 60
|
||||
AutoSize = True
|
||||
Caption = #19979#36733
|
||||
ImageIndex = 9
|
||||
|
|
@ -191,40 +192,40 @@ object frmContractDCList: TfrmContractDCList
|
|||
OnClick = ToolButton7Click
|
||||
end
|
||||
object TBExport: TToolButton
|
||||
Left = 363
|
||||
Top = 30
|
||||
Left = 126
|
||||
Top = 60
|
||||
AutoSize = True
|
||||
Caption = #23548#20986
|
||||
ImageIndex = 75
|
||||
OnClick = TBExportClick
|
||||
end
|
||||
object TBPrint: TToolButton
|
||||
Left = 426
|
||||
Top = 30
|
||||
Left = 189
|
||||
Top = 60
|
||||
AutoSize = True
|
||||
Caption = #25171#21360
|
||||
ImageIndex = 4
|
||||
OnClick = TBPrintClick
|
||||
end
|
||||
object ToolButton15: TToolButton
|
||||
Left = 489
|
||||
Top = 30
|
||||
Left = 252
|
||||
Top = 60
|
||||
AutoSize = True
|
||||
Caption = #26080#39044#35272#25171#21360
|
||||
ImageIndex = 4
|
||||
OnClick = ToolButton15Click
|
||||
end
|
||||
object ToolButton12: TToolButton
|
||||
Left = 588
|
||||
Top = 30
|
||||
Left = 351
|
||||
Top = 60
|
||||
AutoSize = True
|
||||
Caption = #30452#25509#25171#21360
|
||||
ImageIndex = 4
|
||||
OnClick = ToolButton12Click
|
||||
end
|
||||
object ComboBox1: TComboBox
|
||||
Left = 675
|
||||
Top = 33
|
||||
Left = 438
|
||||
Top = 63
|
||||
Width = 190
|
||||
Height = 24
|
||||
Style = csDropDownList
|
||||
|
|
@ -241,8 +242,8 @@ object frmContractDCList: TfrmContractDCList
|
|||
#35746#33329#25351#31034#20070)
|
||||
end
|
||||
object TBClose: TToolButton
|
||||
Left = 865
|
||||
Top = 30
|
||||
Left = 628
|
||||
Top = 60
|
||||
AutoSize = True
|
||||
Caption = #20851#38381
|
||||
ImageIndex = 21
|
||||
|
|
@ -251,9 +252,9 @@ object frmContractDCList: TfrmContractDCList
|
|||
end
|
||||
object cxGrid1: TcxGrid
|
||||
Left = 0
|
||||
Top = 179
|
||||
Top = 209
|
||||
Width = 1140
|
||||
Height = 140
|
||||
Height = 110
|
||||
Align = alClient
|
||||
TabOrder = 1
|
||||
object Tv1: TcxGridDBTableView
|
||||
|
|
@ -521,7 +522,7 @@ object frmContractDCList: TfrmContractDCList
|
|||
end
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Top = 62
|
||||
Top = 92
|
||||
Width = 1140
|
||||
Height = 75
|
||||
Align = alTop
|
||||
|
|
@ -995,7 +996,7 @@ object frmContractDCList: TfrmContractDCList
|
|||
end
|
||||
object cxTabControl1: TcxTabControl
|
||||
Left = 0
|
||||
Top = 137
|
||||
Top = 167
|
||||
Width = 1140
|
||||
Height = 21
|
||||
Align = alTop
|
||||
|
|
@ -1014,7 +1015,7 @@ object frmContractDCList: TfrmContractDCList
|
|||
end
|
||||
object cxTabControl2: TcxTabControl
|
||||
Left = 0
|
||||
Top = 158
|
||||
Top = 188
|
||||
Width = 1140
|
||||
Height = 21
|
||||
Align = alTop
|
||||
|
|
|
|||
|
|
@ -13,7 +13,20 @@ uses
|
|||
cxDropDownEdit, ShellAPI, IdBaseComponent, IdComponent, IdTCPConnection,
|
||||
IdTCPClient, IdFTP, IniFiles, StrUtils, BtnEdit, cxPC, cxLookAndFeels,
|
||||
cxLookAndFeelPainters, cxNavigator, dxBarBuiltInMenu, dxSkinsCore,
|
||||
dxSkinsDefaultPainters, dxSkinscxPCPainter;
|
||||
dxSkinsDefaultPainters, dxSkinscxPCPainter, dxSkinBlack, dxSkinBlue,
|
||||
dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom,
|
||||
dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle,
|
||||
dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary,
|
||||
dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin,
|
||||
dxSkinMetropolis, dxSkinMetropolisDark, dxSkinMoneyTwins,
|
||||
dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
|
||||
dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
|
||||
dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinOffice2013DarkGray,
|
||||
dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinPumpkin,
|
||||
dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus,
|
||||
dxSkinSilver, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008,
|
||||
dxSkinTheAsphaltWorld, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint,
|
||||
dxSkinXmas2008Blue;
|
||||
|
||||
type
|
||||
TfrmContractDCList = class(TForm)
|
||||
|
|
|
|||
|
|
@ -79,17 +79,20 @@ begin
|
|||
SetLength(user, 255);
|
||||
SetLength(pswd, 255);
|
||||
|
||||
if Trim(DataBaseStr) = '' then
|
||||
begin
|
||||
server := '47.100.130.130,7781';
|
||||
// server := '.';
|
||||
dtbase := 'zhenyongdata';
|
||||
user := 'zhenyongsa';
|
||||
pswd := 'rightsoft@9101';
|
||||
// pswd := 'rightsoft';
|
||||
DConString := 'Provider=SQLOLEDB.1;Password=' + pswd + ';Persist Security Info=True;User ID=' + user + ';Initial Catalog=' + dtbase + ';Data Source=' + server;
|
||||
// DConString := DataBaseStr;
|
||||
// DName:='司洋';
|
||||
//DParameters1:='高权限';
|
||||
//DParameters2:='';
|
||||
DName := 'ADMIN';
|
||||
DCode := 'ADMIN';
|
||||
DParameters1 := '高权限';
|
||||
end
|
||||
else
|
||||
DConString := DataBaseStr;
|
||||
|
||||
if not ConnData() then
|
||||
begin
|
||||
result := 0;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
object frmYFGLList: TfrmYFGLList
|
||||
Left = 209
|
||||
Top = 118
|
||||
Left = 564
|
||||
Top = 297
|
||||
Width = 1384
|
||||
Height = 670
|
||||
Caption = #36816#36153#31649#29702
|
||||
|
|
@ -21,7 +21,7 @@ object frmYFGLList: TfrmYFGLList
|
|||
object ToolBar1: TToolBar
|
||||
Left = 0
|
||||
Top = 0
|
||||
Width = 1368
|
||||
Width = 1376
|
||||
AutoSize = True
|
||||
ButtonHeight = 30
|
||||
ButtonWidth = 107
|
||||
|
|
@ -117,10 +117,18 @@ object frmYFGLList: TfrmYFGLList
|
|||
ImageIndex = 68
|
||||
OnClick = ToolButton7Click
|
||||
end
|
||||
object TBClose: TToolButton
|
||||
object ToolButton8: TToolButton
|
||||
Left = 675
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #25353#19994#21153#21592#23548#20986
|
||||
ImageIndex = 68
|
||||
OnClick = ToolButton8Click
|
||||
end
|
||||
object TBClose: TToolButton
|
||||
Left = 786
|
||||
Top = 0
|
||||
AutoSize = True
|
||||
Caption = #20851#38381
|
||||
ImageIndex = 21
|
||||
OnClick = TBCloseClick
|
||||
|
|
@ -129,7 +137,7 @@ object frmYFGLList: TfrmYFGLList
|
|||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Top = 32
|
||||
Width = 1368
|
||||
Width = 1376
|
||||
Height = 59
|
||||
Align = alTop
|
||||
BevelInner = bvRaised
|
||||
|
|
@ -252,8 +260,8 @@ object frmYFGLList: TfrmYFGLList
|
|||
object cxGrid2: TcxGrid
|
||||
Left = 0
|
||||
Top = 91
|
||||
Width = 1368
|
||||
Height = 540
|
||||
Width = 1376
|
||||
Height = 548
|
||||
Align = alClient
|
||||
TabOrder = 2
|
||||
object TV1: TcxGridDBTableView
|
||||
|
|
|
|||
|
|
@ -12,7 +12,20 @@ uses
|
|||
cxDropDownEdit, cxCheckBox, RM_Common, RM_Class, RM_e_Xls, RM_Dataset,
|
||||
RM_System, RM_GridReport, Menus, cxCalendar, cxButtonEdit, cxTextEdit, cxPC,
|
||||
BtnEdit, cxSplitter, cxLookAndFeels, cxLookAndFeelPainters, cxNavigator,
|
||||
dxBarBuiltInMenu, MovePanel, cxCalc, Registry;
|
||||
dxBarBuiltInMenu, MovePanel, cxCalc, Registry, dxSkinsCore, dxSkinBlack,
|
||||
dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom,
|
||||
dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
|
||||
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
|
||||
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
|
||||
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
|
||||
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
|
||||
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
|
||||
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray,
|
||||
dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic,
|
||||
dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringTime, dxSkinStardust,
|
||||
dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinsDefaultPainters,
|
||||
dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint, dxSkinXmas2008Blue,
|
||||
dxSkinscxPCPainter;
|
||||
|
||||
type
|
||||
TfrmYFGLList = class(TForm)
|
||||
|
|
@ -82,6 +95,7 @@ type
|
|||
RM2: TRMGridReport;
|
||||
RMDB_2: TRMDBDataSet;
|
||||
TV1Column17: TcxGridDBColumn;
|
||||
ToolButton8: TToolButton;
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
|
|
@ -124,6 +138,7 @@ type
|
|||
procedure ToolButton6Click(Sender: TObject);
|
||||
procedure ordernoKeyPress(Sender: TObject; var Key: Char);
|
||||
procedure ToolButton7Click(Sender: TObject);
|
||||
procedure ToolButton8Click(Sender: TObject);
|
||||
private
|
||||
canshu2: string;
|
||||
FDate: TDateTime;
|
||||
|
|
@ -145,7 +160,7 @@ type
|
|||
implementation
|
||||
|
||||
uses
|
||||
U_DataLink, U_RTFun, U_ZDYHelp, U_BaoGuanInPut, U_Fun, U_YFGLInPut;
|
||||
U_DataLink, U_RTFun, U_ZDYHelp, U_BaoGuanInPut, U_Fun, U_YFGLInPut, U_LabelPrintFun;
|
||||
|
||||
{$R *.dfm}
|
||||
function TfrmYFGLList.GetShellFolders(strDir: string): string;
|
||||
|
|
@ -222,7 +237,6 @@ begin
|
|||
|
||||
end;
|
||||
SQL.Add(fwhere);
|
||||
|
||||
// ShowMessage(sql.Text);
|
||||
Open;
|
||||
end;
|
||||
|
|
@ -1051,5 +1065,34 @@ begin
|
|||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmYFGLList.ToolButton8Click(Sender: TObject);
|
||||
var
|
||||
MPrintJson, JsonResult, msql: string;
|
||||
begin
|
||||
|
||||
if CDS_Main.IsEmpty then
|
||||
Exit;
|
||||
msql := ' select A.*,ZUSD=(SELECT SUM(FYMONEY)FROM FP_SUB B WHERE B.FPID=A.FPID AND B.FYBZ=''美元''),ZRMB=(SELECT SUM(FYMONEY)FROM FP_SUB B WHERE B.FPID=A.FPID AND B.FYBZ=''人民币'') ';
|
||||
msql := msql + 'FROM FP_MAIN A where 1=1 ';
|
||||
if ComboBox1.Text = '船期' then
|
||||
begin
|
||||
msql := msql + ' and chuandate>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.Date)) + ''' ';
|
||||
msql := msql + ' and chuandate<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.Date + 1)) + ''' ';
|
||||
|
||||
end
|
||||
else if combobox1.Text = '制单日期' then
|
||||
begin
|
||||
msql := msql + ' and FILLTIME>=''' + Trim(FormatDateTime('yyyy-MM-dd', BegDate.Date)) + ''' ';
|
||||
msql := msql + ' and FILLTIME<''' + Trim(FormatDateTime('yyyy-MM-dd', EndDate.Date + 1)) + ''' ';
|
||||
|
||||
end;
|
||||
msql := msql + 'ORDER BY YWY desc, FILLTIME ';
|
||||
|
||||
MPrintJson := '{ "LBName": "按业务员导出","QrCodeField": "ssid","DConString": "' + DConString + '","DCode": "' + DCode + '","DName": "' + DName + '","IsPreview": true,"printerIndex": 0,"ExportFileType": "xls", "PrtArgs": [ {"SqlStr": "' + msql + '" }] }';
|
||||
|
||||
FunPrint(Application, PChar(MPrintJson));
|
||||
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
|
|
|||
BIN
报关管理(BaoGuan.dll)/按业务员导出.xls
Normal file
BIN
报关管理(BaoGuan.dll)/按业务员导出.xls
Normal file
Binary file not shown.
|
|
@ -76,6 +76,8 @@ begin
|
|||
SetLength(user, 255);
|
||||
SetLength(pswd, 255);
|
||||
|
||||
if Trim(DataBaseStr) = '' then
|
||||
begin
|
||||
server := '47.100.130.130,7781';
|
||||
// server := '.';
|
||||
dtbase := 'zhenyongdata';
|
||||
|
|
@ -84,10 +86,14 @@ begin
|
|||
pswd := 'rightsoft@9101';
|
||||
// pswd := 'rightsoft';
|
||||
DConString := 'Provider=SQLOLEDB.1;Password=' + pswd + ';Persist Security Info=True;User ID=' + user + ';Initial Catalog=' + dtbase + ';Data Source=' + server;
|
||||
// DConString := DataBaseStr;
|
||||
//
|
||||
DName := 'ADMIN';
|
||||
DCode:='ADMIN';
|
||||
DCode := 'ADMIN';
|
||||
DParameters1 := '¸ßȨÏÞ';
|
||||
end
|
||||
else
|
||||
DConString := DataBaseStr;
|
||||
|
||||
if not ConnData() then
|
||||
begin
|
||||
result := 0;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
object frmMarkingInspection: TfrmMarkingInspection
|
||||
Left = 214
|
||||
Top = 37
|
||||
Left = 318
|
||||
Top = 159
|
||||
Width = 1539
|
||||
Height = 825
|
||||
Align = alLeft
|
||||
|
|
@ -21,9 +21,9 @@ object frmMarkingInspection: TfrmMarkingInspection
|
|||
TextHeight = 12
|
||||
object ScrollBox1: TScrollBox
|
||||
Left = 236
|
||||
Top = 89
|
||||
Top = 113
|
||||
Width = 621
|
||||
Height = 705
|
||||
Height = 681
|
||||
Align = alLeft
|
||||
TabOrder = 6
|
||||
Visible = False
|
||||
|
|
@ -1571,9 +1571,9 @@ object frmMarkingInspection: TfrmMarkingInspection
|
|||
end
|
||||
object cxGrid3: TcxGrid
|
||||
Left = 1151
|
||||
Top = 89
|
||||
Top = 113
|
||||
Width = 380
|
||||
Height = 705
|
||||
Height = 681
|
||||
Align = alClient
|
||||
PopupMenu = PopupMenu1
|
||||
TabOrder = 3
|
||||
|
|
@ -1684,6 +1684,12 @@ object frmMarkingInspection: TfrmMarkingInspection
|
|||
Options.Sorting = False
|
||||
Width = 40
|
||||
end
|
||||
object Tv3Column2: TcxGridDBColumn
|
||||
Caption = #32465#23450#26465#24418#30721
|
||||
DataBinding.FieldName = 'BarCode'
|
||||
HeaderAlignmentHorz = taCenter
|
||||
Width = 100
|
||||
end
|
||||
end
|
||||
object cxGridLevel2: TcxGridLevel
|
||||
GridView = Tv3
|
||||
|
|
@ -1691,9 +1697,9 @@ object frmMarkingInspection: TfrmMarkingInspection
|
|||
end
|
||||
object Panel2: TPanel
|
||||
Left = 0
|
||||
Top = 89
|
||||
Top = 113
|
||||
Width = 236
|
||||
Height = 705
|
||||
Height = 681
|
||||
Align = alLeft
|
||||
BevelInner = bvRaised
|
||||
BevelOuter = bvLowered
|
||||
|
|
@ -2280,9 +2286,9 @@ object frmMarkingInspection: TfrmMarkingInspection
|
|||
end
|
||||
object Panel7: TPanel
|
||||
Left = 857
|
||||
Top = 89
|
||||
Top = 113
|
||||
Width = 294
|
||||
Height = 705
|
||||
Height = 681
|
||||
Align = alLeft
|
||||
BevelInner = bvRaised
|
||||
BevelOuter = bvLowered
|
||||
|
|
@ -2307,7 +2313,7 @@ object frmMarkingInspection: TfrmMarkingInspection
|
|||
Left = 2
|
||||
Top = 404
|
||||
Width = 290
|
||||
Height = 299
|
||||
Height = 275
|
||||
Align = alClient
|
||||
TabOrder = 0
|
||||
object Tv2: TcxGridDBTableView
|
||||
|
|
@ -2424,14 +2430,14 @@ object frmMarkingInspection: TfrmMarkingInspection
|
|||
Left = 0
|
||||
Top = 0
|
||||
Width = 1531
|
||||
Height = 89
|
||||
Height = 113
|
||||
Align = alTop
|
||||
TabOrder = 0
|
||||
object Panel6: TPanel
|
||||
Left = 1
|
||||
Top = 31
|
||||
Width = 1529
|
||||
Height = 57
|
||||
Height = 81
|
||||
Align = alClient
|
||||
BevelInner = bvRaised
|
||||
BevelOuter = bvLowered
|
||||
|
|
@ -2543,8 +2549,8 @@ object frmMarkingInspection: TfrmMarkingInspection
|
|||
ParentFont = False
|
||||
end
|
||||
object Label25: TLabel
|
||||
Left = 649
|
||||
Top = 16
|
||||
Left = 9
|
||||
Top = 48
|
||||
Width = 100
|
||||
Height = 19
|
||||
Caption = #32465#23450#26465#24418#30721
|
||||
|
|
@ -2632,9 +2638,9 @@ object frmMarkingInspection: TfrmMarkingInspection
|
|||
OnClick = edtChenClick
|
||||
end
|
||||
object BarCode: TEdit
|
||||
Left = 752
|
||||
Top = 12
|
||||
Width = 185
|
||||
Left = 120
|
||||
Top = 44
|
||||
Width = 153
|
||||
Height = 27
|
||||
Font.Charset = GB2312_CHARSET
|
||||
Font.Color = clWindowText
|
||||
|
|
|
|||
|
|
@ -329,6 +329,7 @@ type
|
|||
SpeedButton123: TSpeedButton;
|
||||
Label25: TLabel;
|
||||
BarCode: TEdit;
|
||||
Tv3Column2: TcxGridDBColumn;
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure TBCloseClick(Sender: TObject);
|
||||
|
|
|
|||
|
|
@ -820,6 +820,7 @@ begin
|
|||
SQL.Add('and ( filler in ( select username from SY_User where UType=(select UType from SY_User where UserName=' + quotedstr(Trim(dname)));
|
||||
SQL.Add(')) OR FILLER =' + QuotedStr(Trim(DName)));
|
||||
SQL.Add(')');
|
||||
// ShowMessage(sql.Text);
|
||||
Open;
|
||||
end;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user