diff --git a/src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java b/src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java index f018cb5b..703d103d 100644 --- a/src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java +++ b/src/main/java/com/xujie/sys/modules/ecss/service/impl/CoDelServiceImpl.java @@ -1146,6 +1146,21 @@ public class CoDelServiceImpl implements CoDelService { template.addVar("Currency", "CNY"); template.addVar("Incoterm", "EXW "); template.addVar("shippingMode", notifyHeader.getShippingMode()); + List notifyDetailList =coDelMapper.getNotifyPartDetail(data); + Map notifyDetailMap = notifyDetailList.stream().collect(Collectors.toMap( o -> o.get("partNo"), o -> o)); + // 装箱明细 + List palletDetailList = coDelMapper.exportCoDelPalletDetail(notifyHeader); + Map palletMap = palletDetailList.stream().collect(Collectors.toMap( o -> o.get("part_no"), o -> o)); + // 装箱数据 + List palletHeaderDataList = coDelMapper.searchEcssCoDelPalletHeaderData(notifyHeader);// 总托数 + Integer totalPlt = palletHeaderDataList.get(0).getPalletQty(); + // 关务物料属性 + List propertiesValues = coDelMapper.getPropertiesListByTypeAndCodeNo( + notifyHeader.getSite(), "ECSSPART","BG001",notifyHeader.getBuNo()); + // 每一个物料加属性对应一个属性,用来下面遍历发货通知单明细时获取具体属性值 + Map partNoAndItemNoMap = propertiesValues.stream() + .collect(Collectors.toMap(o -> o.getPartNo() + "$" + o.getPropertiesItemNo(), o -> o)); + Map poNoMap = new HashMap<>(); List detailList = coDelMapper.exportEcssCoDelNotifyDetail(data); Map detailMap = new TreeMap<>(); @@ -1167,13 +1182,31 @@ public class CoDelServiceImpl implements CoDelService { BigDecimal allPrice = BigDecimal.valueOf(0.0); for (int i = 0; i < list.size(); i++) { Map eorder = list.get(i); + String partNo = (String) eorder.get("part_no"); eorder.put("row_num", i + 1); + Map nodifyData = notifyDetailMap.get(partNo); + Map pm = palletMap.get(partNo); + int totalQty = Integer.parseInt(pm.get("total_qty").toString()); + String lossratio = ""; + if (nodifyData!=null && nodifyData.get("lossratio") !=null) { + lossratio = "\n" + (nodifyData.get("ehundred")!=null && StringUtils.isNotEmpty((String) nodifyData.get("ehundred")) + ?"E100-"+nodifyData.get("ehundred"):"") + +" "+"纯FSC纸重量:"+ + fscWeight(partNoAndItemNoMap,partNo, totalQty, (String) nodifyData.get("lossratio")); + } eorder.put("designation", eorder.get("part_description") + "\n" + "PO:" + eorder.get("customerPO") - + " HS Code:" + eorder.get("hsCode")); + + " HS Code:" + eorder.get("hsCode")+ lossratio); 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 (ecHeader.getPackaging()!=null && ecHeader.getPackaging()) { + template.addVar("packaging", "Non-reusable plastic packaging:"); + // 根据维护参数计算出KGS=总托数*plastic packaging维护参数 + template.addVar("KGS_qty", (ecHeader.getKgs().multiply(BigDecimal.valueOf(totalPlt))).setScale(2, RoundingMode.HALF_UP)); + template.addVar("KGS", "KGS"); + } template.addVar("allPrice", allPrice.setScale(2, RoundingMode.HALF_UP)); template.addListVarAll(list); template.render(response.getOutputStream()); diff --git a/src/main/resources/templates/declaration-invoice-template.xlsx b/src/main/resources/templates/declaration-invoice-template.xlsx index 1d5d324d..ea2d31a2 100644 Binary files a/src/main/resources/templates/declaration-invoice-template.xlsx and b/src/main/resources/templates/declaration-invoice-template.xlsx differ