|
|
|
@ -1596,7 +1596,6 @@ public class CoDelServiceImpl implements CoDelService { |
|
|
|
} |
|
|
|
// 装箱数据 |
|
|
|
List<EcssCoDelPalletHeaderData> palletHeaderDataList = coDelMapper.searchEcssCoDelPalletHeaderData(notifyHeaderData); |
|
|
|
List<Map> palletDetailList = coDelMapper.exportCoDelPalletDetail(notifyHeaderData); |
|
|
|
Integer totalPlt = palletHeaderDataList.stream() |
|
|
|
.map(EcssCoDelPalletHeaderData::getPalletQty) |
|
|
|
.filter(Objects::nonNull) // 防止空指针 |
|
|
|
@ -1816,6 +1815,10 @@ public class CoDelServiceImpl implements CoDelService { |
|
|
|
// RFID和RF不需要po,合同带印章(declaration-invoice-seal-template.xlsx),发票号不带章declaration-invoice-template.xlsx |
|
|
|
String xlsx = notifyHeader.getBuNo().equals("04-MHM") || notifyHeader.getBuNo().equals("02-Hardtag")? |
|
|
|
"templates/declaration-invoice2-template.xlsx":"templates/declaration-invoice-template.xlsx"; |
|
|
|
if (data.getShowWeight()!=null && data.getShowWeight()) { |
|
|
|
xlsx = "templates/declaration-invoice-showWeight-template.xlsx"; |
|
|
|
|
|
|
|
} |
|
|
|
ExcelTemplate template = ExcelTemplate.load(new ClassPathResource(xlsx).getInputStream()); |
|
|
|
extractedInvoice(data, template, notifyHeader); |
|
|
|
try (XSSFWorkbook workbook = template.render(0)) { |
|
|
|
@ -1973,6 +1976,10 @@ public class CoDelServiceImpl implements CoDelService { |
|
|
|
// 硬标天线需要po(declaration-all2-template.xlsx),且多一个合同sheet |
|
|
|
xlsx = "templates/declaration-all2-template.xlsx"; |
|
|
|
} |
|
|
|
if (data.getShowWeight()!=null && data.getShowWeight()) { |
|
|
|
xlsx = "templates/declaration-all-showWeight-template.xlsx"; |
|
|
|
|
|
|
|
} |
|
|
|
XSSFWorkbook workbook = null; |
|
|
|
try { |
|
|
|
ExcelTemplate template = ExcelTemplate.load(new ClassPathResource(xlsx).getInputStream()); |
|
|
|
@ -2036,14 +2043,11 @@ public class CoDelServiceImpl implements CoDelService { |
|
|
|
EcssCoDelNotifyHeaderData notifyHeader = coDelMapper.getEcssCoDelNotifyHeader(data.getSite(), data.getDelNo()); |
|
|
|
// RFID和RF和硬标天线使用的模版不一样 |
|
|
|
// RFID和RF如果勾选了合同,导出需要带公章(declaration-all-seal-template.xlsx) |
|
|
|
String xlsx; |
|
|
|
if (notifyHeader.getBuNo().equals("03-RFID") || notifyHeader.getBuNo().equals("01-Label")) { |
|
|
|
xlsx = "templates/declaration-all-template-pdf.xlsx"; |
|
|
|
} else { |
|
|
|
// 硬标天线需要po(declaration-all2-template.xlsx),且多一个合同sheet |
|
|
|
xlsx = "templates/declaration-all2-template.xlsx"; |
|
|
|
} |
|
|
|
String xlsx = "templates/declaration-all-template-pdf.xlsx"; |
|
|
|
if (data.getShowWeight()!=null && data.getShowWeight()) { |
|
|
|
xlsx = "templates/declaration-all-showWeight-template-pdf.xlsx"; |
|
|
|
|
|
|
|
} |
|
|
|
XSSFWorkbook excelWorkbook = null; |
|
|
|
try { |
|
|
|
ExcelTemplate template = ExcelTemplate.load(new ClassPathResource(xlsx).getInputStream()); |
|
|
|
@ -2387,6 +2391,13 @@ public class CoDelServiceImpl implements CoDelService { |
|
|
|
eorder.put("totalPrice", (((BigDecimal) eorder.get("qty")).multiply((BigDecimal) eorder.get("unitPrice"))). |
|
|
|
setScale(2, RoundingMode.HALF_UP)); |
|
|
|
allPrice = allPrice.add(((BigDecimal) eorder.get("qty")).multiply((BigDecimal) eorder.get("unitPrice"))); |
|
|
|
if (data.getShowWeight()!=null && data.getShowWeight()) { |
|
|
|
// 根据发货通知单明细查找装箱明细,获取重量和净重,保留2位小数 |
|
|
|
eorder.put("grossWeight", pm != null && pm.get("gross_weight") != null ? |
|
|
|
new BigDecimal(pm.get("gross_weight").toString()).setScale(2, RoundingMode.HALF_UP) : ""); |
|
|
|
eorder.put("netWeight", pm != null && pm.get("net_weight") != null ? |
|
|
|
new BigDecimal(pm.get("net_weight").toString()).setScale(2, RoundingMode.HALF_UP) : ""); |
|
|
|
} |
|
|
|
} |
|
|
|
// RFID需要的 |
|
|
|
if (notifyHeader.getBuNo().equals("01-Label") || notifyHeader.getBuNo().equals("03-RFID")) { |
|
|
|
@ -2669,18 +2680,6 @@ public class CoDelServiceImpl implements CoDelService { |
|
|
|
template.addVar("hs_code", stringInput(hsCodes)); |
|
|
|
Map<Object, Object> poNoMap = new HashMap<>(); |
|
|
|
BigDecimal ttlAmount = BigDecimal.ZERO; |
|
|
|
BigDecimal grossWeight = BigDecimal.valueOf(0.0); |
|
|
|
BigDecimal netWeight = BigDecimal.valueOf(0.0); |
|
|
|
for (Map map : nodifyDetailList) { |
|
|
|
String partNo = (String) map.get("part_no"); |
|
|
|
poNoMap.put(map.get("customerPO"), map.get("customerPO")); |
|
|
|
ttlAmount = ttlAmount.add((BigDecimal) map.get("ttl_amount")); |
|
|
|
Map pm = palletMap.get(partNo); |
|
|
|
if (pm != null && !pm.isEmpty()) { |
|
|
|
grossWeight = grossWeight.add((BigDecimal) pm.get("gross_weight")); |
|
|
|
netWeight = netWeight.add((BigDecimal) pm.get("net_weight")); |
|
|
|
} |
|
|
|
} |
|
|
|
StringBuilder ponos = new StringBuilder(); |
|
|
|
poNoMap.forEach((key, value) -> ponos.append(key).append("\n")); |
|
|
|
template.addVar("poNo", ponos); |
|
|
|
@ -2716,9 +2715,6 @@ public class CoDelServiceImpl implements CoDelService { |
|
|
|
|
|
|
|
template.addVar("price", ttlAmount.setScale(2, RoundingMode.HALF_UP)); |
|
|
|
template.addVar("total_qty", totalQty); |
|
|
|
//BigDecimal grossWeight = ecHeader.getGrossWeight() != null ? ecHeader.getGrossWeight() : BigDecimal.ZERO; |
|
|
|
//template.addVar("grossWeight", (grossWeight.add(palletWeight)).setScale(2, RoundingMode.HALF_UP)); |
|
|
|
//template.addVar("netWeight", ecHeader.getNetWeight() != null ? ecHeader.getNetWeight().setScale(2, RoundingMode.HALF_UP) : ""); |
|
|
|
// 托盘重量=根据每个pallet的重量*数量累加 |
|
|
|
BigDecimal palletWeight = BigDecimal.ZERO; |
|
|
|
for (EcssCoDelPalletHeaderData palletHeader : palletHeaderDataList) { |
|
|
|
|