From 6ea39c790edb8a59b1637d18383a14019985d2ba Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期五, 12 十二月 2025 11:21:47 +0800
Subject: [PATCH] bug修复 组托上架功能优化

---
 src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java |   45 ++++++++++++++++++++++++++++++++++++---------
 1 files changed, 36 insertions(+), 9 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
index 28662ed..1f89f19 100644
--- a/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java
@@ -1589,17 +1589,16 @@
         if (Objects.isNull(params.getBsCode())) {
             throw new CoolException("BS鐮佷笉鑳戒负绌猴紒锛�");
         }
-        Task task = taskService.selectOne(new EntityWrapper<Task>()
-                .eq("io_type", TaskIOType.PICK_OUT.type)
-                .eq("wrk_sts", 14)
-                .eq("barcode", params.getCarBarcode()));
-        if (Objects.isNull(task)) {
-            throw new CoolException("鏁版嵁閿欒锛氫换鍔′俊鎭瓨鍦紒锛�");
-        }
+//        Task task = taskService.selectOne(new EntityWrapper<Task>()
+//                .eq("io_type", TaskIOType.PICK_OUT.type)
+//                .eq("wrk_sts", 14)
+//                .eq("barcode", params.getCarBarcode()));
+//        if (Objects.isNull(task)) {
+//            throw new CoolException("鏁版嵁閿欒锛氫换鍔′俊鎭瓨鍦紒锛�");
+//        }
 
-        List<TaskDetl> taskDetl = taskDetlService.selectList(new EntityWrapper<TaskDetl>()
+        List<BasStationDetl> taskDetl = basStationDetlService.selectList(new EntityWrapper<BasStationDetl>()
                 .eq("three_code", params.getBsCode())
-                .eq("wrk_no", task.getWrkNo())
                 .eq("zpallet", params.getCarBarcode()));
 
         if (Objects.isNull(taskDetl) || taskDetl.isEmpty()) {
@@ -1688,9 +1687,22 @@
                 throw new CoolException("鐗╂枡锛�" + detlDto.getMatnr() + ", 瓒呭嚭褰撳墠鎵樼洏瑁呰浇涓婇檺锛侊紒");
             }
 
+            BasStationDetl stationDetl = basStationDetlService.selectOne(new EntityWrapper<BasStationDetl>()
+                    .eq("zpallet", param.getCarBarcode())
+                    .eq("three_code", detlDto.getThreeCode()));
+            if (Objects.isNull(stationDetl)) {
+                throw new CoolException("鏄庣粏鍐呭涓嶅瓨鍦紒锛�");
+            }
+
+            Double v = stationDetl.getAnfme() - stationDetl.getWorkQty();
+            if (detlDto.getAnfme().compareTo(v) > 0) {
+                throw new CoolException("缁勬墭涓婇檺涓猴細" + stationDetl.getAnfme() + ", 宸茬粍鎵橈細" + stationDetl.getWorkQty() + ", 杩樺彲缁勬墭锛�" + v);
+            }
+
             WaitPakin waitPakin = new WaitPakin();
             BeanUtils.copyProperties(mat, waitPakin);
             waitPakin.setBatch(detlDto.getBatch());
+            waitPakin.setType(param.getType());
             waitPakin.setZpallet(param.getBarcode());
             // 璁剧疆缁勬墭绫诲瀷
             waitPakin.setType(param.getType());
@@ -1698,6 +1710,7 @@
             waitPakin.setAnfme(detlDto.getAnfme());
             waitPakin.setThreeCode(detlDto.getThreeCode());
             waitPakin.setStatus("Y");
+            waitPakin.setSuppCode(detlDto.getStandby1());
             waitPakin.setStandby1(detlDto.getStandby1());
             waitPakin.setStandby2(detlDto.getStandby2());
             waitPakin.setStandby3(detlDto.getStandby3());
@@ -1711,6 +1724,20 @@
             if (!waitPakinService.insert(waitPakin)) {
                 throw new CoolException("淇濆瓨鍏ュ簱閫氱煡妗eけ璐�");
             }
+
+            Double v1 = stationDetl.getWorkQty() + detlDto.getAnfme();
+            stationDetl.setWorkQty(v1);
+
+            if (!basStationDetlService.updateById(stationDetl)) {
+                throw new CoolException("绔欑偣鏄庣粏淇敼澶辫触");
+            }
+
+            if (v1.compareTo(stationDetl.getWorkQty()) >= 0) {
+                if (!basStationDetlService.deleteById(stationDetl)) {
+                    throw new CoolException("鍘熷鏁版嵁绉婚櫎澶辫触锛�");
+                }
+            }
+
         }
     }
 

--
Gitblit v1.9.1