From 6eb6a4b530627471d41979ccbc977a7371e99c1f Mon Sep 17 00:00:00 2001
From: zhangchao <zc857179121@qq.com>
Date: 星期一, 04 十一月 2024 15:36:59 +0800
Subject: [PATCH] 找库位

---
 src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java |   36 ++++++++++++++++++++++++------------
 1 files changed, 24 insertions(+), 12 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 1dd5e23..03b6140 100644
--- a/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java
@@ -150,8 +150,9 @@
                 agvWrkDetlService.insert(wrkDetl);
             } else {
                 Double anfme = agvWrkDetl.getAnfme() + pick.getCount();
+                agvWrkDetl.setIoTime(agvWrkMast.getIoTime());
                 agvWrkDetl.setAnfme(anfme);
-                agvWrkDetl.setModiTime(new Date());
+                agvWrkDetl.setModiTime(now);
                 agvWrkDetlService.update(agvWrkDetl,new EntityWrapper<AgvWrkDetl>().eq("matnr",agvWrkDetl.getMatnr()).eq("three_code",agvWrkDetl.getThreeCode()).eq("supp_code",pick.getSuppCode()));
 
             }
@@ -165,23 +166,21 @@
             }
         }
         //  纭鏄惁鍏ㄩ儴鍑哄簱
-        int sameNumber = 0;
+        double totleWrkdetl = 0.0;
+        double totleLocdetl = 0.0;
         List<AgvWrkDetl> agvWrkDetls = agvWrkDetlService.selectList(new EntityWrapper<AgvWrkDetl>().eq("wrk_no", pickParams.getWrkNo()));
         for (AgvLocDetl agvLocDetl : agvLocDetls) {
-            for (AgvWrkDetl agvWrkDetl : agvWrkDetls) {
-                if (agvLocDetl.getMatnr().equals(agvWrkDetl.getMatnr())
-                    && agvLocDetl.getThreeCode().equals(agvWrkDetl.getThreeCode())
-                    && agvLocDetl.getSuppCode().equals(agvWrkDetl.getSuppCode())
-                    && agvLocDetl.getAnfme().equals(agvWrkDetl.getAnfme())) {
-                    sameNumber++;
-                }
-            }
+            totleLocdetl = totleLocdetl + agvLocDetl.getAnfme();
         }
-        if (agvLocDetls.size() == sameNumber || agvLocDetls.size() == 1) {
+        for (AgvWrkDetl agvWrkDetl : agvWrkDetls) {
+            totleWrkdetl = totleWrkdetl + agvWrkDetl.getAnfme();
+        }
+        if (totleWrkdetl >= totleLocdetl) {
             agvWrkMast.setIoType(101);
-            agvWrkMast.setModiTime(new Date());
             agvWrkMastService.update(agvWrkMast,new EntityWrapper<AgvWrkMast>().eq("wrk_no", pickParams.getWrkNo()));
+
         }
+//        agvLocDetls.size() == 1
 
 
         return "缁勬墭鎴愬姛锛岀粦瀹氱珯鐐规垚鍔�";
@@ -521,6 +520,15 @@
                 if (Cools.isEmpty(orderDetl)) {
                     throw new CoolException("褰撳墠鐗╂枡鐨勮皟鎷ㄥ崟涓嶅瓨鍦紒");
                 }
+                Order order = orderService.selectByNo(orderDetl.getOrderNo());
+                if (Cools.isEmpty(order)) {
+                    throw new CoolException("褰撳墠鐗╂枡鐨勮皟鎷ㄥ崟涓嶅瓨鍦紒");
+                }
+                if (order.getSettle() == 4L) {
+                    if (!orderService.updateSettle(order.getId(),2L,userId)) {
+                        throw new CoolException("璋冩嫧鍗曞洖婊氬紓甯�!");
+                    }
+                }
                 orderDetl.setQty(orderDetl.getQty() - agvLocDetl.getAnfme());
                 if (!orderDetlService.updateById(orderDetl)) {
                     throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏澶辫触");
@@ -591,6 +599,7 @@
             agvWrkDetl.setWrkNo(wrkMast.getWrkNo());
             agvWrkDetl.setModiUser(userId);
             agvWrkDetl.setModiTime(now);
+            agvWrkDetl.setIoTime(now);
             if (!agvWrkDetlService.insert(agvWrkDetl)) {
                 throw new CoolException("淇濆瓨宸ヤ綔鏄庣粏澶辫触");
             }
@@ -745,6 +754,7 @@
         agvWrkMast.setWrkSts(201L);
         agvWrkMast.setModiUser(userId);
         agvWrkMast.setModiTime(now);
+        agvWrkMast.setIoTime(now);
 
 
 
@@ -770,6 +780,7 @@
             agvWrkDetl.setOrderNo(agvWrkDetl.getOrderNo().substring(2));
             agvWrkDetl.setModiUser(userId);
             agvWrkDetl.setModiTime(now);
+            agvWrkDetl.setIoTime(now);
             if (!agvWrkDetlService.update(agvWrkDetl,new EntityWrapper<AgvWrkDetl>()
                     .eq("matnr",agvWrkDetl.getMatnr())
                     .eq("three_code",agvWrkDetl.getThreeCode())
@@ -818,6 +829,7 @@
             agvWrkDetl.setWrkNo(wrkMast.getWrkNo());
             // 淇濇寔宸ヤ綔妗f槑缁�
             agvWrkDetl.setWrkNo(wrkMast.getWrkNo());
+            agvWrkDetl.setIoTime(now);
             agvWrkDetl.setModiUser(userId);
             agvWrkDetl.setModiTime(now);
             if (!agvWrkDetlService.insert(agvWrkDetl)) {

--
Gitblit v1.9.1