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 |  100 ++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 96 insertions(+), 4 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 c9cf88c..ce68d4b 100644
--- a/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java
@@ -9,6 +9,7 @@
 import com.zy.asrs.entity.*;
 import com.zy.asrs.entity.param.*;
 import com.zy.asrs.service.*;
+import com.zy.asrs.utils.CodeDetectionUtil;
 import com.zy.common.model.DetlDto;
 import com.zy.common.service.AgvCommonService;
 import lombok.Synchronized;
@@ -67,6 +68,9 @@
     public String comb(CombParam param, Long userId) {
         if (Cools.isEmpty(param.getBarcode(), param.getCombMats())) {
             throw new CoolException(BaseRes.PARAM);
+        }
+        if (!CodeDetectionUtil.barcodeDetection(param.getBarcode())){
+            throw new CoolException(param.getBarcode() + "璐ф灦鐮佹湁璇紝璇锋纭壂鐮侊紒锛侊紒");
         }
         param.setContainerType(Short.valueOf(param.getBarcode().substring(0,2)));
 
@@ -233,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());
@@ -289,6 +293,8 @@
         waitPakin.setDeadTime(detlDto.getIsoseq());
 
         waitPakin.setLocType(detlDto.getLocType());
+
+        waitPakin.setProcessSts(detlDto.getProcessSts());
 
 
         waitPakin.setAppeUser(userId);
@@ -419,7 +425,7 @@
             throw new CoolException("褰撳墠"+agvLocMast.getBarcode()+"璐ф灦鐮佸凡鍦ㄥ伐浣滄。涓�");
         }
         //妫�绱㈠簱浣嶏紝閫夋嫨鍚堥�傜殑搴撲綅
-        AgvLocMast locMast = agvCommonService.getLocNo(agvLocMast.getLocType1(),floor);
+        AgvLocMast locMast = agvCommonService.getLocNo(agvLocMast.getLocType1(),floor,false,false);
         if (Cools.isEmpty(locMast)) {
             throw new CoolException("褰撳墠妤煎眰娌℃湁绌哄簱浣�");
         }
@@ -497,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("宸ヤ綔鐘舵�佷笉绗﹀悎绂诲満鏉′欢");
@@ -542,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)) {
@@ -552,7 +570,7 @@
         if (agvWrkMast.getCrnNo() != agvBasDevp.getFloor()) {
             throw new CoolException("璇风Щ鍔ㄥ埌->" + agvWrkMast.getCrnNo() + "妤煎叆搴撶偣鍏ュ簱");
         }
-        AgvLocMast locNo = agvCommonService.getLocNo(3, 1);
+        AgvLocMast locNo = agvCommonService.getLocNo(3, 1,false,true);
         //宸ヤ綔鐘舵��
         agvWrkMast.setWrkSts(211L);
         //鍏ュ嚭搴撶被鍨�
@@ -578,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("");
@@ -604,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()))) {
@@ -614,7 +644,7 @@
         return "ok";
     }
     /*
-     * 绔欑偣鍥為��
+     * 杞墜鍔ㄥ洖娴�
     */
     @Override
     @Transactional
@@ -631,11 +661,73 @@
     }
 
     /*
+     * 纭鍔犲伐瀹屾垚
+     */
+    @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
     @Transactional
     public String doBack(AgvMobileStartPakin param, Long userId) {
+        if (Cools.isEmpty(param.getBarcode()) || !CodeDetectionUtil.barcodeDetection(param.getBarcode())){
+            throw new CoolException(param.getBarcode() + "璐ф灦鐮佹湁璇紝璇锋纭壂鐮侊紒锛侊紒");
+        }
+        if (Cools.isEmpty(param.getDevNo()) || !CodeDetectionUtil.carCodeDetection(param.getDevNo())){
+            throw new CoolException(param.getDevNo() + "灏忚溅鍦扮爜鏈夎锛岃姝g‘鎵爜锛侊紒锛�");
+        }
         Date now = new Date();
         AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", param.getDevNo()));
         AgvWrkMast agvWrkMastSource = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("source_loc_no", param.getDevNo()));

--
Gitblit v1.9.1