工单打印功能修改,直接打印BarTender标签

This commit is contained in:
2025-04-14 15:48:37 +08:00
parent 38fd3febeb
commit 02a631fff8
5 changed files with 495 additions and 369 deletions

View File

@@ -385,23 +385,30 @@ namespace DOAN.Admin.WebApi.Controllers
} }
//TODO 打印机打印工单 //TODO 打印机打印工单
[HttpPost("print")]
[AllowAnonymous] [AllowAnonymous]
[HttpGet("print")] public async Task<IActionResult> ExportWorkorderPDF([FromBody] ProWorkorderExportDto param)
public async Task<IActionResult> ExportWorkorderPDF(string[] workorderArray,string? path)
{ {
if(workorderArray==null||workorderArray.Length<1) try
{ {
throw new CustomException("workorderArray"); if (param.WorkorderArray == null || param.WorkorderArray.Length < 1)
} {
if (path==null) return ToResponse(500, "工单列表为空");
{
path ="./Resources/gxassembly_production_label.btw";
} }
param.Path = "D:/mes/Label/Trace.btw";
//Task<(string, Stream)> conntext = _ProWorkorderService.ExportPDFByQuestPDFDemo(workorderArray); //Task<(string, Stream)> conntext = _ProWorkorderService.ExportPDFByQuestPDFDemo(workorderArray);
var exception = await _ProWorkorderService.PrintTicketsByTemplate(workorderArray,path); var exception = await _ProWorkorderService.PrintTicketsByTemplate(param);
return (IActionResult)exception; return (IActionResult)exception;
//return File(conntext.Result.Item2, "application/pdf", HttpUtility.UrlEncode(conntext.Result.Item1)); //return File(conntext.Result.Item2, "application/pdf", HttpUtility.UrlEncode(conntext.Result.Item1));
}
catch (Exception ex)
{
return ToResponse(500, ex.Message);
}
} }

View File

@@ -14,7 +14,7 @@
//代码生成数据库配置 //代码生成数据库配置
"CodeGenDbConfig": { "CodeGenDbConfig": {
//代码生成连接字符串,注意{dbName}为固定格式,不要填写数据库名 //代码生成连接字符串,注意{dbName}为固定格式,不要填写数据库名
"Conn": "Data Source=127.0.0.1;User ID=root;Password=123456;Initial Catalog={dbName};Port=3306", "Conn": "Data Source=139.224.232.211;User ID=root;Password=doantech123;Initial Catalog={dbName};Port=3308",
"DbType": 0, "DbType": 0,
"IsAutoCloseConnection": true, "IsAutoCloseConnection": true,
"DbName": "bzfm_mes" //代码生成默认连接数据库,Oracle库是实例的名称 "DbName": "bzfm_mes" //代码生成默认连接数据库,Oracle库是实例的名称

View File

@@ -26,7 +26,11 @@ namespace DOAN.Model.MES.product.Dto
public DateTime WorkorderDate { get; set; } public DateTime WorkorderDate { get; set; }
} }
public class ProWorkorderExportDto
{
public string [] WorkorderArray { get; set; }
public string Path { get; set; }
}
/// <summary> /// <summary>

View File

@@ -65,6 +65,6 @@ namespace DOAN.Service.MES.product.IService
int WorkOrderLog(string workorder, string log, string Operator); int WorkOrderLog(string workorder, string log, string Operator);
Task<(string, Stream)> ExportPDFByQuestPDFDemo(string[] workorderArray); Task<(string, Stream)> ExportPDFByQuestPDFDemo(string[] workorderArray);
Task<CustomException> PrintTicketsByTemplate(string[] workorderArray,string path); Task<CustomException> PrintTicketsByTemplate(ProWorkorderExportDto param);
} }
} }

File diff suppressed because it is too large Load Diff