diff --git a/src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelExcelTXServiceImpl.java b/src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelExcelTXServiceImpl.java index 61e6b3ce..72776235 100644 --- a/src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelExcelTXServiceImpl.java +++ b/src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelExcelTXServiceImpl.java @@ -3122,9 +3122,12 @@ public class CoDelExcelTXServiceImpl implements CoDelExcelTXService { BigDecimal qty = ((BigDecimal)eorder.get("qty")).setScale(6, RoundingMode.HALF_UP); totalQty = totalQty.add(qty); eorder.put("total_qty", ((BigDecimal)eorder.get("qty")).setScale(6, RoundingMode.HALF_UP)); - // 合箱时:第一行显示数值,用于合并单元格居中显示 + // 合箱时:箱级字段只在首行写值,后续行留空,配合按箱合并后居中 boolean isFirstRow = (i == 0); - eorder.put("noCartons",eorder.get("box_qty")!=null?((BigDecimal)eorder.get("box_qty")).setScale(0, RoundingMode.HALF_UP):""); + Object cartonQty = eorder.get("box_qty") != null + ? ((BigDecimal) eorder.get("box_qty")).setScale(0, RoundingMode.HALF_UP) : ""; + // 合箱时F列箱数只在首行写值,后续行留空,配合按箱合并后居中(有托/无托相同) + eorder.put("noCartons", isFirstRow ? cartonQty : ""); eorder.put("qty_percarton", eorder.get("rolls")!=null?((BigDecimal)eorder.get("rolls")).setScale(0, RoundingMode.HALF_UP):""); // 托盘数:一个托盘对应多个箱,仅在该托盘第一条明细显示,其他行留空,后续按托盘合并 boolean showPalletQty = StringUtils.isNotEmpty(palletSeqNo) && !displayedPalletSeqSet.contains(palletSeqNo); @@ -3132,8 +3135,9 @@ public class CoDelExcelTXServiceImpl implements CoDelExcelTXService { displayedPalletSeqSet.add(palletSeqNo); } Integer palletQty = palletQtyMap.get(palletSeqNo); - // 第一列展示托号(pallet_no),按托盘首行显示,后续行留空再做按托合并 - eorder.put("seq_no", hasPalletData?(showPalletQty ? palletNo : ""):boxNo); + // 有托:第一列展示托号,按托首行显示后再按托合并 + // 无托:第一列改展示箱号;合箱只在首行写值,避免同一箱号在每条物料行重复 + eorder.put("seq_no", hasPalletData ? (showPalletQty ? palletNo : "") : (isFirstRow ? boxNo : "")); eorder.put("total_pallets", showPalletQty ? (palletQty != null ? palletQty : "") : ""); eorder.put("volume", isFirstRow ? volume : ""); eorder.put("gross_weight", isFirstRow ? ((BigDecimal) list.get(m).get("gross_weight")).setScale(2, RoundingMode.HALF_UP) : ""); @@ -3146,7 +3150,7 @@ public class CoDelExcelTXServiceImpl implements CoDelExcelTXService { (data.getHsCodeFlag()!=null && data.getHsCodeFlag() ? " HS CODE:" + sanitizePdfRenderText(eorder.get("hsCode")) : ""); eorder.put("artNo", artNoContent); // 计算artNo内容的行数,动态设置行高 - int lineCount = calculateLineCount(artNoContent, 42); + int lineCount = calculateLineCount(artNoContent, 60); // 基础行高16点 + 每额外行增加15点(可根据实际字体大小调整) int rowHeight = 16 + (lineCount - 1) * 15; // 设置当前行的行高(exportList的当前索引) @@ -3158,10 +3162,17 @@ public class CoDelExcelTXServiceImpl implements CoDelExcelTXService { int boxEndIndex = exportList.size() - 1; if (boxEndIndex >= boxStartIndex) { // 箱级字段按箱明细范围合并(一个箱可能有多条箱明细) - // 净重列(倒数第2列,索引7) + // 净重列(J列,索引9) template.addMergeRegion(boxStartIndex, boxEndIndex, 9); - // 毛重列(倒数第1列,索引8) + // 毛重列(K列,索引10) template.addMergeRegion(boxStartIndex, boxEndIndex, 10); + // 合箱:F列箱数按箱合并居中(有托时A列仍是托号,不能按箱合并A列) + if (boxEndIndex > boxStartIndex) { + template.addMergeRegion(boxStartIndex, boxEndIndex, 5); + if (!hasPalletData) { + template.addMergeRegion(boxStartIndex, boxEndIndex, 0); + } + } } // 托盘数列按托盘(seq_no)跨箱合并:一个托盘下多个箱共享同一托盘数 String nextPalletSeqNo = ""; diff --git a/src/main/java/com/xujie/sys/modules/sift/adapter/EcssDeclarationCountAdapter.java b/src/main/java/com/xujie/sys/modules/sift/adapter/EcssDeclarationCountAdapter.java index a9f01f89..ea9878dd 100644 --- a/src/main/java/com/xujie/sys/modules/sift/adapter/EcssDeclarationCountAdapter.java +++ b/src/main/java/com/xujie/sys/modules/sift/adapter/EcssDeclarationCountAdapter.java @@ -28,7 +28,9 @@ public class EcssDeclarationCountAdapter extends AbstractMenuUrlQueryAdapter { Map valueMap = resolveConditionFormulaMap(querySavedVo); data.setPage(1); data.setLimit(1); + // 查询条件已从工厂编码改为 BU;保留 site 以兼容历史保存条件 data.setSite(valueMap.get("site")); + data.setBuNo(valueMap.get("buNo")); data.setDeclarationNo(valueMap.get("declarationNo")); data.setDelNo(valueMap.get("delNo")); data.setCmcInvoice(valueMap.get("cmcInvoice")); diff --git a/src/main/resources/mapper/ecss/CoDelMapper.xml b/src/main/resources/mapper/ecss/CoDelMapper.xml index 1067dc7b..929c2dc6 100644 --- a/src/main/resources/mapper/ecss/CoDelMapper.xml +++ b/src/main/resources/mapper/ecss/CoDelMapper.xml @@ -815,6 +815,9 @@ create_by,create_date,update_by,update_date AND a.site like #{query.site} + + AND noHeader.bu_no = #{query.buNo} + AND a.ship_date>= #{query.startDate}