From 1da25624bd70e9ebaf83e5e2c85a928593176173 Mon Sep 17 00:00:00 2001 From: xhj Date: Wed, 18 Oct 2023 13:31:50 +0800 Subject: [PATCH] first --- .../jcsj/impl/BomUploadServiceImpl.java | 225 +++++++++--------- .../service/jcsj/impl/DmBomServiceImpl.java | 3 +- .../mappers/jcsj/DmBclqmxpMapper.xml | 4 +- 3 files changed, 121 insertions(+), 111 deletions(-) diff --git a/src/main/java/com/dsic/gj_erp/service/jcsj/impl/BomUploadServiceImpl.java b/src/main/java/com/dsic/gj_erp/service/jcsj/impl/BomUploadServiceImpl.java index 6c5fdf1..c471350 100644 --- a/src/main/java/com/dsic/gj_erp/service/jcsj/impl/BomUploadServiceImpl.java +++ b/src/main/java/com/dsic/gj_erp/service/jcsj/impl/BomUploadServiceImpl.java @@ -1405,132 +1405,139 @@ public class BomUploadServiceImpl { Comparator.comparing( tc -> tc.getTjb().getWpgg() + ";" + tc.getTjb().getWpxh() + ";" + tc.getTjb().getTzbh()))), ArrayList::new)); collect.forEach(i -> { - DmBchxylp e = i.getTjb(); - if (StringUtils.isNotBlank(e.getWpgg())) { - DmBom dmBom = new DmBom(); - dmBom.setCs(2); - // dmBom.setQgcd(e.getYlzd4Z()); - //dmBom.setHxcd(e.getHxcdZ()); - dmBom.setTzbh(e.getTzbh()); - // dmBom.setTlsl(e.getSl()); - //dmBom.setLjbh(e.getWph()); - //dmBom.setLjsl(e.getLjslZ()); - dmBom.setDcch(e.getDcCh()); - dmBom.setPl(e.getDcPl()); - //dmBom.setFd(e.getWph().substring(0,4)); - dmBom.setSjch(e.getDcCh()); - dmBom.setWpcz(e.getWpxh()); - dmBom.setWpgg(e.getWpgg()); - System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpgg().split("\\*")[0]); - System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpgg()); - dmBom.setBh(new BigDecimal(e.getWpgg().split("\\*")[0])); - dmBom.setBc(new BigDecimal(e.getWpgg().split("\\*")[2])); - String tzbh = e.getTzbh(); - String hxlx = ""; - // 根据图纸编号获取 手工,数控 跨位,组立,、 - if (tzbh.substring(4, 5).equals("S")) { - hxlx = "1010"; - } else if (tzbh.substring(4, 5).equals("N")) { - hxlx = "1020"; - } - // 跨位 - String s = kwxxMap.get(tzbh.substring(4, 7)); - String zl = this.getZL(tzbh); - String zlbm = zllbMap.get(zl); - String zzcj = qgKwMap.get(s); - dmBom.setZl(zlbm); - dmBom.setKw(zzcj); - dmBom.setLqlb(hxlx); - // 领取表找打 fds - if (e.getHxfl().equals("B")) { - dmBom.setType("B"); - List collect11 = list.stream().filter(fst -> null!= fst.getBclq() &&fst.getBclq().getWpgg().equals(e.getWpgg()) && - fst.getBclq().getWpxh().equals(e.getWpxh()) && fst.getBclq().getDcPlZ().equals(e.getDcPl()) - ).collect(Collectors.toList()); - if (collect11.size() > 0) { - dmBom.setFds(collect11.get(0).getBclq().getDcFdZ()); + if(null !=i.getTjb()){ + DmBchxylp e = i.getTjb(); + if (StringUtils.isNotBlank(e.getWpgg())) { + DmBom dmBom = new DmBom(); + dmBom.setCs(2); + // dmBom.setQgcd(e.getYlzd4Z()); + //dmBom.setHxcd(e.getHxcdZ()); + dmBom.setTzbh(e.getTzbh()); + // dmBom.setTlsl(e.getSl()); + //dmBom.setLjbh(e.getWph()); + //dmBom.setLjsl(e.getLjslZ()); + dmBom.setDcch(e.getDcCh()); + dmBom.setPl(e.getDcPl()); + //dmBom.setFd(e.getWph().substring(0,4)); + dmBom.setSjch(e.getDcCh()); + dmBom.setWpcz(e.getWpxh()); + dmBom.setWpgg(e.getWpgg()); + System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpgg().split("\\*")[0]); + System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpgg()); + dmBom.setBh(new BigDecimal(e.getWpgg().split("\\*")[0])); + dmBom.setBc(new BigDecimal(e.getWpgg().split("\\*")[2])); + String tzbh = e.getTzbh(); + String hxlx = ""; + // 根据图纸编号获取 手工,数控 跨位,组立,、 + if (tzbh.substring(4, 5).equals("S")) { + hxlx = "1010"; + } else if (tzbh.substring(4, 5).equals("N")) { + hxlx = "1020"; } - } else { + // 跨位 + String s = kwxxMap.get(tzbh.substring(4, 7)); + String zl = this.getZL(tzbh); + String zlbm = zllbMap.get(zl); + String zzcj = qgKwMap.get(s); + dmBom.setZl(zlbm); + dmBom.setKw(zzcj); + dmBom.setLqlb(hxlx); + // 领取表找打 fds + if (e.getHxfl().equals("B")) { + dmBom.setType("B"); + List collect11 = list.stream().filter(fst -> null!= fst.getBclq() &&fst.getBclq().getWpgg().equals(e.getWpgg()) && + fst.getBclq().getWpxh().equals(e.getWpxh()) && fst.getBclq().getDcPlZ().equals(e.getDcPl()) + ).collect(Collectors.toList()); + if (collect11.size() > 0) { + dmBom.setFds(collect11.get(0).getBclq().getDcFdZ()); + } + } else { - BigDecimal cd=e.getXccd().divide(new BigDecimal("1000")); - List collect11 = list.stream().filter(fst -> null!= fst.getBclq() && fst.getBclq().getWpxh().equals(e.getWpgg()) && - fst.getBclq().getWpgg().equals(e.getWpxh()) && fst.getBclq().getDcPlZ().equals(e.getDcPl()) && fst.getBclq().getYlzd11().compareTo(cd)==0 - ).collect(Collectors.toList()); - if (collect11.size() > 0) { - dmBom.setFds(collect11.get(0).getBclq().getDcFdZ()); - dmBom.setXcgs(collect11.get(0).getBclq().getSl()); - dmBom.setXcshms(collect11.get(0).getBclq().getShms()); + BigDecimal cd=e.getXccd().divide(new BigDecimal("1000")); + List collect11 = list.stream().filter(fst -> null!= fst.getBclq() && fst.getBclq().getWpxh().equals(e.getWpgg()) && + fst.getBclq().getWpgg().equals(e.getWpxh()) && fst.getBclq().getDcPlZ().equals(e.getDcPl()) && fst.getBclq().getYlzd11().compareTo(cd)==0 + ).collect(Collectors.toList()); + if (collect11.size() > 0) { + dmBom.setFds(collect11.get(0).getBclq().getDcFdZ()); + dmBom.setXcgs(collect11.get(0).getBclq().getSl()); + dmBom.setXcshms(collect11.get(0).getBclq().getShms()); + } + dmBom.setType("X"); } - dmBom.setType("X"); + adds.add(dmBom); } - adds.add(dmBom); } + }); } else { list.forEach(i -> { - DmBchxmxp e = i.getTlt(); - if (StringUtils.isNotBlank(e.getWpggZ())) { - DmBom dmBom = new DmBom(); - dmBom.setCs(3); - dmBom.setQgcd(e.getYlzd4Z()); - dmBom.setHxcd(e.getHxcdZ()); - dmBom.setTzbh(e.getTzbhZ()); - dmBom.setTlsl(e.getSl()); - dmBom.setLjbh(e.getWph()); - dmBom.setLjsl(e.getLjslZ()); - dmBom.setDcch(e.getDcChZ()); - dmBom.setPl(e.getDcPlZ()); - dmBom.setFd(e.getWph().substring(0, 4)); - dmBom.setSjch(e.getDcChZ()); - dmBom.setWpcz(e.getWpxhZ()); - dmBom.setWpgg(e.getWpggZ()); - System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpggZ().split("\\*")[0]); - System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpggZ()); - dmBom.setBh(new BigDecimal(e.getWpggZ().split("\\*")[0])); - dmBom.setBc(new BigDecimal(e.getWpggZ().split("\\*")[2])); - String tzbh = e.getTzbhZ(); - String hxlx = ""; - // 根据图纸编号获取 手工,数控 跨位,组立,、 - if (tzbh.substring(4, 5).equals("S")) { - hxlx = "1010"; - } else if (tzbh.substring(4, 5).equals("N")) { - hxlx = "1020"; - } - // 跨位 - System.out.println("tzbh = " + tzbh); - String s = kwxxMap.get(tzbh.substring(4, 7)); - String zl = this.getZL(tzbh); - String zlbm = zllbMap.get(zl); - String zzcj = qgKwMap.get(s); - dmBom.setZl(zlbm); - dmBom.setKw(zzcj); - dmBom.setLqlb(hxlx); - dmBom.setLqbs("Y"); - if(tzbh.substring(4, 5).equals("X")){ // 型材 - // 先去 统计表中查找 + if(null!= i.getTlt()){ + DmBchxmxp e = i.getTlt(); + if (StringUtils.isNotBlank(e.getWpggZ())) { + DmBom dmBom = new DmBom(); + dmBom.setCs(3); + dmBom.setQgcd(e.getYlzd4Z()); + dmBom.setHxcd(e.getHxcdZ()); + dmBom.setTzbh(e.getTzbhZ()); + dmBom.setTlsl(e.getSl()); + dmBom.setLjbh(e.getWph()); + dmBom.setLjsl(e.getLjslZ()); + dmBom.setDcch(e.getDcChZ()); + dmBom.setPl(e.getDcPlZ()); + dmBom.setFd(e.getWph().substring(0, 4)); + dmBom.setSjch(e.getDcChZ()); + dmBom.setWpcz(e.getWpxhZ()); + dmBom.setWpgg(e.getWpggZ()); + System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpggZ().split("\\*")[0]); + System.out.println("e.getWpggZ().split(\"\\\\*\")[0] = " + e.getWpggZ()); + dmBom.setBh(new BigDecimal(e.getWpggZ().split("\\*")[0])); + dmBom.setBc(new BigDecimal(e.getWpggZ().split("\\*")[2])); + String tzbh = e.getTzbhZ(); + String hxlx = ""; + // 根据图纸编号获取 手工,数控 跨位,组立,、 + if (tzbh.substring(4, 5).equals("S")) { + hxlx = "1010"; + } else if (tzbh.substring(4, 5).equals("N")) { + hxlx = "1020"; + } + // 跨位 + System.out.println("tzbh = " + tzbh); + String s = kwxxMap.get(tzbh.substring(4, 7)); + String zl = this.getZL(tzbh); + String zlbm = zllbMap.get(zl); + String zzcj = qgKwMap.get(s); + dmBom.setZl(zlbm); + dmBom.setKw(zzcj); + dmBom.setLqlb(hxlx); + dmBom.setLqbs("Y"); + if(tzbh.substring(4, 5).equals("X")){ // 型材 + // 先去 统计表中查找 // List collect11 = list.stream().filter(fst -> null!= fst.getTjb() && fst.getTjb().getWpxh().equals(e.getWpxhZ()) && // fst.getTjb().getWpgg().equals(e.getWpggZ()) && fst.getTjb().getDcPl().equals(e.getDcPlZ()) // ).collect(Collectors.toList()); - List collect11 = list.stream().filter(fst -> null!= fst.getTjb() && tzbh.equals(fst.getTjb().getTzbh()) - ).collect(Collectors.toList()); - // 找到长度 + List collect11 = list.stream().filter(fst -> null!= fst.getTjb() && tzbh.equals(fst.getTjb().getTzbh()) + ).collect(Collectors.toList()); + // 找到长度 BigDecimal cd=collect11.get(0).getTjb().getXccd().divide(new BigDecimal("1000")); - List collect111 = list.stream().filter(fst -> null!= fst.getBclq() && fst.getBclq().getWpgg().equals(e.getWpxhZ()) && - fst.getBclq().getWpxh().equals(e.getWpggZ()) && fst.getBclq().getDcPlZ().equals(e.getDcPlZ()) && fst.getBclq().getYlzd11().compareTo(cd)==0 - ).collect(Collectors.toList()); - if (collect111.size() > 0) { + List collect111 = list.stream().filter(fst -> null!= fst.getBclq() && fst.getBclq().getWpgg().equals(e.getWpxhZ()) && + fst.getBclq().getWpxh().equals(e.getWpggZ()) && fst.getBclq().getDcPlZ().equals(e.getDcPlZ()) && fst.getBclq().getYlzd11().compareTo(cd)==0 + ).collect(Collectors.toList()); + if (collect111.size() > 0) { // dmBom.setFds(collect11.get(0).getBclq().getDcFdZ()); - dmBom.setXcgs(collect111.get(0).getBclq().getSl()); - dmBom.setXcshms(collect111.get(0).getBclq().getShms()); + dmBom.setXcgs(collect111.get(0).getBclq().getSl()); + dmBom.setXcshms(collect111.get(0).getBclq().getShms()); + } + dmBom.setType("X"); + }else { + dmBom.setType("B"); } - dmBom.setType("X"); - }else { - dmBom.setType("B"); - } - adds.add(dmBom); + adds.add(dmBom); + } } + + }); } dmBomService.insertBoms(adds); diff --git a/src/main/java/com/dsic/gj_erp/service/jcsj/impl/DmBomServiceImpl.java b/src/main/java/com/dsic/gj_erp/service/jcsj/impl/DmBomServiceImpl.java index 3a75db3..1a0b202 100644 --- a/src/main/java/com/dsic/gj_erp/service/jcsj/impl/DmBomServiceImpl.java +++ b/src/main/java/com/dsic/gj_erp/service/jcsj/impl/DmBomServiceImpl.java @@ -62,8 +62,9 @@ public class DmBomServiceImpl extends ServiceImpl implements // }else{ List list = this.list(new QueryWrapper().eq("dcch", map.get("dcch")) .eq(StrUtil.isNotEmpty((String) map.get("fd")), "fd", map.get("dcfd")) - .eq(StrUtil.isNotEmpty((String) map.get("pl")), "fd", map.get("dcpl")) + .eq(StrUtil.isNotEmpty((String) map.get("dcpl")), "pl", map.get("dcpl")) .eq(StrUtil.isNotEmpty((String) map.get("zt")), "zt", map.get("zt")) + .orderBy(true,true,"pl","fd") ); return list; // } diff --git a/src/main/resources/mappers/jcsj/DmBclqmxpMapper.xml b/src/main/resources/mappers/jcsj/DmBclqmxpMapper.xml index 35821e3..87a2787 100644 --- a/src/main/resources/mappers/jcsj/DmBclqmxpMapper.xml +++ b/src/main/resources/mappers/jcsj/DmBclqmxpMapper.xml @@ -116,7 +116,9 @@ and DM_BCLQJBP.zzcj=#{zzcj} - + + and DM_BCLQMXP.DC_FD like'%'+#{dcfd}+'%' + and DM_BCLQJBP.DELX=#{delx}