diff --git a/src/main/java/com/xujie/sys/modules/ecss/mapper/CoDelMapper.java b/src/main/java/com/xujie/sys/modules/ecss/mapper/CoDelMapper.java index 71237462..e372dc3d 100644 --- a/src/main/java/com/xujie/sys/modules/ecss/mapper/CoDelMapper.java +++ b/src/main/java/com/xujie/sys/modules/ecss/mapper/CoDelMapper.java @@ -185,7 +185,7 @@ public interface CoDelMapper { List getNotifyDetailGroup(EcssDeclarationHeaderData data); List getPropertiesListByTypeAndCodeNo(@Param("site") String site,@Param("recordType") String recordType, - @Param("codeNo") String codeNo,@Param("buNo") String buNo); + @Param("codeNo") String codeNo,@Param("buNo") String buNo,@Param("pn") String pn); List getEcssContacts(@Param("buNo") String buNo); 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 833285d6..0b491dd4 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 @@ -17,7 +17,6 @@ import com.xujie.sys.modules.part.entity.*; import com.xujie.sys.modules.part.mapper.PartInformationMapper; import com.xujie.sys.modules.pms.data.MailSendAddressData; import com.xujie.sys.modules.pms.data.SendMailRecord; -import com.xujie.sys.modules.pms.mapper.EamMapper; import com.xujie.sys.modules.pms.mapper.QcMapper; import com.xujie.sys.modules.sys.entity.SysUserEntity; import lombok.extern.slf4j.Slf4j; @@ -34,13 +33,10 @@ import org.apache.shiro.SecurityUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.io.ClassPathResource; -import org.springframework.mail.javamail.JavaMailSenderImpl; -import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; -import javax.mail.internet.MimeMessage; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.InputStream; @@ -892,9 +888,6 @@ public class CoDelServiceImpl implements CoDelService { } } } - // 关务物料属性 - List propertiesValues = coDelMapper.getPropertiesListByTypeAndCodeNo( - inData.getSite(), "ECSSPART","BG001",inData.getBuNo()); EcssWalMartOrder task = new EcssWalMartOrder(); List headerList = new ArrayList<>(); List detailList = new ArrayList<>(); @@ -938,12 +931,14 @@ public class CoDelServiceImpl implements CoDelService { detailData.setBoxQty(thisData.getBoxQty()); } else { String partNo = thisData.getPartNo(); + // 关务物料属性 + List propertiesValues = coDelMapper.getPropertiesListByTypeAndCodeNo( + inData.getSite(), "ECSSPART","BG001",inData.getBuNo(),partNo); // 每一个物料加属性对应一个属性,用来下面遍历发货通知单明细时获取具体属性值 - Map partNoAndItemNoMap = propertiesValues.stream() - .collect(Collectors.toMap(o -> o.getPartNo() + "$" + o.getPropertiesItemNo(), o -> o)); - PartSubPropertiesValueData propertiesRollQty = partNoAndItemNoMap.get(partNo + "$ROLLQTY");//每卷数量 - PartSubPropertiesValueData propertiesBoxRolls = partNoAndItemNoMap.get(partNo + "$BOXROLLS");//每箱卷数 - //PartSubPropertiesValueData propertiesBoxWeight = partNoAndItemNoMap.get(partNo + "$BOXWEIGHT");//箱重量 + Map> partNoAndItemNoMap = propertiesValues.stream() + .collect(Collectors.groupingBy(PartSubPropertiesValue::getPropertiesItemNo)); + PartSubPropertiesValueData propertiesRollQty = partNoAndItemNoMap.get("ROLLQTY")==null? null:partNoAndItemNoMap.get("ROLLQTY").get(0);//每卷数量 + PartSubPropertiesValueData propertiesBoxRolls = partNoAndItemNoMap.get("BOXROLLS")==null? null:partNoAndItemNoMap.get("BOXROLLS").get(0);//每箱卷数 if (propertiesRollQty==null||propertiesBoxRolls==null) { throw new RuntimeException("请先维护物料["+detailData.getPn()+"]的每卷数量和每箱卷数!"); } @@ -1087,13 +1082,13 @@ public class CoDelServiceImpl implements CoDelService { String partNo = partPackageMap.get(packageData.get().getPackageNo()).toString(); // 关务物料属性 List propertiesValues = coDelMapper.getPropertiesListByTypeAndCodeNo( - inData.getSite(), "ECSSPART","BG001",inData.getBuNo()); + inData.getSite(), "ECSSPART","BG001",inData.getBuNo(), partNo); // 每一个物料加属性对应一个属性,用来下面遍历发货通知单明细时获取具体属性值 - Map partNoAndItemNoMap = propertiesValues.stream() - .collect(Collectors.toMap(o -> o.getPartNo() + "$" + o.getPropertiesItemNo(), o -> o)); - PartSubPropertiesValueData propertiesRollQty = partNoAndItemNoMap.get(partNo + "$ROLLQTY");//每卷数量 - PartSubPropertiesValueData propertiesBoxRolls = partNoAndItemNoMap.get(partNo + "$BOXROLLS");//每箱卷数 - PartSubPropertiesValueData propertiesBoxWeight = partNoAndItemNoMap.get(partNo + "$BOXWEIGHT");//箱重量 + Map> partNoAndItemNoMap = propertiesValues.stream() + .collect(Collectors.groupingBy(PartSubPropertiesValue::getPropertiesItemNo)); + PartSubPropertiesValueData propertiesRollQty = partNoAndItemNoMap.get("ROLLQTY")==null?null:partNoAndItemNoMap.get("ROLLQTY").get(0);//每卷数量 + PartSubPropertiesValueData propertiesBoxRolls = partNoAndItemNoMap.get("BOXROLLS")==null?null:partNoAndItemNoMap.get("BOXROLLS").get(0);//每箱卷数 + PartSubPropertiesValueData propertiesBoxWeight = partNoAndItemNoMap.get("BOXWEIGHT")==null?null:partNoAndItemNoMap.get("BOXWEIGHT").get(0);//箱重量 if (propertiesRollQty==null||propertiesBoxRolls==null||propertiesBoxWeight==null) { throw new RuntimeException("请先维护物料["+partNo+"]基本信息!"); } @@ -1393,7 +1388,9 @@ public class CoDelServiceImpl implements CoDelService { response.setHeader("Content-Disposition", "attachment; filename=\"报关要素.xlsx\""); response.flushBuffer(); } catch (Exception e) { + log.error("导出报关要素异常{}", e.getMessage()); e.printStackTrace(); + throw new RuntimeException("报关导出异常:"+e.getMessage()); } } /** @@ -1411,7 +1408,9 @@ public class CoDelServiceImpl implements CoDelService { response.setHeader("Content-Disposition", "attachment; filename=\"报关单.xlsx\""); response.flushBuffer(); } catch (Exception e) { + log.error("导出报关单异常{}", e.getMessage()); e.printStackTrace(); + throw new RuntimeException("报关导出异常:"+e.getMessage()); } } @@ -1444,7 +1443,9 @@ public class CoDelServiceImpl implements CoDelService { response.setHeader("Content-Disposition", "attachment; filename=\"发票.xlsx\""); response.flushBuffer(); } catch (Exception e) { + log.error("报关导出发票异常:{}", e.getMessage()); e.printStackTrace(); + throw new RuntimeException("报关导出异常:"+e.getMessage()); } } /** @@ -1466,7 +1467,9 @@ public class CoDelServiceImpl implements CoDelService { response.setHeader("Content-Disposition", "attachment; filename=\"箱单.xlsx\""); response.flushBuffer(); } catch (Exception e) { + log.error("报关导出箱单异常:{}", e.getMessage()); e.printStackTrace(); + throw new RuntimeException("报关导出异常:"+e.getMessage()); } } @@ -1485,7 +1488,9 @@ public class CoDelServiceImpl implements CoDelService { response.setHeader("Content-Disposition", "attachment; filename=\"出口货物委托书.xlsx\""); response.flushBuffer(); } catch (Exception e) { + log.error("报关导出出口货物委托书异常:{}", e.getMessage()); e.printStackTrace(); + throw new RuntimeException("报关导出异常:"+e.getMessage()); } } @@ -1504,7 +1509,9 @@ public class CoDelServiceImpl implements CoDelService { response.setHeader("Content-Disposition", "attachment; filename=\"合同.xlsx\""); response.flushBuffer(); } catch (Exception e) { + log.error("报关导出合同异常:{}", e.getMessage()); e.printStackTrace(); + throw new RuntimeException("报关导出异常:"+e.getMessage()); } } @@ -1556,12 +1563,15 @@ public class CoDelServiceImpl implements CoDelService { response.setHeader("Content-Disposition", "attachment; filename=\"单证信息.xlsx\""); response.flushBuffer(); } catch (IOException e) { + log.error("报关导出所有异常:{}", e.getMessage()); e.printStackTrace(); + throw new RuntimeException("报关导出异常:"+e.getMessage()); } finally { if (workbook != null) { try { workbook.close(); // 显式关闭资源 } catch (IOException e) { + log.error("关闭资源异常{}", e.getMessage()); e.printStackTrace(); } } @@ -1711,13 +1721,6 @@ public class CoDelServiceImpl implements CoDelService { throw new RuntimeException("没有装箱数据"); }*/ int totalPlt = palletHeaderDataList.isEmpty()?0: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<>(); @@ -1746,6 +1749,12 @@ public class CoDelServiceImpl implements CoDelService { int totalQty = pm!=null && pm.get("total_qty")!=null?Integer.parseInt(pm.get("total_qty").toString()):0; String lossratio = ""; if (nodifyData!=null && nodifyData.getLossratio()!=null && !StringUtils.isBlank(nodifyData.getLossratio())) { + // 关务物料属性 + List propertiesValues = coDelMapper.getPropertiesListByTypeAndCodeNo( + notifyHeader.getSite(), "ECSSPART","BG001", notifyHeader.getBuNo(), partNo); + // 每一个物料加属性对应一个属性,用来下面遍历发货通知单明细时获取具体属性值 + Map> partNoAndItemNoMap = propertiesValues.stream() + .collect(Collectors.groupingBy(PartSubPropertiesValue::getPropertiesItemNo)); lossratio = "\n" + (nodifyData.getEhundred()!=null && StringUtils.isNotEmpty(nodifyData.getEhundred()) ?"E100-"+nodifyData.getEhundred():"") +" "+"纯FSC纸重量:"+ @@ -1813,12 +1822,6 @@ public class CoDelServiceImpl implements CoDelService { template.addVar("dateStr", DateUtils.format(notifyHeader.getReadyDate(), "yyyy-MM-dd")); template.addVar("cmc_invoice", notifyHeader.getCmcInvoice()); Map poNoMap = new HashMap<>(); - // 关务物料属性 - List propertiesValues = coDelMapper.getPropertiesListByTypeAndCodeNo( - notifyHeader.getSite(), "ECSSPART","BG001",notifyHeader.getBuNo()); - // 每一个物料加属性对应一个属性,用来下面遍历发货通知单明细时获取具体属性值 - Map partNoAndItemNoMap = propertiesValues.stream() - .collect(Collectors.toMap(o -> o.getPartNo() + "$" + o.getPropertiesItemNo(), o -> o)); // 装箱数据 List palletHeaderDataList = coDelMapper.searchEcssCoDelPalletHeaderData(notifyHeader); if (palletHeaderDataList.isEmpty()) { @@ -1891,6 +1894,12 @@ public class CoDelServiceImpl implements CoDelService { // 只有RFID需要 String lossratio=""; if (notifyHeader.getBuNo().equals("03-RFID") && nodifyData!=null && StringUtils.isNotEmpty(nodifyData.getLossratio())) { + // 关务物料属性 + List propertiesValues = coDelMapper.getPropertiesListByTypeAndCodeNo( + notifyHeader.getSite(), "ECSSPART","BG001",notifyHeader.getBuNo(), partNo); + // 每一个物料加属性对应一个属性,用来下面遍历发货通知单明细时获取具体属性值 + Map> partNoAndItemNoMap = propertiesValues.stream() + .collect(Collectors.groupingBy(PartSubPropertiesValue::getPropertiesItemNo)); lossratio = "\n" + (StringUtils.isNotEmpty(nodifyData.getEhundred())?"E100-"+nodifyData.getEhundred():"") +" "+"纯FSC纸重量:"+ fscWeight(partNoAndItemNoMap,partNo, totalQty, nodifyData.getLossratio()); @@ -1981,25 +1990,23 @@ public class CoDelServiceImpl implements CoDelService { template.addVar("hs_code_desc", stringInput(data.getHsCodeDescType()!=null&& data.getHsCodeDescType().equals("N")? nodifyDetailList.get(0).get("hsCodeDescEn").toString():nodifyDetailList.get(0).get("hsCodeDesc").toString())); template.addVar("hs_code", stringInput(nodifyDetailList.get(0).get("hsCode").toString())); - StringBuilder poNos = new StringBuilder(); + Map poNoMap = new HashMap<>(); BigDecimal ttlAmount = BigDecimal.ZERO; BigDecimal grossWeight = BigDecimal.valueOf(0.0); BigDecimal netWeight = BigDecimal.valueOf(0.0); - for (int i = 0; i < nodifyDetailList.size(); i++) { - String partNo = (String) nodifyDetailList.get(i).get("part_no"); - if (i == nodifyDetailList.size() - 1) { - poNos.append(nodifyDetailList.get(i).get("customerPO")); - } else { - poNos.append(nodifyDetailList.get(i).get("customerPO")).append("\n"); - } - ttlAmount = ttlAmount.add((BigDecimal) nodifyDetailList.get(i).get("ttl_amount")); + 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()) { + if (pm != null && !pm.isEmpty()) { grossWeight = grossWeight.add((BigDecimal) pm.get("gross_weight")); netWeight = netWeight.add((BigDecimal) pm.get("net_weight")); } } - template.addVar("poNo", poNos); + StringBuilder ponos = new StringBuilder(); + poNoMap.forEach((key, value) -> ponos.append(key).append("\n")); + template.addVar("poNo", ponos); template.addVar("shipping_port", stringInput(notifyHeader.getCnative())); template.addVar("cmc_invoice", stringInput(notifyHeader.getCmcInvoice())); // 导出时默认,可编辑的栏目 @@ -2069,40 +2076,40 @@ public class CoDelServiceImpl implements CoDelService { /** * 计算FSC纸重量 */ - private BigDecimal fscWeight(Map partNoAndItemNoMap, String partNo, + private BigDecimal fscWeight(Map> partNoAndItemNoMap, String partNo, int totalQty, String lossratio) { - PartSubPropertiesValueData FSC001 = partNoAndItemNoMap.get(partNo + "$FSC001");//P距 - PartSubPropertiesValueData FSC002 = partNoAndItemNoMap.get(partNo + "$FSC002");//排数 - PartSubPropertiesValueData FSC003 = partNoAndItemNoMap.get(partNo + "$FSC003");//1米标签面积 - PartSubPropertiesValueData FSC004 = partNoAndItemNoMap.get(partNo + "$FSC004");//底纸宽度 - PartSubPropertiesValueData FSC005 = partNoAndItemNoMap.get(partNo + "$FSC005");//BOM分配张数 - PartSubPropertiesValueData FSC0012 = partNoAndItemNoMap.get(partNo + "$FSC001-02");//P距 - PartSubPropertiesValueData FSC0022 = partNoAndItemNoMap.get(partNo + "$FSC002-02");//排数 - PartSubPropertiesValueData FSC0032 = partNoAndItemNoMap.get(partNo + "$FSC003-02");//1米标签面积 - PartSubPropertiesValueData FSC0042 = partNoAndItemNoMap.get(partNo + "$FSC004-02");//底纸宽度 - PartSubPropertiesValueData FSC0052 = partNoAndItemNoMap.get(partNo + "$FSC005-02");//BOM分配张数 + PartSubPropertiesValueData FSC001 = partNoAndItemNoMap.get("FSC001")==null?null:partNoAndItemNoMap.get("FSC001").get(0);//P距 + PartSubPropertiesValueData FSC002 = partNoAndItemNoMap.get("FSC002")==null?null:partNoAndItemNoMap.get("FSC002").get(0);//排数 + PartSubPropertiesValueData FSC003 = partNoAndItemNoMap.get("FSC003")==null?null:partNoAndItemNoMap.get("FSC003").get(0);//1米标签面积 + PartSubPropertiesValueData FSC004 = partNoAndItemNoMap.get("FSC004")==null?null:partNoAndItemNoMap.get("FSC004").get(0);//底纸宽度 + PartSubPropertiesValueData FSC005 = partNoAndItemNoMap.get("FSC005")==null?null:partNoAndItemNoMap.get("FSC005").get(0);//BOM分配张数 + PartSubPropertiesValueData FSC0012 = partNoAndItemNoMap.get("FSC001-02")==null?null:partNoAndItemNoMap.get("FSC001-02").get(0);//P距 + PartSubPropertiesValueData FSC0022 = partNoAndItemNoMap.get("FSC002-02")==null?null:partNoAndItemNoMap.get("FSC002-02").get(0);//排数 + PartSubPropertiesValueData FSC0032 = partNoAndItemNoMap.get("FSC003-02")==null?null:partNoAndItemNoMap.get("FSC003-02").get(0);//1米标签面积 + PartSubPropertiesValueData FSC0042 = partNoAndItemNoMap.get("FSC004-02")==null?null:partNoAndItemNoMap.get("FSC004-02").get(0);//底纸宽度 + PartSubPropertiesValueData FSC0052 = partNoAndItemNoMap.get("FSC005-02")==null?null:partNoAndItemNoMap.get("FSC005-02").get(0);//BOM分配张数 BigDecimal fscWeight = BigDecimal.valueOf(0); BigDecimal fscWeight2 = BigDecimal.valueOf(0); // 千张理论用量(M)=((BOM分配张数/排数)*P距)/1000 if (FSC001!=null && FSC002!=null && FSC003!=null && FSC004!=null && FSC005!=null) { - BigDecimal bom = BigDecimal.valueOf(FSC005.getNumValue()); - BigDecimal row = BigDecimal.valueOf(FSC002.getNumValue()); - BigDecimal area = BigDecimal.valueOf(FSC003.getNumValue()); - BigDecimal width = BigDecimal.valueOf(FSC004.getNumValue()); - BigDecimal pju = BigDecimal.valueOf(FSC001.getNumValue()); - if (FSC005.getNumValue()!=0 && FSC001.getNumValue()!=0 && FSC003.getNumValue()!=0 - && FSC004.getNumValue()!=0 && FSC002.getNumValue()!=0) { + BigDecimal bom = FSC005.getNumValue()!=null?BigDecimal.valueOf(FSC005.getNumValue()):BigDecimal.ZERO; + BigDecimal row = FSC002.getNumValue()!=null?BigDecimal.valueOf(FSC002.getNumValue()):BigDecimal.ZERO; + BigDecimal area = FSC003.getNumValue()!=null?BigDecimal.valueOf(FSC003.getNumValue()):BigDecimal.ZERO; + BigDecimal width = FSC004.getNumValue()!=null?BigDecimal.valueOf(FSC004.getNumValue()):BigDecimal.ZERO; + BigDecimal pju = FSC001.getNumValue()!=null?BigDecimal.valueOf(FSC001.getNumValue()):BigDecimal.ZERO; + if (bom.compareTo(BigDecimal.ZERO)!=0 && row.compareTo(BigDecimal.ZERO)!=0 && area.compareTo(BigDecimal.ZERO)!=0 + && width.compareTo(BigDecimal.ZERO)!=0 && pju.compareTo(BigDecimal.ZERO)!=0) { fscWeight = getFSC(totalQty, lossratio, bom, row, area, width, pju); } } if (FSC0012!=null && FSC0022!=null && FSC0032!=null && FSC0042!=null && FSC0052!=null) { - BigDecimal bom = BigDecimal.valueOf(FSC0052.getNumValue()); - BigDecimal row = BigDecimal.valueOf(FSC0022.getNumValue()); - BigDecimal area = BigDecimal.valueOf(FSC0032.getNumValue()); - BigDecimal width = BigDecimal.valueOf(FSC0042.getNumValue()); - BigDecimal pju = BigDecimal.valueOf(FSC0012.getNumValue()); - if (FSC0052.getNumValue()!=0 && FSC0012.getNumValue()!=0 && FSC0032.getNumValue()!=0 - && FSC0042.getNumValue()!=0 && FSC0022.getNumValue()!=0) { + BigDecimal bom = FSC0052.getNumValue()!=null?BigDecimal.valueOf(FSC0052.getNumValue()):BigDecimal.ZERO; + BigDecimal row = FSC0022.getNumValue()!=null?BigDecimal.valueOf(FSC0022.getNumValue()):BigDecimal.ZERO; + BigDecimal area = FSC0032.getNumValue()!=null?BigDecimal.valueOf(FSC0032.getNumValue()):BigDecimal.ZERO; + BigDecimal width = FSC0042.getNumValue()!=null?BigDecimal.valueOf(FSC0042.getNumValue()):BigDecimal.ZERO; + BigDecimal pju = FSC0012.getNumValue()!=null?BigDecimal.valueOf(FSC0012.getNumValue()):BigDecimal.ZERO; + if (bom.compareTo(BigDecimal.ZERO)!=0 && row.compareTo(BigDecimal.ZERO)!=0 && area.compareTo(BigDecimal.ZERO)!=0 + && width.compareTo(BigDecimal.ZERO)!=0 && pju.compareTo(BigDecimal.ZERO)!=0) { fscWeight2 = getFSC(totalQty, lossratio, bom, row, area, width, pju); } } @@ -2146,12 +2153,6 @@ public class CoDelServiceImpl implements CoDelService { palletData = palletDataList.get(0); } List ecssCoDelNotifyDetail = coDelMapper.searchEcssCoDelNotifyDetail(notifyHeader); - // 关务物料属性 - 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 palletItemMap = new HashMap<>(); Map> palletListMap = new HashMap<>(); //int totalQty = 0; @@ -2175,10 +2176,16 @@ public class CoDelServiceImpl implements CoDelService { int seqNo = coDelMapper.getCoDelPalletHeaderSeqNo(inData); StringBuilder partNos = new StringBuilder(); for (String partNo : palletItemMap.keySet()) { + // 关务物料属性 + List propertiesValues = coDelMapper.getPropertiesListByTypeAndCodeNo( + notifyHeader.getSite(), "ECSSPART","BG001",notifyHeader.getBuNo(), partNo); + // 每一个物料加属性对应一个属性,用来下面遍历发货通知单明细时获取具体属性值 + Map> partNoAndItemNoMap = propertiesValues.stream() + .collect(Collectors.groupingBy(PartSubPropertiesValue::getPropertiesItemNo)); List partList = coDelMapper.getPartInfo(inData.getSite(),partNo); - PartSubPropertiesValueData propertiesRollQty = partNoAndItemNoMap.get(partNo + "$ROLLQTY");//每卷数量 - PartSubPropertiesValueData propertiesBoxRolls = partNoAndItemNoMap.get(partNo + "$BOXROLLS");//每箱卷数 - PartSubPropertiesValueData propertiesBoxWeight = partNoAndItemNoMap.get(partNo + "$BOXWEIGHT");//箱重量 + PartSubPropertiesValueData propertiesRollQty = partNoAndItemNoMap.get("ROLLQTY")==null ? null : partNoAndItemNoMap.get("ROLLQTY").get(0);//每卷数量 + PartSubPropertiesValueData propertiesBoxRolls = partNoAndItemNoMap.get("BOXROLLS")==null ? null : partNoAndItemNoMap.get("BOXROLLS").get(0);//每箱卷数 + PartSubPropertiesValueData propertiesBoxWeight = partNoAndItemNoMap.get("BOXWEIGHT")==null? null: partNoAndItemNoMap.get("BOXWEIGHT").get(0);//箱重量 if (propertiesRollQty==null||propertiesBoxRolls==null||propertiesBoxWeight==null) { partNos.append(partList.get(0).getSku()).append(" "); } @@ -2187,9 +2194,15 @@ public class CoDelServiceImpl implements CoDelService { throw new RuntimeException("请先维护物料["+partNos+"]基本信息(每卷数量、每箱卷数、箱重量)!"); } for (String partNo : palletItemMap.keySet()) { - PartSubPropertiesValueData propertiesRollQty = partNoAndItemNoMap.get(partNo + "$ROLLQTY");//每卷数量 - PartSubPropertiesValueData propertiesBoxRolls = partNoAndItemNoMap.get(partNo + "$BOXROLLS");//每箱卷数 - PartSubPropertiesValueData propertiesBoxWeight = partNoAndItemNoMap.get(partNo + "$BOXWEIGHT");//箱重量 + // 关务物料属性 + List propertiesValues = coDelMapper.getPropertiesListByTypeAndCodeNo( + notifyHeader.getSite(), "ECSSPART","BG001",notifyHeader.getBuNo(), partNo); + // 每一个物料加属性对应一个属性,用来下面遍历发货通知单明细时获取具体属性值 + Map> partNoAndItemNoMap = propertiesValues.stream() + .collect(Collectors.groupingBy(PartSubPropertiesValue::getPropertiesItemNo)); + PartSubPropertiesValueData propertiesRollQty = partNoAndItemNoMap.get("ROLLQTY").get(0);//每卷数量 + PartSubPropertiesValueData propertiesBoxRolls = partNoAndItemNoMap.get("BOXROLLS").get(0);//每箱卷数 + PartSubPropertiesValueData propertiesBoxWeight = partNoAndItemNoMap.get("BOXWEIGHT").get(0);//箱重量 EcssCoDelPalletHeaderData headerData = new EcssCoDelPalletHeaderData(); BeanUtils.copyProperties(inData, headerData); headerData.setSeqNo(seqNo+seq); diff --git a/src/main/resources/mapper/ecss/CoDelMapper.xml b/src/main/resources/mapper/ecss/CoDelMapper.xml index 5540f7ff..4b331749 100644 --- a/src/main/resources/mapper/ecss/CoDelMapper.xml +++ b/src/main/resources/mapper/ecss/CoDelMapper.xml @@ -871,6 +871,7 @@ left join ecss_CoDelNotifyHeader noHeader on a.site=noHeader.site and a.delNo=no and a.record_type = #{recordType} and a.bu_no=#{buNo} and a.code_no = #{codeNo} + and a.part_no = #{pn} order by a.item_no diff --git a/src/main/resources/templates/declaration-all-seal-template.xlsx b/src/main/resources/templates/declaration-all-seal-template.xlsx index e3bcc2c0..18a74c89 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 d9ce6bb6..3bcdb42c 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-all2-template.xlsx b/src/main/resources/templates/declaration-all2-template.xlsx index d8cecd74..a0376c67 100644 Binary files a/src/main/resources/templates/declaration-all2-template.xlsx and b/src/main/resources/templates/declaration-all2-template.xlsx differ diff --git a/src/main/resources/templates/export-goods-template.xlsx b/src/main/resources/templates/export-goods-template.xlsx index 47880cf5..3b00ee5e 100644 Binary files a/src/main/resources/templates/export-goods-template.xlsx and b/src/main/resources/templates/export-goods-template.xlsx differ