1
This commit is contained in:
parent
2544965bf7
commit
91f32f0b8c
3877
A00标签打印/U_ClientPrintRmf.dfm
Normal file
3877
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_1: TADOQuery;
|
||||
ADO_2: TADOQuery;
|
||||
RMDB_3: TRMDBDataSet;
|
||||
ADO_3: TADOQuery;
|
||||
RMXLSExport1: TRMXLSExport;
|
||||
RMJPEGExport1: TRMJPEGExport;
|
||||
RMBarCodeObject1: TRMBarCodeObject;
|
||||
ADOQueryCmd: TADOQuery;
|
||||
ADO_While: TADOQuery;
|
||||
ADO_4: TADOQuery;
|
||||
RMDB_4: TRMDBDataSet;
|
||||
ADO_5: TADOQuery;
|
||||
RMDB_5: TRMDBDataSet;
|
||||
ADOQueryReport: TADOQuery;
|
||||
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: string;
|
||||
FExportFileType, FExportFileName: string;
|
||||
SqlStr1, SqlStr2, SqlStr3, SqlStr4, SqlStr5: string;
|
||||
FSuccessfulFun: string;
|
||||
FparamBlclid: string;
|
||||
procedure PrintReport();
|
||||
procedure ExportReport();
|
||||
procedure InitAdo(Ado: TADOQuery; SqlStr: string);
|
||||
procedure InitArgs();
|
||||
{ Private declarations }
|
||||
public
|
||||
FPrintJson: PChar;
|
||||
FJsonOut: PChar;
|
||||
constructor Create(AOwner: TComponent; JsonArgs: PChar);
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmClientPrintRmf: TfrmClientPrintRmf;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
U_DataLink, U_RTFun, superobject;
|
||||
|
||||
{$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'];
|
||||
|
||||
// 设置默认导出文件名
|
||||
if Trim(FExportFileName) = '' then
|
||||
FExportFileName := FLBName;
|
||||
|
||||
// 导出文件操作(保持不变)
|
||||
ExportFtErpFile(FLBName + '.rmf', ADOQueryReport);
|
||||
|
||||
// 初始化 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.InitAdo(Ado: TADOQuery; SqlStr: string);
|
||||
begin
|
||||
if Trim(SqlStr) = '' then
|
||||
Exit;
|
||||
with Ado do
|
||||
begin
|
||||
Close;
|
||||
sql.Clear;
|
||||
sql.add(SqlStr);
|
||||
// ShowMessage(SqlStr);
|
||||
Open;
|
||||
end;
|
||||
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;
|
||||
try
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected := false;
|
||||
ConnectionString := DConString;
|
||||
Connected := true;
|
||||
end;
|
||||
except
|
||||
{if Application.MessageBox('网络连接失败,是否要再次连接?','提示',32+4)=IDYES then
|
||||
begin
|
||||
try
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=DConString;
|
||||
//ConnectionString:='23242';
|
||||
Connected:=true;
|
||||
end;
|
||||
except
|
||||
end;
|
||||
end; }
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmClientPrintRmf.FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
begin
|
||||
|
||||
Action := cafree;
|
||||
end;
|
||||
|
||||
procedure TfrmClientPrintRmf.FormShow(Sender: TObject);
|
||||
begin
|
||||
|
||||
InitArgs();
|
||||
|
||||
if flbName = '' then
|
||||
begin
|
||||
FJsonOut := '{"success":false,"message":"未传入打印标签!"}';
|
||||
self.Close;
|
||||
exit;
|
||||
end;
|
||||
if SqlStr1 = '' then
|
||||
begin
|
||||
FJsonOut := '{"success":false,"message":"未传入打印语句!"}';
|
||||
self.Close;
|
||||
exit;
|
||||
end;
|
||||
|
||||
InitAdo(ADO_1, SqlStr1);
|
||||
InitAdo(ADO_2, SqlStr2);
|
||||
InitAdo(ADO_3, SqlStr3);
|
||||
InitAdo(ADO_4, SqlStr4);
|
||||
InitAdo(ADO_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
422
A00标签打印/U_LabelPrint.pas
Normal file
422
A00标签打印/U_LabelPrint.pas
Normal file
|
|
@ -0,0 +1,422 @@
|
|||
unit U_LabelPrint;
|
||||
|
||||
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, 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_1: TADOQuery;
|
||||
btnShow: TSpeedButton;
|
||||
ADO_2: TADOQuery;
|
||||
RMDB_3: TRMDBDataSet;
|
||||
ADO_3: TADOQuery;
|
||||
RMXLSExport1: TRMXLSExport;
|
||||
RMJPEGExport1: TRMJPEGExport;
|
||||
RMBarCodeObject1: TRMBarCodeObject;
|
||||
CheckBox1: TCheckBox;
|
||||
Label1: TLabel;
|
||||
cbbLab: TcxMRUEdit;
|
||||
CheckBox2: TCheckBox;
|
||||
ADOQueryCmd: TADOQuery;
|
||||
ADO_While: TADOQuery;
|
||||
ComboBox1: TcxComboBox;
|
||||
ComboBox_Print: TcxComboBox;
|
||||
btnPrint: TSpeedButton;
|
||||
ADO_4: TADOQuery;
|
||||
RMDB_4: TRMDBDataSet;
|
||||
ADO_5: TADOQuery;
|
||||
RMDB_5: TRMDBDataSet;
|
||||
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: string;
|
||||
FFiltration1, FFiltration2, FFiltration3, FFiltration4, FFiltration5: string;
|
||||
FSuccessfulFun: string;
|
||||
FparamBlclid: string;
|
||||
procedure InitGrid();
|
||||
procedure PrintLabel(MIsShow: Boolean);
|
||||
procedure InitAdo(Ado: TADOQuery; IsSql: Boolean; LMSql, FFiltration: string);
|
||||
procedure InitArgs();
|
||||
{ Private declarations }
|
||||
public
|
||||
FPrintJson: PChar;
|
||||
FJsonOut: PChar;
|
||||
constructor Create(AOwner: TComponent; JsonArgs: PChar);
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
var
|
||||
frmLabelPrint: TfrmLabelPrint;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
U_DataLink, U_RTFun, U_LabelMapSet, superobject;
|
||||
|
||||
{$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'];
|
||||
|
||||
// 获取数组
|
||||
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.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_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;
|
||||
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
|
||||
InitAdo(ADO_1, IsSql1, 'LMSql1', FFiltration1);
|
||||
|
||||
if trim(CDS_Label.fieldbyname('LMSql2').AsString) <> '' then
|
||||
InitAdo(ADO_2, IsSql2, 'LMSql2', FFiltration2);
|
||||
|
||||
if trim(CDS_Label.fieldbyname('LMSql3').AsString) <> '' then
|
||||
InitAdo(ADO_3, IsSql3, 'LMSql3', FFiltration3);
|
||||
|
||||
if trim(CDS_Label.fieldbyname('LMSql4').AsString) <> '' then
|
||||
InitAdo(ADO_4, IsSql4, 'LMSql4', FFiltration4);
|
||||
|
||||
if trim(CDS_Label.fieldbyname('LMSql5').AsString) <> '' then
|
||||
InitAdo(ADO_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.PrintReport;
|
||||
end
|
||||
else
|
||||
begin
|
||||
Application.MessageBox(PChar('没有找' + fPrintFile), '提示', 0);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelPrint.FormCreate(Sender: TObject);
|
||||
begin
|
||||
|
||||
FPreviewPrint := True;
|
||||
try
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected := false;
|
||||
ConnectionString := DConString;
|
||||
Connected := true;
|
||||
end;
|
||||
except
|
||||
{if Application.MessageBox('网络连接失败,是否要再次连接?','提示',32+4)=IDYES then
|
||||
begin
|
||||
try
|
||||
with ADOConnection1 do
|
||||
begin
|
||||
Connected:=false;
|
||||
ConnectionString:=DConString;
|
||||
//ConnectionString:='23242';
|
||||
Connected:=true;
|
||||
end;
|
||||
except
|
||||
end;
|
||||
end; }
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelPrint.btnPrintClick(Sender: TObject);
|
||||
begin
|
||||
PrintLabel(False);
|
||||
FJsonOut := '{"succsee":true,"success":true}';
|
||||
ModalResult := 1;
|
||||
end;
|
||||
|
||||
procedure TfrmLabelPrint.btnShowClick(Sender: TObject);
|
||||
begin
|
||||
|
||||
PrintLabel(true);
|
||||
FJsonOut := '{"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
|
||||
|
||||
InitArgs();
|
||||
// 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.
|
||||
|
||||
|
|
@ -44,7 +44,7 @@ object frmSelExportField: TfrmSelExportField
|
|||
TabOrder = 2
|
||||
Visible = False
|
||||
object ExpGrid: TcxGridDBTableView
|
||||
NavigatorButtons.ConfirmDelete = False
|
||||
Navigator.Buttons.CustomButtons = <>
|
||||
DataController.DataSource = ExportDataSource
|
||||
DataController.Summary.DefaultGroupSummaryItems = <>
|
||||
DataController.Summary.FooterSummaryItems = <>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,22 @@ uses
|
|||
DB,IniFiles, RM_Common, RM_Class, RM_e_Xls, cxStyles, cxCustomData,
|
||||
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData,
|
||||
cxGridLevel, cxClasses, cxControls, cxGridCustomView,
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid;
|
||||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid,
|
||||
cxLookAndFeels, cxLookAndFeelPainters, 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,
|
||||
cxNavigator;
|
||||
|
||||
type
|
||||
TfrmSelExportField = class(TForm)
|
||||
|
|
|
|||
7502
Z99Dependency/ThreeFun/Fun/superobject.pas
Normal file
7502
Z99Dependency/ThreeFun/Fun/superobject.pas
Normal file
File diff suppressed because it is too large
Load Diff
|
|
@ -873,6 +873,8 @@ object frmYMTFHSQList: TfrmYMTFHSQList
|
|||
Top = 308
|
||||
end
|
||||
object cxStyleRepository1: TcxStyleRepository
|
||||
Left = 16
|
||||
Top = 112
|
||||
PixelsPerInch = 96
|
||||
object cxStyle1: TcxStyle
|
||||
AssignedValues = [svFont]
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ object frmYMTRKInPut: TfrmYMTRKInPut
|
|||
object cxGrid2: TcxGrid
|
||||
Left = 0
|
||||
Top = 33
|
||||
Width = 1690
|
||||
Width = 1632
|
||||
Height = 559
|
||||
Align = alClient
|
||||
TabOrder = 0
|
||||
|
|
@ -521,9 +521,9 @@ object frmYMTRKInPut: TfrmYMTRKInPut
|
|||
end
|
||||
end
|
||||
object Panel2: TPanel
|
||||
Left = 1690
|
||||
Left = 1632
|
||||
Top = 33
|
||||
Width = 131
|
||||
Width = 189
|
||||
Height = 559
|
||||
Align = alRight
|
||||
Caption = 'Panel2'
|
||||
|
|
@ -531,7 +531,7 @@ object frmYMTRKInPut: TfrmYMTRKInPut
|
|||
object cxGrid1: TcxGrid
|
||||
Left = 1
|
||||
Top = 33
|
||||
Width = 129
|
||||
Width = 187
|
||||
Height = 525
|
||||
Align = alClient
|
||||
TabOrder = 0
|
||||
|
|
@ -592,7 +592,7 @@ object frmYMTRKInPut: TfrmYMTRKInPut
|
|||
object ToolBar2: TToolBar
|
||||
Left = 1
|
||||
Top = 1
|
||||
Width = 129
|
||||
Width = 187
|
||||
AutoSize = True
|
||||
ButtonHeight = 30
|
||||
ButtonWidth = 59
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
object frmYMTRKList: TfrmYMTRKList
|
||||
Left = 478
|
||||
Top = 392
|
||||
Left = 436
|
||||
Top = 278
|
||||
Width = 1372
|
||||
Height = 754
|
||||
Height = 750
|
||||
Caption = #38754#26009#22238#20179#30331#35760
|
||||
Color = clBtnFace
|
||||
Font.Charset = GB2312_CHARSET
|
||||
|
|
@ -23,7 +23,7 @@ object frmYMTRKList: TfrmYMTRKList
|
|||
Width = 1364
|
||||
Height = 33
|
||||
ButtonHeight = 30
|
||||
ButtonWidth = 59
|
||||
ButtonWidth = 101
|
||||
Caption = 'ToolBar1'
|
||||
Color = clSkyBlue
|
||||
Flat = True
|
||||
|
|
@ -94,6 +94,20 @@ object frmYMTRKList: TfrmYMTRKList
|
|||
ImageIndex = 21
|
||||
OnClick = TBCloseClick
|
||||
end
|
||||
object ToolButton1: TToolButton
|
||||
Left = 441
|
||||
Top = 0
|
||||
Caption = 'ToolButton1'
|
||||
ImageIndex = 22
|
||||
OnClick = ToolButton1Click
|
||||
end
|
||||
object ToolButton2: TToolButton
|
||||
Left = 542
|
||||
Top = 0
|
||||
Caption = 'ToolButton2'
|
||||
ImageIndex = 23
|
||||
OnClick = ToolButton2Click
|
||||
end
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
|
|
@ -393,7 +407,7 @@ object frmYMTRKList: TfrmYMTRKList
|
|||
Left = 0
|
||||
Top = 105
|
||||
Width = 1224
|
||||
Height = 618
|
||||
Height = 614
|
||||
Align = alClient
|
||||
TabOrder = 2
|
||||
object Tv1: TcxGridDBTableView
|
||||
|
|
@ -649,7 +663,7 @@ object frmYMTRKList: TfrmYMTRKList
|
|||
Left = 1224
|
||||
Top = 105
|
||||
Width = 140
|
||||
Height = 618
|
||||
Height = 614
|
||||
Align = alRight
|
||||
TabOrder = 3
|
||||
object TvMX: TcxGridDBTableView
|
||||
|
|
|
|||
|
|
@ -116,6 +116,8 @@ type
|
|||
CDS_MX: TClientDataSet;
|
||||
DS_MX: TDataSource;
|
||||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||||
ToolButton1: TToolButton;
|
||||
ToolButton2: TToolButton;
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
|
|
@ -135,6 +137,8 @@ type
|
|||
procedure FactoryNameChange(Sender: TObject);
|
||||
procedure TvMXCustomDrawIndicatorCell(Sender: TcxGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxCustomGridIndicatorItemViewInfo; var ADone: Boolean);
|
||||
procedure Tv1FocusedRecordChanged(Sender: TcxCustomGridTableView; APrevFocusedRecord, AFocusedRecord: TcxCustomGridRecord; ANewItemRecordFocusingChanged: Boolean);
|
||||
procedure ToolButton1Click(Sender: TObject);
|
||||
procedure ToolButton2Click(Sender: TObject);
|
||||
private
|
||||
canshu1, canshu2: string;
|
||||
procedure InitGrid();
|
||||
|
|
@ -151,7 +155,8 @@ var
|
|||
implementation
|
||||
|
||||
uses
|
||||
U_DataLink, U_RTFun, U_YMTRKInPut, U_ZdyAttachGYS;
|
||||
U_DataLink, U_RTFun, U_YMTRKInPut, U_ZdyAttachGYS, U_LabelPrint,
|
||||
U_ClientPrintRmf;
|
||||
|
||||
{$R *.dfm}
|
||||
procedure TfrmYMTRKList.InitMXGrid(MCRNO: string);
|
||||
|
|
@ -430,5 +435,39 @@ begin
|
|||
InitMXGrid(Trim(CDS_Main.fieldbyname('SPID').AsString));
|
||||
end;
|
||||
|
||||
procedure TfrmYMTRKList.ToolButton1Click(Sender: TObject);
|
||||
var
|
||||
FPrintJson, JsonResult: string;
|
||||
begin
|
||||
FPrintJson := '{ "LMType": "LMType","PreviewPrint": true, "PrtArgs": [ { "IsSql": true, "Filtration": "Filtration1" }, { "IsSql": true, "Filtration": "Filtration2" }, { "IsSql": true, "Filtration": "Filtration3" } ] }';
|
||||
with TfrmLabelPrint.Create(Application, PChar(FPrintJson)) do
|
||||
begin
|
||||
|
||||
if ShowModal = 1 then
|
||||
begin
|
||||
JsonResult := FJsonOut;
|
||||
end;
|
||||
end;
|
||||
ShowMessage(JsonResult);
|
||||
end;
|
||||
|
||||
procedure TfrmYMTRKList.ToolButton2Click(Sender: TObject);
|
||||
var
|
||||
MPrintJson, JsonResult: string;
|
||||
begin
|
||||
MPrintJson := '{ "LBName": "²âÊÔ","IsPreview": true,"printerIndex": 0,"ExportFileType": "", "PrtArgs": [ {"SqlStr": "EXEC p_test ''22'' " }, {"SqlStr": "select x=2" }, {"SqlStr": "select x=2" } ] }';
|
||||
|
||||
with TfrmClientPrintRmf.Create(Application, PChar(MPrintJson)) do
|
||||
begin
|
||||
|
||||
Show;
|
||||
|
||||
JsonResult := FJsonOut;
|
||||
|
||||
end;
|
||||
|
||||
ShowMessage(JsonResult);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
|
|
|||
|
|
@ -14,11 +14,15 @@ uses
|
|||
U_iniParam in 'U_iniParam.pas',
|
||||
U_ZDYHelp in 'U_ZDYHelp.pas' {frmZDYHelp},
|
||||
U_Fun in '..\Z99Dependency\ThreeFun\Fun\U_Fun.pas',
|
||||
U_SelExportField in '..\Z99Dependency\ThreeFun\Form\U_SelExportField.pas' {frmSelExportField},
|
||||
U_ColumnSet in '..\Z99Dependency\ThreeFun\Form\U_ColumnSet.pas' {frmColumnSet},
|
||||
U_ColumnBandSet in '..\Z99Dependency\ThreeFun\Form\U_ColumnBandSet.pas' {frmColumnBandSet},
|
||||
U_SelPrintFieldNew in '..\Z99Dependency\ThreeFun\Form\U_SelPrintFieldNew.pas' {frmSelPrintFieldNew},
|
||||
U_CompressionFun in '..\Z99Dependency\ThreeFun\Fun\U_CompressionFun.pas';
|
||||
U_CompressionFun in '..\Z99Dependency\ThreeFun\Fun\U_CompressionFun.pas',
|
||||
U_SelExportField in '..\Z99Dependency\ThreeFun\Fun\U_SelExportField.pas' {frmSelExportField},
|
||||
superobject in '..\Z99Dependency\ThreeFun\Fun\superobject.pas',
|
||||
U_ClientPrintRmf in '..\A00±êÇ©´òÓ¡\U_ClientPrintRmf.pas' {frmClientPrintRmf},
|
||||
U_LabelMapSet in '..\A00±êÇ©´òÓ¡\U_LabelMapSet.pas' {frmLabelMapSet},
|
||||
U_LabelPrint in '..\A00±êÇ©´òÓ¡\U_LabelPrint.pas' {frmLabelPrint};
|
||||
|
||||
{$R *.res}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user