From 33572f0281be7b59dbe76c97d635825f0444d5f1 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期五, 26 十二月 2025 14:32:04 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/controller/BarcodeMatnrController.java |  191 +++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 175 insertions(+), 16 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/BarcodeMatnrController.java b/src/main/java/com/zy/asrs/controller/BarcodeMatnrController.java
index bdb26e2..f3aa230 100644
--- a/src/main/java/com/zy/asrs/controller/BarcodeMatnrController.java
+++ b/src/main/java/com/zy/asrs/controller/BarcodeMatnrController.java
@@ -3,50 +3,71 @@
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.plugins.Page;
 import com.core.annotations.ManagerAuth;
+import com.core.common.BaseRes;
 import com.core.common.Cools;
 import com.core.common.DateUtils;
 import com.core.common.R;
-import com.zy.asrs.entity.MatBarcode;
-import com.zy.asrs.service.MatBarcodeService;
+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 lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
+@Slf4j
 @RequestMapping
 @RestController
 public class BarcodeMatnrController extends BaseController {
     @Autowired
     private MatBarcodeService matBarcodeService;
+    @Autowired
+    private MobileService mobileService;
+    @Autowired
+    private MatService matService;
+    @Autowired
+    private WaitPakinService waitPakinService;
+    @Autowired
+    private WrkMastService wrkMastService;
+    @Autowired
+    private WrkDetlService wrkDetlService;
+    @Autowired
+    private LocDetlService locDetlService;
+
     /*
-    * 鐗╂枡鎵樼洏缁戝畾鍒嗛〉鏌ヨ
-    * */
+     * 鐗╂枡鎵樼洏缁戝畾鍒嗛〉鏌ヨ
+     * */
     @RequestMapping(value = "/barcodeMatnr/list/auth")
     @ManagerAuth
-    public R list(@RequestParam(defaultValue = "1")Integer curr,
-                  @RequestParam(defaultValue = "10")Integer limit,
-                  @RequestParam(required = false)String orderByField,
-                  @RequestParam(required = false)String orderByType,
-                  @RequestParam Map<String, Object> param){
+    public R list(@RequestParam(defaultValue = "1") Integer curr,
+                  @RequestParam(defaultValue = "10") Integer limit,
+                  @RequestParam(required = false) String orderByField,
+                  @RequestParam(required = false) String orderByType,
+                  @RequestParam Map<String, Object> param) {
         excludeTrash(param);
         EntityWrapper<MatBarcode> wrapper = new EntityWrapper<>();
         convert(param, wrapper);
-        if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));}
-        else {
+        if (!Cools.isEmpty(orderByField)) {
+            wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));
+        } else {
             wrapper.orderBy("modi_time", false);
         }
         return R.ok(matBarcodeService.selectPage(new Page<>(curr, limit), wrapper));
     }
 
-    private void convert(Map<String, Object> map, EntityWrapper wrapper){
-        for (Map.Entry<String, Object> entry : map.entrySet()){
+    private void convert(Map<String, Object> map, EntityWrapper wrapper) {
+        for (Map.Entry<String, Object> entry : map.entrySet()) {
             String val = String.valueOf(entry.getValue());
-            if (val.contains(RANGE_TIME_LINK)){
+            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]));
@@ -57,12 +78,150 @@
     }
 
     /*
-    * 鐗╂枡鎵樼洏瑙g粦
-    * */
+     * 鐗╂枡鎵樼洏瑙g粦
+     * */
     @RequestMapping("/barcodeMatnr/matnrLostBarcode")
     @ManagerAuth(memo = "鐗╂枡鎵樼洏瑙g粦")
     public R matnrLostBarcode(@RequestBody List<MatBarcode> list) {
         matBarcodeService.deleteMatBarcode(list);
         return R.ok();
     }
+
+    /*
+     * 鎵归噺缁勬墭
+     * */
+    @RequestMapping("/barcodeMatnr/matnrAndBarcode")
+    @ManagerAuth(memo = "鐗╂枡鎵樼洏鎵归噺缁勬墭")
+    public R matnrAndBarcode(@RequestBody List<MatBarcode> list) {
+        if (Cools.isEmpty(list)) {
+            return R.error(BaseRes.PARAM);
+        }
+        for (MatBarcode matBarcode : list) {
+            if (!matBarcode.getZpallet().equals(list.get(0).getZpallet())) {
+                log.info(matBarcode.getZpallet());
+                log.info(list.get(0).getZpallet());
+                throw new CoolException("璇烽�夋嫨鐩稿悓鎵樼洏鐮佺殑鏁版嵁");
+            }
+        }
+        waitPakinService.comb(list);
+        return R.ok("缁勬墭鎴愬姛");
+
+    }
+
+    /*鐗╂枡鎵樼洏缁戝畾
+     *
+     * */
+    @RequestMapping(value = "/barcodeMatnr/add/auth")
+    @ManagerAuth
+    public R add(WaitPakin waitPakin) {
+        if (Cools.isEmpty(waitPakin.getBarcode()) || Cools.isEmpty(waitPakin.getModiUser())) {
+            return R.error(BaseRes.PARAM);
+        }
+        matBarcodeService.addBarcodeMatnr(waitPakin);
+        return R.ok();
+    }
+
+    /*缁勬墭
+     *
+     * */
+//    @RequestMapping(value = "/barcodeMatnr/comb/auth")
+    @ManagerAuth
+    public R comb(WaitPakin waitPakin) {
+        Mat mat = matService.selectById(waitPakin.getModiUser());
+        MatBarcode matBarcode = matBarcodeService.selectbyMatnr(mat.getMatnr());
+        if (matBarcode == null) {
+            throw new CoolException("璇ョ墿鏂欐湭涓庢墭鐩樼粦瀹�");
+        } else {
+            if (!matBarcode.getZpallet().equals(waitPakin.getBarcode())) {
+                throw new CoolException("璇ョ墿鏂欎笌鍏朵粬鎵樼洏缁戝畾锛屼笉鑳戒笌褰撳墠鎵樼洏" + waitPakin.getBarcode() + "缁戝畾锛屼笌璇ョ墿鏂欑粦瀹氱殑鎵樼洏鏄�" + matBarcode.getZpallet());
+            }
+        }
+        if (mat.getColor().equals("鎶ュ簾")) {
+            throw new CoolException("璇ョ墿鏂欏凡鎶ュ簾锛岃鍕跨粦瀹�");
+        }
+        if (Cools.isEmpty(waitPakin.getBarcode()) || Cools.isEmpty(waitPakin.getModiUser()) || Cools.isEmpty(waitPakin.getAnfme())) {
+            return R.error(BaseRes.PARAM);
+        }
+        mobileService.combToWms(waitPakin);
+        return R.ok("缁勬墭鎴愬姛");
+    }
+
+    /*骞舵澘
+     *
+     * */
+//    @RequestMapping(value = "/barcodeMatnr/clamp/auth")
+    @ManagerAuth
+    public R clamp(WaitPakin waitPakin) {
+        if (Cools.isEmpty(waitPakin.getBarcode()) || Cools.isEmpty(waitPakin.getModiUser())) {
+            return R.error(BaseRes.PARAM);
+        }
+        Mat mat = matService.selectById(waitPakin.getModiUser());
+        MatBarcode matBarcode = matBarcodeService.selectbyMatnr(mat.getMatnr());
+        if (matBarcode == null) {
+            throw new CoolException("璇ョ墿鏂欐湭涓庢墭鐩樼粦瀹�");
+        } else {
+            if (!matBarcode.getZpallet().equals(waitPakin.getBarcode())) {
+                throw new CoolException("璇ョ墿鏂欎笌鍏朵粬鎵樼洏缁戝畾锛屼笉鑳戒笌褰撳墠鎵樼洏" + waitPakin.getBarcode() + "缁戝畾锛屼笌璇ョ墿鏂欑粦瀹氱殑鎵樼洏鏄�" + matBarcode.getZpallet());
+            }
+        }
+        MobileAdjustParam combParam = new MobileAdjustParam();
+        ArrayList<CombParam.CombMat> combMats = new ArrayList<>();
+        CombParam.CombMat combMat = new CombParam.CombMat();
+        combMat.setMatnr(mat.getMatnr());
+        combMat.setMaktx(mat.getMaktx());
+//        combMat.setAnfme(waitPakin.getAnfme());
+        combMat.setAnfme(1.0);
+        combMats.add(combMat);
+        combParam.setBarcode(waitPakin.getBarcode());
+        combParam.setCombMats(combMats);
+//        mobileService.adjustNew(combParam, Boolean.TRUE, getUserId());
+        return R.ok("骞舵澘鎴愬姛");
+    }
+
+    /*鎵归噺骞舵澘*/
+    @RequestMapping(value = "/barcodeMatnr/clamp/auth")
+    @ManagerAuth
+    public R clamp2(@RequestBody List<MatBarcode> list) {
+        if (Cools.isEmpty(list)) {
+            return R.error(BaseRes.PARAM);
+        }
+        for (MatBarcode matBarcode : list) {
+            WrkMast wrkMast = wrkMastService.selectByBarcode(matBarcode.getZpallet());
+            if (wrkMast == null){
+                return R.error("鎵樼洏娌℃湁瀵瑰簲宸ヤ綔妗�");
+            }
+            if (wrkMast.getIoType() != 104){
+                return R.error("鎵樼洏瀵瑰簲宸ヤ綔妗d笉鏄苟鏉垮嚭搴�");
+            }
+            if (wrkMast.getWrkSts() != 14){
+                return R.error("鎵樼洏瀵瑰簲宸ヤ綔妗f湭瀹屾垚");
+            }
+            //瀵逛簬宸茬粡缁勬墭杩囩殑 妯″叿 涓嶅厑璁稿啀娆″苟鏉�
+            Integer waitPakinCount = waitPakinService.selectByBarcodeAndMatnr(matBarcode.getMatnr());
+            if (waitPakinCount >= 1){
+                throw new CoolException("璇ユā鍏峰凡缁忕粍鎵�,鍟嗗搧妯″叿鍚嶇О:" + matBarcode.getMatnr());
+            }
+            //瀵逛簬宸茬粡鏈夊簱瀛樼殑妯″叿 涓嶅厑璁稿啀娆″苟鏉�
+            List<LocDetl> locDetlList = locDetlService.selectList(new EntityWrapper<LocDetl>().eq("matnr", matBarcode.getMatnr()));
+            if (!Cools.isEmpty(locDetlList)) {
+                throw new CoolException("璇ユā鍏峰凡缁忓叆搴�,鍟嗗搧妯″叿鍚嶇О:" + matBarcode.getMatnr());
+            }
+            //瀵逛簬宸茬粡鏈夊伐浣滄。鐨勬ā鍏� 涓嶅厑璁稿啀娆″苟鏉�
+            List<WrkDetl> wrkDetlList = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("matnr", matBarcode.getMatnr()));
+            if (!Cools.isEmpty(wrkDetlList)) {
+                throw new CoolException("璇ユā鍏峰凡缁忓瓨鍦ㄥ伐浣滄。,鍟嗗搧妯″叿鍚嶇О:" + matBarcode.getMatnr());
+            }
+            MobileAdjustParam combParam = new MobileAdjustParam();
+            ArrayList<CombParam.CombMat> combMats = new ArrayList<>();
+            CombParam.CombMat combMat = new CombParam.CombMat();
+            combMat.setMatnr(matBarcode.getMatnr());
+            combMat.setMaktx(matBarcode.getMaktx());
+            combMat.setAnfme(1.0);
+            combMats.add(combMat);
+            combParam.setBarcode(matBarcode.getZpallet());
+            combParam.setCombMats(combMats);
+            mobileService.adjustNew(combParam, Boolean.TRUE, getUserId(),matBarcode);
+        }
+        return R.ok("骞舵澘鎴愬姛");
+    }
 }

--
Gitblit v1.9.1