|
|
@ -3122,9 +3122,12 @@ public class CoDelExcelTXServiceImpl implements CoDelExcelTXService { |
|
|
BigDecimal qty = ((BigDecimal)eorder.get("qty")).setScale(6, RoundingMode.HALF_UP); |
|
|
BigDecimal qty = ((BigDecimal)eorder.get("qty")).setScale(6, RoundingMode.HALF_UP); |
|
|
totalQty = totalQty.add(qty); |
|
|
totalQty = totalQty.add(qty); |
|
|
eorder.put("total_qty", ((BigDecimal)eorder.get("qty")).setScale(6, RoundingMode.HALF_UP)); |
|
|
eorder.put("total_qty", ((BigDecimal)eorder.get("qty")).setScale(6, RoundingMode.HALF_UP)); |
|
|
// 合箱时:第一行显示数值,用于合并单元格居中显示 |
|
|
|
|
|
|
|
|
// 合箱时:箱级字段只在首行写值,后续行留空,配合按箱合并后居中 |
|
|
boolean isFirstRow = (i == 0); |
|
|
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):""); |
|
|
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); |
|
|
boolean showPalletQty = StringUtils.isNotEmpty(palletSeqNo) && !displayedPalletSeqSet.contains(palletSeqNo); |
|
|
@ -3132,8 +3135,9 @@ public class CoDelExcelTXServiceImpl implements CoDelExcelTXService { |
|
|
displayedPalletSeqSet.add(palletSeqNo); |
|
|
displayedPalletSeqSet.add(palletSeqNo); |
|
|
} |
|
|
} |
|
|
Integer palletQty = palletQtyMap.get(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("total_pallets", showPalletQty ? (palletQty != null ? palletQty : "") : ""); |
|
|
eorder.put("volume", isFirstRow ? volume : ""); |
|
|
eorder.put("volume", isFirstRow ? volume : ""); |
|
|
eorder.put("gross_weight", isFirstRow ? ((BigDecimal) list.get(m).get("gross_weight")).setScale(2, RoundingMode.HALF_UP) : ""); |
|
|
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")) : ""); |
|
|
(data.getHsCodeFlag()!=null && data.getHsCodeFlag() ? " HS CODE:" + sanitizePdfRenderText(eorder.get("hsCode")) : ""); |
|
|
eorder.put("artNo", artNoContent); |
|
|
eorder.put("artNo", artNoContent); |
|
|
// 计算artNo内容的行数,动态设置行高 |
|
|
// 计算artNo内容的行数,动态设置行高 |
|
|
int lineCount = calculateLineCount(artNoContent, 42); |
|
|
|
|
|
|
|
|
int lineCount = calculateLineCount(artNoContent, 60); |
|
|
// 基础行高16点 + 每额外行增加15点(可根据实际字体大小调整) |
|
|
// 基础行高16点 + 每额外行增加15点(可根据实际字体大小调整) |
|
|
int rowHeight = 16 + (lineCount - 1) * 15; |
|
|
int rowHeight = 16 + (lineCount - 1) * 15; |
|
|
// 设置当前行的行高(exportList的当前索引) |
|
|
// 设置当前行的行高(exportList的当前索引) |
|
|
@ -3158,10 +3162,17 @@ public class CoDelExcelTXServiceImpl implements CoDelExcelTXService { |
|
|
int boxEndIndex = exportList.size() - 1; |
|
|
int boxEndIndex = exportList.size() - 1; |
|
|
if (boxEndIndex >= boxStartIndex) { |
|
|
if (boxEndIndex >= boxStartIndex) { |
|
|
// 箱级字段按箱明细范围合并(一个箱可能有多条箱明细) |
|
|
// 箱级字段按箱明细范围合并(一个箱可能有多条箱明细) |
|
|
// 净重列(倒数第2列,索引7) |
|
|
|
|
|
|
|
|
// 净重列(J列,索引9) |
|
|
template.addMergeRegion(boxStartIndex, boxEndIndex, 9); |
|
|
template.addMergeRegion(boxStartIndex, boxEndIndex, 9); |
|
|
// 毛重列(倒数第1列,索引8) |
|
|
|
|
|
|
|
|
// 毛重列(K列,索引10) |
|
|
template.addMergeRegion(boxStartIndex, boxEndIndex, 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)跨箱合并:一个托盘下多个箱共享同一托盘数 |
|
|
// 托盘数列按托盘(seq_no)跨箱合并:一个托盘下多个箱共享同一托盘数 |
|
|
String nextPalletSeqNo = ""; |
|
|
String nextPalletSeqNo = ""; |
|
|
|