From 4d0fb4ddb8d307088c8a41399dc436cdaa3d4d2c Mon Sep 17 00:00:00 2001
From: 野心家 <1051256694@qq.com>
Date: 星期一, 02 十二月 2024 09:06:50 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/common/web/WcsController.java |  110 +++++++++++++++++++++++++++----------------------------
 1 files changed, 54 insertions(+), 56 deletions(-)

diff --git a/src/main/java/com/zy/common/web/WcsController.java b/src/main/java/com/zy/common/web/WcsController.java
index 665cec7..6c5a1ae 100644
--- a/src/main/java/com/zy/common/web/WcsController.java
+++ b/src/main/java/com/zy/common/web/WcsController.java
@@ -52,10 +52,10 @@
     @Autowired
     private  MatService matService;
 
-    @Value("mes.url")
+    @Value("${mes.url}")
     private String mesUrl;
 
-    @Value("mes.inPath")
+    @Value("${mes.inPath}")
     private String inpath;
 
     @PostMapping("/pakin/loc/v1")
@@ -68,46 +68,19 @@
         if (Cools.isEmpty(param.getSourceStaNo())) {
             return R.error("婧愮珯缂栧彿涓嶈兘涓虹┖");
         }
-
-        if (Cools.isEmpty(param.getPackNo())) {
-            return R.error("packNo涓嶈兘涓虹┖");
+        if (Cools.isEmpty(param.getBarcode())) {
+            return R.error("鎵樼洏鐮佷笉鑳戒负绌�");
         }
         Date now = new Date();
-        if (param.getSourceStaNo()==109){
-            try{
-                Mat mat = matService.selectByMatnr(param.getPackNo());
-                if (Cools.isEmpty(mat)){
-                    return R.error("鍟嗗搧淇℃伅妗f鏈煡璇㈠埌pack淇℃伅"+param.getPackNo());
-                }
-                WaitPakin waitPakin = new WaitPakin();
-                waitPakin.setMatnr(mat.getMatnr());// Pack鐮�
-                waitPakin.setMaktx(mat.getMaktx());
-                waitPakin.setZpallet(param.getBarcode());   //鎵樼洏鐮�
-                waitPakin.setIoStatus("N");     // 鍏ュ嚭鐘舵��
-                waitPakin.setAnfme(1.0);  // 鏁伴噺
-                waitPakin.setStatus("Y");    // 鐘舵��
-                waitPakin.setManuDate(mat.getManuDate());
-                waitPakin.setAppeUser(null);
-                waitPakin.setAppeTime(now);
-                waitPakin.setModiUser(null);
-                waitPakin.setModiTime(now);
-                waitPakin.setDeadWarn(mat.getDeadWarn());
-                if (!waitPakinService.insert(waitPakin)) {
-                    throw new CoolException("淇濆瓨鍏ュ簱閫氱煡妗eけ璐�");
-                }
-            }catch (Exception e){
-
-            }
-        }
         List<WaitPakin> waitPakins = null;
         if (param.getIoType() == 1) {
             if (Cools.isEmpty(param.getBarcode())) {
                 return R.error("鏉$爜涓嶈兘涓虹┖");
             }
             waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", param.getBarcode()));
-            if (Cools.isEmpty(waitPakins) || waitPakins.size()!=1) {
+            if (Cools.isEmpty(waitPakins) || waitPakins.size() !=1) {
                 WrkMast wrkMast = wrkMastService.selectByBarcode(param.getBarcode());
-                if (wrkMast != null || waitPakins.size()!=1) {
+                if (wrkMast != null || waitPakins.size() !=1) {
                     return R.parse("600-閲嶅缁勬墭");
                 }
                 return R.parse(CodeRes.NO_COMB_700);
@@ -128,8 +101,8 @@
 
         // 婧愮珯鐐圭姸鎬佹娴�
         BasDevp sourceStaNo = basDevpService.checkSiteStatus(param.getSourceStaNo(), false);
-//        sourceStaNo.setLocType1(param.getLocType1());
-        sourceStaNo.setLocType1((short)1);
+        sourceStaNo.setLocType1(param.getLocType1());
+//        sourceStaNo.setLocType1((short)1);
         LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo);
 
         StartupDto dto = null;
@@ -149,7 +122,7 @@
     }
 
     /**
-     * 鍏ㄦ澘鍏ュ簱
+         * 鍏ㄦ澘鍏ュ簱
      */
     @Transactional
     public StartupDto startupFullPutStore(Integer devpNo, String barcode, LocTypeDto locTypeDto, List<WaitPakin> waitPakins) {
@@ -189,7 +162,7 @@
         LocMast locMast = locMastService.selectById(dto.getLocNo());
 
         // 鐢熸垚宸ヤ綔妗f槑缁�
-        waitPakins.forEach(waitPakin -> {
+        for (WaitPakin waitPakin: waitPakins) {
             WrkDetl wrkDetl = new WrkDetl();
             wrkDetl.sync(waitPakin);
             wrkDetl.setWrkNo(wrkMast.getWrkNo());
@@ -200,25 +173,49 @@
             if (!wrkDetlService.insert(wrkDetl)) {
                 throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏澶辫触");
             }
-            TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>().eq("barcode", wrkMast.getBarcode()));
 
-            if (Cools.isEmpty(testMast)){
-                //鐢熸垚娴嬭瘯妗�
-                testMast=new TestMast();
-                testMast.setChannel(locMast.getChannel());
-                testMast.setUserId(locMast.getLocNo());
-                testMast.setStatus(1);
-                testMast.setBarcode(wrkDetl.getMatnr());
-                testMast.setLocNo(locMast.getLocNo());
-                testMast.setModiTime(now);
-                testMast.setAppeTime(now);
-                if (!testMastService.insert(testMast)){
-                    throw new CoolException(wrkDetl.getMatnr()+"鐢熸垚娴嬭瘯妗eけ璐�");
+                TestMast testMast = testMastService.selectOne(new EntityWrapper<TestMast>()
+                        .eq("barcode", wrkDetl.getMatnr()));//pack鐮�
+                if (Cools.isEmpty(testMast)){
+                    //鐢熸垚娴嬭瘯妗�
+                    testMast=new TestMast();
+                    //鍏ュ緟娴嬪簱浣嶉�氶亾璁句负0
+                    if(locMast.getChannel()==null) {
+                        testMast.setChannel(0);//閫氶亾璁句负0
+                    }else{
+                        testMast.setChannel(locMast.getChannel());
+                    }
+                    testMast.setUserId(wrkMast.getBarcode());//鎵樼洏鐮�
+                    testMast.setStatus(1);
+                    testMast.setBarcode(wrkDetl.getMatnr());
+                    testMast.setLocNo(locMast.getLocNo());
+                    testMast.setModiTime(now);
+                    testMast.setAppeTime(now);
+                    if (!testMastService.insert(testMast)){
+                        throw new CoolException(wrkDetl.getMatnr()+"鐢熸垚娴嬭瘯妗eけ璐�");
+                    }
+                }else if(wrkMast.getStaNo()==209){
+                    testMast.setBarcode(wrkDetl.getMatnr());
+                    testMast.setLocNo(locMast.getLocNo());
+                    testMast.setUserId(wrkMast.getBarcode());//鎵樼洏鐮�
+                    testMast.setAppeTime(now);
+                    if(!testMastService.update(testMast,new EntityWrapper<TestMast>().eq("barcode", wrkDetl.getMatnr()))){
+                        throw new CoolException(wrkDetl.getMatnr()+"鏇存柊娴嬭瘯妗eけ璐�");
+                    }
+                }else {
+                    testMast.setBarcode(wrkDetl.getMatnr());
+                    testMast.setChannel(locMast.getChannel());
+                    testMast.setLocNo(locMast.getLocNo());
+                    testMast.setStatus(1);
+                    testMast.setUserId(wrkMast.getBarcode());//鎵樼洏鐮�
+                    testMast.setAppeTime(now);
+                    if(!testMastService.update(testMast,new EntityWrapper<TestMast>().eq("barcode", wrkDetl.getMatnr()))){
+                        throw new CoolException(wrkDetl.getMatnr()+"鏇存柊娴嬭瘯妗eけ璐�");
+                    }
                 }
-            }else {
-                throw new CoolException(wrkDetl.getMatnr()+"宸插瓨鍦ㄦ祴璇曟。");
-            }
-        });
+
+
+        }
         // 鏇存柊鍏ュ簱閫氱煡妗� ioStatus ===>> Y
         Wrapper<WaitPakin> wrapper = new EntityWrapper<WaitPakin>()
                 .eq("zpallet", barcode);
@@ -242,10 +239,11 @@
             if (!locMastService.updateById(locMast)){
                 throw new CoolException("鏀瑰彉搴撲綅鐘舵�佸け璐�");
             }else{
-                if (locMast.getRow1()<3){
+                if (locMast.getRow1()<2){
                     //1.鎵爜涓婃姤
                     CombParam combParam = new CombParam();
-                    combParam.setPackNo(wrkMast.getBarcode());
+                    combParam.setPackNo(waitPakins.get(0).getMatnr());
+                    combParam.setBarcode(wrkMast.getBarcode());
                     combParam.setLocNo(wrkMast.getLocNo());
                     combParam.setPackSts(0);
                     combParam.setStepSts(1);

--
Gitblit v1.9.1