From 5c50696e9514c45960e08e84ce8c7ccec52a60e4 Mon Sep 17 00:00:00 2001
From: 野心家 <1051256694@qq.com>
Date: 星期三, 31 五月 2023 09:28:51 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/common/web/WcsController.java |   34 +++++++++++++++++++++++++++-------
 1 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/zy/common/web/WcsController.java b/src/main/java/com/zy/common/web/WcsController.java
index 5f0a27d..41456b6 100644
--- a/src/main/java/com/zy/common/web/WcsController.java
+++ b/src/main/java/com/zy/common/web/WcsController.java
@@ -68,14 +68,28 @@
         if (Cools.isEmpty(param.getSourceStaNo())) {
             return R.error("婧愮珯缂栧彿涓嶈兘涓虹┖");
         }
-
+        if (Cools.isEmpty(param.getBarcode())) {
+            return R.error("鎵樼洏鐮佷笉鑳戒负绌�");
+        }
+        boolean logs=true;
+        TestMast testMast11=new TestMast();
+        //濡傛灉pack鐮佷负绌猴紝鏌ユ祴璇曡〃
         if (Cools.isEmpty(param.getPackNo())) {
-            return R.error("packNo涓嶈兘涓虹┖");
+            testMast11= testMastService.selectOne(new EntityWrapper<TestMast>()
+                    .eq("user_id",param.getBarcode())//鏌ユ墭鐩樼爜
+                    .eq("status",4));   //瀹屾垚娴嬭瘯
+            logs=false;
         }
         Date now = new Date();
         if (true){
             try{
-                Mat mat = matService.selectByMatnr(param.getPackNo());
+                Mat mat=new Mat();
+                if(logs){
+                    mat = matService.selectByMatnr(param.getPackNo());
+                }else {
+                    mat = matService.selectByMatnr(testMast11.getBarcode());
+                }
+
                 if (Cools.isEmpty(mat)){
                     return R.error("鍟嗗搧淇℃伅妗f鏈煡璇㈠埌pack淇℃伅"+param.getPackNo());
                 }
@@ -203,13 +217,13 @@
             if (!wrkDetlService.insert(wrkDetl)) {
                 throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏澶辫触");
             }
-            TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>().eq("barcode", wrkMast.getBarcode()));
-
+            TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>()
+                    .eq("barcode", wrkDetl.getMatnr()));//pack鐮�
             if (Cools.isEmpty(testMast)){
                 //鐢熸垚娴嬭瘯妗�
                 testMast=new TestMast();
                 testMast.setChannel(locMast.getChannel());
-                testMast.setUserId(locMast.getLocNo());
+                testMast.setUserId(wrkMast.getBarcode());//鎵樼洏鐮�
                 testMast.setStatus(1);
                 testMast.setBarcode(wrkDetl.getMatnr());
                 testMast.setLocNo(locMast.getLocNo());
@@ -219,7 +233,13 @@
                     throw new CoolException(wrkDetl.getMatnr()+"鐢熸垚娴嬭瘯妗eけ璐�");
                 }
             }else {
-                throw new CoolException(wrkDetl.getMatnr()+"宸插瓨鍦ㄦ祴璇曟。");
+                testMast.setBarcode(wrkDetl.getMatnr());
+                testMast.setChannel(locMast.getChannel());
+                testMast.setLocNo(locMast.getLocNo());
+                testMast.setAppeTime(now);
+                if(!testMastService.update(testMast,new EntityWrapper<TestMast>().eq("barcode", wrkDetl.getMatnr()))){
+                    throw new CoolException(wrkDetl.getMatnr()+"鏇存柊娴嬭瘯妗eけ璐�");
+                }
             }
         });
         // 鏇存柊鍏ュ簱閫氱煡妗� ioStatus ===>> Y

--
Gitblit v1.9.1