diff --git a/src/main/java/com/xujie/sys/common/utils/ExcelTemplate.java b/src/main/java/com/xujie/sys/common/utils/ExcelTemplate.java index d2b8cb35..816efea6 100644 --- a/src/main/java/com/xujie/sys/common/utils/ExcelTemplate.java +++ b/src/main/java/com/xujie/sys/common/utils/ExcelTemplate.java @@ -157,11 +157,17 @@ public class ExcelTemplate { XSSFDrawing drawing = (XSSFDrawing) part; List shapes = drawing.getShapes(); for (XSSFShape shape : shapes) { - XSSFPicture simpleShape = (XSSFPicture) shape; - ClientAnchor anchor = (ClientAnchor) simpleShape.getAnchor(); - // 调整行坐标实现下移 - anchor.setRow1(anchor.getRow1() + listVariables.size() - 1); - anchor.setRow2(anchor.getRow2() + listVariables.size() - 1); + // 只处理图片类型的形状 + if (shape instanceof XSSFPicture) { + XSSFPicture picture = (XSSFPicture) shape; + // 调整行坐标实现下移 + ClientAnchor anchor = (ClientAnchor) picture.getAnchor(); + if (anchor.getRow1() > 10) { // 只下移位于10行之后的图片 + anchor.setRow1(anchor.getRow1() + listVariables.size() - 1); + anchor.setRow2(anchor.getRow2() + listVariables.size() - 1); + } + + } } } } diff --git a/src/main/java/com/xujie/sys/modules/ecss/entity/EcssPallet.java b/src/main/java/com/xujie/sys/modules/ecss/entity/EcssPallet.java index 11e11d3a..8edb2955 100644 --- a/src/main/java/com/xujie/sys/modules/ecss/entity/EcssPallet.java +++ b/src/main/java/com/xujie/sys/modules/ecss/entity/EcssPallet.java @@ -27,6 +27,7 @@ public class EcssPallet extends QueryPage { private BigDecimal width; private BigDecimal height; private String applicationArea; + private BigDecimal palletWeight; /** * 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 2dd0626e..a88ce23b 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 @@ -1693,6 +1693,13 @@ public class CoDelServiceImpl implements CoDelService { eorder.put("net_weight", ""); eorder.put("weight_unit", ""); } + if (eorder.get("currency") != null) { + String currency = stringInput((String) eorder.get("currency")); + if (currency.toUpperCase().startsWith("RMB")) { + currency = "CNY"; + } + eorder.put("currency", currency); + } eorder.put("hs_code_desc", eorder.get("hs_code_desc")); } template.addListVarAll(detailList); @@ -1769,6 +1776,7 @@ public class CoDelServiceImpl implements CoDelService { template.setCellStyle(true); template.setRangeStyle(true); template.setPriceRight(true); + template.setMoveSeal(true); template.addVar("remark", stringInput(data.getFpremark())); template.addVar("localShipper", notifyHeader.getCustomerName()); template.addVar("localShipAddress", notifyHeader.getLocalShipAddress()); @@ -1778,7 +1786,19 @@ public class CoDelServiceImpl implements CoDelService { template.addVar("cmc_invoice", notifyHeader.getCmcInvoice()); template.addVar("dateStr", DateUtils.format(notifyHeader.getReadyDate(), "yyyy-MM-dd")); List detailList = coDelMapper.exportEcssCoDelNotifyDetail(data); - template.addVar("Currency", detailList.isEmpty()?"CNY":detailList.get(0).get("currency")); + String currency = "CNY"; + if (!detailList.isEmpty()) { + Object cur = detailList.get(0).get("currency"); + if (cur != null) { + String curStr = cur.toString().trim(); + if (curStr.toUpperCase().startsWith("RMB")) { + currency = "CNY"; + } else { + currency = curStr; + } + } + } + template.addVar("Currency", currency); template.addVar("Incoterm", "EXW "); template.addVar("shippingMode", stringInput(notifyHeader.getShippingMode())); Map notifyDetailMap = notifyDetailList.stream().collect( @@ -1872,6 +1892,7 @@ public class CoDelServiceImpl implements CoDelService { Collectors.toMap(EcssCoDelNotifyDetailData::getPartNo,e->e)); template.setCellStyle(true); template.setRangeStyle(true); + template.setMoveSeal(true); if (notifyHeader.getBuNo().equals("03-RFID") || notifyHeader.getBuNo().equals("01-Label")){ template.setCellStyle2(true); } @@ -1965,8 +1986,22 @@ public class CoDelServiceImpl implements CoDelService { 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)); } - // 托盘重量=总托数*维护参数 - BigDecimal palletWeight = data.getPalletWeight()!=null? data.getPalletWeight().multiply(BigDecimal.valueOf(totalPlt)):BigDecimal.valueOf(0.0); + // 托盘重量=根据每个pallet的重量*数量累加 + BigDecimal palletWeight = BigDecimal.ZERO; + for (EcssCoDelPalletHeaderData palletHeader : palletHeaderDataList) { + if (palletHeader.getPallet() != null && !palletHeader.getPallet().isEmpty()) { + // 根据pallet编号查询EcssPallet信息 + List palletDataList = coDelMapper.getPallet(notifyHeader.getSite(), notifyHeader.getBuNo(), palletHeader.getPallet()); + if (!palletDataList.isEmpty()) { + EcssPalletData palletData = palletDataList.get(0); + if (palletData.getPalletWeight() != null && palletHeader.getPalletQty() != null) { + // 栈板重量 = 单个栈板重量 * 数量 + BigDecimal singlePalletWeight = palletData.getPalletWeight().multiply(BigDecimal.valueOf(palletHeader.getPalletQty())); + palletWeight = palletWeight.add(singlePalletWeight); + } + } + } + } template.addVar("Total_Cartons", totalCartons.setScale(0, RoundingMode.HALF_UP)); template.addVar("Gross_Weight", grossWeight.setScale(2, RoundingMode.HALF_UP)); template.addVar("Net_Weight", netWeight.setScale(2, RoundingMode.HALF_UP)); @@ -1978,7 +2013,11 @@ public class CoDelServiceImpl implements CoDelService { // 下面是可选的或者手动维护的 // RFID需要的 if (notifyHeader.getBuNo().equals("01-Label") || notifyHeader.getBuNo().equals("03-RFID")) { - template.addVar("total_plt", totalPlt); + String plt = "CTN"; + if (!palletHeaderDataList.isEmpty()) { + plt = "PLT"; + } + template.addVar("total_plt", totalPlt+plt); template.addVar("total:", "total:"); template.addVar("madein", stringInput(data.getOrigin())); template.addVar("shippingNo", "shipping no"); @@ -2064,7 +2103,11 @@ public class CoDelServiceImpl implements CoDelService { template.addVar("cmc_invoice", stringInput(notifyHeader.getCmcInvoice())); // 导出时默认,可编辑的栏目 template.addVar("sales_method", stringInput(data.getSalesMethod()));//贸易方式 - template.addVar("currency", stringInput(data.getCurrency()));//币制 + String currency = stringInput(data.getCurrency()); + if (currency.toUpperCase().startsWith("RMB")) { + currency = "CNY"; + } + template.addVar("currency", currency);//币制 template.addVar("made_area", stringInput(data.getMadeArea()));//货物产地 template.addVar("send_port", stringInput(data.getSendPort()));//发货港 template.addVar("shipper", stringInput(data.getShipper()));//发货人 @@ -2309,6 +2352,7 @@ public class CoDelServiceImpl implements CoDelService { wholeBoxData.setQty(wholeBoxQty); // 整箱数量 wholeBoxData.setBoxQty(wholeBoxes); wholeBoxData.setRolls(wholeBoxQty.divide(BigDecimal.valueOf(propertiesRollQty.getNumValue()), 4, RoundingMode.HALF_UP)); + wholeBoxData.setNotifyDetailItemNo(detailData.getItemNo()); coDelMapper.saveCodelPalletDetail(wholeBoxData); seqNo++; } @@ -2341,6 +2385,7 @@ public class CoDelServiceImpl implements CoDelService { remainderBoxData.setQty(remainderQty); remainderBoxData.setBoxQty(BigDecimal.ONE); remainderBoxData.setRolls(remainderQty.divide(BigDecimal.valueOf(propertiesRollQty.getNumValue()), 4, RoundingMode.HALF_UP)); + remainderBoxData.setNotifyDetailItemNo(detailData.getItemNo()); coDelMapper.saveCodelPalletDetail(remainderBoxData); seqNo++; } @@ -2373,6 +2418,7 @@ public class CoDelServiceImpl implements CoDelService { palletDetailData.setQty(detailData.getQty()); palletDetailData.setBoxQty(detailData.getQty().divide(eaPerBox, 0, RoundingMode.UP)); palletDetailData.setRolls(detailData.getQty().divide(BigDecimal.valueOf(propertiesRollQty.getNumValue()), 4, RoundingMode.HALF_UP)); + palletDetailData.setNotifyDetailItemNo(detailData.getItemNo()); coDelMapper.saveCodelPalletDetail(palletDetailData); seqNo++; } diff --git a/src/main/resources/mapper/ecss/CoDelMapper.xml b/src/main/resources/mapper/ecss/CoDelMapper.xml index 58caab31..4d58a7bf 100644 --- a/src/main/resources/mapper/ecss/CoDelMapper.xml +++ b/src/main/resources/mapper/ecss/CoDelMapper.xml @@ -621,7 +621,7 @@ left join ecss_CoDelNotifyHeader noHeader on a.site=noHeader.site and a.delNo=no diff --git a/src/main/resources/templates/declaration-all-seal-template.xlsx b/src/main/resources/templates/declaration-all-seal-template.xlsx index 9efcc3ec..a9ab85e0 100644 Binary files a/src/main/resources/templates/declaration-all-seal-template.xlsx and b/src/main/resources/templates/declaration-all-seal-template.xlsx differ diff --git a/src/main/resources/templates/declaration-all-template.xlsx b/src/main/resources/templates/declaration-all-template.xlsx index df831082..ad9e999c 100644 Binary files a/src/main/resources/templates/declaration-all-template.xlsx and b/src/main/resources/templates/declaration-all-template.xlsx differ diff --git a/src/main/resources/templates/declaration-invoice-seal-template.xlsx b/src/main/resources/templates/declaration-invoice-seal-template.xlsx index 4a259a12..eae37bde 100644 Binary files a/src/main/resources/templates/declaration-invoice-seal-template.xlsx and b/src/main/resources/templates/declaration-invoice-seal-template.xlsx differ diff --git a/src/main/resources/templates/declaration-invoice-template.xlsx b/src/main/resources/templates/declaration-invoice-template.xlsx index dea76bbc..6958a77e 100644 Binary files a/src/main/resources/templates/declaration-invoice-template.xlsx and b/src/main/resources/templates/declaration-invoice-template.xlsx differ diff --git a/src/main/resources/templates/declaration-packingList-template.xlsx b/src/main/resources/templates/declaration-packingList-template.xlsx index 6a554584..d271eb15 100644 Binary files a/src/main/resources/templates/declaration-packingList-template.xlsx and b/src/main/resources/templates/declaration-packingList-template.xlsx differ