Browse Source

有托:第一列展示托号,按托首行显示后再按托合并,无托:第一列改展示箱号;合箱只在首行写值,避免同一箱号在每条物料行重复

ecss-tx
han\hanst 2 weeks ago
parent
commit
cd3e7b7aa6
  1. 25
      src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelExcelTXServiceImpl.java
  2. 2
      src/main/java/com/xujie/sys/modules/sift/adapter/EcssDeclarationCountAdapter.java
  3. 3
      src/main/resources/mapper/ecss/CoDelMapper.xml

25
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 = "";

2
src/main/java/com/xujie/sys/modules/sift/adapter/EcssDeclarationCountAdapter.java

@ -28,7 +28,9 @@ public class EcssDeclarationCountAdapter extends AbstractMenuUrlQueryAdapter {
Map<String, String> 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"));

3
src/main/resources/mapper/ecss/CoDelMapper.xml

@ -815,6 +815,9 @@ create_by,create_date,update_by,update_date
<if test="query.site != null and query.site != ''">
AND a.site like #{query.site}
</if>
<if test="query.buNo != null and query.buNo != ''">
AND noHeader.bu_no = #{query.buNo}
</if>
<if test = "query.startDate!= null">
AND a.ship_date>= #{query.startDate}

Loading…
Cancel
Save