添加钢构件送货单详情页面“托盘标签”、“托盘老鼠图”、“导出Excel”、“标签纸打印”的接口

This commit is contained in:
曹鹏飞 2026-05-26 15:05:44 +08:00
parent 663d94b0c6
commit d37658cbc6
1 changed files with 3 additions and 6 deletions

View File

@ -2101,7 +2101,7 @@ public class StructuralPackageOrderController extends BaseController {
* @param ids 托盘id列表 * @param ids 托盘id列表
*/ */
@PostMapping("exportPdfByTrayIds") @PostMapping("exportPdfByTrayIds")
public ApiResult<String> exportPdfByTrayIds(@RequestBody @NotEmpty List<Long> ids) throws Exception { public void exportPdfByTrayIds(HttpServletResponse response,@RequestBody @NotEmpty List<Long> ids) throws Exception {
List<DeliverStructuralPackageOrderTrayItemVO> list = structuralPackageOrderTrayItemService.getListVOByTrayIds(ids); List<DeliverStructuralPackageOrderTrayItemVO> list = structuralPackageOrderTrayItemService.getListVOByTrayIds(ids);
VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(list)).throwMessage("数据不存在"); VUtil.trueThrowBusinessError(CollectionUtil.isEmpty(list)).throwMessage("数据不存在");
DeliverStructuralPackageOrderExtendVO trayVO = structuralPackageOrderTrayService.getInfo(list.get(0).getTrayId()); DeliverStructuralPackageOrderExtendVO trayVO = structuralPackageOrderTrayService.getInfo(list.get(0).getTrayId());
@ -2133,10 +2133,7 @@ public class StructuralPackageOrderController extends BaseController {
variables.put("info", vo); variables.put("info", vo);
variables.put("pages", PdfPageDTO.create(items, 9, new PackageMaterialDTO())); variables.put("pages", PdfPageDTO.create(items, 9, new PackageMaterialDTO()));
String html = ThymeleafUtil.generator("/template/", "钢构件老鼠图", ".html", variables); String html = ThymeleafUtil.generator("/template/", "钢构件老鼠图", ".html", variables);
// PdfGeneratorUtil.generatePdf(vo.getExternalOrderNo() + "-" + vo.getWorkbenchCode() + "老鼠图", html, response); URL baseUrl = new ClassPathResource("template/").getURL();
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); PdfGeneratorUtil.generatePdf("钢构件老鼠图", html, baseUrl.toString(), response);
PdfGeneratorUtil.generatePdf(vo.getExternalOrderNo() + "-" + vo.getWorkbenchCode() + "老鼠图", html, outputStream);
InputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
return ApiResult.success(fileUploadService.upload("tmp/sp/" + RandomUtil.randomString(10) + "/" + "老鼠图.pdf", inputStream, MediaType.APPLICATION_PDF_VALUE));
} }
} }