|
|
@ -2035,33 +2035,15 @@ public class CoDelExcelServiceImpl implements CoDelExcelService { |
|
|
palletList = sqlSession.selectList("ecssMapper.searchEcssCoDelNotifyDetail", data); |
|
|
palletList = sqlSession.selectList("ecssMapper.searchEcssCoDelNotifyDetail", data); |
|
|
} |
|
|
} |
|
|
//计算总数和总箱数 |
|
|
//计算总数和总箱数 |
|
|
int totalQty = 0; |
|
|
|
|
|
int totalBoxQty = 0; |
|
|
|
|
|
|
|
|
BigDecimal totalQty = BigDecimal.ZERO; |
|
|
|
|
|
BigDecimal totalBoxQty = BigDecimal.ZERO; |
|
|
for (Map<String, Object> item : palletList) { |
|
|
for (Map<String, Object> item : palletList) { |
|
|
Object qtyObj = item.get("qty"); |
|
|
Object qtyObj = item.get("qty"); |
|
|
Object boxQtyObj = item.get("boxQty"); |
|
|
Object boxQtyObj = item.get("boxQty"); |
|
|
int qty = 0; |
|
|
|
|
|
int boxQty = 0; |
|
|
|
|
|
if (qtyObj instanceof Number) { |
|
|
|
|
|
qty = ((Number) qtyObj).intValue(); |
|
|
|
|
|
} else if (qtyObj instanceof String) { |
|
|
|
|
|
try { |
|
|
|
|
|
qty = Integer.parseInt((String) qtyObj); |
|
|
|
|
|
} catch (NumberFormatException e) { |
|
|
|
|
|
qty = 0; // 或者根据需求处理异常 |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (boxQtyObj instanceof Number) { |
|
|
|
|
|
boxQty = ((Number) boxQtyObj).intValue(); |
|
|
|
|
|
} else if (boxQtyObj instanceof String) { |
|
|
|
|
|
try { |
|
|
|
|
|
boxQty = Integer.parseInt((String) boxQtyObj); |
|
|
|
|
|
} catch (NumberFormatException e) { |
|
|
|
|
|
boxQty = 0; // 或者根据需求处理异常 |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
totalQty += qty; |
|
|
|
|
|
totalBoxQty += boxQty; |
|
|
|
|
|
|
|
|
BigDecimal qty = parseDecimalValue(qtyObj); |
|
|
|
|
|
BigDecimal boxQty = parseDecimalValue(boxQtyObj); |
|
|
|
|
|
totalQty = totalQty.add(qty); |
|
|
|
|
|
totalBoxQty = totalBoxQty.add(boxQty); |
|
|
item.put("qty", qty); |
|
|
item.put("qty", qty); |
|
|
item.put("boxQty", boxQty); |
|
|
item.put("boxQty", boxQty); |
|
|
} |
|
|
} |
|
|
@ -2084,6 +2066,38 @@ public class CoDelExcelServiceImpl implements CoDelExcelService { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 统一将对象解析为BigDecimal,支持整数/小数/字符串数字(含千分位)。 |
|
|
|
|
|
*/ |
|
|
|
|
|
private BigDecimal parseDecimalValue(Object value) { |
|
|
|
|
|
if (value == null) { |
|
|
|
|
|
return BigDecimal.ZERO; |
|
|
|
|
|
} |
|
|
|
|
|
if (value instanceof BigDecimal) { |
|
|
|
|
|
return (BigDecimal) value; |
|
|
|
|
|
} |
|
|
|
|
|
if (value instanceof Number) { |
|
|
|
|
|
try { |
|
|
|
|
|
return new BigDecimal(value.toString()); |
|
|
|
|
|
} catch (NumberFormatException e) { |
|
|
|
|
|
return BigDecimal.ZERO; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (value instanceof String) { |
|
|
|
|
|
String str = ((String) value).trim(); |
|
|
|
|
|
if (str.isEmpty()) { |
|
|
|
|
|
return BigDecimal.ZERO; |
|
|
|
|
|
} |
|
|
|
|
|
str = str.replace(",", ""); |
|
|
|
|
|
try { |
|
|
|
|
|
return new BigDecimal(str); |
|
|
|
|
|
} catch (NumberFormatException e) { |
|
|
|
|
|
return BigDecimal.ZERO; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return BigDecimal.ZERO; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 导出出口货物委托书 |
|
|
* 导出出口货物委托书 |
|
|
*/ |
|
|
*/ |
|
|
|