工单打印功能修改,直接打印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 打印机打印工单
[HttpPost("print")]
[AllowAnonymous]
[HttpGet("print")]
public async Task<IActionResult> ExportWorkorderPDF(string[] workorderArray,string? path)
public async Task<IActionResult> ExportWorkorderPDF([FromBody] ProWorkorderExportDto param)
{
if(workorderArray==null||workorderArray.Length<1)
try
{
throw new CustomException("workorderArray");
}
if (path==null)
{
path ="./Resources/gxassembly_production_label.btw";
}
//Task<(string, Stream)> conntext = _ProWorkorderService.ExportPDFByQuestPDFDemo(workorderArray);
var exception = await _ProWorkorderService.PrintTicketsByTemplate(workorderArray,path);
if (param.WorkorderArray == null || param.WorkorderArray.Length < 1)
{
return ToResponse(500, "工单列表为空");
}
param.Path = "D:/mes/Label/Trace.btw";
//Task<(string, Stream)> conntext = _ProWorkorderService.ExportPDFByQuestPDFDemo(workorderArray);
var exception = await _ProWorkorderService.PrintTicketsByTemplate(param);
return (IActionResult)exception;
//return File(conntext.Result.Item2, "application/pdf", HttpUtility.UrlEncode(conntext.Result.Item1));
}
catch (Exception ex)
{
return ToResponse(500, ex.Message);
}
return (IActionResult)exception;
//return File(conntext.Result.Item2, "application/pdf", HttpUtility.UrlEncode(conntext.Result.Item1));
}