From ad0539f90df37d449ae86d604ae9288af38651f2 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期三, 29 五月 2024 11:51:04 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java |   40 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 38 insertions(+), 2 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 a0623aa..2b26325 100644
--- a/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java
@@ -392,7 +392,11 @@
                 ioType = 11;
             }
         } else {
-            ioType = 12;
+            if (agvLocMast.getFloor() != floor) {
+                ioType = 12;
+            } else {
+                ioType = 11;
+            }
         }
         Date now = new Date();
         //鏌ヨ宸ヤ綔妗�
@@ -430,7 +434,7 @@
         if (!agvWrkMastService.insertByIncrease(mast)) {
             throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
         }
-        if (!agvLocMast.getLocSts().equals("F")) {
+        if (agvLocMast.getLocSts().equals("F")) {
             AgvWrkMast mast1 = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", locMast.getLocNo()).eq("source_loc_no",agvLocMast.getLocNo()));
             //鐢熸垚宸ヤ綔妗f槑缁�
             List<AgvLocDetl> agvLocDetls = agvLocDetlService.selectList(new EntityWrapper<AgvLocDetl>().eq("loc_no", agvLocMast.getLocNo()));
@@ -448,6 +452,17 @@
                     throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏澶辫触");
                 }
             });
+        }
+        // 濡傛灉褰撳墠浠诲姟鏄澹充簩涓夋ゼ鍥為��涓�妤肩殑 鍥炴粴璋冩嫧鍗�
+        if (ioType == 12 && locMast.getFloor() == 1) {
+            List<AgvLocDetl> agvLocDetls = agvLocDetlService.selectList(new EntityWrapper<AgvLocDetl>().eq("loc_no", agvLocMast.getLocNo()));
+            for (AgvLocDetl agvLocDetl : agvLocDetls) {
+                OrderDetl orderDetl = orderDetlService.selectOne(new EntityWrapper<OrderDetl>().eq("three_code", agvLocDetl.getThreeCode()).eq("matnr", agvLocDetl.getMatnr()).eq("order_no", "DB" + agvLocDetl.getOrderNo()));
+                orderDetl.setQty(orderDetl.getQty() - agvLocDetl.getAnfme());
+                if (!orderDetlService.updateById(orderDetl)) {
+                    throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏澶辫触");
+                }
+            }
         }
         //鏇存柊鐩爣搴撲綅鐘舵��
         updateAgvLocMast(agvLocMast,"P");
@@ -532,9 +547,30 @@
     */
     @Override
     @Transactional
+    public String handBack(AgvMobileStartPakin param, Long userId) {
+        Date now = new Date();
+        AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("source_loc_no", param.getDevNo()));
+        agvWrkMast.setIoType(113);
+        agvWrkMast.setModiUser(userId);
+        agvWrkMast.setModiTime(now);
+        if (!agvWrkMastService.update(agvWrkMast,new EntityWrapper<AgvWrkMast>().eq("wrk_no",agvWrkMast.getWrkNo()))) {
+            throw new CoolException("鏇存柊宸ヤ綔妗eけ璐�");
+        }
+        return "ok";
+    }
+
+    /*
+     * 绔欑偣鍥為��
+     */
+    @Override
+    @Transactional
     public String doBack(AgvMobileStartPakin param, Long userId) {
         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()));
+        if (!Cools.isEmpty(agvWrkMastSource)) {
+            throw new CoolException("褰撳墠绔欑偣宸叉湁閫�搴撲换鍔�");
+        }
         Integer oldWrkNo = agvWrkMast.getWrkNo();
         if (!agvWrkMast.getBarcode().equals(param.getBarcode())) {
             throw new CoolException("鍥為��浠诲姟鐨勮揣鏋剁爜涓庡綋鍓嶈揣鏋剁爜涓嶄竴鑷�!");

--
Gitblit v1.9.1