From 84cfd49774d4aa0e475b319a70a411c4cc078694 Mon Sep 17 00:00:00 2001
From: whycq <10027870+whycq@user.noreply.gitee.com>
Date: 星期四, 13 六月 2024 16:18:32 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java |   88 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 85 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java
index 591ab0b..ce68d4b 100644
--- a/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java
@@ -237,7 +237,7 @@
                 checkOrderQty(order,combMat);
             }
 
-            DetlDto detlDto = new DetlDto(combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme(), combMat.getCsocode(), combMat.getIsoseq(),combMat.getContainerCode(),param.getLocType());
+            DetlDto detlDto = new DetlDto(combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme(), combMat.getCsocode(), combMat.getIsoseq(),combMat.getContainerCode(),param.getLocType(),combMat.getProcessSts());
             //鍚屼竴璐ф灦涓嬬浉鍚岀墿鏂欎俊鎭拰鎵瑰彿杞负涓�涓叆搴撻�氱煡妗�
             if (DetlDto.has(detlDtos, detlDto)) {
                 DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch(), detlDto.getCsocode(), detlDto.getIsoseq(),detlDto.getContainerCode());
@@ -293,6 +293,8 @@
         waitPakin.setDeadTime(detlDto.getIsoseq());
 
         waitPakin.setLocType(detlDto.getLocType());
+
+        waitPakin.setProcessSts(detlDto.getProcessSts());
 
 
         waitPakin.setAppeUser(userId);
@@ -423,7 +425,7 @@
             throw new CoolException("褰撳墠"+agvLocMast.getBarcode()+"璐ф灦鐮佸凡鍦ㄥ伐浣滄。涓�");
         }
         //妫�绱㈠簱浣嶏紝閫夋嫨鍚堥�傜殑搴撲綅
-        AgvLocMast locMast = agvCommonService.getLocNo(agvLocMast.getLocType1(),floor,false,true);
+        AgvLocMast locMast = agvCommonService.getLocNo(agvLocMast.getLocType1(),floor,false,false);
         if (Cools.isEmpty(locMast)) {
             throw new CoolException("褰撳墠妤煎眰娌℃湁绌哄簱浣�");
         }
@@ -501,10 +503,16 @@
     @Synchronized
     public String allocationOut(AgvMobileStartPakin param, Long userId) {
         Date now = new Date();
+        if(Cools.isEmpty(param.getBarcode())) {
+            throw new CoolException("璇疯緭鍏ヨ揣鏋剁爜");
+        }
         AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", param.getDevNo()));
         Integer oldWrkNo = agvWrkMast.getWrkNo();
         if (Cools.isEmpty(agvWrkMast)) {
             throw new CoolException("宸ヤ綔妗d腑娌℃湁姝ょ珯鐐逛换鍔�");
+        }
+        if (!agvWrkMast.getBarcode().equals(param.getBarcode())) {
+            throw new CoolException("褰撳墠璐ф灦鐮佷笌浠诲姟涓嶅尮閰�");
         }
         if (!agvWrkMast.getWrkSts().equals(207L)) {
             throw new CoolException("宸ヤ綔鐘舵�佷笉绗﹀悎绂诲満鏉′欢");
@@ -546,8 +554,14 @@
     public String allocationIn(AgvMobileStartPakin param, Long userId) {
         Date now = new Date();
         AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("barcode", param.getBarcode()));
+        if (Cools.isEmpty(agvWrkMast)) {
+            throw new CoolException("鏆傛棤褰撳墠璐ф灦鐮佺殑浠诲姟");
+        }
         if (agvWrkMast.getIoType() != 111) {
             throw new CoolException("闈炴墜鍔ㄨ皟鎷ㄤ换鍔★紝涓嶆敮鎸佹鍔熻兘");
+        }
+        if (!Cools.isEmpty(agvWrkMast.getSourceLocNo())) {
+            throw new CoolException("褰撳墠璐ф灦鐮佷换鏈夋簮搴撲綅锛岃纭");
         }
         AgvBasDevp agvBasDevp = agvBasDevpService.selectByDevNo(param.getDevNo());
         if (Cools.isEmpty(agvWrkMast)) {
@@ -582,10 +596,16 @@
     @Synchronized
     public String empOut(AgvMobileStartPakin param, Long userId) {
         Date now = new Date();
+        if (Cools.isEmpty(param.getBarcode())) {
+            throw new CoolException("璇疯緭鍏ヨ揣鏋剁爜");
+        }
         AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("source_loc_no", param.getDevNo()));
         Integer oldWrkNo = agvWrkMast.getWrkNo();
         if (Cools.isEmpty(agvWrkMast)) {
             throw new CoolException("宸ヤ綔妗d腑娌℃湁姝ょ珯鐐逛换鍔�");
+        }
+        if (!agvWrkMast.getBarcode().equals(param.getBarcode())) {
+            throw new CoolException("褰撳墠璐ф灦鐮佷笌浠诲姟涓嶅尮閰�");
         }
         agvWrkMast.setWrkSts(213L);
         agvWrkMast.setSourceLocNo("");
@@ -608,6 +628,12 @@
         if (Cools.isEmpty(agvWrkMast)) {
             throw new CoolException("宸ヤ綔妗d腑娌℃湁姝ょ珯鐐逛换鍔�");
         }
+        if (agvWrkMast.getIoType() != 113) {
+            throw new CoolException("褰撳墠宸ヤ綔绫诲瀷涓嶈兘绌烘灦杩涘満");
+        }
+        if (agvWrkMast.getWrkSts() != 213) {
+            throw new CoolException("褰撳墠宸ヤ綔绫诲瀷涓嶈兘绌烘灦杩涘満");
+        }
         agvWrkMast.setWrkSts(214L);
         agvWrkMast.setSourceLocNo(param.getDevNo());
         if (!agvWrkMastService.update(agvWrkMast,new EntityWrapper<AgvWrkMast>().eq("wrk_no",agvWrkMast.getWrkNo()))) {
@@ -618,7 +644,7 @@
         return "ok";
     }
     /*
-     * 绔欑偣鍥為��
+     * 杞墜鍔ㄥ洖娴�
     */
     @Override
     @Transactional
@@ -635,6 +661,62 @@
     }
 
     /*
+     * 纭鍔犲伐瀹屾垚
+     */
+    @Override
+    @Transactional
+    public String processed(AgvMobileStartPakin param, Long userId) {
+        Date now = new Date();
+        AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("barcode", param.getBarcode()).eq("loc_no", param.getDevNo()));
+        if (Cools.isEmpty(agvWrkMast)) {
+            throw new CoolException("鏆傛棤褰撳墠璐ф灦鐨勫伐浣滄。");
+        }
+        if (agvWrkMast.getWrkSts() != 205) {
+            throw new CoolException("褰撳墠浠诲姟鏈畬鎴愶紝璇风‘璁�");
+        }
+        //鐢熸垚AGV宸ヤ綔鍘嗗彶妗� + 鐢熸垚AGV宸ヤ綔鏄庣粏鍘嗗彶妗�
+        agvWrkMastLogService.save(agvWrkMast);
+        agvWrkDetlLogService.save(agvWrkMast.getWrkNo());
+        String sourceLocNo = agvWrkMast.getSourceLocNo();
+        AgvLocMast newLocMast = agvCommonService.getLocNo(3, 1,false,false);
+        agvWrkMast.setSourceLocNo(agvWrkMast.getLocNo());
+        agvWrkMast.setLocNo(newLocMast.getLocNo());
+        agvWrkMast.setIoType(57);
+        agvWrkMast.setWrkSts(201L);
+        agvWrkMast.setModiUser(userId);
+        agvWrkMast.setModiTime(now);
+
+
+
+        if (!agvWrkMastService.update(agvWrkMast,new EntityWrapper<AgvWrkMast>().eq("wrk_no",agvWrkMast.getWrkNo()))) {
+            throw new CoolException("鏇存柊宸ヤ綔妗eけ璐�");
+        }
+
+        // 鏇存柊婧愮珯鐐� + 鐩爣搴撲綅鐘舵�� + 鍘嗗彶婧愬簱浣�
+        agvBasDevpService.updateLocStsAndBarcodeByDevNo(param.getDevNo(),"R",param.getBarcode(),agvWrkMast.getWhsType().shortValue());
+        agvLocMastService.updateLocStsByLocNo(newLocMast.getLocNo(),"S",agvWrkMast.getBarcode(),agvWrkMast.getWhsType().shortValue());
+        agvLocMastService.updateLocStsByLocNo(sourceLocNo,"O","",(short)30);
+        agvLocDetlService.delete(new EntityWrapper<AgvLocDetl>().eq("loc_no",sourceLocNo));
+
+        List<AgvWrkDetl> agvWrkDetls = agvWrkDetlService.selectList(new EntityWrapper<AgvWrkDetl>().eq("supp_code",param.getBarcode()));
+        agvWrkDetls.forEach(agvWrkDetl -> {
+            agvWrkDetl.setProcessSts(2);
+            agvWrkDetl.setOrderNo(agvWrkDetl.getOrderNo().substring(2));
+            agvWrkDetl.setModiUser(userId);
+            agvWrkDetl.setModiTime(now);
+            if (!agvWrkDetlService.update(agvWrkDetl,new EntityWrapper<AgvWrkDetl>()
+                    .eq("matnr",agvWrkDetl.getMatnr())
+                    .eq("three_code",agvWrkDetl.getThreeCode())
+                    .eq("supp_code",param.getBarcode()))) {
+                throw new CoolException("鏇存柊宸ヤ綔鏄庣粏澶辫触");
+            }
+        });
+        return "ok";
+    }
+
+
+
+    /*
      * 绔欑偣鍥為��
      */
     @Override

--
Gitblit v1.9.1