Переглянути джерело

入库回库光栅逻辑判断

k 2 роки тому
батько
коміт
212503d29c

+ 10 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/pda/PdaController.java

@@ -45,6 +45,7 @@ import com.ruoyi.common.core.domain.entity.SysDictData;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.PageUtils;
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.system.service.ISysConfigService;
 import com.ruoyi.system.service.ISysDictDataService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -89,6 +90,8 @@ public class PdaController {
     private IWmsDocAsnDetailsService wmsDocAsnDetailsService;
     @Autowired
     private IInvLotLocIdService invLotLocIdService;
+    @Autowired
+    private ISysConfigService iSysConfigService;
 
 
     /*************************************************入库-START****************************************************/
@@ -167,6 +170,13 @@ public class PdaController {
         List<AgvCallDTO> list = new ArrayList<>();
         for (LineCallListFrom lform : lineCallForm.getLineCallList()) {
 
+            // 入库回库检测光栅高度
+            String gratingNo = Constant.GRATING_AND_LOCATION_MAPPING.getByLocation(lform.getLocationFrom()).getValue();
+            boolean isSuperHigh = iSysConfigService.checkGratingIsSuperHigh(gratingNo);
+            if (isSuperHigh) {
+                return AjaxResult.error("光栅监测到货物超高!请人工处理!");
+            }
+
             //入库时绑定托盘
             if (flowConfigHeaderVO.getFlowType().equals("ASN")) {
                 PaForm paForm = new PaForm();

+ 2 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/web/exception/GlobalExceptionHandler.java

@@ -60,7 +60,8 @@ public class GlobalExceptionHandler {
      */
     @ExceptionHandler(ServiceException.class)
     public AjaxResult handleServiceException(ServiceException e, HttpServletRequest request) {
-        log.error(e.getMessage(), e);
+//        log.error(e.getMessage(), e);
+        log.error(e.getMessage());
         Integer code = e.getCode();
         List<String> lockList = redisTemplate.opsForList().range(RedisKey.LOCK_LIST + e.getToken(), 0, -1);
         if (lockList != null && lockList.size() > 0) {

+ 19 - 11
ruoyi-system/src/main/java/com/ruoyi/system/service/ISysConfigService.java

@@ -1,18 +1,18 @@
 package com.ruoyi.system.service;
 
 import java.util.List;
+
 import com.ruoyi.system.domain.SysConfig;
 
 /**
  * 参数配置 服务层
- * 
+ *
  * @author ruoyi
  */
-public interface ISysConfigService
-{
+public interface ISysConfigService {
     /**
      * 查询参数配置信息
-     * 
+     *
      * @param configId 参数配置ID
      * @return 参数配置信息
      */
@@ -20,7 +20,7 @@ public interface ISysConfigService
 
     /**
      * 根据键名查询参数配置信息
-     * 
+     *
      * @param configKey 参数键名
      * @return 参数键值
      */
@@ -28,14 +28,14 @@ public interface ISysConfigService
 
     /**
      * 获取验证码开关
-     * 
+     *
      * @return true开启,false关闭
      */
     public boolean selectCaptchaOnOff();
 
     /**
      * 查询参数配置列表
-     * 
+     *
      * @param config 参数配置信息
      * @return 参数配置集合
      */
@@ -43,7 +43,7 @@ public interface ISysConfigService
 
     /**
      * 新增参数配置
-     * 
+     *
      * @param config 参数配置信息
      * @return 结果
      */
@@ -51,7 +51,7 @@ public interface ISysConfigService
 
     /**
      * 修改参数配置
-     * 
+     *
      * @param config 参数配置信息
      * @return 结果
      */
@@ -59,7 +59,7 @@ public interface ISysConfigService
 
     /**
      * 批量删除参数信息
-     * 
+     *
      * @param configIds 需要删除的参数ID
      * @return 结果
      */
@@ -82,9 +82,17 @@ public interface ISysConfigService
 
     /**
      * 校验参数键名是否唯一
-     * 
+     *
      * @param config 参数信息
      * @return 结果
      */
     public String checkConfigKeyUnique(SysConfig config);
+
+    /**
+     * 检测库位对应光栅是否超高
+     *
+     * @param gratingConfigKey
+     * @return true 超高 false不超高
+     */
+    boolean checkGratingIsSuperHigh(String gratingConfigKey);
 }

+ 24 - 10
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java

@@ -19,7 +19,7 @@ import java.util.List;
 
 /**
  * 参数配置 服务层实现
- * 
+ *
  * @author ruoyi
  */
 @Service
@@ -42,7 +42,7 @@ public class SysConfigServiceImpl implements ISysConfigService
 
     /**
      * 查询参数配置信息
-     * 
+     *
      * @param configId 参数配置ID
      * @return 参数配置信息
      */
@@ -57,7 +57,7 @@ public class SysConfigServiceImpl implements ISysConfigService
 
     /**
      * 根据键名查询参数配置信息
-     * 
+     *
      * @param configKey 参数key
      * @return 参数键值
      */
@@ -82,7 +82,7 @@ public class SysConfigServiceImpl implements ISysConfigService
 
     /**
      * 获取验证码开关
-     * 
+     *
      * @return true开启,false关闭
      */
     @Override
@@ -98,7 +98,7 @@ public class SysConfigServiceImpl implements ISysConfigService
 
     /**
      * 查询参数配置列表
-     * 
+     *
      * @param config 参数配置信息
      * @return 参数配置集合
      */
@@ -110,7 +110,7 @@ public class SysConfigServiceImpl implements ISysConfigService
 
     /**
      * 新增参数配置
-     * 
+     *
      * @param config 参数配置信息
      * @return 结果
      */
@@ -127,7 +127,7 @@ public class SysConfigServiceImpl implements ISysConfigService
 
     /**
      * 修改参数配置
-     * 
+     *
      * @param config 参数配置信息
      * @return 结果
      */
@@ -144,7 +144,7 @@ public class SysConfigServiceImpl implements ISysConfigService
 
     /**
      * 批量删除参数信息
-     * 
+     *
      * @param configIds 需要删除的参数ID
      * @return 结果
      */
@@ -198,7 +198,7 @@ public class SysConfigServiceImpl implements ISysConfigService
 
     /**
      * 校验参数键名是否唯一
-     * 
+     *
      * @param config 参数配置信息
      * @return 结果
      */
@@ -216,7 +216,7 @@ public class SysConfigServiceImpl implements ISysConfigService
 
     /**
      * 设置cache key
-     * 
+     *
      * @param configKey 参数键
      * @return 缓存键key
      */
@@ -224,4 +224,18 @@ public class SysConfigServiceImpl implements ISysConfigService
     {
         return Constants.SYS_CONFIG_KEY + configKey;
     }
+
+
+    @Override
+    public boolean checkGratingIsSuperHigh(String gratingConfigKey) {
+        String endState = "";
+        SysConfig sysConfig = new SysConfig();
+        sysConfig.setConfigKey(gratingConfigKey);
+        List<SysConfig> sysConfigs = this.selectConfigList(sysConfig);
+        if (sysConfigs.size() > 0) {
+            String configType = sysConfigs.get(0).getConfigType();
+            endState = configType;
+        }
+        return endState.equals("Y");
+    }
 }

+ 6 - 6
warewms-ams/src/main/java/com/ruoyi/ams/business/BusinessServiceImpl.java

@@ -196,7 +196,7 @@ public class BusinessServiceImpl implements IBusinessService {
             return AjaxResult.success("任务下发成功");
         } catch (Exception e) {
             redisCache.unlockCacheObject(token); // 异常捕获的话就不能释放锁
-            throw new ServiceException(e.getMessage(), token);
+            throw new ServiceException("agvCall任务下发失败:" + e.getMessage(), token);
         }
     }
 
@@ -334,7 +334,7 @@ public class BusinessServiceImpl implements IBusinessService {
                     break;
                 }
                 if (locationInfo == null) {
-                    throw new ServiceException("目标点没有可以分配的库位", token);
+                    throw new ServiceException("入库目标点没有可以分配的库位", token);
                 }
             }
         } else if (type.equals("SO")) {
@@ -351,7 +351,7 @@ public class BusinessServiceImpl implements IBusinessService {
                     break;
                 }
                 if (locationInfo == null) {
-                    throw new ServiceException("起始点没有可以分配的库存!", token);
+                    throw new ServiceException("出库起始点没有可以分配的库存!", token);
                 }
 
             } else { //目标库位
@@ -366,7 +366,7 @@ public class BusinessServiceImpl implements IBusinessService {
                     break;
                 }
                 if (locationInfo == null) {
-                    throw new ServiceException("目标点没有可以分配的库位", token);
+                    throw new ServiceException("出库目标点没有可以分配的库位", token);
                 }
             }
         } else { //移库
@@ -389,7 +389,7 @@ public class BusinessServiceImpl implements IBusinessService {
                 } else {
                     //如果未启用策略则进行判断
                     if (locationInfo == null) {
-                        throw new ServiceException("没有可以分配的库位", token);
+                        throw new ServiceException("移库没有可以分配的库位", token);
                     }
                 }
 
@@ -411,7 +411,7 @@ public class BusinessServiceImpl implements IBusinessService {
                 } else {
                     //如果未启用策略则进行判断
                     if (locationInfo == null) {
-                        throw new ServiceException("没有可以分配的库位", token);
+                        throw new ServiceException("移库没有可以分配的库位", token);
                     }
                 }
             }

+ 86 - 0
warewms-base/src/main/java/com/ruoyi/base/constant/Constant.java

@@ -290,4 +290,90 @@ public class Constant {
         }
     }
 
+    /**
+     * 光栅和库位编号对应关系
+     */
+    public enum GRATING_AND_LOCATION_MAPPING {
+        /***
+         * 1号光栅
+         */
+        NO1("sys.guangshan.no1", "IN-01-01"),
+        /***
+         * 2号光栅
+         */
+        NO2("sys.guangshan.no2", "IN-02-01"),
+        /***
+         * 3号光栅
+         */
+        NO3("sys.guangshan.no3", "RET-01-01"),
+        /***
+         * 4号光栅
+         */
+        NO4("sys.guangshan.no4", "RET-02-01");
+
+        /**
+         * 光栅编号
+         */
+        private String value;
+
+        /**
+         * 库位编号
+         */
+        private String value1;
+
+        GRATING_AND_LOCATION_MAPPING(String value, String value1) {
+            this.value = value;
+            this.value1 = value1;
+        }
+
+        /**
+         * 获取光栅编号
+         *
+         * @return
+         */
+        public String getValue() {
+            return value;
+        }
+
+        /**
+         * 获取库位编号
+         *
+         * @return
+         */
+        public String getValue1() {
+            return value1;
+        }
+
+        /**
+         * 根据光栅号获取
+         *
+         * @param grating
+         * @return
+         */
+        public static GRATING_AND_LOCATION_MAPPING getByGrating(String grating) {
+            for (GRATING_AND_LOCATION_MAPPING code : values()) {
+                if (code.getValue().equals(grating)) {
+                    return code;
+                }
+            }
+            return null;
+        }
+
+        /**
+         * 根据库位编号获取
+         *
+         * @param location
+         * @return
+         */
+        public static GRATING_AND_LOCATION_MAPPING getByLocation(String location) {
+            for (GRATING_AND_LOCATION_MAPPING code : values()) {
+                if (code.getValue1().equals(location)) {
+                    return code;
+                }
+            }
+            return null;
+        }
+    }
+
+
 }