|
|
@ -3138,14 +3138,8 @@ public class CoDelServiceImpl implements CoDelService { |
|
|
for (int m = 0; m < list.size(); m++) { |
|
|
for (int m = 0; m < list.size(); m++) { |
|
|
boxData.setSeqNo(Integer.valueOf(list.get(m).get("item_no")!=null?list.get(m).get("item_no").toString():"")); |
|
|
boxData.setSeqNo(Integer.valueOf(list.get(m).get("item_no")!=null?list.get(m).get("item_no").toString():"")); |
|
|
List<Map> checkList = coDelMapper.selectPalletDetailList(boxData); |
|
|
List<Map> checkList = coDelMapper.selectPalletDetailList(boxData); |
|
|
int middleIndex; |
|
|
|
|
|
if (checkList.size() == 1) { |
|
|
|
|
|
middleIndex = 0; // 第一行 |
|
|
|
|
|
} else if (checkList.size() == 2) { |
|
|
|
|
|
middleIndex = 0; // 特殊:两行时也是第一行 |
|
|
|
|
|
} else { |
|
|
|
|
|
middleIndex = checkList.size() / 2; // 其他情况按规则 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 记录当前箱子对应的exportList起始索引 |
|
|
|
|
|
int boxStartIndex = exportList.size(); |
|
|
for (int i = 0; i < checkList.size(); i++) { |
|
|
for (int i = 0; i < checkList.size(); i++) { |
|
|
Map eorder = checkList.get(i); |
|
|
Map eorder = checkList.get(i); |
|
|
String partNo = (String) eorder.get("part_no"); |
|
|
String partNo = (String) eorder.get("part_no"); |
|
|
@ -3153,10 +3147,11 @@ public class CoDelServiceImpl implements CoDelService { |
|
|
totalQty = totalQty + qty; |
|
|
totalQty = totalQty + qty; |
|
|
BigDecimal noCartons = list.get(m).get("box_qty")!=null?(BigDecimal) list.get(m).get("box_qty"):BigDecimal.ZERO; |
|
|
BigDecimal noCartons = list.get(m).get("box_qty")!=null?(BigDecimal) list.get(m).get("box_qty"):BigDecimal.ZERO; |
|
|
eorder.put("total_qty", ((BigDecimal)eorder.get("qty")).setScale(0, RoundingMode.HALF_UP).intValue()); |
|
|
eorder.put("total_qty", ((BigDecimal)eorder.get("qty")).setScale(0, RoundingMode.HALF_UP).intValue()); |
|
|
boolean isMiddleRow = (i == middleIndex); |
|
|
|
|
|
eorder.put("noCartons", isMiddleRow ? noCartons.setScale(0, RoundingMode.HALF_UP) : ""); |
|
|
|
|
|
eorder.put("gross_weight", isMiddleRow ? ((BigDecimal) list.get(m).get("gross_weight")).setScale(2, RoundingMode.HALF_UP) : ""); |
|
|
|
|
|
eorder.put("net_weight", isMiddleRow ? ((BigDecimal) list.get(m).get("net_weight")).setScale(2, RoundingMode.HALF_UP) : ""); |
|
|
|
|
|
|
|
|
// 合箱时:第一行显示数值,用于合并单元格居中显示 |
|
|
|
|
|
boolean isFirstRow = (i == 0); |
|
|
|
|
|
eorder.put("noCartons", isFirstRow ? noCartons.setScale(0, RoundingMode.HALF_UP) : ""); |
|
|
|
|
|
eorder.put("gross_weight", isFirstRow ? ((BigDecimal) list.get(m).get("gross_weight")).setScale(2, RoundingMode.HALF_UP) : ""); |
|
|
|
|
|
eorder.put("net_weight", isFirstRow ? ((BigDecimal) list.get(m).get("net_weight")).setScale(2, RoundingMode.HALF_UP) : ""); |
|
|
BigDecimal cuRolls = eorder.get("rolls") !=null?((BigDecimal)eorder.get("rolls")).setScale(0, RoundingMode.HALF_UP):BigDecimal.valueOf(0.0); |
|
|
BigDecimal cuRolls = eorder.get("rolls") !=null?((BigDecimal)eorder.get("rolls")).setScale(0, RoundingMode.HALF_UP):BigDecimal.valueOf(0.0); |
|
|
eorder.put("rolls", cuRolls); |
|
|
eorder.put("rolls", cuRolls); |
|
|
rolls = rolls.add(cuRolls); |
|
|
rolls = rolls.add(cuRolls); |
|
|
@ -3185,6 +3180,16 @@ public class CoDelServiceImpl implements CoDelService { |
|
|
+ (data.getSo()!=null && data.getSo()?"\n" + "SO:"+eorder.get("so"):"")); |
|
|
+ (data.getSo()!=null && data.getSo()?"\n" + "SO:"+eorder.get("so"):"")); |
|
|
exportList.add(eorder); |
|
|
exportList.add(eorder); |
|
|
} |
|
|
} |
|
|
|
|
|
// 如果当前箱子对应多个物料(合箱),添加合并单元格区域 |
|
|
|
|
|
int boxEndIndex = exportList.size() - 1; |
|
|
|
|
|
if (checkList.size() > 1) { |
|
|
|
|
|
// 合并箱数列(第4列,索引4) |
|
|
|
|
|
template.addMergeRegion(boxStartIndex, boxEndIndex, 4); |
|
|
|
|
|
// 合并净重列(第6列,索引6) |
|
|
|
|
|
template.addMergeRegion(boxStartIndex, boxEndIndex, 6); |
|
|
|
|
|
// 合并毛重列(第7列,索引7) |
|
|
|
|
|
template.addMergeRegion(boxStartIndex, boxEndIndex, 7); |
|
|
|
|
|
} |
|
|
totalCartons = totalCartons.add(list.get(m).get("box_qty") !=null? new BigDecimal(list.get(m).get("box_qty").toString()) : BigDecimal.valueOf(0.0)); |
|
|
totalCartons = totalCartons.add(list.get(m).get("box_qty") !=null? new BigDecimal(list.get(m).get("box_qty").toString()) : BigDecimal.valueOf(0.0)); |
|
|
grossWeight = grossWeight.add(list.get(m).get("gross_weight") !=null?new BigDecimal(list.get(m).get("gross_weight").toString()):BigDecimal.valueOf(0.0)); |
|
|
grossWeight = grossWeight.add(list.get(m).get("gross_weight") !=null?new BigDecimal(list.get(m).get("gross_weight").toString()):BigDecimal.valueOf(0.0)); |
|
|
netWeight = netWeight.add(list.get(m).get("net_weight") !=null?new BigDecimal(list.get(m).get("net_weight").toString()):BigDecimal.valueOf(0.0)); |
|
|
netWeight = netWeight.add(list.get(m).get("net_weight") !=null?new BigDecimal(list.get(m).get("net_weight").toString()):BigDecimal.valueOf(0.0)); |
|
|
|