From 844c7c3ce2c39139490a6ecb0f35170f6cade290 Mon Sep 17 00:00:00 2001
From: wankeda <Administrator@DESKTOP-HAU3ST3>
Date: 星期二, 28 四月 2026 16:31:54 +0800
Subject: [PATCH] 1
---
Print/Print/Controllers/PrintController.cs | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/Print/Print/Controllers/PrintController.cs b/Print/Print/Controllers/PrintController.cs
new file mode 100644
index 0000000..bc933cd
--- /dev/null
+++ b/Print/Print/Controllers/PrintController.cs
@@ -0,0 +1,49 @@
+锘縰sing FastReport;
+using FastReport.Barcode;
+using FastReport.Table;
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace Print.Controllers
+{
+ [ApiController]
+ [Route("[controller]")]
+ public class PrintController : Controller
+ {
+ //const string PrintName = @"\\192.168.99.3\Gprinter GP-3120TU";
+
+ [HttpGet, HttpPost, Route("PrintPalletCode"), AllowAnonymous]
+ public object PrintPalletCode([FromBody] List<string> PalletCodes)
+ {
+ try
+ {
+ foreach (var item in PalletCodes)
+ {
+ string ReportPathmater = System.IO.Directory.GetCurrentDirectory();
+ string MFile = string.Empty;
+ MFile = ReportPathmater + "\\frx\\PalletCode.frx";
+ Report report = new Report();
+ report.Load(MFile);
+ report.PrintSettings.ShowDialog = false;
+ System.Drawing.Printing.PrinterSettings oitem = new System.Drawing.Printing.PrinterSettings();
+ report.PrintSettings.Printer = oitem.PrinterName;
+ BarcodeObject OrderNoObj = report.FindObject("PalletCode") as BarcodeObject;
+ if (OrderNoObj != null)
+ {
+ OrderNoObj.Text = item;
+ }
+ report.Print();
+ report.Dispose();
+ }
+ return new { Code = 400, Status = false, Message = "鎵撳嵃鎴愬姛" };
+ }
+ catch (Exception ex)
+ {
+ return new { Code = 400, Status = false, Message = "鎵撳嵃澶辫触锛岃鏌ョ湅鏄惁杩炴帴鎵撳嵃鏈�" };
+ }
+ }
+ }
+}
--
Gitblit v1.9.3