From 5ee8d702138b67a8070e850ba622aa4b07d64fb9 Mon Sep 17 00:00:00 2001
From: dubin <bindu_bean@163.com>
Date: 星期四, 30 十月 2025 13:00:08 +0800
Subject: [PATCH] #1

---
 src/main/java/com/zy/asrs/controller/WaitPakinController.java |   81 +++++++++++++++++++++++++++++++++++-----
 1 files changed, 70 insertions(+), 11 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/WaitPakinController.java b/src/main/java/com/zy/asrs/controller/WaitPakinController.java
index ef4582e..95b349c 100644
--- a/src/main/java/com/zy/asrs/controller/WaitPakinController.java
+++ b/src/main/java/com/zy/asrs/controller/WaitPakinController.java
@@ -10,10 +10,14 @@
 import com.core.common.Cools;
 import com.core.common.DateUtils;
 import com.core.common.R;
-import com.zy.asrs.entity.WaitPakin;
-import com.zy.asrs.service.WaitPakinService;
+import com.core.exception.CoolException;
+import com.zy.asrs.entity.*;
+import com.zy.asrs.entity.param.CombParam;
+import com.zy.asrs.entity.param.MobileAdjustParam;
+import com.zy.asrs.service.*;
 import com.zy.common.web.BaseController;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.ArrayList;
@@ -26,6 +30,14 @@
 
     @Autowired
     private WaitPakinService waitPakinService;
+    @Autowired
+    private OrderDetlService orderDetlService;
+    @Autowired
+    private WrkMastService wrkMastService;
+    @Autowired
+    private MobileService mobileService;
+    @Autowired
+    private MatService matService;
 
     @RequestMapping(value = "/waitPakin/{id}/auth")
     @ManagerAuth
@@ -44,17 +56,21 @@
         EntityWrapper<WaitPakin> wrapper = new EntityWrapper<>();
         convert(param, wrapper);
         if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
+        else {
+            wrapper.orderBy("modi_time", false);
+        }
         return R.ok(waitPakinService.selectPage(new Page<>(curr, limit), wrapper));
     }
 
     private void convert(Map<String, Object> map, EntityWrapper wrapper){
         for (Map.Entry<String, Object> entry : map.entrySet()){
-            if (entry.getKey().endsWith(">")) {
-                wrapper.ge(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
-            } else if (entry.getKey().endsWith("<")) {
-                wrapper.le(Cools.deleteChar(entry.getKey()), DateUtils.convert(String.valueOf(entry.getValue())));
+            String val = String.valueOf(entry.getValue());
+            if (val.contains(RANGE_TIME_LINK)){
+                String[] dates = val.split(RANGE_TIME_LINK);
+                wrapper.ge(entry.getKey(), DateUtils.convert(dates[0]));
+                wrapper.le(entry.getKey(), DateUtils.convert(dates[1]));
             } else {
-                wrapper.like(entry.getKey(), String.valueOf(entry.getValue()));
+                wrapper.like(entry.getKey(), val);
             }
         }
     }
@@ -69,7 +85,7 @@
 	@RequestMapping(value = "/waitPakin/update/auth")
 	@ManagerAuth
     public R update(WaitPakin waitPakin){
-        if (Cools.isEmpty(waitPakin) || null==waitPakin.getId()){
+        if (Cools.isEmpty(waitPakin)){
             return R.error();
         }
         waitPakinService.updateById(waitPakin);
@@ -78,13 +94,24 @@
 
     @RequestMapping(value = "/waitPakin/delete/auth")
     @ManagerAuth
+    @Transactional
     public R delete(@RequestParam String param){
         List<WaitPakin> list = JSONArray.parseArray(param, WaitPakin.class);
         if (Cools.isEmpty(list)){
-            return R.error();
+            return R.error("鏁版嵁涓虹┖");
         }
         for (WaitPakin entity : list){
+            List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("barcode", entity.getZpallet()));
+            if(!Cools.isEmpty(wrkMasts) || wrkMasts.size() > 0){
+                return R.error("鏉$爜宸茬敓鎴愬叆搴撳伐浣滄。锛岀姝㈠垹闄�");
+            }
             waitPakinService.delete(new EntityWrapper<>(entity));
+            //璁㈠崟鍏宠仈锛屼慨鏀硅鍗曚綔涓氭暟閲�
+            if (!Cools.isEmpty(entity.getOrderNo())) {
+                if (!orderDetlService.decrease(entity, entity.getAnfme())) {
+                    return R.error("璁㈠崟鏁版嵁鍥炴粴澶辫触");
+                }
+            }
         }
         return R.ok();
     }
@@ -109,8 +136,8 @@
         List<Map<String, Object>> result = new ArrayList<>();
         for (WaitPakin waitPakin : page.getRecords()){
             Map<String, Object> map = new HashMap<>();
-            map.put("id", waitPakin.getId());
-            map.put("value", waitPakin.getId());
+            map.put("id", waitPakin.getZpallet());
+            map.put("value", waitPakin.getZpallet());
             result.add(map);
         }
         return R.ok(result);
@@ -126,4 +153,36 @@
         return R.ok();
     }
 
+    /*鍏ュ簱閫氱煡妗g晫闈㈢粍鎵� 闀囨睙鎭掔珛*/
+    @RequestMapping(value = "waitPakin/comb/auth")
+    @ManagerAuth
+    public R comb(WaitPakin waitPakin) {
+        if (Cools.isEmpty(waitPakin.getBarcode())||Cools.isEmpty(waitPakin.getModiUser())||Cools.isEmpty(waitPakin.getAnfme())){
+            return R.error(BaseRes.PARAM);
+        }
+        mobileService.combToWms(waitPakin);
+        return R.ok("缁勬墭鎴愬姛");
+    }
+
+    /*鍏ュ簱閫氱煡妗g晫闈㈠苟鏉� 闀囨睙鎭掔珛*/
+    @RequestMapping(value = "/waitPakin/clamp/auth")
+    @ManagerAuth
+    public R clamp(WaitPakin waitPakin) {
+        if (Cools.isEmpty(waitPakin.getBarcode())||Cools.isEmpty(waitPakin.getModiUser())||Cools.isEmpty(waitPakin.getAnfme())){
+            return R.error(BaseRes.PARAM);
+        }
+        Mat mat = matService.selectById(waitPakin.getModiUser());
+        MobileAdjustParam combParam=new MobileAdjustParam();
+        ArrayList<CombParam.CombMat> combMats=new ArrayList<>();
+        CombParam.CombMat combMat=new CombParam.CombMat();
+        combMat.setSpecs(mat.getSpecs());
+        combMat.setMatnr(mat.getMatnr());
+        combMat.setMaktx(mat.getMaktx());
+        combMat.setAnfme(waitPakin.getAnfme());
+        combMats.add(combMat);
+        combParam.setBarcode(waitPakin.getBarcode());
+        combParam.setCombMats(combMats);
+        mobileService.adjustNew(combParam, Boolean.TRUE, getUserId());
+        return R.ok("骞舵澘鎴愬姛");
+    }
 }

--
Gitblit v1.9.1