From 43568b5a131b475806af6bfb59831ab866d1d824 Mon Sep 17 00:00:00 2001 From: qiankanghui Date: Tue, 14 Jul 2026 09:47:26 +0800 Subject: [PATCH] =?UTF-8?q?feat(print):=20=E6=9B=B4=E6=96=B0=E7=AE=B1?= =?UTF-8?q?=E4=BD=93=E6=A0=87=E7=AD=BE=E6=89=93=E5=8D=B0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 重命名打印函数从printPage到printBoxPage以统一命名规范 - 新增labelFlag为'D'的打印页面类型printBoxPageD - 修改条件判断逻辑从labelFlag != 'A' && labelFlag != 'B'改为labelFlag = 'C' - 在B类型打印中添加对D类型打印的支持 - 完善代码注释和格式化以提高可读性 --- .../ccl/tt/controller/PrintController.java | 48 +++---- src/main/resources/templates/print/box.ftl | 132 ++++++++++++++++-- 2 files changed, 147 insertions(+), 33 deletions(-) diff --git a/src/main/java/com/ccl/tt/controller/PrintController.java b/src/main/java/com/ccl/tt/controller/PrintController.java index d304e12..cd81196 100644 --- a/src/main/java/com/ccl/tt/controller/PrintController.java +++ b/src/main/java/com/ccl/tt/controller/PrintController.java @@ -41,13 +41,13 @@ public class PrintController { @Autowired private SoRollRepository rollRepo; - + @Autowired private ProcedureDao procedureDao; @Autowired private SoRollOperationRepository rollOpRepo; - + @Autowired private ProjectCodeRepository projectCodeRepo; @Autowired @@ -90,7 +90,7 @@ public class PrintController { public Integer getCurrentPrinterIndex(Authentication authentication) { return getPrinterSetting(authentication.getName()).getSeq(); } - + @ModelAttribute("currentPrinterName") public String getCurrentPrinterName(Authentication authentication) { return getPrinterSetting(authentication.getName()).getPrintName(); @@ -506,28 +506,28 @@ public class PrintController { } return "print/finalroll"; } - + @Autowired UserRepository userRepo; @Autowired ShipmentBoxRepository boxRepo; - + @Autowired ReceiveBoxRepository reBox; @Autowired ShipmentBoxRollRepository boxRollRepo; - + @Autowired ReceiveBoxRollRepository receiveBoxRollRepository; @Autowired ShipmentRepository shipRepo; - + @Autowired SoReceiveRepository soReceiveRepository; - + @Autowired FinalRollDao finalRollDao; @@ -728,7 +728,7 @@ public class PrintController { String pkgC="CCL"+partApn+pkgcDate+seqNo; model.addAttribute("pkg", pkgC); } - if("B".equals(printFlag)){ + if("B".equals(printFlag) || "D".equals(printFlag)){ // 使用Calendar类获取周数 calendar.setTime(productTime); int week = calendar.get(Calendar.WEEK_OF_YEAR); @@ -843,17 +843,17 @@ public class PrintController { return "print/box"; } - + /** - * - * @Title: getBoxRollCreatedDate - * @Description: 获取箱中创建卷的日期 + * + * @Title: getBoxRollCreatedDate + * @Description: 获取箱中创建卷的日期 * @param shipNo * @param boxNo - * @return - * @return: String + * @return + * @return: String * @author LR - * @date: 2021-7-12 11:02:35 + * @date: 2021-7-12 11:02:35 * @throws */ public String getBoxRollCreatedDate(String shipNo, String boxNo) { @@ -874,7 +874,7 @@ public class PrintController { throw new RuntimeException("打印错误: " + boxNo+"does not exists "); } SoReceive SoReceive = soReceiveRepository.findByReceiveNo(box.getReceiveNo()); - + List boxRolls = receiveBoxRollRepository.findByBoxNo(box.getBoxNo()); String partNo = ""; @@ -917,7 +917,7 @@ public class PrintController { } } DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - String tsStr = sdf.format(SoReceive.getReceivedDate()); + String tsStr = sdf.format(SoReceive.getReceivedDate()); String date = tsStr.substring(0, 10); model.addAttribute("box", box); model.addAttribute("productDate", DateUtils2.getStringDate(box.getProductDate())); @@ -980,7 +980,7 @@ public class PrintController { throw new RuntimeException("打印错误: " + boxNo+"does not exists "); } SoReceive SoReceive = soReceiveRepository.findByReceiveNo(box.getReceiveNo()); - + List boxRolls = receiveBoxRollRepository.findByBoxNo(box.getBoxNo()); int count = 0; for(int i = 0; i - \ No newline at end of file +