From c8daee5975e5a6f5c844e1fceb65a3a682253c0e Mon Sep 17 00:00:00 2001
From: Junjie <xjj@123>
Date: 星期三, 06 三月 2024 11:51:23 +0800
Subject: [PATCH] #四项库拣料回库时合并wrkdetl到locdetl

---
 src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java |   67 +++++++++++++++++++++++++++------
 1 files changed, 54 insertions(+), 13 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
index 9aeabad..354b926 100644
--- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -96,7 +96,8 @@
         boolean hasContainerCode = false;
         int containerCodeCount = 0;//鏂欑鐮佹暟閲�
         for (CombParam.CombMat combMat : param.getCombMats()) {
-            if (combMat.getContainerCode() != null) {
+            if(!Cools.isEmpty(combMat.getContainerCode())){
+            //if (combMat.getContainerCode() != null) {
                 hasContainerCode = true;
                 containerCodeCount++;
                 continue;
@@ -492,21 +493,19 @@
         waitPakinList.forEach(waitPakin -> {
             //鏂欐兂鐮�
             String containerCode = waitPakin.getSuppCode();
-            //濡傛灉褰撳墠鏂欐兂鐮佸凡瀛樺湪锛屽垯淇敼璇ユ枡鎯崇殑鐗╂枡鏁伴噺
-            ManLocDetl manLocDetl = manLocDetlService.selectOne(new EntityWrapper<ManLocDetl>().eq("container_code", containerCode));
+            //濡傛灉褰撳墠搴撲綅宸插瓨鍦ㄨ揣鐗�
+            Wrapper<ManLocDetl> wrapper = new EntityWrapper<ManLocDetl>().eq("loc_no", locNo).eq("matnr",waitPakin.getMatnr());
+            Utils.wapperSetCondition(wrapper,"container_code",containerCode);
+            Utils.wapperSetCondition(wrapper,"batch",waitPakin.getBatch());
+            Utils.wapperSetCondition(wrapper,"csocode",waitPakin.getThreeCode());
+            Utils.wapperSetCondition(wrapper,"isoseq",waitPakin.getDeadTime());
+            ManLocDetl manLocDetl = manLocDetlService.selectOne(wrapper);
             if(Cools.isEmpty(manLocDetl)){
                 saveManlocDetl(waitPakin,now,locNo);
             }else{
-                if(Cools.eq(manLocDetl.getMatnr(),waitPakin.getMatnr())
-                        && Cools.eq(manLocDetl.getCsocode(),waitPakin.getThreeCode())
-                        && Cools.eq(manLocDetl.getIsoseq(),waitPakin.getDeadTime())){
-                    manLocDetl.setAnfme(manLocDetl.getAnfme() + waitPakin.getAnfme());
-                    manLocDetlService.update(manLocDetl,new EntityWrapper<ManLocDetl>()
-                            .eq("loc_no",manLocDetl.getLocNo())
-                            .eq("container_code",manLocDetl.getContainerCode()));
-                }else{
-                    saveManlocDetl(waitPakin,now,locNo);
-                }
+                manLocDetl.setAnfme(manLocDetl.getAnfme() + waitPakin.getAnfme());
+                manLocDetlService.update(manLocDetl,wrapper);
+
             }
             //鐢熸垚骞冲簱鍏ュ嚭搴撴棩蹇�
             SaasUtils.insertLog(0,locNo,waitPakin.getMatnr(), waitPakin.getAnfme(),user.getUsername());
@@ -617,6 +616,48 @@
         });
     }
 
+    @Override
+    public void nodePakinNoComb(CombParam param) {
+        if(Cools.isEmpty(param.getLocno())){
+            throw new CoolException("搴撲綅鍙锋湭濉啓锛屾棤娉曞叆搴�");
+        }
+        param.getCombMats().forEach(combMat -> {
+            Wrapper<ManLocDetl> wrapper = new EntityWrapper<ManLocDetl>().eq("loc_no", param.getLocno()).eq("matnr",combMat.getMatnr());
+            Utils.wapperSetCondition(wrapper,"container_code",combMat.getContainerCode());
+            Utils.wapperSetCondition(wrapper,"batch",combMat.getBatch());
+            Utils.wapperSetCondition(wrapper,"csocode",combMat.getCsocode());
+            Utils.wapperSetCondition(wrapper,"isoseq",combMat.getIsoseq());
+            ManLocDetl manLocDetl = manLocDetlService.selectOne(wrapper);
+            if(Cools.isEmpty(manLocDetl)){
+                saveManlocDetl(combMat,param.getLocno());
+            }else{
+                manLocDetl.setAnfme(manLocDetl.getAnfme() + combMat.getAnfme());
+                manLocDetlService.update(manLocDetl,wrapper);
+            }
+            //鐢熸垚骞冲簱鍏ュ嚭搴撴棩蹇�
+            SaasUtils.insertLog(0,param.getLocno(),combMat.getMatnr(), combMat.getAnfme(),"");
+        });
+
+    }
+
+    private boolean saveManlocDetl(CombParam.CombMat combMat, String locNo){
+        Node node = nodeService.selectOne(new EntityWrapper<Node>()
+                .eq("name", locNo));
+        Mat mat = matService.selectByMatnr(combMat.getMatnr());
+        ManLocDetl manLocDetl = new ManLocDetl();
+        BeanUtils.copyProperties(mat,manLocDetl);
+        manLocDetl.setAnfme(combMat.getAnfme());
+        manLocDetl.setNodeId(node.getId());
+        manLocDetl.setContainerCode(combMat.getContainerCode());
+        manLocDetl.setCsocode(combMat.getCsocode());
+        manLocDetl.setIsoseq(combMat.getIsoseq());
+        manLocDetl.setCreateTime(new Date());
+        manLocDetl.setModiTime(new Date());
+        manLocDetl.setLocNo(locNo);
+        manLocDetl.setStatus(1);
+        return manLocDetlService.insert(manLocDetl);
+    }
+
     private void saveManlocDetl(WaitPakin waitPakin, Date now, String locNo){
 
         Node node = nodeService.selectOne(new EntityWrapper<Node>()

--
Gitblit v1.9.1