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/entity/param/CombParam.java         |    2 +
 src/main/java/com/zy/asrs/service/impl/MobileServiceImpl.java |   45 ++++++++++++++++++----
 src/main/java/com/zy/asrs/entity/BasStationDetl.java          |   14 +++++++
 src/main/webapp/views/basStation/basStationDetl.html          |    2 
 4 files changed, 53 insertions(+), 10 deletions(-)

diff --git a/src/main/java/com/zy/asrs/entity/BasStationDetl.java b/src/main/java/com/zy/asrs/entity/BasStationDetl.java
index d9a76b5..c9d117b 100644
--- a/src/main/java/com/zy/asrs/entity/BasStationDetl.java
+++ b/src/main/java/com/zy/asrs/entity/BasStationDetl.java
@@ -1,9 +1,11 @@
 package com.zy.asrs.entity;
 
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId;
 import com.baomidou.mybatisplus.enums.IdType;
 import com.baomidou.mybatisplus.annotations.TableField;
 import com.core.common.SpringUtils;
+import com.zy.asrs.service.MatService;
 import com.zy.system.service.UserService;
 import com.zy.system.entity.User;
 import java.text.SimpleDateFormat;
@@ -45,6 +47,9 @@
      */
     @ApiModelProperty(value= "鏁伴噺")
     private Double anfme;
+
+    @ApiModelProperty("鎵ц涓暟閲�")
+    private Double workQty;
 
     /**
      * 鎵樼洏鏉$爜
@@ -441,6 +446,15 @@
         }
     }
 
+    public String getTag$() {
+        MatService service = SpringUtils.getBean(MatService.class);
+        Mat order = service.selectOne(new EntityWrapper<Mat>().eq("matnr", this.matnr));
+        if (Cools.isEmpty(order)){
+            return null;
+        }
+        return order.getTagId$();
+    }
+
     public String getDanger$(){
         if (null == this.danger){ return null; }
         switch (this.danger){
diff --git a/src/main/java/com/zy/asrs/entity/param/CombParam.java b/src/main/java/com/zy/asrs/entity/param/CombParam.java
index 03b03b8..e4f79b0 100644
--- a/src/main/java/com/zy/asrs/entity/param/CombParam.java
+++ b/src/main/java/com/zy/asrs/entity/param/CombParam.java
@@ -24,6 +24,8 @@
     //鍞竴缂栫爜
     private String bsCode;
 
+    private String carBarcode;
+
     private String type;
 
     private List<CombMat> combMats;
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("鍘熷鏁版嵁绉婚櫎澶辫触锛�");
+                }
+            }
+
         }
     }
 
diff --git a/src/main/webapp/views/basStation/basStationDetl.html b/src/main/webapp/views/basStation/basStationDetl.html
index 59c1d7b..32c608e 100644
--- a/src/main/webapp/views/basStation/basStationDetl.html
+++ b/src/main/webapp/views/basStation/basStationDetl.html
@@ -32,7 +32,7 @@
         var cols = [
             {field: 'devNo', align: 'center', title: '绔欑偣鍙板彿'}
         ];
-        cols.push.apply(cols, cacheCols);
+        cols.push.apply(cols, detlCols);
         return cols;
     }
 

--
Gitblit v1.9.1