From 608fb6f9529ce51291ef682638a5efc7dd51ac63 Mon Sep 17 00:00:00 2001
From: zwl <1051256694@qq.com>
Date: 星期二, 18 十一月 2025 08:21:08 +0800
Subject: [PATCH] 1.完善找库位 2.新增erp订单删除后,wms订单跟着删除功能 3.新增订单完成后,上报erp,erp报错后显现在出货单中 4.新增一键查询到异常完成订单 5.对销售单据和其他单据进行区分出库 6.对中间表订单状态进行完善 7.新增锁单功能 8.新增任务查询维护加上订单号

---
 src/main/java/com/zy/asrs/controller/MobileController.java |  596 ++++++++++++++++++++++++++++++++---------------------------
 1 files changed, 325 insertions(+), 271 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/MobileController.java b/src/main/java/com/zy/asrs/controller/MobileController.java
index aaf62cd..faacc48 100644
--- a/src/main/java/com/zy/asrs/controller/MobileController.java
+++ b/src/main/java/com/zy/asrs/controller/MobileController.java
@@ -3,12 +3,11 @@
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
-import com.baomidou.mybatisplus.mapper.Wrapper;
+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.R;
-import com.core.exception.CoolException;
 import com.zy.asrs.entity.*;
 import com.zy.asrs.entity.param.CombParam;
 import com.zy.asrs.entity.param.MobileAdjustParam;
@@ -16,13 +15,15 @@
 import com.zy.asrs.entity.result.MobileAdjustResult;
 import com.zy.asrs.mapper.ManLocDetlMapper;
 import com.zy.asrs.service.*;
-import com.zy.common.model.LocDto;
-import com.zy.common.model.TaskDto;
+import com.zy.asrs.service.impl.MatServiceImpl;
 import com.zy.common.model.WrkDto;
 import com.zy.common.utils.HttpHandler;
 import com.zy.common.web.BaseController;
 import com.zy.system.entity.Config;
 import com.zy.system.service.ConfigService;
+import com.zy.third.entity.ExdMaterial;
+import com.zy.third.entity.ExdvYanbu;
+import com.zy.third.mapper.ExdMaterialMapper;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -40,7 +41,7 @@
 @Slf4j
 @RestController
 @RequestMapping("mobile")
-public class MobileController extends BaseController  {
+public class MobileController extends BaseController {
 
     @Autowired
     private MobileService mobileService;
@@ -80,21 +81,26 @@
     @Autowired
     private ConfigService configService;
 
+    @Autowired
+    private ExdMaterialMapper exdMaterialMapper;
+    @Autowired
+    private MatServiceImpl matService;
+
     // 鍟嗗搧涓婃灦
     @RequestMapping("/mat/onSale/auth")
     @ManagerAuth
-    public R matOnSale(@RequestBody CombParam combParam){
+    public R matOnSale(@RequestBody CombParam combParam) {
         mobileService.onSale(combParam);
         return R.ok("涓婃灦鎴愬姛");
     }
+
     // 鍟嗗搧涓嬫灦
     @RequestMapping("/mat/offSale/auth")
     //@ManagerAuth
-    public R matOffSale(@RequestBody OffSaleParam offSaleParam){
+    public R matOffSale(@RequestBody OffSaleParam offSaleParam) {
         mobileService.offSale(offSaleParam);
         return R.ok("涓嬫灦鎴愬姛");
     }
-
 
 
     // 缁勬墭 ----------------------------------------------------------------------------------------------------
@@ -105,7 +111,7 @@
      */
     @RequestMapping("/order/search/orderNo/auth")
     @ManagerAuth
-    public R orderSearchByBarcode(@RequestParam String orderNo){
+    public R orderSearchByBarcode(@RequestParam String orderNo) {
         Order order = orderService.selectByNo(orderNo);
         if (order == null) {
             return R.ok();
@@ -114,26 +120,32 @@
         if (docType.getPakin() == null || docType.getPakin() != 1) {
             return R.ok();
         }
-        if (order.getSettle() > 2) {
-            return R.ok();
-        }
+
         List<OrderDetl> orderDetls = orderService.selectWorkingDetls(order.getId());
         if (Cools.isEmpty(orderDetls)) {
             return R.ok();
         }
-        return R.ok().add(orderDetls);
+        List<OrderDetl> orderDetls1= new ArrayList<>();
+        for (OrderDetl orderDetl : orderDetls) {
+            if(orderDetl.getAnfme()-orderDetl.getWorkQty()>0){
+                orderDetls1.add(orderDetl);
+            }
+
+        }
+        return R.ok().add(orderDetls1);
     }
 
     @RequestMapping("/comb/auth")
     @ManagerAuth(memo = "缁勬墭")
-    public R comb(@RequestBody CombParam combParam){
-        mobileService.comb(combParam, getUserId());
+    public R comb(@RequestBody CombParam combParam) {
+        log.info("缁勬墭鏁版嵁锛歿}", combParam.toString());
+        mobileService.comb(combParam, getUserId(), getUser().getEmail());
         return R.ok("缁勬墭鎴愬姛");
     }
 
     @RequestMapping("/pack/get/auth")
     @ManagerAuth
-    public R packGet(@RequestParam String barcode){
+    public R packGet(@RequestParam String barcode) {
         Pack pack = packService.selectByBarcode(barcode);
         if (pack == null) {
             return R.ok();
@@ -146,7 +158,7 @@
 
     @RequestMapping("/pack/comb/auth")
     @ManagerAuth(memo = "涓嬬嚎缁勬墭")
-    public R packComb(@RequestBody CombParam combParam){
+    public R packComb(@RequestBody CombParam combParam) {
         mobileService.packComb(combParam, getUserId());
         return R.ok("缁勬墭鎴愬姛");
     }
@@ -159,7 +171,7 @@
     @Deprecated
     public R pakoutQuery(@RequestParam(required = false) String barcode,
                          @RequestParam(required = false) Integer staNo,
-                         @RequestParam(required = false) String matnr){
+                         @RequestParam(required = false) String matnr) {
         if (Cools.isEmpty(barcode) && Cools.isEmpty(matnr)) {
             return R.ok();
         }
@@ -183,7 +195,7 @@
      */
     @RequestMapping("/pakout/confirm/barcode/auth")
     @ManagerAuth
-    public R pakoutQueryByBarcode(@RequestParam(required = false) String barcode){
+    public R pakoutQueryByBarcode(@RequestParam(required = false) String barcode) {
         if (Cools.isEmpty(barcode)) {
             return R.ok();
         }
@@ -200,7 +212,7 @@
     // 鏍规嵁搴撲綅鐮佸拰鍟嗗搧鐮佹悳绱㈠晢鍝�
     @RequestMapping("/mat/find/auth")
     public R find(@RequestParam(required = false) String locNo
-            , @RequestParam(required = false) String matnr){
+            , @RequestParam(required = false) String matnr) {
         //List<ManLocDetl> manLocDetls = manLocDetlMapper.selectItem0(locNo, matnr);
         ManLocDetl manLocDetl = manLocDetlMapper.selectLocNo0(locNo, matnr);
         return R.ok(manLocDetl);
@@ -213,7 +225,7 @@
     @RequestMapping("/pakout/confirm/pick/auth")
     @ManagerAuth
     public R pakoutQueryByBarcode(@RequestParam(required = false) Integer wrkNo
-                                , @RequestParam(required = false) String matnr){
+            , @RequestParam(required = false) String matnr) {
         if (Cools.isEmpty(wrkNo)) {
             return R.ok();
         }
@@ -279,9 +291,9 @@
                 for (WrkDetl wrkDetl : dto.getWrkDetls()) {
                     wrkDetlService.updateInspect(wrkDetl.getWrkNo(), wrkDetl.getMatnr(), wrkDetl.getBatch());
                 }
-                if(wrkMast.getIoType() == 103 || wrkMast.getIoType() == 107) {
+                if (wrkMast.getIoType() == 103 || wrkMast.getIoType() == 107) {
                     wrkMast.setWrkSts(34L);//涓嬫灦瀹屾垚绛夊緟鍥炲簱
-                }else {
+                } else {
                     wrkMast.setWrkSts(15L);
                 }
                 wrkMastService.updateById(wrkMast);
@@ -340,7 +352,7 @@
 
     @RequestMapping("/adjust/auth")
     @ManagerAuth(memo = "鐩樼偣")
-    public R adjust(@RequestBody MobileAdjustParam combParam){
+    public R adjust(@RequestBody MobileAdjustParam combParam) {
         mobileService.adjust(combParam, getUserId());
         return R.ok("鐩樼偣鎴愬姛");
     }
@@ -348,10 +360,10 @@
     @PostMapping("/order/out/pakout/auth")
     @ManagerAuth(memo = "璁㈠崟鍑哄簱")
     public synchronized R pakoutByOrder(@RequestBody JSONObject param) {
-        if(!param.containsKey("staNo") || !param.containsKey("orderNo")){
+        if (!param.containsKey("staNo") || !param.containsKey("orderNo")) {
             return R.parse(BaseRes.PARAM);
         }
-        mobileService.pakoutByOrder(param,getUserId());
+        mobileService.pakoutByOrder(param, getUserId());
         return R.ok("鍑哄簱鎴愬姛");
     }
 
@@ -359,38 +371,39 @@
 
     /**
      * 琛ョ┖鏉�   鍖哄煙鍒扮偣
+     *
      * @param locNo 鐩爣绔欑偣
      * @param size  鎵樼洏澶у皬 1锛氬皬鎵樼洏  2锛氬ぇ鎵樼洏
      * @return
      */
     @RequestMapping("/FillEmptyPallets")
     public synchronized R FillEmptyPallets(@RequestParam(required = false) String locNo
-            ,@RequestParam(required = false) String size){
+            , @RequestParam(required = false) String size) {
         if (Cools.isEmpty(locNo) || Cools.isEmpty(size)) {
             return R.error("绔欑偣鎴栬�呭ぇ灏忎笉鑳戒负绌�");
 
         }
         //绌烘墭鐩樼紦鍐插尯 灏忥細E8  澶э細E9
-        String rStaNo ="E8";
-        if(size.equals("2")){
+        String rStaNo = "E8";
+        if (size.equals("2")) {
             rStaNo = "E9";
         }
-        LinkedHashMap<String,Object> rcsParam=new LinkedHashMap<>();
+        LinkedHashMap<String, Object> rcsParam = new LinkedHashMap<>();
         rcsParam.put("taskType", "PF-FMR-COMMON");
-        List<LinkedHashMap<String,Object>> targetRoutes=new ArrayList<>();
-        LinkedHashMap<String,Object> t1=new LinkedHashMap<>();
-        LinkedHashMap<String,Object> t2=new LinkedHashMap<>();
+        List<LinkedHashMap<String, Object>> targetRoutes = new ArrayList<>();
+        LinkedHashMap<String, Object> t1 = new LinkedHashMap<>();
+        LinkedHashMap<String, Object> t2 = new LinkedHashMap<>();
         t1.put("seq", 0);
-        t1.put("type","ZONE");
+        t1.put("type", "ZONE");
         t1.put("code", rStaNo);
-        t1.put("autoStart",0);
-        t1.put("operation","COLLECT");
+        t1.put("autoStart", 0);
+        t1.put("operation", "COLLECT");
 
         t2.put("seq", 0);
-        t2.put("type","SITE");
+        t2.put("type", "SITE");
         t2.put("code", locNo);
-        t2.put("autoStart",0);
-        t2.put("operation","DELIVERY");
+        t2.put("autoStart", 0);
+        t2.put("operation", "DELIVERY");
 
         targetRoutes.add(t1);
         targetRoutes.add(t2);
@@ -398,123 +411,12 @@
         rcsParam.put("initPriority", 100);
 
 
-        String response ="";
-        Boolean bool =false;
+        String response = "";
+        Boolean bool = false;
         String msg = "";
-        HashMap<String,Object> map = new HashMap<>();
+        HashMap<String, Object> map = new HashMap<>();
         Date date = new Date();
-        String time = date.getTime()+"";
-
-        map.put("X-LR-REQUEST-ID", time);
-        try {
-            log.info("wms娲惧彂鎼繍浠诲姟缁橝GV鎼繍={}", rcsParam);
-            response = new HttpHandler.Builder()
-                     .setHeaders(map)
-                    .setUri(url)
-                    .setHttps(true)
-                    .setPath(attrcs)
-                    .setJson(JSON.toJSONString(rcsParam))
-                    .build()
-                    .doPostCloseSSL();
-            JSONObject jsonObject = JSON.parseObject(response);
-            if(jsonObject.getString("code").equals("SUCCESS")){
-                bool = true;
-            }else{
-                msg=jsonObject.getString("message");
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            log.error("wms娲惧彂鎼繍浠诲姟缁橝GV鎼繍澶辫触杩斿洖鍊�={}", response);
-        } finally {
-            apiLogService.save("wms娲惧彂鎼繍浠诲姟缁橝GV鎼繍"
-                    , url + attrcs
-                    , null
-                    , "127.0.0.1"
-                    , JSON.toJSONString(rcsParam)
-                    , response
-                    , bool
-            );
-        }
-
-        if(bool){
-            return R.ok();
-        }else {
-            return R.error(msg);
-        }
-
-    }
-
-    /**
-     * 绌烘墭鐩樺洖搴�
-     * @param sourceStaNo 鍘熺珯鐐�
-     * @param barcode  鎵樼洏澶у皬 1锛氬皬鎵樼洏  2锛氬ぇ鎵樼洏  鐩爣鍖烘垨鑰呭贩閬�
-     * @return
-     */
-    @RequestMapping("/FillEmptyPalletsStack")
-    public synchronized R FillEmptyPalletsStack(@RequestParam(required = false) String sourceStaNo
-            ,@RequestParam(required = false) String barcode){
-        if (Cools.isEmpty(sourceStaNo) || Cools.isEmpty(barcode)) {
-            return R.error("绔欑偣鎴栬�呭ぇ灏忎笉鑳戒负绌�");
-
-        }
-        //绌烘墭鐩樼紦鍐插尯 灏忥細E8  澶э細E9
-        String rStaNo ="E8";
-        String type ="ZONE"; //鍖哄煙
-        if(barcode.substring(0,1).equals("9")){
-            rStaNo = "E9";
-        }else{
-            Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "autoE").eq("status", "1"));
-
-            if (config != null) {
-                type ="STACK"; //宸烽亾
-                if (Cools.isEmpty(config.getValue())) {
-                    rStaNo = rStaNo + "01";
-                    config.setValue("2");
-                }else if (config.getValue().equals("1")) {
-                    rStaNo = rStaNo + "01";
-                    config.setValue("2");
-                }else if (config.getValue().equals("2")) {
-                    rStaNo = rStaNo + "02";
-                    config.setValue("3");
-                }else if (config.getValue().equals("3")) {
-                    rStaNo = rStaNo + "03";
-                    config.setValue("1");
-                }
-                configService.updateById(config);
-            }
-        }
-
-
-
-        LinkedHashMap<String,Object> rcsParam=new LinkedHashMap<>();
-        rcsParam.put("taskType", "PF-FMR-COMMON");
-        List<LinkedHashMap<String,Object>> targetRoutes=new ArrayList<>();
-        LinkedHashMap<String,Object> t1=new LinkedHashMap<>();
-        LinkedHashMap<String,Object> t2=new LinkedHashMap<>();
-        t1.put("seq", 0);
-        t1.put("type","SITE");
-        t1.put("code", sourceStaNo);
-        t1.put("autoStart",0);
-        t1.put("operation","COLLECT");
-
-        t2.put("seq", 0);
-        t2.put("type",type);
-        t2.put("code", rStaNo);
-        t2.put("autoStart",0);
-        t2.put("operation","DELIVERY");
-
-        targetRoutes.add(t1);
-        targetRoutes.add(t2);
-        rcsParam.put("targetRoute", targetRoutes);
-        rcsParam.put("initPriority", 100);
-
-
-        String response ="";
-        Boolean bool =false;
-        String msg = "";
-        HashMap<String,Object> map = new HashMap<>();
-        Date date = new Date();
-        String time = date.getTime()+"";
+        String time = date.getTime() + "";
 
         map.put("X-LR-REQUEST-ID", time);
         try {
@@ -528,10 +430,10 @@
                     .build()
                     .doPostCloseSSL();
             JSONObject jsonObject = JSON.parseObject(response);
-            if(jsonObject.getString("code").equals("SUCCESS")){
+            if (jsonObject.getString("code").equals("SUCCESS")) {
                 bool = true;
-            }else{
-                msg=jsonObject.getString("message");
+            } else {
+                msg = jsonObject.getString("message");
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -547,50 +449,158 @@
             );
         }
 
-        if(bool){
+        if (bool) {
             return R.ok();
-        }else {
+        } else {
             return R.error(msg);
         }
 
     }
 
+    /**
+     * 绌烘墭鐩樺洖搴�
+     *
+     * @param sourceStaNo 鍘熺珯鐐�
+     * @param barcode     鎵樼洏澶у皬 1锛氬皬鎵樼洏  2锛氬ぇ鎵樼洏  鐩爣鍖烘垨鑰呭贩閬�
+     * @return
+     */
+    @RequestMapping("/FillEmptyPalletsStack")
+    public synchronized R FillEmptyPalletsStack(@RequestParam(required = false) String sourceStaNo
+            , @RequestParam(required = false) String barcode) {
+        if (Cools.isEmpty(sourceStaNo) || Cools.isEmpty(barcode)) {
+            return R.error("绔欑偣鎴栬�呭ぇ灏忎笉鑳戒负绌�");
+
+        }
+        //绌烘墭鐩樼紦鍐插尯 灏忥細E8  澶э細E9
+        String rStaNo = "E8";
+        Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "autoE").eq("status", "1"));
+            String type = "ZONE"; //鍖哄煙
+            if (barcode.substring(0, 1).equals("9")) {
+                rStaNo = "E9";
+            }else {
+                if (config != null) {
+                    type = "STACK"; //宸烽亾
+                    if (Cools.isEmpty(config.getValue())) {
+                        rStaNo = rStaNo + "01";
+                        config.setValue("2");
+                    } else if (config.getValue().equals("1")) {
+                        rStaNo = rStaNo + "01";
+                        config.setValue("2");
+                    } else if (config.getValue().equals("2")) {
+                        rStaNo = rStaNo + "02";
+                        config.setValue("3");
+                    } else if (config.getValue().equals("3")) {
+                        rStaNo = rStaNo + "03";
+                        config.setValue("1");
+                    }
+                    configService.updateById(config);
+                }
+            }
+
+            LinkedHashMap<String, Object> rcsParam = new LinkedHashMap<>();
+            rcsParam.put("taskType", "PF-FMR-COMMON");
+            List<LinkedHashMap<String, Object>> targetRoutes = new ArrayList<>();
+            LinkedHashMap<String, Object> t1 = new LinkedHashMap<>();
+            LinkedHashMap<String, Object> t2 = new LinkedHashMap<>();
+            t1.put("seq", 0);
+            t1.put("type", "SITE");
+            t1.put("code", sourceStaNo);
+            t1.put("autoStart", 0);
+            t1.put("operation", "COLLECT");
+
+            t2.put("seq", 0);
+            t2.put("type", type);
+            t2.put("code", rStaNo);
+            t2.put("autoStart", 0);
+            t2.put("operation", "DELIVERY");
+
+            targetRoutes.add(t1);
+            targetRoutes.add(t2);
+            rcsParam.put("targetRoute", targetRoutes);
+            rcsParam.put("initPriority", 100);
+
+
+            String response = "";
+            Boolean bool = false;
+            String msg = "";
+            HashMap<String, Object> map = new HashMap<>();
+            Date date = new Date();
+            String time = date.getTime() + "";
+
+            map.put("X-LR-REQUEST-ID", time);
+            try {
+                log.info("wms娲惧彂鎼繍浠诲姟缁橝GV鎼繍={}", rcsParam);
+                response = new HttpHandler.Builder()
+                        .setHeaders(map)
+                        .setUri(url)
+                        .setHttps(true)
+                        .setPath(attrcs)
+                        .setJson(JSON.toJSONString(rcsParam))
+                        .build()
+                        .doPostCloseSSL();
+                JSONObject jsonObject = JSON.parseObject(response);
+                if (jsonObject.getString("code").equals("SUCCESS")) {
+                    bool = true;
+                } else {
+                    msg = jsonObject.getString("message");
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+                log.error("wms娲惧彂鎼繍浠诲姟缁橝GV鎼繍澶辫触杩斿洖鍊�={}", response);
+            } finally {
+                apiLogService.save("wms娲惧彂鎼繍浠诲姟缁橝GV鎼繍"
+                        , url + attrcs
+                        , null
+                        , "127.0.0.1"
+                        , JSON.toJSONString(rcsParam)
+                        , response
+                        , bool
+                );
+            }
+
+            if (bool) {
+                return R.ok();
+            } else {
+                return R.error(msg);
+            }
+    }
 
     /**
      * 鎵ц绉诲簱浠诲姟--鐐瑰埌鐐�
+     *
      * @param sourceStaNo
      * @param staNo
      * @return
      */
     @RequestMapping("/SITESITEAGVMove")
     public synchronized R SITESITEAGVMove(@RequestParam(required = false) String sourceStaNo
-            ,@RequestParam(required = false) String staNo
-            ,@RequestParam(required = false) String taskNo){
+            , @RequestParam(required = false) String staNo
+            , @RequestParam(required = false) String taskNo) {
         if (Cools.isEmpty(sourceStaNo) || Cools.isEmpty(staNo)) {
             return R.error("婧愮珯鐐瑰拰鐩爣绔欑偣涓嶈兘涓虹┖");
 
         }
 
-        LinkedHashMap<String,Object> rcsParam=new LinkedHashMap<>();
+        LinkedHashMap<String, Object> rcsParam = new LinkedHashMap<>();
         rcsParam.put("taskType", "PF-FMR-COMMON");
-        if(!Cools.isEmpty(taskNo)){
+        if (!Cools.isEmpty(taskNo)) {
             rcsParam.put("robotTaskCode", taskNo);
         }
 
-        List<LinkedHashMap<String,Object>> targetRoutes=new ArrayList<>();
-        LinkedHashMap<String,Object> t1=new LinkedHashMap<>();
-        LinkedHashMap<String,Object> t2=new LinkedHashMap<>();
+        List<LinkedHashMap<String, Object>> targetRoutes = new ArrayList<>();
+        LinkedHashMap<String, Object> t1 = new LinkedHashMap<>();
+        LinkedHashMap<String, Object> t2 = new LinkedHashMap<>();
         t1.put("seq", 0);
-        t1.put("type","SITE");
+        t1.put("type", "SITE");
         t1.put("code", sourceStaNo);
-        t1.put("autoStart",0);
-        t1.put("operation","COLLECT");
+        t1.put("autoStart", 0);
+        t1.put("operation", "COLLECT");
 
         t2.put("seq", 0);
-        t2.put("type","SITE");
+        t2.put("type", "SITE");
         t2.put("code", staNo);
-        t2.put("autoStart",0);
-        t2.put("operation","DELIVERY");
+        t2.put("autoStart", 0);
+        t2.put("operation", "DELIVERY");
 
         targetRoutes.add(t1);
         targetRoutes.add(t2);
@@ -598,12 +608,12 @@
         rcsParam.put("initPriority", 100);
 
 
-        String response ="";
-        Boolean bool =false;
+        String response = "";
+        Boolean bool = false;
         String msg = "";
-        HashMap<String,Object> map = new HashMap<>();
+        HashMap<String, Object> map = new HashMap<>();
         Date date = new Date();
-        String time = date.getTime()+"";
+        String time = date.getTime() + "";
 
         map.put("X-LR-REQUEST-ID", time);
         try {
@@ -617,10 +627,10 @@
                     .build()
                     .doPostCloseSSL();
             JSONObject jsonObject = JSON.parseObject(response);
-            if(jsonObject.getString("code").equals("SUCCESS")){
+            if (jsonObject.getString("code").equals("SUCCESS")) {
                 bool = true;
-            }else{
-                msg=jsonObject.getString("message");
+            } else {
+                msg = jsonObject.getString("message");
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -636,9 +646,9 @@
             );
         }
 
-        if(bool){
+        if (bool) {
             return R.ok();
-        }else {
+        } else {
             return R.error(msg);
         }
 
@@ -646,38 +656,39 @@
 
     /**
      * 鎵ц绉诲簱浠诲姟--鐐瑰埌鍖哄煙
+     *
      * @param sourceStaNo
      * @param staNo
      * @return
      */
     @RequestMapping("/SITEZONEAGVMove")
     public synchronized R SITEZONEAGVMove(@RequestParam(required = false) String sourceStaNo
-            ,@RequestParam(required = false) String staNo
-            ,@RequestParam(required = false) String taskNo){
+            , @RequestParam(required = false) String staNo
+            , @RequestParam(required = false) String taskNo) {
         if (Cools.isEmpty(sourceStaNo) || Cools.isEmpty(staNo)) {
             return R.error("婧愮珯鐐瑰拰鐩爣绔欑偣涓嶈兘涓虹┖");
 
         }
-        LinkedHashMap<String,Object> rcsParam=new LinkedHashMap<>();
+        LinkedHashMap<String, Object> rcsParam = new LinkedHashMap<>();
         rcsParam.put("taskType", "PF-FMR-COMMON");
-        if(!Cools.isEmpty(taskNo)){
+        if (!Cools.isEmpty(taskNo)) {
             rcsParam.put("robotTaskCode", taskNo);
         }
 
-        List<LinkedHashMap<String,Object>> targetRoutes=new ArrayList<>();
-        LinkedHashMap<String,Object> t1=new LinkedHashMap<>();
-        LinkedHashMap<String,Object> t2=new LinkedHashMap<>();
+        List<LinkedHashMap<String, Object>> targetRoutes = new ArrayList<>();
+        LinkedHashMap<String, Object> t1 = new LinkedHashMap<>();
+        LinkedHashMap<String, Object> t2 = new LinkedHashMap<>();
         t1.put("seq", 0);
-        t1.put("type","SITE");
+        t1.put("type", "SITE");
         t1.put("code", sourceStaNo);
-        t1.put("autoStart",0);
-        t1.put("operation","COLLECT");
+        t1.put("autoStart", 0);
+        t1.put("operation", "COLLECT");
 
         t2.put("seq", 0);
-        t2.put("type","ZONE");
+        t2.put("type", "ZONE");
         t2.put("code", staNo);
-        t2.put("autoStart",0);
-        t2.put("operation","DELIVERY");
+        t2.put("autoStart", 0);
+        t2.put("operation", "DELIVERY");
 
         targetRoutes.add(t1);
         targetRoutes.add(t2);
@@ -685,12 +696,12 @@
         rcsParam.put("initPriority", 100);
 
 
-        String response ="";
-        Boolean bool =false;
+        String response = "";
+        Boolean bool = false;
         String msg = "";
-        HashMap<String,Object> map = new HashMap<>();
+        HashMap<String, Object> map = new HashMap<>();
         Date date = new Date();
-        String time = date.getTime()+"";
+        String time = date.getTime() + "";
 
         map.put("X-LR-REQUEST-ID", time);
         try {
@@ -704,10 +715,10 @@
                     .build()
                     .doPostCloseSSL();
             JSONObject jsonObject = JSON.parseObject(response);
-            if(jsonObject.getString("code").equals("SUCCESS")){
+            if (jsonObject.getString("code").equals("SUCCESS")) {
                 bool = true;
-            }else{
-                msg=jsonObject.getString("message");
+            } else {
+                msg = jsonObject.getString("message");
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -723,9 +734,9 @@
             );
         }
 
-        if(bool){
+        if (bool) {
             return R.ok();
-        }else {
+        } else {
             return R.error(msg);
         }
 
@@ -733,38 +744,39 @@
 
     /**
      * 鎵ц绉诲簱浠诲姟--鍖哄煙鍒扮偣
+     *
      * @param sourceStaNo
      * @param staNo
      * @return
      */
     @RequestMapping("/ZONESITEAGVMove")
     public synchronized R ZONESITEAGVMove(@RequestParam(required = false) String sourceStaNo
-            ,@RequestParam(required = false) String staNo
-            ,@RequestParam(required = false) String taskNo){
+            , @RequestParam(required = false) String staNo
+            , @RequestParam(required = false) String taskNo) {
         if (Cools.isEmpty(sourceStaNo) || Cools.isEmpty(staNo)) {
             return R.error("婧愮珯鐐瑰拰鐩爣绔欑偣涓嶈兘涓虹┖");
 
         }
-        LinkedHashMap<String,Object> rcsParam=new LinkedHashMap<>();
+        LinkedHashMap<String, Object> rcsParam = new LinkedHashMap<>();
         rcsParam.put("taskType", "PF-FMR-COMMON");
-        if(!Cools.isEmpty(taskNo)){
+        if (!Cools.isEmpty(taskNo)) {
             rcsParam.put("robotTaskCode", taskNo);
         }
 
-        List<LinkedHashMap<String,Object>> targetRoutes=new ArrayList<>();
-        LinkedHashMap<String,Object> t1=new LinkedHashMap<>();
-        LinkedHashMap<String,Object> t2=new LinkedHashMap<>();
+        List<LinkedHashMap<String, Object>> targetRoutes = new ArrayList<>();
+        LinkedHashMap<String, Object> t1 = new LinkedHashMap<>();
+        LinkedHashMap<String, Object> t2 = new LinkedHashMap<>();
         t1.put("seq", 0);
-        t1.put("type","ZONE");
+        t1.put("type", "ZONE");
         t1.put("code", sourceStaNo);
-        t1.put("autoStart",0);
-        t1.put("operation","COLLECT");
+        t1.put("autoStart", 0);
+        t1.put("operation", "COLLECT");
 
         t2.put("seq", 0);
-        t2.put("type","SITE");
+        t2.put("type", "SITE");
         t2.put("code", staNo);
-        t2.put("autoStart",0);
-        t2.put("operation","DELIVERY");
+        t2.put("autoStart", 0);
+        t2.put("operation", "DELIVERY");
 
         targetRoutes.add(t1);
         targetRoutes.add(t2);
@@ -772,12 +784,12 @@
         rcsParam.put("initPriority", 100);
 
 
-        String response ="";
-        Boolean bool =false;
+        String response = "";
+        Boolean bool = false;
         String msg = "";
-        HashMap<String,Object> map = new HashMap<>();
+        HashMap<String, Object> map = new HashMap<>();
         Date date = new Date();
-        String time = date.getTime()+"";
+        String time = date.getTime() + "";
 
         map.put("X-LR-REQUEST-ID", time);
         try {
@@ -791,10 +803,10 @@
                     .build()
                     .doPostCloseSSL();
             JSONObject jsonObject = JSON.parseObject(response);
-            if(jsonObject.getString("code").equals("SUCCESS")){
+            if (jsonObject.getString("code").equals("SUCCESS")) {
                 bool = true;
-            }else{
-                msg=jsonObject.getString("message");
+            } else {
+                msg = jsonObject.getString("message");
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -810,9 +822,9 @@
             );
         }
 
-        if(bool){
+        if (bool) {
             return R.ok();
-        }else {
+        } else {
             return R.error(msg);
         }
 
@@ -820,54 +832,58 @@
 
     /**
      * AGV绔欑偣缁戝畾鍜岃В缁�
-     * @param sourceStaNo   //绔欑偣
-     * @param barcodeType   //鎵樼洏鐮�
-     * @param invoke        //BIND涓虹粦瀹�    UNBIND涓鸿В缁�
+     *
+     * @param sourceStaNo //绔欑偣
+     * @param barcodeType //鎵樼洏鐮�
+     * @param invoke      //BIND涓虹粦瀹�    UNBIND涓鸿В缁�
      * @return
      */
     @RequestMapping("/siteBindAndUnbind")
     public synchronized R siteBindAndUnbind(@RequestParam(required = false) String sourceStaNo
-            ,@RequestParam(required = false) String barcodeType
-            ,@RequestParam(required = false) String invoke){
+            , @RequestParam(required = false) String barcodeType
+            , @RequestParam(required = false) String invoke) {
         if (Cools.isEmpty(sourceStaNo) || Cools.isEmpty(barcodeType)) {
             return R.error("绔欑偣鍜屾墭鐩樼被鍨嬩笉鑳戒负绌�");
 
         }
-        if(barcodeType.substring(0,1).equals("8")){
-            barcodeType="11";
-        }else if(barcodeType.substring(0,1).equals("9")){
-            barcodeType="21";
+        if (barcodeType.substring(0, 1).equals("8")) {
+            barcodeType = "11";
+        } else if (barcodeType.substring(0, 1).equals("9")) {
+            barcodeType = "21";
         }
-        LinkedHashMap<String,Object> rcsParam=new LinkedHashMap<>();
+        LinkedHashMap<String, Object> rcsParam = new LinkedHashMap<>();
         rcsParam.put("slotCategory", "SITE");
         rcsParam.put("slotCode", sourceStaNo);
         rcsParam.put("carrierCategory", "PALLET");
         rcsParam.put("carrierType", barcodeType);//11涓哄皬鎵樼洏   21涓哄ぇ鎵樼洏
-if(sourceStaNo.equals("101")){
-    rcsParam.put("carrierDir","0");
-}else  if(sourceStaNo.equals("R01")||sourceStaNo.equals("R03")){
-    rcsParam.put("carrierDir","-90");
+        if (sourceStaNo.equals("101")) {
+            rcsParam.put("carrierDir", "0");
+        } else if (sourceStaNo.equals("R01") || sourceStaNo.equals("R03")) {
+            rcsParam.put("carrierDir", "-90");
 
-    }else  if(sourceStaNo.equals("R02")){
-    rcsParam.put("carrierDir","90");
-}else {
-    rcsParam.put("carrierDir","180");
-}
+        } else if (sourceStaNo.equals("R02")) {
+            rcsParam.put("carrierDir", "90");
+        } else if(sourceStaNo.substring(0,1).equals("C")){
+            rcsParam.put("carrierDir", "90");
+        }
+        else{
+            rcsParam.put("carrierDir", "180");
+        }
 
         rcsParam.put("temporary", "");
         rcsParam.put("invoke", invoke);
 
 
-        String response ="";
-        Boolean bool =false;
+        String response = "";
+        Boolean bool = false;
         String msg = "";
-        HashMap<String,Object> map = new HashMap<>();
+        HashMap<String, Object> map = new HashMap<>();
         Date date = new Date();
-        String time = date.getTime()+"";
+        String time = date.getTime() + "";
 
         map.put("X-LR-REQUEST-ID", time);
         try {
-            log.info("WMS瀹屾垚"+invoke+"agv绔欑偣={},涓婃姤鍙傛暟涓�={}",sourceStaNo,rcsParam);
+            log.info("WMS瀹屾垚" + invoke + "agv绔欑偣={},涓婃姤鍙傛暟涓�={}", sourceStaNo, rcsParam);
             response = new HttpHandler.Builder()
                     .setHeaders(map)
                     .setUri(url)
@@ -877,16 +893,16 @@
                     .build()
                     .doPostCloseSSL();
             JSONObject jsonObject = JSON.parseObject(response);
-            if(jsonObject.getString("code").equals("SUCCESS")){
+            if (jsonObject.getString("code").equals("SUCCESS")) {
                 bool = true;
-            }else{
-                msg=jsonObject.getString("message");
+            } else {
+                msg = jsonObject.getString("message");
             }
         } catch (Exception e) {
             e.printStackTrace();
-            log.error("WMS瀹屾垚"+invoke+"agv绔欑偣澶辫触={}", response);
+            log.error("WMS瀹屾垚" + invoke + "agv绔欑偣澶辫触={}", response);
         } finally {
-            apiLogService.save("WMS瀹屾垚"+invoke+"agv绔欑偣"+sourceStaNo
+            apiLogService.save("WMS瀹屾垚" + invoke + "agv绔欑偣" + sourceStaNo
                     , url + siteBindAndUnbing
                     , null
                     , "127.0.0.1"
@@ -896,9 +912,9 @@
             );
         }
 
-        if(bool){
+        if (bool) {
             return R.ok();
-        }else {
+        } else {
             return R.error(msg);
         }
 
@@ -906,36 +922,42 @@
 
     /**
      * 绌烘澘鍥炲簱鎴栬�呮嫞鏂欏洖搴�
+     *
      * @param sourceStaNo
      * @param staNo
      * @return
      */
     @RequestMapping("/AGVStartReturn")
     public synchronized R AGVStartReturn(@RequestParam(required = false) String sourceStaNo
-            ,@RequestParam(required = false) String staNo
-            ,@RequestParam(required = false) String taskNo){
+            , @RequestParam(required = false) String staNo
+            , @RequestParam(required = false) String taskNo) {
         if (Cools.isEmpty(sourceStaNo) || Cools.isEmpty(staNo)) {
             return R.error("婧愮珯鐐瑰拰鎵樼洏鐮佷笉鑳戒负绌�");
 
         }
 
-        R r=R.ok();
+        R r = R.ok();
+        //闃叉鏈夋湭涓嬫灦鐨勭墿鏂欑洿鎺ヨ繘琛岀┖鏉垮洖搴撴垨鑰呮嫞鏂欏洖搴�
+        WrkMast wrkMast1 = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", staNo).in("wrk_sts", 33));
+        if (!Cools.isEmpty(wrkMast1)) {
+            return R.error("璇ユ墭鐩�="+wrkMast1.getBarcode()+",娌℃湁涓嬫灦锛岃涓嬫灦鍚庡啀鍥炲簱锛侊紒锛�");
+        }
 
-        WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", staNo).in("io_type",103,105,107));
+        WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", staNo).in("io_type", 103, 105, 107));
         if (wrkMast == null) {
-            r=FillEmptyPalletsStack(sourceStaNo,staNo);
-        }else {
-            if (wrkMast.getWrkSts()>30){
-                return R.error("璇ユ墭鐩�={},娌℃湁涓嬫灦锛岃涓嬫灦鍚庡啀鍥炲簱锛侊紒锛�");
+            r = FillEmptyPalletsStack(sourceStaNo, staNo);
+        } else {
+            if (wrkMast.getWrkSts() > 30&& 34< wrkMast.getWrkSts()) {
+                return R.error("璇ユ墭鐩�="+wrkMast.getBarcode()+",娌℃湁涓嬫灦锛岃涓嬫灦鍚庡啀鍥炲簱锛侊紒锛�");
             }
-            List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("sta_no", wrkMast.getStaNo()).in("io_type",101,103,105,107).lt("wrk_sts", 33));
-            if (!Cools.isEmpty(wrkMasts)){
-                return R.error(wrkMast.getCrnNo()+"鍫嗗灈鏈�,鏈夊嚭搴撲换鍔★紝绂佹鍥炲簱锛侊紒锛�");
+            List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("sta_no", wrkMast.getStaNo()).in("io_type", 101, 103, 105, 107).lt("wrk_sts", 33));
+            if (!Cools.isEmpty(wrkMasts)) {
+                return R.error(wrkMast.getCrnNo() + "鍫嗗灈鏈�,鏈夊嚭搴撲换鍔★紝绂佹鍥炲簱锛侊紒锛�");
             }
             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
             String format = sdf.format(new Date());
-            String s = format+"-" + wrkMast.getWrkNo() + "-" + wrkMast.getBarcode();
-            r=SITESITEAGVMove(sourceStaNo,wrkMast.getStaNo$(),s);
+            String s = format + "-" + wrkMast.getWrkNo() + "-" + wrkMast.getBarcode();
+            r = SITESITEAGVMove(sourceStaNo, wrkMast.getStaNo$(), s);
             if (r.get("code").equals(200)) {
                 wrkMast.setPdcType(s);
                 /**
@@ -955,16 +977,48 @@
 
     /**
      * 鑾峰彇浠撳簱
+     *
      * @return
      */
     @RequestMapping("/ck")
     @PostMapping
-    public R AGVStartReturn(){
-        List<String> list=new ArrayList<>();
+    public R AGVStartReturn() {
+        List<String> list = new ArrayList<>();
         list.add("鍗婃垚鍝佷粨搴�");
         list.add("鎴愬搧浠撳簱");
         return R.ok(list);
     }
 
 
+    @RequestMapping(value = "/mat/tiaoma/auth")
+    @ManagerAuth
+    public R find(@RequestParam("barcode") String barcode) {
+        ExdvYanbu barcode1 = exdMaterialMapper.getBacode(barcode);
+        if (barcode1 == null) {
+            return R.error("鎵规瀵瑰簲鐨勯獙甯冩暟鎹笉瀛樺湪");
+        }
+        Mat mat = matService.selectByMatnr(barcode1.getItemnumber());
+        if(Cools.isEmpty(mat.getUuid())) {
+            ExdMaterial fnumber = exdMaterialMapper.getID(barcode1.getItemnumber());
+            mat.setUuid(fnumber.getId());
+        }
+        mat.setAnfme(barcode1.getQty());
+        mat.setBc(barcode);
+        mat.setBatch(barcode);
+        matService.updateById(mat);
+
+        return R.ok(mat);
+    }
+
+    @RequestMapping(value = "/getOrderNo/auth")
+    @ManagerAuth
+    public R findOrderNo(@RequestParam("orderNo") String orderNo) {
+        Page<Order> orderPage = orderService.selectPage(new Page<>(0, 10), new EntityWrapper<Order>().like("order_no", "%" + orderNo + "%"));
+        List<String> objects = new ArrayList<>();
+        for (Order record : orderPage.getRecords()) {
+            objects.add(record.getOrderNo());
+        }
+        return R.ok(objects);
+    }
+
 }

--
Gitblit v1.9.1