From 20c01e934d711daf21f60f3d4cadf19235eb2a3b Mon Sep 17 00:00:00 2001 From: zhangzq Date: Mon, 11 Dec 2023 15:42:33 +0800 Subject: [PATCH] =?UTF-8?q?rev:=E4=BF=AE=E6=94=B9=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E5=8F=AB=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/HandNewMaterialServiceImpl.java | 83 ++++++++++--------- .../nl/pda/st/in/wql/QPADST_IN_SERVICE.wql | 2 +- .../src/main/resources/logback-spring.xml | 2 + 3 files changed, 49 insertions(+), 38 deletions(-) diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/pda/st/in/service/impl/HandNewMaterialServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/pda/st/in/service/impl/HandNewMaterialServiceImpl.java index 15c2aeb6..033075a3 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/pda/st/in/service/impl/HandNewMaterialServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/pda/st/in/service/impl/HandNewMaterialServiceImpl.java @@ -32,7 +32,9 @@ import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; @Service @RequiredArgsConstructor @@ -380,6 +382,17 @@ public class HandNewMaterialServiceImpl implements HandNewMaterialService { mst_jo.put("syscompanyid", deptId + ""); io_mst.insert(mst_jo); + //批量查询桶: + List bucketuniqueCollenct = new ArrayList<>(); + for (HashMap row : rows) { + bucketuniqueCollenct.add(String.valueOf(row.get("bucketunique"))); + } + Map buckqMap = bucket_wql.query("bucketunique in ('" + bucketuniqueCollenct.stream().collect(Collectors.joining("','")) + "')") + .getResultJSONArray(0).stream().collect(HashMap::new, (map, buckq) -> { + JSONObject jo = (JSONObject) buckq; + map.put("key_"+jo.getString("bucketunique")+jo.getString("material_id") + jo.getString("pcsn"), jo); + }, HashMap::putAll); + for (int i = 0; i < rows.size(); i++) { String iostorinvdtl_id = ""; String iostorinvdis_id = ""; @@ -388,47 +401,45 @@ public class HandNewMaterialServiceImpl implements HandNewMaterialService { if (flag.equals("5") && row.containsKey("is_new") && row.get("is_new").equals("0")) { continue; } + JSONObject bucket_jo = buckqMap.get("key_" + row.get("bucketunique") + row.get("material_id") + row.get("pcsn")); - //校验桶状态 - JSONObject bucket_jo = bucket_wql.query("bucketunique = '" + row.get("bucketunique") + "' AND material_id = '" + row.get("material_id") + "' AND pcsn = '" + row.get("pcsn") + "'").uniqueResult(0); - - if (ObjectUtil.isEmpty(bucket_jo)) { - throw new PdaRequestException("桶号:"+row.get("bucketunique")+"查不到对应物料批次记录!"); - } - - if (!ObjectUtil.isEmpty(bucket_jo) && !bucket_jo.getString("status").equals("01")) { - //如果为软废采购入库,判断是否为新加,不是新加的不需要判断是否组盘 - if (!flag.equals("5") && row.containsKey("is_new") && row.get("is_new").equals("0")) { - throw new PdaRequestException("桶" + bucket_jo.getString("bucketunique") + "已经组盘!"); + check:{ //校验桶状态 + if (ObjectUtil.isEmpty(bucket_jo)) { + throw new PdaRequestException("桶号:" + row.get("bucketunique") + "查不到对应物料批次记录!"); } - } - if (flag.equals("1")) { - if (StrUtil.isNotEmpty(material_id) && StrUtil.isNotEmpty(pcsn)) { - if (!row.get("material_id").equals(material_id) || !pcsn.equals(row.get("pcsn"))) { - throw new PdaRequestException("存在不同物料、批次的明细!"); + if (!ObjectUtil.isEmpty(bucket_jo) && !bucket_jo.getString("status").equals("01")) { + //如果为软废采购入库,判断是否为新加,不是新加的不需要判断是否组盘 + if (!flag.equals("5") && row.containsKey("is_new") && row.get("is_new").equals("0")) { + throw new PdaRequestException("桶" + bucket_jo.getString("bucketunique") + "已经组盘!"); + } + } + + if (flag.equals("1")) { + if (StrUtil.isNotEmpty(material_id) && StrUtil.isNotEmpty(pcsn)) { + if (!row.get("material_id").equals(material_id) || !pcsn.equals(row.get("pcsn"))) { + throw new PdaRequestException("存在不同物料、批次的明细!"); + } + } + } + //工序返工入库校验、零头粉入库 + if (flag.equals("3") || flag.equals("6")) { + //物料为PG粉 + boolean is_pgf = materialbaseService.isAlongMaterType(MaterOptTypeEnum.PGF.getCode(), bucket_jo.getString("material_id"), null); + //桶内物料必须为PG粉; + if (!is_pgf) { + throw new PdaRequestException("桶内物料不为PG粉!"); + } + } + if (flag.equals("5") || flag.equals("7")) { + //物料为软废 + boolean is_rf = materialbaseService.isAlongMaterType(MaterOptTypeEnum.RF.getCode(), bucket_jo.getString("material_id"), null); + //桶内物料必须为软废; + if (!is_rf) { + throw new PdaRequestException("桶内物料不为软废!"); } } } - //工序返工入库校验、零头粉入库 - if (flag.equals("3") || flag.equals("6")) { - //物料为PG粉 - boolean is_pgf = materialbaseService.isAlongMaterType(MaterOptTypeEnum.PGF.getCode(), bucket_jo.getString("material_id"), null); - //桶内物料必须为PG粉; - if (!is_pgf) { - throw new PdaRequestException("桶内物料不为PG粉!"); - } - } - - if (flag.equals("5") || flag.equals("7")) { - //物料为软废 - boolean is_rf = materialbaseService.isAlongMaterType(MaterOptTypeEnum.RF.getCode(), bucket_jo.getString("material_id"), null); - //桶内物料必须为软废; - if (!is_rf) { - throw new PdaRequestException("桶内物料不为软废!"); - } - } - //查询该桶记录是否存在 if (ObjectUtil.isEmpty(bucket_jo) || !"01,02,03".contains(bucket_jo.getString("status"))) { //插入一条桶记录 @@ -438,10 +449,8 @@ public class HandNewMaterialServiceImpl implements HandNewMaterialService { row.put("flag", flag); this.insertBucket(row); } - //立库返工入库校验 if (flag.equals("4")) { - bucket_jo = bucket_wql.query("bucketunique = '" + row.get("bucketunique") + "' AND material_id = '" + row.get("material_id") + "' AND pcsn = '" + row.get("pcsn") + "'").uniqueResult(0); //物料为PG粉 boolean is_pgf = materialbaseService.isAlongMaterType(MaterOptTypeEnum.PGF.getCode(), bucket_jo.getString("material_id"), null); //桶内物料必须为PG粉; diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/pda/st/in/wql/QPADST_IN_SERVICE.wql b/mes/hd/nladmin-system/src/main/java/org/nl/pda/st/in/wql/QPADST_IN_SERVICE.wql index 422c293a..4cdd6533 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/pda/st/in/wql/QPADST_IN_SERVICE.wql +++ b/mes/hd/nladmin-system/src/main/java/org/nl/pda/st/in/wql/QPADST_IN_SERVICE.wql @@ -66,7 +66,7 @@ IF 输入.flag = "11" QUERY SELECT - IOStorInvDisDtl.* + IOStorInvDisDtl.storagevehicle_code FROM ST_IVT_IOStorInvDisDtl IOStorInvDisDtl LEFT JOIN st_ivt_iostorinvdtl iostorinvdtl ON iostorinvdtl.iostorinvdtl_id = IOStorInvDisDtl.iostorinvdtl_id diff --git a/mes/hd/nladmin-system/src/main/resources/logback-spring.xml b/mes/hd/nladmin-system/src/main/resources/logback-spring.xml index 7ffef186..7cb6d0e1 100644 --- a/mes/hd/nladmin-system/src/main/resources/logback-spring.xml +++ b/mes/hd/nladmin-system/src/main/resources/logback-spring.xml @@ -130,6 +130,8 @@ https://juejin.cn/post/6844903775631572999 + +