From bb338744d76122d40927b7ae02804feafa7f0a57 Mon Sep 17 00:00:00 2001 From: "DESKTOP-E401PHE\\Administrator" Date: Thu, 7 Aug 2025 12:49:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- A00标签打印/U_ClientPrintRmf.dfm | 93 ++++++++++++++++---------------- A00标签打印/U_ClientPrintRmf.pas | 39 +++++--------- A00标签打印/U_LabelPrint.dfm | 8 +-- A00标签打印/U_LabelPrint.pas | 49 +++++++---------- A00标签打印/U_LabelPrintFun.pas | 40 ++++++++++++++ 5 files changed, 124 insertions(+), 105 deletions(-) create mode 100644 A00标签打印/U_LabelPrintFun.pas diff --git a/A00标签打印/U_ClientPrintRmf.dfm b/A00标签打印/U_ClientPrintRmf.dfm index 8c88d20..e23b714 100644 --- a/A00标签打印/U_ClientPrintRmf.dfm +++ b/A00标签打印/U_ClientPrintRmf.dfm @@ -1,8 +1,8 @@ object frmClientPrintRmf: TfrmClientPrintRmf - Left = 372 - Top = 106 - Width = 924 - Height = 745 + Left = 874 + Top = 483 + Width = 403 + Height = 240 Caption = #25253#34920#25171#21360 Color = clBtnFace Font.Charset = DEFAULT_CHARSET @@ -22,20 +22,20 @@ object frmClientPrintRmf: TfrmClientPrintRmf Connection = ADOConnection1 LockType = ltReadOnly Parameters = <> - Left = 526 - Top = 219 + Left = 265 + Top = 65503 end object ADOConnection1: TADOConnection LoginPrompt = False - Left = 280 - Top = 219 + Left = 19 + Top = 65503 end object ImageList1: TImageList DrawingStyle = dsTransparent Height = 32 Width = 32 - Left = 362 - Top = 343 + Left = 101 + Top = 91 Bitmap = { 494C010119002400040020002000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 000000000000360000002800000080000000E0000000010020000000000000C0 @@ -3743,8 +3743,8 @@ object frmClientPrintRmf: TfrmClientPrintRmf object RMDB_1: TRMDBDataSet Visible = True DataSet = ADO_1 - Left = 526 - Top = 343 + Left = 265 + Top = 91 end object RM1: TRMGridReport ThreadPrepareReport = True @@ -3763,48 +3763,48 @@ object frmClientPrintRmf: TfrmClientPrintRmf CompressThread = False LaterBuildEvents = True OnlyOwnerDataSet = False - Left = 526 - Top = 405 + Left = 265 + Top = 153 ReportData = {} end object RMDB_2: TRMDBDataSet Visible = True DataSet = ADO_2 - Left = 608 - Top = 343 + Left = 347 + Top = 91 end object CDS_Label: TClientDataSet Aggregates = <> Params = <> - Left = 280 - Top = 343 + Left = 19 + Top = 91 end object ADO_1: TADOQuery Connection = ADOConnection1 LockType = ltReadOnly Parameters = <> - Left = 608 - Top = 219 + Left = 347 + Top = 65503 end object ADO_2: TADOQuery Connection = ADOConnection1 LockType = ltReadOnly Parameters = <> - Left = 280 - Top = 281 + Left = 19 + Top = 29 end object RMDB_3: TRMDBDataSet Visible = True DataSet = ADO_3 - Left = 280 - Top = 405 + Left = 19 + Top = 153 end object ADO_3: TADOQuery Connection = ADOConnection1 LockType = ltReadOnly Parameters = <> - Left = 362 - Top = 281 + Left = 101 + Top = 29 end object RMXLSExport1: TRMXLSExport ShowAfterExport = True @@ -3817,61 +3817,62 @@ object frmClientPrintRmf: TfrmClientPrintRmf ScaleX = 1.000000000000000000 ScaleY = 1.000000000000000000 CompressFile = False - Left = 362 - Top = 467 + Left = 19 + Top = 215 end object RMJPEGExport1: TRMJPEGExport ScaleX = 1.000000000000000000 ScaleY = 1.000000000000000000 - Left = 608 - Top = 405 + Left = 347 + Top = 153 end object RMBarCodeObject1: TRMBarCodeObject - Left = 444 - Top = 343 + Left = 183 + Top = 91 end object ADOQueryCmd: TADOQuery Connection = ADOConnection1 Parameters = <> - Left = 362 - Top = 219 + Left = 101 + Top = 65503 end object ADO_While: TADOQuery + Connection = ADOConnection1 LockType = ltReadOnly Parameters = <> - Left = 608 - Top = 281 + Left = 347 + Top = 29 end object ADO_4: TADOQuery Connection = ADOConnection1 LockType = ltReadOnly Parameters = <> - Left = 444 - Top = 281 + Left = 183 + Top = 29 end object RMDB_4: TRMDBDataSet Visible = True DataSet = ADO_4 - Left = 362 - Top = 405 + Left = 101 + Top = 153 end object ADO_5: TADOQuery Connection = ADOConnection1 LockType = ltReadOnly Parameters = <> - Left = 526 - Top = 281 + Left = 265 + Top = 29 end object RMDB_5: TRMDBDataSet Visible = True DataSet = ADO_5 - Left = 444 - Top = 405 + Left = 183 + Top = 153 end object ADOQueryReport: TADOQuery Connection = DataLink_YXYMT.ADOLink Parameters = <> - Left = 444 - Top = 219 + Left = 183 + Top = 65503 end end diff --git a/A00标签打印/U_ClientPrintRmf.pas b/A00标签打印/U_ClientPrintRmf.pas index 660b707..9d5c78d 100644 --- a/A00标签打印/U_ClientPrintRmf.pas +++ b/A00标签打印/U_ClientPrintRmf.pas @@ -57,6 +57,7 @@ type public FPrintJson: PChar; FJsonOut: PChar; + DConString, DCode, DName: string; constructor Create(AOwner: TComponent; JsonArgs: PChar); { Public declarations } end; @@ -67,7 +68,7 @@ var implementation uses - U_DataLink, U_RTFun, superobject; + U_RTFun, superobject; {$R *.dfm} constructor TfrmClientPrintRmf.Create(AOwner: TComponent; JsonArgs: PChar); @@ -100,6 +101,10 @@ begin FExportFileType := JSONObject.S['ExportFileType']; FExportFileName := JSONObject.S['ExportFileName']; + DConString := JSONObject.S['DConString']; + DCode := JSONObject.S['DCode']; + DName := JSONObject.S['DName']; + // Ĭϵļ if Trim(FExportFileName) = '' then FExportFileName := FLBName; @@ -216,30 +221,16 @@ 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; } + InitArgs(); + + with ADOConnection1 do + begin + Connected := false; + ConnectionString := DConString; + Connected := true; end; + end; procedure TfrmClientPrintRmf.FormClose(Sender: TObject; var Action: TCloseAction); @@ -251,8 +242,6 @@ end; procedure TfrmClientPrintRmf.FormShow(Sender: TObject); begin - InitArgs(); - if flbName = '' then begin FJsonOut := '{"success":false,"message":"δӡǩ!"}'; diff --git a/A00标签打印/U_LabelPrint.dfm b/A00标签打印/U_LabelPrint.dfm index f772eec..1da8049 100644 --- a/A00标签打印/U_LabelPrint.dfm +++ b/A00标签打印/U_LabelPrint.dfm @@ -1,8 +1,8 @@ object frmLabelPrint: TfrmLabelPrint Left = 1104 Top = 424 - Width = 291 - Height = 194 + Width = 277 + Height = 181 Caption = #25253#34920#25171#21360 Color = clBtnFace Font.Charset = DEFAULT_CHARSET @@ -21,8 +21,8 @@ object frmLabelPrint: TfrmLabelPrint object Panel1: TPanel Left = 0 Top = 0 - Width = 283 - Height = 163 + Width = 269 + Height = 150 Align = alClient BevelInner = bvRaised BevelOuter = bvLowered diff --git a/A00标签打印/U_LabelPrint.pas b/A00标签打印/U_LabelPrint.pas index 37d2612..c1c88d7 100644 --- a/A00标签打印/U_LabelPrint.pas +++ b/A00标签打印/U_LabelPrint.pas @@ -79,6 +79,7 @@ type public FPrintJson: PChar; FJsonOut: PChar; + DConString, DCode, DName: string; constructor Create(AOwner: TComponent; JsonArgs: PChar); { Public declarations } end; @@ -89,7 +90,7 @@ var implementation uses - U_DataLink, U_RTFun, U_LabelMapSet, superobject; + U_RTFun, U_LabelMapSet, superobject; {$R *.dfm} constructor TfrmLabelPrint.Create(AOwner: TComponent; JsonArgs: PChar); @@ -107,8 +108,6 @@ begin // fexportFileType := exportFileType; end; - - procedure TfrmLabelPrint.InitArgs; var JSONObject, item: ISuperObject; // SuperObject ӿ @@ -128,7 +127,13 @@ begin FSuccessfulFun := JSONObject.S['SuccessfulFun']; FLMType := JSONObject.S['LMType']; FPreviewPrint := JSONObject.B['PreviewPrint']; - + + DConString := JSONObject.S['DConString']; + DCode := JSONObject.S['DCode']; + DName := JSONObject.S['DName']; + + + // ȡ jsonArray := JSONObject.A['PrtArgs']; if jsonArray = nil then // 鲻ڵ @@ -280,34 +285,20 @@ 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; } + InitArgs(); + with ADOConnection1 do + begin + Connected := false; + ConnectionString := DConString; + Connected := true; end; + end; procedure TfrmLabelPrint.btnPrintClick(Sender: TObject); begin PrintLabel(False); - FJsonOut := '{"succsee":true,"success":true}'; + FJsonOut := '{"success":true}'; ModalResult := 1; end; @@ -315,7 +306,7 @@ procedure TfrmLabelPrint.btnShowClick(Sender: TObject); begin PrintLabel(true); - FJsonOut := '{"ShowFlag":true}'; + FJsonOut := '{"success":true,"ShowFlag":true}'; end; procedure TfrmLabelPrint.cbbLabPropertiesButtonClick(Sender: TObject); @@ -397,12 +388,11 @@ 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; @@ -414,7 +404,6 @@ end; procedure TfrmLabelPrint.FormDestroy(Sender: TObject); begin - frmLabelPrint := nil; end; diff --git a/A00标签打印/U_LabelPrintFun.pas b/A00标签打印/U_LabelPrintFun.pas new file mode 100644 index 0000000..6bb938d --- /dev/null +++ b/A00标签打印/U_LabelPrintFun.pas @@ -0,0 +1,40 @@ +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 + Show; + + if ShowModal = 1 then + Result := FJsonOut + else + Result := FJsonOut; + end; +end; +// '{ "LBName": "","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. +