From 8257d89c461f6553d66fad1e5e3df3d172a00924 Mon Sep 17 00:00:00 2001
From: 1 <1>
Date: 星期六, 29 十一月 2025 18:10:18 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java |  130 +++++++++++++++++++++++++++++++-----------
 1 files changed, 95 insertions(+), 35 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
index 7e40f99..d402788 100644
--- a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -14,13 +14,16 @@
 import com.zy.asrs.entity.result.StockVo;
 import com.zy.asrs.mapper.TagMapper;
 import com.zy.asrs.service.*;
+import com.zy.asrs.task.core.ReturnT;
 import com.zy.asrs.utils.MatUtils;
 import com.zy.asrs.utils.OrderInAndOutUtil;
 import com.zy.asrs.utils.Utils;
+import com.zy.common.constant.ArmConstant;
 import com.zy.common.model.DetlDto;
 import com.zy.common.service.CommonService;
 import com.zy.common.utils.HttpHandler;
 import com.zy.common.utils.NodeUtils;
+import com.zy.erp.kingdee.utils.PostMesDataUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -68,6 +71,8 @@
     private LocOwnerService locOwnerService;
     @Autowired
     private CommonService commonService;
+    @Autowired
+    private LocMastServiceImpl locMastService;
 
     @Override
     @Transactional
@@ -661,7 +666,8 @@
                 .eq("status", 1)
         );
         if (Cools.isEmpty(basArm)){
-            throw new CoolException("鏈烘鑷傞厤缃紓甯革紝鏌ヨ涓嶅埌鏈烘鑷傛暟鎹紒锛侊紒"+ JSON.toJSONString(param));
+            return;
+//            throw new CoolException("鏈烘鑷傞厤缃紓甯革紝鏌ヨ涓嶅埌鏈烘鑷傛暟鎹紒锛侊紒"+ JSON.toJSONString(param));
         }
 
         try{
@@ -700,7 +706,8 @@
                         .eq("status", 1)
         );
         if (Cools.isEmpty(basArmMast)){
-            throw new CoolException("鏈煡璇㈠埌鐩稿叧鏈烘鑷傛媶鐮佸灈浠诲姟锛侊紒锛�"+ JSON.toJSONString(param));
+            return;
+//            throw new CoolException("鏈煡璇㈠埌鐩稿叧鏈烘鑷傛媶鐮佸灈浠诲姟锛侊紒锛�"+ JSON.toJSONString(param));
         }
         if (Integer.parseInt(param.getPick_num()) !=1){
             basArmMast.setStatus(9);
@@ -731,7 +738,8 @@
         if (Cools.isEmpty(basArmMast)){
             throw new CoolException("鏈煡璇㈠埌鐩稿叧鏈烘鑷傛媶鐮佸灈浠诲姟锛侊紒锛�"+ JSON.toJSONString(param));
         }
-        basArmMastService.updateArmMastStatus(param.getArm_no(),basArmMast.getSortingLine(),2,3);
+        basArmMastService.updateArmMastStatus(param.getArm_no(),basArmMast.getSortingLine(),basArmMast.getStaNo(),1,3);
+        basArmMastService.updateArmMastStatus(param.getArm_no(),basArmMast.getSortingLine(),basArmMast.getStaNo(),2,3);
     }
 
     @Override
@@ -752,7 +760,7 @@
                         .eq("status", 5)
         );
         if (!Cools.isEmpty(basArmMast)){
-            basArmMastService.updateArmMastStatus(param.getArm_no(),basArmMast.getSortingLine(), 5,6);
+            basArmMastService.updateArmMastStatus(param.getArm_no(),basArmMast.getSortingLine(),basArmMast.getStaNo(), 5,6);
         }
     }
 
@@ -790,7 +798,6 @@
         if (param == null) {
             throw new CoolException("鍙傛暟涓嶈兘涓虹┖");
         }
-        Integer devpId = 1;
         // 鍒涘缓瀵硅薄锛堟瀯閫犲嚱鏁颁腑宸茬敓鎴� timestamp锛�
         BasAgvMast basAgvMast = new BasAgvMast();
         // 鐢熸垚 WMS 浠诲姟鍙凤紙濡傛棤澶栭儴浼犲叆锛屽彲浠ヤ娇鐢ㄩ洩鑺盜D 鎴栬嚜澧烇級
@@ -806,7 +813,7 @@
         basAgvMast.setAppeTime(new Date());  // 娣诲姞鏃堕棿
         basAgvMast.setModiTime(new Date());  // 淇敼鏃堕棿
         basAgvMast.setIoType(param.getIoType());// 浠诲姟绫诲瀷
-        basAgvMast.setDevpId(devpId);
+        basAgvMast.setFloorNo(param.getFloorNo()); //妤煎眰
 
         // 鎻掑叆鏁版嵁搴�
         basAgvMastService.insert(basAgvMast);
@@ -816,30 +823,38 @@
 
     @Override
     @Transactional
-    public List<AgvLocListDetlParam> getAgvLocList(AgvLocListParam param){
-
-        if (param == null || Cools.isEmpty(param.getLocNoList())) {
-            throw new CoolException("搴撲綅鍙蜂笉鑳戒负绌�");
-        }
-
-        List<String> locNos = param.getLocNoList();
-
+    public List<AgvLocListDetlParam> getAgvLocList(AgvLocListParam param) {
         List<AgvLocListDetlParam> result = new ArrayList<>();
 
-        for (String locNo : locNos) {
+        if (Cools.isEmpty(param.getLocNo())) {
+            EntityWrapper<LocMast> locMastEntityWrapper = new EntityWrapper<>();
+            locMastEntityWrapper.setSqlSelect("TOP 5 loc_no as locNo,loc_sts as locSts")
+                    .where("loc_sts in ('F','D','S','R') and whs_type = '5'");
+            List<LocMast> locMasts = locMastService.selectList(locMastEntityWrapper);
 
-            // 鏌ヨ璇ュ簱浣� detail
-            List<LocDetl> detlList = locDetlService.selectList(
-                    new EntityWrapper<LocDetl>().eq("loc_no", locNo)
+            for (LocMast locMast : locMasts) {
+                result.add(buildAgvLocListDetlParam(locMast.getLocNo(), locMast.getLocSts$()));
+            }
+        } else {
+            LocMast locMast = locMastService.selectOne(
+                    new EntityWrapper<LocMast>().eq("loc_no", param.getLocNo())
             );
-
-            AgvLocListDetlParam dto = new AgvLocListDetlParam();
-            dto.setLocNo(locNo);
-            dto.setAgvDetlList(detlList);
-            result.add(dto);
+            result.add(buildAgvLocListDetlParam(param.getLocNo(), locMast.getLocSts$()));
         }
-
+        
         return result;
+    }
+
+    private AgvLocListDetlParam buildAgvLocListDetlParam(String locNo, String locSts) {
+        List<LocDetl> detlList = locDetlService.selectList(
+                new EntityWrapper<LocDetl>().eq("loc_no", locNo)
+        );
+        
+        AgvLocListDetlParam dto = new AgvLocListDetlParam();
+        dto.setLocNo(locNo);
+        dto.setLocSys(locSts);
+        dto.setAgvDetlList(detlList);
+        return dto;
     }
 
 
@@ -857,23 +872,18 @@
         agvBindCtnrAndBinParam.setReqCode(String.valueOf(System.currentTimeMillis()));
         agvBindCtnrAndBinParam.setCtnrCode(param.getBarcode());
         agvBindCtnrAndBinParam.setCtnrTyp("1");
-        agvBindCtnrAndBinParam.setPositionCode(
-                basAgvLocNoSou != null && basAgvLocNoSou.getAgvLocNo() != null
-                        ? basAgvLocNoSou.getAgvLocNo()
-                        : ""
-        );
-        agvBindCtnrAndBinParam.setStgBinCode(
-                basAgvLocNoEnd != null && basAgvLocNoEnd.getAgvLocNo() != null
-                        ? basAgvLocNoEnd.getAgvLocNo()
-                        : ""
-        );
+        if(basAgvLocNoEnd != null && basAgvLocNoEnd.getAgvLocNo() != null){
+            agvBindCtnrAndBinParam.setStgBinCode(basAgvLocNoEnd.getAgvLocNo());
+        }
+        if(basAgvLocNoSou != null && basAgvLocNoSou.getAgvLocNo() != null){
+            agvBindCtnrAndBinParam.setStgBinCode(basAgvLocNoSou.getAgvLocNo());
+        }
         agvBindCtnrAndBinParam.setIndBind(param.getIndBind());
         try {
             String URL = "http://10.10.10.200:8181/rcms/services/rest/hikRpcService"; // AGV鎺ュ彛鍦板潃
             String mesPath = "bindCtnrAndBin"; // 鎺ュ彛璺緞
             String response = "";
             boolean success = false;
-
             try {
                 log.info("AGV缁戝畾瀹瑰櫒鎺ュ彛璇锋眰鍙傛暟: {}", JSON.toJSONString(agvBindCtnrAndBinParam));
 
@@ -904,5 +914,55 @@
     }
 
 
+    @Override
+    @Transactional
+    public boolean agvApplicationPassedTheGrating(ArmAgvGratingParam arm) {
+        ReturnT<String> result = new PostMesDataUtils().postMesDataArmGrating("鍏夋爡璇锋眰涓嬪彂锛�", ArmConstant.getArmUrl(arm.getArmNo()), ArmConstant.ARM_ADAPTOR_GRATING_AGVENTER, arm);
+        if (result.getCode()==200){
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    @Transactional
+    public boolean agvApplicationPassedTheGrating(AgvGoTheArnParam param) {
+        String URL = "http://10.10.10.200:8181/rcms/services/rest/hikRpcService"; // AGV鎺ュ彛鍦板潃
+        String AGVPath = "continueTask"; // 鎺ュ彛璺緞
+        AgvGoParam agvGoParam = new AgvGoParam();
+        agvGoParam.setCode("0");
+        agvGoParam.setMessage("缁х画鎵ц");
+        agvGoParam.setReqCode(param.getReqCode());
+        ReturnT<String> result = new PostMesDataUtils().postMesDataArmGrating("鍏夋爡涓嬪彂鍚庣户缁换鍔★細", URL, AGVPath, param);
+        if (result.getCode()==200){
+            return true;
+        }
+        return false;
+    }
+
+    @Override
+    @Transactional
+    public boolean agvBindAndBin(String taskNo) {
+        String URL = "http://10.10.10.200:8181/"; // AGV鎺ュ彛鍦板潃
+        String AGVPath = "rcms/services/rest/hikRpcService/bindCtnrAndBin"; // 鎺ュ彛璺緞
+        BasAgvMast basAgvMast = basAgvMastService.selectOne(new EntityWrapper<BasAgvMast>().eq("task_no",taskNo));
+        BasAgvLocNoService basAgvLocNoService = SpringUtils.getBean(BasAgvLocNoService.class);
+        BasAgvLocNo basAgvLocNoEnd = basAgvLocNoService.selectOne(
+                new EntityWrapper<BasAgvLocNo>().eq("sta_no", basAgvMast.getStaNo())
+        );
+        AgvBindCtnrAndBinParam agvBindCtnrAndBinParam = new AgvBindCtnrAndBinParam();
+        agvBindCtnrAndBinParam.setReqCode(basAgvMast.getTaskNo() + "-" + basAgvMast.getTimestamp());
+        agvBindCtnrAndBinParam.setCtnrCode(basAgvMast.getTimestamp().toString());
+        agvBindCtnrAndBinParam.setCtnrTyp("1");
+        agvBindCtnrAndBinParam.setStgBinCode(basAgvLocNoEnd.getAgvLocNo());
+        agvBindCtnrAndBinParam.setIndBind("0");
+        ReturnT<String> resultBind = new PostMesDataUtils().postMesDataArmGrating("AGV瀹瑰櫒缁戝畾瑙g粦", URL,AGVPath, agvBindCtnrAndBinParam);
+        if (resultBind.getCode()!=200){
+            return true;
+        }
+        return false;
+    }
+
+
 
 }

--
Gitblit v1.9.1