zhangxin 1 год назад
Родитель
Сommit
de776bb22c
23 измененных файлов с 740 добавлено и 107 удалено
  1. 0 0
      base_sql/base.sql
  2. 1 0
      base_sql/pallet_sql/jinyinhua_dml_20231025.sql
  3. 16 6
      warewms-ams/src/main/java/com/warewms/common/constant/WmsConstant.java
  4. 3 3
      warewms-ams/src/main/java/com/warewms/common/constant/SceneConstants.java
  5. 4 3
      warewms-ams/src/main/java/com/warewms/ams/ndc/AciService.java
  6. 83 0
      warewms-ams/src/main/java/com/warewms/ams/ndc/controller/BaseLocationInfoController.java
  7. 2 3
      warewms-ams/src/main/java/com/warewms/ams/ndc/domain/BaseLocationInfo.java
  8. 163 0
      warewms-ams/src/main/java/com/warewms/ams/ndc/dto/AmsTaskDTO.java
  9. 51 1
      warewms-ams/src/main/java/com/warewms/ams/ndc/mapper/BaseLocationInfoMapper.java
  10. 4 2
      warewms-ams/src/main/java/com/warewms/ams/ndc/service/IAmsTaskService.java
  11. 43 0
      warewms-ams/src/main/java/com/warewms/ams/ndc/service/IBaseLocationInfoService.java
  12. 43 22
      warewms-ams/src/main/java/com/warewms/ams/ndc/service/impl/AmsTaskServiceImpl.java
  13. 54 3
      warewms-ams/src/main/java/com/warewms/ams/ndc/service/impl/BaseLocationInfoServiceImpl.java
  14. 16 12
      warewms-ams/src/main/java/com/warewms/ams/ndc/service/impl/SocketBufferServiceImpl.java
  15. 14 11
      warewms-ams/src/main/java/com/warewms/ams/ndc/service/impl/StatusUpdateServiceImpl.java
  16. 10 10
      warewms-ams/src/main/java/com/warewms/ams/thread/ClientHandler.java
  17. 2 2
      warewms-ams/src/main/java/com/warewms/ams/thread/ServerGs.java
  18. 15 15
      warewms-ams/src/main/java/com/warewms/ams/wcs/service/impl/WcsServiceImpl.java
  19. 2 12
      warewms-ams/src/main/java/com/warewms/common/constant/Constants.java
  20. 1 1
      warewms-ams/src/main/java/com/warewms/framework/config/CaptchaConfig.java
  21. 21 0
      warewms-ams/src/main/java/com/warewms/framework/config/RestTemplateConfig.java
  22. 1 1
      warewms-ams/src/main/resources/logback.xml
  23. 191 0
      warewms-ams/src/main/resources/mapper/ams/BaseLocationInfoMapper.xml

base_sql/ry_20210908.sql → base_sql/base.sql


Разница между файлами не показана из-за своего большого размера
+ 1 - 0
base_sql/pallet_sql/jinyinhua_dml_20231025.sql


+ 16 - 6
warewms-ams/src/main/java/com/warewms/common/constant/WmsConstant.java

@@ -1,10 +1,10 @@
-package com.warewms.common.constant;
+package com.warewms.ams.common;
 
 import cn.hutool.core.comparator.CompareUtil;
 
 import java.util.Arrays;
 
-public class WmsConstant {
+public class AmsConstant {
 
     /**
      * 出库缓存位
@@ -17,6 +17,16 @@ public class WmsConstant {
      */
     public static final Long LOC_MIDDLE_CACHE = 99999l;
 
+    /**
+     * agv点位缓存key
+     */
+    public static final String WMS_CORRESPOND_AGV_STATION_KEY = "wms_correspond_agv_station:";
+
+    /**
+     * 区域信息缓存key
+     */
+    public static final String LOCATION_ROW_KEY = "location_row:";
+
     /**
      * 是否下发NDC
      */
@@ -225,7 +235,7 @@ public class WmsConstant {
 
         public static Integer getValueByKey(Integer key) {
             return Arrays.stream(values()).filter(item -> CompareUtil.compare(item.getKey(), key) == 0)
-                    .map(WmsConstant.TASK_STS::getValue).findFirst().orElseGet(() -> null);
+                    .map(AmsConstant.TASK_STS::getValue).findFirst().orElseGet(() -> null);
         }
     }
 
@@ -299,7 +309,7 @@ public class WmsConstant {
          */
         public static String getValueByKey(String key) {
             return Arrays.stream(values()).filter(item -> CompareUtil.compare(item.getKey(), key) == 0)
-                    .map(WmsConstant.GRATING_DETECTION_SIGNAL::getValue).findFirst().orElseGet(() -> null);
+                    .map(AmsConstant.GRATING_DETECTION_SIGNAL::getValue).findFirst().orElseGet(() -> null);
         }
     }
 
@@ -357,7 +367,7 @@ public class WmsConstant {
          */
         public static String getValueByKey(String key) {
             return Arrays.stream(values()).filter(item -> CompareUtil.compare(item.getKey(), key) == 0)
-                    .map(WmsConstant.AREA_INFO::getValue).findFirst().orElseGet(() -> null);
+                    .map(AmsConstant.AREA_INFO::getValue).findFirst().orElseGet(() -> null);
         }
 
         /**
@@ -368,7 +378,7 @@ public class WmsConstant {
          */
         public static String getKeyByValue(String value) {
             return Arrays.stream(values()).filter(item -> CompareUtil.compare(item.getValue(), value) == 0)
-                    .map(WmsConstant.AREA_INFO::getKey).findFirst().orElseGet(() -> null);
+                    .map(AmsConstant.AREA_INFO::getKey).findFirst().orElseGet(() -> null);
         }
     }
 

+ 3 - 3
warewms-ams/src/main/java/com/warewms/common/constant/SceneConstants.java

@@ -1,4 +1,4 @@
-package com.warewms.common.constant;
+package com.warewms.ams.common;
 
 import java.util.HashMap;
 import java.util.Map;
@@ -16,8 +16,8 @@ public interface SceneConstants {
 
     Map<String, Integer> locationToAreaCacheListMapper = new HashMap<String, Integer>(){
         {
-            put(SceneConstants.LOCATION_FROM_LIST, WmsConstant.ZONE_TYPE.IN_CACHE.getValue());//入库区域
-            put(SceneConstants.LOCATION_TO_LIST, WmsConstant.ZONE_TYPE.OUT_CACHE.getValue());//出库区域
+            put(SceneConstants.LOCATION_FROM_LIST, AmsConstant.ZONE_TYPE.IN_CACHE.getValue());//入库区域
+            put(SceneConstants.LOCATION_TO_LIST, AmsConstant.ZONE_TYPE.OUT_CACHE.getValue());//出库区域
         }
     };
 

+ 4 - 3
warewms-ams/src/main/java/com/warewms/ams/ndc/AciService.java

@@ -3,6 +3,7 @@ package com.warewms.ams.ndc;
 import cn.hutool.core.date.DateUnit;
 import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSON;
+import com.warewms.ams.common.AmsConstant;
 import com.warewms.ams.ndc.common.Aci;
 import com.warewms.ams.ndc.common.ByteUtil;
 import com.warewms.ams.ndc.domain.AmsHexdefineDetail;
@@ -11,7 +12,6 @@ import com.warewms.ams.ndc.entity.Order;
 import com.warewms.ams.ndc.service.IAmsHexdefineDetailService;
 import com.warewms.ams.ndc.service.IAmsTaskService;
 import com.warewms.ams.ndc.service.SocketBufferService;
-import com.warewms.common.constant.WmsConstant;
 import com.warewms.common.exception.base.BaseException;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -112,7 +112,7 @@ public class AciService {
                 taskBean = new AmsTask();
                 taskBean.setIsDelete(0);
                 taskBean.setAciAccept(0);
-                taskBean.setBusinessType(WmsConstant.TASK_BUSINESS_TYPE.TASK_POWER.getValue());
+                taskBean.setBusinessType(AmsConstant.TASK_BUSINESS_TYPE.TASK_POWER.getValue());
                 taskBean = amsTaskService.selectAmsTaskByModel(taskBean);
                 s = "87CD0008000C000100710008658100010001%04X";
                 if (taskBean != null) {
@@ -209,6 +209,7 @@ public class AciService {
                             channel.read(buffer);
                             List<Order> bufferSeparators = socketBufferService.bufferSeparator(buffer.array());
                             for (Order order : bufferSeparators) {
+                                log.info("NDC Msg info is :{}", order);
                                 switch (order.getMessageType()) {
                                     case Aci.MSG_ORDER_STATUS://车体状态信息、位置信息
                                         socketBufferService.handleMsgOrderStatus(order.getParameters());
@@ -230,7 +231,7 @@ public class AciService {
                             iterator.remove();
                         }
                     }
-                    Thread.currentThread().sleep(3000);
+//                    Thread.currentThread().sleep(3000);
                 } catch (Exception e) {
                     throw new BaseException(e.getMessage());
                 }

+ 83 - 0
warewms-ams/src/main/java/com/warewms/ams/ndc/controller/BaseLocationInfoController.java

@@ -0,0 +1,83 @@
+package com.warewms.ams.ndc.controller;
+
+
+import com.warewms.ams.ndc.domain.BaseLocationInfo;
+import com.warewms.ams.ndc.service.IBaseLocationInfoService;
+import com.warewms.common.annotation.Log;
+import com.warewms.common.base.controller.BaseController;
+import com.warewms.common.base.domain.AjaxResult;
+import com.warewms.common.base.page.TableDataInfo;
+import com.warewms.common.enums.BusinessType;
+import com.warewms.common.utils.poi.ExcelUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 库位信息Controller
+ *
+ * @author andy
+ * @date 2022-02-18
+ */
+@RestController
+@RequestMapping("/base/locationInfo")
+public class BaseLocationInfoController extends BaseController {
+    @Autowired
+    private IBaseLocationInfoService baseLocationInfoService;
+
+    /**
+     * 查询库位信息列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(BaseLocationInfo baseLocationInfo) {
+        startPage();
+        List<BaseLocationInfo> list = baseLocationInfoService.selectBaseLocationInfoList(baseLocationInfo);
+        return getDataTable(list);
+    }
+
+
+    /**
+     * 获取库位信息详细信息
+     */
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
+        return AjaxResult.success(baseLocationInfoService.selectBaseLocationInfoById(id));
+    }
+
+    /**
+     * 修改库位信息
+     */
+    @Log(title = "库位信息", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody BaseLocationInfo baseLocationInfo) {
+        return toAjax(baseLocationInfoService.updateBaseLocationInfo(baseLocationInfo));
+    }
+
+    /**
+     * 删除库位信息
+     */
+    @Log(title = "库位信息", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
+        return toAjax(baseLocationInfoService.deleteBaseLocationInfoByIds(ids));
+    }
+
+    /**
+     * 获取库位字典
+     */
+    @GetMapping("/queryDict/{zoneId}")
+    public AjaxResult queryDict(@PathVariable("zoneId") Long zoneId) {
+        List<BaseLocationInfo> locationInfoList = baseLocationInfoService.selectSortedLocatinListByZoneId(zoneId, 1L,null);
+        return AjaxResult.success("", locationInfoList);
+    }
+
+
+    @PostMapping("/importTemplate")
+    public void importTemplate(HttpServletResponse response)
+    {
+        ExcelUtil<BaseLocationInfo> util = new ExcelUtil<>(BaseLocationInfo.class);
+        util.importTemplateExcel(response, "库位信息");
+    }
+}

+ 2 - 3
warewms-ams/src/main/java/com/warewms/ams/ndc/domain/BaseLocationInfo.java

@@ -1,10 +1,9 @@
 package com.warewms.ams.ndc.domain;
 
 import com.warewms.common.annotation.Excel;
+import com.warewms.common.base.domain.BaseEntity;
 import lombok.Data;
 
-import java.io.Serializable;
-
 /**
  * 库位信息对象 base_location_info
  *
@@ -12,7 +11,7 @@ import java.io.Serializable;
  * @date 2022-02-18
  */
 @Data
-public class BaseLocationInfo implements Serializable {
+public class BaseLocationInfo extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
     /**

+ 163 - 0
warewms-ams/src/main/java/com/warewms/ams/ndc/dto/AmsTaskDTO.java

@@ -0,0 +1,163 @@
+package com.warewms.ams.ndc.dto;
+
+import com.warewms.common.annotation.Excel;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * ams任务列表对象 ams_task
+ *
+ * @author andy
+ * @date 2022-08-08
+ */
+@Data
+public class AmsTaskDTO implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+
+    /**
+     * $column.columnComment
+     */
+    private Long id;
+
+    /**
+     * 任务编号
+     */
+    @Excel(name = "任务编号")
+    private String taskNo;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Long ikey;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Integer aciIndex;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Integer stFrom;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Integer stTo;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Integer priority;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Integer systemStatus;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Integer event;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Integer serverAck;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Integer aciAccept;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Integer isDelete;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String callbackurl;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private Date addtime;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String addwho;
+
+    /**
+     * 调用系统名称
+     */
+    @Excel(name = "调用系统名称")
+    private String sysName;
+
+    /**
+     * 设备名称
+     */
+    @Excel(name = "设备名称")
+    private String deviceName;
+
+    /**
+     * 任务类型(01普通任务60进判断位90出判断位m释放判断位)
+     */
+    @Excel(name = "任务类型(01普通任务60进判断位90出判断位m释放判断位)")
+    private String businessType;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String ext1;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String ext2;
+
+    /**
+     * $column.columnComment
+     */
+    @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
+    private String ext3;
+
+    /**
+     * 1(低) 2(中) 3(高)
+     */
+    @Excel(name = "1(低) 2(中) 3(高)")
+    private String heightLevel;
+
+    /**
+     * 巷道
+     */
+    @Excel(name = "巷道")
+    private String roadway;
+
+    /**
+     * 层
+     */
+    @Excel(name = "层")
+    private String tier;
+
+}

+ 51 - 1
warewms-ams/src/main/java/com/warewms/ams/ndc/mapper/BaseLocationInfoMapper.java

@@ -4,13 +4,63 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.warewms.ams.ndc.domain.BaseLocationInfo;
 import org.apache.ibatis.annotations.Mapper;
 
+import java.util.List;
+
 /**
  * 库位信息Mapper接口
  *
- * @author
+ * @author andy
  * @date 2022-02-18
  */
 @Mapper
 public interface BaseLocationInfoMapper extends BaseMapper<BaseLocationInfo> {
+    /**
+     * 查询库位信息
+     *
+     * @param id 库位信息主键
+     * @return 库位信息
+     */
+    BaseLocationInfo selectBaseLocationInfoById(Long id);
+
+    /**
+     * 查询库位信息列表
+     *
+     * @param baseLocationInfo 库位信息
+     * @return 库位信息集合
+     */
+    List<BaseLocationInfo> selectBaseLocationInfoList(BaseLocationInfo baseLocationInfo);
+
+    /**
+     * 新增库位信息
+     *
+     * @param baseLocationInfo 库位信息
+     * @return 结果
+     */
+    int insertBaseLocationInfo(BaseLocationInfo baseLocationInfo);
+
+    /**
+     * 修改库位信息
+     *
+     * @param baseLocationInfo 库位信息
+     * @return 结果
+     */
+    int updateBaseLocationInfo(BaseLocationInfo baseLocationInfo);
+
+    /**
+     * 批量删除库位信息
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int deleteBaseLocationInfoByIds(Long[] ids);
+
+    /**
+     * 根据zoneId查询库位信息
+     * 返回结果会根据排列层进行排序
+     *
+     * @param baseLocationInfo
+     * @return
+     */
+    List<BaseLocationInfo> selectSortedLocationListByZoneId(BaseLocationInfo baseLocationInfo);
 
 }

+ 4 - 2
warewms-ams/src/main/java/com/warewms/ams/ndc/service/IAmsTaskService.java

@@ -2,8 +2,10 @@ package com.warewms.ams.ndc.service;
 
 import com.warewms.ams.ndc.domain.AmsTask;
 import com.warewms.ams.ndc.dto.AmsTaskCancelDTO;
+import com.warewms.ams.ndc.dto.AmsTaskDTO;
 import com.warewms.ams.ndc.dto.AmsTaskInfoDTO;
 import com.warewms.ams.ndc.dto.AmsTaskInsertDTO;
+import com.warewms.framework.service.CrudService;
 
 import java.util.List;
 
@@ -13,7 +15,7 @@ import java.util.List;
  * @author andy
  * @date 2022-08-08
  */
-public interface IAmsTaskService {
+public interface IAmsTaskService extends CrudService<AmsTask, AmsTaskDTO> {
     /**
      * 查询ams任务列表
      *
@@ -78,7 +80,7 @@ public interface IAmsTaskService {
 
     Long amsTaskInsert(AmsTaskInsertDTO amsTaskInsertDTO);
 
-    void ndcAmsTaskInsert(String businessNo, String businessType, Integer stFrom, Integer stTo);
+    void ndcAmsTaskInsert(String businessNo, String businessType, Integer stFrom, String stTo);
 
     AmsTaskInfoDTO getAmsTaskInfo(String businessNo);
 

+ 43 - 0
warewms-ams/src/main/java/com/warewms/ams/ndc/service/IBaseLocationInfoService.java

@@ -13,4 +13,47 @@ import java.util.List;
 public interface IBaseLocationInfoService {
 
     List<BaseLocationInfo> queryBaseLocationInfoList(Integer zoneId, String rowNo);
+
+    /**
+     * 查询库位信息
+     *
+     * @param id 库位信息主键
+     * @return 库位信息
+     */
+    BaseLocationInfo selectBaseLocationInfoById(Long id);
+
+    /**
+     * 查询库位信息列表
+     *
+     * @param baseLocationInfo 库位信息
+     * @return 库位信息集合
+     */
+    List<BaseLocationInfo> selectBaseLocationInfoList(BaseLocationInfo baseLocationInfo);
+
+    /**
+     * 修改库位信息
+     *
+     * @param baseLocationInfo 库位信息
+     * @return 结果
+     */
+    int updateBaseLocationInfo(BaseLocationInfo baseLocationInfo);
+
+    /**
+     * 批量删除库位信息
+     *
+     * @param ids 需要删除的库位信息主键集合
+     * @return 结果
+     */
+    int deleteBaseLocationInfoByIds(Long[] ids);
+
+
+    /**
+     * 根据zoneId查询库位信息
+     * 返回结果会根据排列层进行排序
+     *
+     * @param zoneId
+     * @param warehouseId
+     * @return
+     */
+    List<BaseLocationInfo> selectSortedLocatinListByZoneId(Long zoneId, Long warehouseId,String orderBy);
 }

+ 43 - 22
warewms-ams/src/main/java/com/warewms/ams/ndc/service/impl/AmsTaskServiceImpl.java

@@ -4,25 +4,27 @@ import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.comparator.CompareUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.warewms.ams.common.AmsConstant;
+import com.warewms.ams.common.SceneConstants;
 import com.warewms.ams.ndc.common.ByteUtil;
 import com.warewms.ams.ndc.common.CRC16Util;
 import com.warewms.ams.ndc.domain.AmsTask;
 import com.warewms.ams.ndc.domain.BaseLocationInfo;
 import com.warewms.ams.ndc.dto.AmsTaskCancelDTO;
+import com.warewms.ams.ndc.dto.AmsTaskDTO;
 import com.warewms.ams.ndc.dto.AmsTaskInfoDTO;
 import com.warewms.ams.ndc.dto.AmsTaskInsertDTO;
 import com.warewms.ams.ndc.mapper.AmsTaskMapper;
 import com.warewms.ams.ndc.service.IAmsTaskService;
 import com.warewms.ams.ndc.service.IBaseLocationInfoService;
-import com.warewms.common.constant.Constants;
-import com.warewms.common.constant.SceneConstants;
-import com.warewms.common.constant.WmsConstant;
 import com.warewms.common.exception.base.BaseException;
 import com.warewms.common.utils.ConvertUtils;
 import com.warewms.common.utils.redis.RedisCache;
 import com.warewms.common.utils.string.StringUtils;
+import com.warewms.framework.service.impl.CrudServiceImpl;
 import com.warewms.system.service.ISysConfigService;
 import io.jsonwebtoken.lang.Assert;
 import org.assertj.core.util.Lists;
@@ -41,7 +43,7 @@ import java.util.Map;
  * @date 2022-08-08
  */
 @Service
-public class AmsTaskServiceImpl implements IAmsTaskService
+public class AmsTaskServiceImpl extends CrudServiceImpl<AmsTaskMapper, AmsTask, AmsTaskDTO> implements IAmsTaskService
 {
     @Autowired
     private AmsTaskMapper amsTaskMapper;
@@ -173,44 +175,48 @@ public class AmsTaskServiceImpl implements IAmsTaskService
         amsTask.setId(Long.parseLong(IdWorker.getIdStr()));
         amsTask.setTaskNo(amsTaskInsertDTO.getBusinessNo());
         amsTask.setStFrom(convertLocation(amsTaskInsertDTO.getLocationFrom()));
-        boolean isExist = redisCache.checkIsExist(Constants.WMS_CORRESPOND_AGV_STATION_KEY.concat(amsTaskInsertDTO.getLocationFrom()))
-                && redisCache.checkIsExist(Constants.WMS_CORRESPOND_AGV_STATION_KEY.concat(amsTaskInsertDTO.getLocationTo()));
+        boolean isExist = redisCache.checkIsExist(AmsConstant.WMS_CORRESPOND_AGV_STATION_KEY.concat(amsTaskInsertDTO.getLocationFrom()))
+                && redisCache.checkIsExist(AmsConstant.WMS_CORRESPOND_AGV_STATION_KEY.concat(amsTaskInsertDTO.getLocationTo()));
         amsTask.setStTo(isExist ? convertLocation(amsTaskInsertDTO.getLocationTo()) : getCacheLocation(amsTaskInsertDTO.getLocationFrom(), amsTaskInsertDTO.getLocationTo()));
-        amsTask.setExt3(isExist ? null : convertLocation(amsTaskInsertDTO.getLocationTo()).toString());
+        amsTask.setExt3(isExist ? null : amsTaskInsertDTO.getLocationTo());
+        amsTask.setExt1(isExist ? redisCache.getCacheObject(AmsConstant.LOCATION_ROW_KEY.concat(amsTask.getStTo().toString())) : String.valueOf(BigDecimal.ZERO));
+        amsTask.setExt2(amsTask.getExt1());
         amsTask.setBusinessType(StringUtils.isNotBlank(amsTaskInsertDTO.getBusinessType()) ?
-                amsTaskInsertDTO.getBusinessType() : WmsConstant.TASK_BUSINESS_TYPE.TASK_01.getValue());
+                amsTaskInsertDTO.getBusinessType() : AmsConstant.TASK_BUSINESS_TYPE.TASK_01.getValue());
         amsTask.setIsDelete(0);
         amsTask.setAciAccept(0);
-        amsTask.setIkey((long) genIKey(amsTask.getTaskNo()));
+        amsTask.setIkey((long) genIKey(amsTask.getId().toString()));
         amsTask.setRemark("move the start location to the cache location");
         amsTaskMapper.insert(amsTask);
         return amsTask.getId();
     }
 
     @Override
-    public void ndcAmsTaskInsert(String businessNo, String businessType, Integer stFrom, Integer stTo) {
+    public void ndcAmsTaskInsert(String businessNo, String businessType, Integer stFrom, String stTo) {
         AmsTask amsTask = new AmsTask();
         amsTask.setId(Long.parseLong(IdWorker.getIdStr()));
         amsTask.setTaskNo(businessNo);
         amsTask.setStFrom(convertLocation(stFrom.toString()));
-        amsTask.setStTo(stTo);
+        amsTask.setStTo(convertLocation(stTo));
+        amsTask.setExt1(redisCache.getCacheObject(AmsConstant.LOCATION_ROW_KEY.concat(stTo)));
+        amsTask.setExt2(amsTask.getExt1());
         amsTask.setBusinessType(businessType);
         amsTask.setIsDelete(0);
         amsTask.setAciAccept(0);
-        amsTask.setIkey((long) genIKey(amsTask.getTaskNo()));
+        amsTask.setIkey((long) genIKey(amsTask.getId().toString()));
         amsTask.setRemark("move the cache location to the end location");
         amsTaskMapper.insert(amsTask);
     }
 
     private Integer convertLocation(String locationNo) {
-        boolean isExist = redisCache.checkIsExist(Constants.WMS_CORRESPOND_AGV_STATION_KEY.concat(locationNo));
-        return isExist ? Integer.parseInt(redisCache.getCacheObject(Constants.WMS_CORRESPOND_AGV_STATION_KEY.concat(locationNo)).toString()) : Integer.parseInt(locationNo);
+        boolean isExist = redisCache.checkIsExist(AmsConstant.WMS_CORRESPOND_AGV_STATION_KEY.concat(locationNo));
+        return isExist ? Integer.parseInt(redisCache.getCacheObject(AmsConstant.WMS_CORRESPOND_AGV_STATION_KEY.concat(locationNo)).toString()) : Integer.parseInt(locationNo);
     }
 
     private Integer getCacheLocation(String locationFromId, String locationToId) {
-        boolean isExist = redisCache.checkIsExist(Constants.WMS_CORRESPOND_AGV_STATION_KEY.concat(locationFromId));
+        boolean isExist = redisCache.checkIsExist(AmsConstant.WMS_CORRESPOND_AGV_STATION_KEY.concat(locationFromId));
         String rowNo = isExist ?
-                redisCache.getCacheObject(Constants.LOCATION_ROW_KEY.concat(locationFromId)) : redisCache.getCacheObject(Constants.LOCATION_ROW_KEY.concat(locationToId));
+                redisCache.getCacheObject(AmsConstant.LOCATION_ROW_KEY.concat(locationFromId)) : redisCache.getCacheObject(AmsConstant.LOCATION_ROW_KEY.concat(locationToId));
         String locationConfig = sysConfigService.selectConfigByKey(SceneConstants.LOCATION_SCENE);
         if(StringUtils.isBlank(locationConfig)) throw new BaseException("location.scene.config is blank");
         Map<String, List<Integer>> locationConfigMap = JSONObject.parseObject(locationConfig, Map.class);
@@ -249,12 +255,12 @@ public class AmsTaskServiceImpl implements IAmsTaskService
         AmsTask amsTask = getAmsTaskById(id);
         Assert.isTrue(ObjectUtil.isNotNull(amsTask), "任务不存在!");
         //请求ams 取消任务
-        Assert.isTrue(ObjectUtil.isNull(amsTask.getEvent()) || CompareUtil.compare(amsTask.getEvent(), WmsConstant.TASK_STS.TASK7.getKey()) != 0
+        Assert.isTrue(ObjectUtil.isNull(amsTask.getEvent()) || CompareUtil.compare(amsTask.getEvent(), AmsConstant.TASK_STS.TASK7.getKey()) != 0
                 , "任务已取消!");
         return amsTaskMapper.update(new AmsTask(), Wrappers.<AmsTask>lambdaUpdate()
                 .eq(AmsTask::getId, id)
-                .set(AmsTask::getIsDelete, WmsConstant.DELETE_STATUS.Y.getValue())
-                .set(AmsTask::getAciAccept, WmsConstant.ACI_ACCEPT_STATUS.N.getValue())
+                .set(AmsTask::getIsDelete, AmsConstant.DELETE_STATUS.Y.getValue())
+                .set(AmsTask::getAciAccept, AmsConstant.ACI_ACCEPT_STATUS.N.getValue())
                 .set(AmsTask::getRemark, "下发超时1分钟未接收自动取消, 取消原因为:" + remark)) > 0;
     }
 
@@ -263,9 +269,9 @@ public class AmsTaskServiceImpl implements IAmsTaskService
         Integer aciAccept = ObjectUtil.isNotNull(amsTask.getAciAccept()) ? amsTask.getAciAccept() : null;
         if ((CompareUtil.compare(new BigDecimal(aciAccept), BigDecimal.ZERO) == 0 &&
                 CompareUtil.compare(new BigDecimal(delete), BigDecimal.ZERO) == 0) || ObjectUtil.isNull(amsTask.getAciIndex()) || ObjectUtil.isNull(amsTask.getEvent())){
-            return WmsConstant.TASK_STS.TASK0.getValue();
+            return AmsConstant.TASK_STS.TASK0.getValue();
         }
-        return WmsConstant.TASK_STS.getValueByKey(amsTask.getEvent());
+        return AmsConstant.TASK_STS.getValueByKey(amsTask.getEvent());
     }
 
     public AmsTask getAmsTaskById(String id){
@@ -281,7 +287,22 @@ public class AmsTaskServiceImpl implements IAmsTaskService
         List<AmsTask> amsTaskList = amsTaskMapper.selectList(Wrappers.<AmsTask>lambdaQuery()
                 .in(CollectionUtil.isNotEmpty(businessNoList), AmsTask::getTaskNo, businessNoList)
                 .in(CollectionUtil.isNotEmpty(idList), AmsTask::getId, idList)
-                .eq(ObjectUtil.isNotNull(aciIndex), AmsTask::getAciIndex, aciIndex));
+                .eq(ObjectUtil.isNotNull(aciIndex), AmsTask::getAciIndex, aciIndex)
+                .orderByDesc(AmsTask::getAddtime));
         return amsTaskList;
     }
+
+    @Override
+    public QueryWrapper<AmsTask> getWrapper(Map<String, Object> params) {
+        QueryWrapper<AmsTask> queryWrapper = new QueryWrapper<>();
+        String taskNo = (String) params.get("taskNo");
+        String aciIndex = (String) params.get("aciIndex");
+        String stFrom = (String) params.get("stFrom");
+        String stTo = (String) params.get("stTo");
+        queryWrapper.lambda().eq(StringUtils.isNotBlank(taskNo), AmsTask::getTaskNo, Integer.parseInt(taskNo))
+                .eq(StringUtils.isNotBlank(aciIndex), AmsTask::getAciIndex, Integer.parseInt(aciIndex))
+                .eq(StringUtils.isNotBlank(stFrom), AmsTask::getStFrom, Integer.parseInt(stFrom))
+                .eq(StringUtils.isNotBlank(stTo), AmsTask::getStTo, Integer.parseInt(stTo));
+        return queryWrapper;
+    }
 }

+ 54 - 3
warewms-ams/src/main/java/com/warewms/ams/ndc/service/impl/BaseLocationInfoServiceImpl.java

@@ -2,10 +2,10 @@ package com.warewms.ams.ndc.service.impl;
 
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.warewms.ams.common.AmsConstant;
 import com.warewms.ams.ndc.domain.BaseLocationInfo;
 import com.warewms.ams.ndc.mapper.BaseLocationInfoMapper;
 import com.warewms.ams.ndc.service.IBaseLocationInfoService;
-import com.warewms.common.constant.Constants;
 import com.warewms.common.utils.redis.RedisCache;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -45,8 +45,8 @@ public class BaseLocationInfoServiceImpl implements IBaseLocationInfoService {
     public void loadingLocationCache() {
         List<BaseLocationInfo> baseLocationInfoList = baseLocationInfoMapper.selectList(Wrappers.emptyWrapper());
         for (BaseLocationInfo baseLocationInfo : baseLocationInfoList) {
-            redisCache.setCacheObject(Constants.WMS_CORRESPOND_AGV_STATION_KEY.concat(baseLocationInfo.getLocationNo()), baseLocationInfo.getAgvStation());
-            redisCache.setCacheObject(Constants.LOCATION_ROW_KEY.concat(baseLocationInfo.getLocationNo()), baseLocationInfo.getRowNo());
+            redisCache.setCacheObject(AmsConstant.WMS_CORRESPOND_AGV_STATION_KEY.concat(baseLocationInfo.getLocationNo()), baseLocationInfo.getAgvStation());
+            redisCache.setCacheObject(AmsConstant.LOCATION_ROW_KEY.concat(baseLocationInfo.getLocationNo()), baseLocationInfo.getRowNo());
         }
     }
 
@@ -62,5 +62,56 @@ public class BaseLocationInfoServiceImpl implements IBaseLocationInfoService {
                 .eq(StringUtils.isNotBlank(rowNo), BaseLocationInfo::getRowNo, rowNo));
     }
 
+    /**
+     * 查询库位信息
+     *
+     * @param id 库位信息主键
+     * @return 库位信息
+     */
+    @Override
+    public BaseLocationInfo selectBaseLocationInfoById(Long id) {
+        return baseLocationInfoMapper.selectBaseLocationInfoById(id);
+    }
+
+    /**
+     * 查询库位信息列表
+     *
+     * @param baseLocationInfo 库位信息
+     * @return 库位信息
+     */
+    @Override
+    public List<BaseLocationInfo> selectBaseLocationInfoList(BaseLocationInfo baseLocationInfo) {
+        return baseLocationInfoMapper.selectBaseLocationInfoList(baseLocationInfo);
+    }
+
+    /**
+     * 修改库位信息
+     *
+     * @param baseLocationInfo 库位信息
+     * @return 结果
+     */
+    @Override
+    public int updateBaseLocationInfo(BaseLocationInfo baseLocationInfo) {
+        return baseLocationInfoMapper.updateBaseLocationInfo(baseLocationInfo);
+    }
+
+    /**
+     * 批量删除库位信息
+     *
+     * @param ids 需要删除的库位信息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteBaseLocationInfoByIds(Long[] ids) {
+        return baseLocationInfoMapper.deleteBaseLocationInfoByIds(ids);
+    }
+
+    @Override
+    public List<BaseLocationInfo> selectSortedLocatinListByZoneId(Long zoneId, Long warehouseId,String orderBy) {
+        BaseLocationInfo query = new BaseLocationInfo();
+        query.setWarehouseId(warehouseId);
+        query.setZoneId(zoneId);
+        return baseLocationInfoMapper.selectSortedLocationListByZoneId(query);
+    }
 
 }

+ 16 - 12
warewms-ams/src/main/java/com/warewms/ams/ndc/service/impl/SocketBufferServiceImpl.java

@@ -2,6 +2,7 @@ package com.warewms.ams.ndc.service.impl;
 
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSON;
+import com.warewms.ams.common.AmsConstant;
 import com.warewms.ams.ndc.common.Aci;
 import com.warewms.ams.ndc.common.ByteUtil;
 import com.warewms.ams.ndc.domain.AmsNdcEvent;
@@ -11,7 +12,6 @@ import com.warewms.ams.ndc.service.IAmsNdcEventService;
 import com.warewms.ams.ndc.service.IAmsTaskService;
 import com.warewms.ams.ndc.service.SocketBufferService;
 import com.warewms.ams.ndc.service.StatusUpdateService;
-import com.warewms.common.constant.WmsConstant;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -125,17 +125,21 @@ public class SocketBufferServiceImpl implements SocketBufferService {
         event.setEcode((int) ByteUtil.getShort(parameters, 16));
         AmsNdcEvent eventBean = amsNdcEventService.selectAmsNdcEventByModel(event);
         if (ObjectUtil.isNull(eventBean)) return;
-            event = eventBean;
-            event.setLocationindex(ByteUtil.getInt(parameters, 26));
-            event.setLp1("" + ByteUtil.getInt(parameters, 34));
-            event.setLp2("" + ByteUtil.getInt(parameters, 38));
-            event.setLp3("" + ByteUtil.getInt(parameters, 42));
-            event.setLp4("" + ByteUtil.getInt(parameters, 46));
-            int eventId = event.getId();
-            if (ObjectUtil.isNotNull(WmsConstant.TASK_STS.getValueByKey(eventId))){
-                statusUpdateService.taskStateResponse(WmsConstant.TASK_STS.getValueByKey(eventId), icarNo, Integer.parseInt(event.getLp1()));
-            }
-            AmsTask taskBean = new AmsTask();
+        event = eventBean;
+        event.setLocationindex(ByteUtil.getInt(parameters, 26));
+        event.setLp1("" + ByteUtil.getInt(parameters, 34));
+        log.info("lp1 is :{}", event.getLp1());
+        event.setLp2("" + ByteUtil.getInt(parameters, 38));
+        log.info("lp2 is :{}", event.getLp2());
+        event.setLp3("" + ByteUtil.getInt(parameters, 42));
+        log.info("lp3 is :{}", event.getLp3());
+        event.setLp4("" + ByteUtil.getInt(parameters, 46));
+        int eventId = event.getId();
+        log.info("evenId is :{}", eventId);
+        if (ObjectUtil.isNotNull(AmsConstant.TASK_STS.getValueByKey(eventId))) {
+            statusUpdateService.taskStateResponse(AmsConstant.TASK_STS.getValueByKey(eventId), icarNo, Integer.parseInt(event.getLp1()));
+        }
+        AmsTask taskBean = new AmsTask();
 
 //            log.info("----event:" + eventId);
             switch (eventId) {

+ 14 - 11
warewms-ams/src/main/java/com/warewms/ams/ndc/service/impl/StatusUpdateServiceImpl.java

@@ -2,11 +2,11 @@ package com.warewms.ams.ndc.service.impl;
 
 import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSONObject;
+import com.warewms.ams.common.AmsConstant;
 import com.warewms.ams.ndc.domain.AmsTask;
 import com.warewms.ams.ndc.dto.AmsTaskStateFeedbackDTO;
 import com.warewms.ams.ndc.service.IAmsTaskService;
 import com.warewms.ams.ndc.service.StatusUpdateService;
-import com.warewms.common.constant.WmsConstant;
 import com.warewms.common.utils.string.StringUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -23,7 +23,8 @@ public class StatusUpdateServiceImpl implements StatusUpdateService {
     @Autowired
     private IAmsTaskService amsTaskService;
 
-    private RestTemplate restTemplate = new RestTemplate();
+    @Autowired
+    private RestTemplate restTemplate;
 
     private final String WMS_URL = "localhost:28080/erp/execResult";
 
@@ -34,10 +35,11 @@ public class StatusUpdateServiceImpl implements StatusUpdateService {
     @Override
     public void taskStateResponse(Integer state, Integer carNo, Integer aciIndex) {
         AmsTask amsTask = amsTaskService.getAmsTaskByAciIndex(aciIndex);
-        if (ObjectUtil.isNull(amsTask)) return;
-        if (StringUtils.isNotBlank(amsTask.getExt3()) &&
-                (state.equals(WmsConstant.TASK_STS.TASK2.getValue()) ||
-                        state.equals(WmsConstant.TASK_STS.TASK6.getValue()))) {
+        log.info("taskStateResponse - amsTask is :{}, state is :{}", amsTask, state);
+        if (ObjectUtil.isNull(amsTask)) {
+            return;
+        }
+        if (StringUtils.isNotBlank(amsTask.getExt3()) && (state.equals(AmsConstant.TASK_STS.TASK2.getValue()) || state.equals(AmsConstant.TASK_STS.TASK6.getValue()))) {
             return;
         }
         AmsTaskStateFeedbackDTO amsTaskStateFeedbackDTO = new AmsTaskStateFeedbackDTO();
@@ -45,13 +47,14 @@ public class StatusUpdateServiceImpl implements StatusUpdateService {
         amsTaskStateFeedbackDTO.setTaskNo(String.valueOf(amsTask.getId()));
         amsTaskStateFeedbackDTO.setBusinessNo(amsTask.getTaskNo());
         amsTaskStateFeedbackDTO.setCarNo(carNo);
+        log.info("taskStateResponse - amsTaskStateFeedbackDTO is :{}", amsTaskStateFeedbackDTO);
         Object response = null;
         try {
             response = restTemplate.postForObject(WMS_URL, amsTaskStateFeedbackDTO, Object.class);
+            log.info("wms response data is :{}", JSONObject.toJSONString(response));
         } catch (RestClientException e) {
             log.error("AMS send request to WMS is on error, pause is :{}", e.getMessage());
         }
-        log.info("wms response data is :{}", JSONObject.toJSONString(response));
     }
 
     @Override
@@ -63,12 +66,12 @@ public class StatusUpdateServiceImpl implements StatusUpdateService {
         if (amsTask.getAciIndex() == null) {
             log.error("没有index,未下发的任务");
         }
-        amsTask.setSystemStatus(WmsConstant.TASK_STS.getValueByKey(amsTask.getEvent()));
+        amsTask.setSystemStatus(AmsConstant.TASK_STS.getValueByKey(amsTask.getEvent()));
         amsTaskService.updateAmsTask(amsTask);
         if (StringUtils.isNotBlank(amsTask.getExt3()) &&
-                (amsTask.getSystemStatus().equals(WmsConstant.TASK_STS.TASK2.getValue()) ||
-                        amsTask.getSystemStatus().equals(WmsConstant.TASK_STS.TASK6.getValue()))) {
-            amsTaskService.ndcAmsTaskInsert(amsTask.getTaskNo(), amsTask.getBusinessType(), amsTask.getStTo(), Integer.parseInt(amsTask.getExt3()));
+                (amsTask.getSystemStatus().equals(AmsConstant.TASK_STS.TASK2.getValue()) ||
+                        amsTask.getSystemStatus().equals(AmsConstant.TASK_STS.TASK6.getValue()))) {
+            amsTaskService.ndcAmsTaskInsert(amsTask.getTaskNo(), amsTask.getBusinessType(), amsTask.getStTo(), amsTask.getExt3());
         }
     }
 }

+ 10 - 10
warewms-ams/src/main/java/com/warewms/ams/thread/ClientHandler.java

@@ -1,11 +1,11 @@
 package com.warewms.ams.thread;
 
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
+import com.warewms.ams.common.AmsConstant;
 import com.warewms.ams.ndc.common.ByteUtil;
 import com.warewms.ams.ndc.common.CRC16Util;
 import com.warewms.ams.ndc.domain.AmsTask;
 import com.warewms.ams.ndc.service.IAmsTaskService;
-import com.warewms.common.constant.WmsConstant;
 import com.warewms.common.utils.redis.RedisCache;
 import com.warewms.common.utils.spring.SpringUtils;
 import com.warewms.system.entity.SysConfig;
@@ -155,15 +155,15 @@ public class ClientHandler {
                             break;
                         case "3F00500D0A":
                             //入库区域光栅检测到信号
-                            if (redisCache.checkIsExist(WmsConstant.AREA_INFO.STORAGE_AREA.getKey())) break;
-                            insertAmsTask(WmsConstant.AREA_INFO.STORAGE_AREA.getValue());
-                            redisCache.setCacheObject(WmsConstant.AREA_INFO.STORAGE_AREA.getKey(), Boolean.TRUE);
+                            if (redisCache.checkIsExist(AmsConstant.AREA_INFO.STORAGE_AREA.getKey())) break;
+                            insertAmsTask(AmsConstant.AREA_INFO.STORAGE_AREA.getValue());
+                            redisCache.setCacheObject(AmsConstant.AREA_INFO.STORAGE_AREA.getKey(), Boolean.TRUE);
                             break;
                         case "3F00600D0A":
                             //出库区域光栅检测到信号
-                            if (redisCache.checkIsExist(WmsConstant.AREA_INFO.EXIT_AREA.getKey())) break;
-                            insertAmsTask(WmsConstant.AREA_INFO.EXIT_AREA.getValue());
-                            redisCache.setCacheObject(WmsConstant.AREA_INFO.EXIT_AREA.getKey(), Boolean.TRUE);
+                            if (redisCache.checkIsExist(AmsConstant.AREA_INFO.EXIT_AREA.getKey())) break;
+                            insertAmsTask(AmsConstant.AREA_INFO.EXIT_AREA.getValue());
+                            redisCache.setCacheObject(AmsConstant.AREA_INFO.EXIT_AREA.getKey(), Boolean.TRUE);
                             break;
                     }
                 }
@@ -185,10 +185,10 @@ public class ClientHandler {
         AmsTask amsTask = new AmsTask();
         amsTask.setTaskNo(IdWorker.getIdStr());
         amsTask.setIkey(Long.parseLong(String.valueOf(CRC16Util.calcCrc16(ByteUtil.string2byteArray(amsTask.getTaskNo())))));
-        amsTask.setStFrom(Integer.valueOf(WmsConstant.LOC_MIDDLE_CACHE.toString()));
-        amsTask.setStTo(Integer.valueOf(WmsConstant.LOC_SORTATION_CACHE.toString()));
+        amsTask.setStFrom(Integer.valueOf(AmsConstant.LOC_MIDDLE_CACHE.toString()));
+        amsTask.setStTo(Integer.valueOf(AmsConstant.LOC_SORTATION_CACHE.toString()));
         amsTask.setPriority(1);
-        amsTask.setBusinessType(WmsConstant.TASK_BUSINESS_TYPE.TASK_76.getValue());
+        amsTask.setBusinessType(AmsConstant.TASK_BUSINESS_TYPE.TASK_76.getValue());
         amsTask.setExt1(op);
         amsTaskService.insertAmsTask(amsTask);
     }

+ 2 - 2
warewms-ams/src/main/java/com/warewms/ams/thread/ServerGs.java

@@ -1,7 +1,7 @@
 package com.warewms.ams.thread;
 
+import com.warewms.ams.common.AmsConstant;
 import com.warewms.ams.ndc.common.ByteUtil;
-import com.warewms.common.constant.WmsConstant;
 import com.warewms.common.utils.redis.RedisCache;
 import com.warewms.common.utils.spring.SpringUtils;
 import com.warewms.system.entity.SysConfig;
@@ -89,7 +89,7 @@ public class ServerGs {
                         config.setConfigValue("Y");
                         List<SysConfig> list = configService.selectConfigList(config);
                         for (SysConfig sysConfig : list) {
-                            String detectionSignal = WmsConstant.GRATING_DETECTION_SIGNAL.getValueByKey(sysConfig.getConfigKey());
+                            String detectionSignal = AmsConstant.GRATING_DETECTION_SIGNAL.getValueByKey(sysConfig.getConfigKey());
                             if (StringUtils.isBlank(detectionSignal)) continue;
                             os.write(ByteUtil.hexString2ByteArray(detectionSignal));
                             os.flush();

+ 15 - 15
warewms-ams/src/main/java/com/warewms/ams/wcs/service/impl/WcsServiceImpl.java

@@ -2,13 +2,13 @@ package com.warewms.ams.wcs.service.impl;
 
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
+import com.warewms.ams.common.AmsConstant;
 import com.warewms.ams.ndc.common.ByteUtil;
 import com.warewms.ams.ndc.common.CRC16Util;
 import com.warewms.ams.ndc.domain.AmsTask;
 import com.warewms.ams.ndc.service.IAmsTaskService;
 import com.warewms.ams.wcs.form.BtnOpForm;
 import com.warewms.ams.wcs.service.IWcsService;
-import com.warewms.common.constant.WmsConstant;
 import com.warewms.common.utils.redis.RedisCache;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -69,8 +69,8 @@ public class WcsServiceImpl implements IWcsService {
      */
     private static final Map<String, String> buttonBoxControlMap= new HashMap<String, String>(){
         {
-            put(OPEN, WmsConstant.TASK_BUSINESS_TYPE.TASK_75.getValue());
-            put(CLOSE, WmsConstant.TASK_BUSINESS_TYPE.TASK_74.getValue());
+            put(OPEN, AmsConstant.TASK_BUSINESS_TYPE.TASK_75.getValue());
+            put(CLOSE, AmsConstant.TASK_BUSINESS_TYPE.TASK_74.getValue());
         }
     };
 
@@ -79,8 +79,8 @@ public class WcsServiceImpl implements IWcsService {
      */
     private static final Map<String, String> buttonBoxGratingRedisKeyMap= new HashMap<String, String>(){
         {
-            put(WmsConstant.AREA_INFO.STORAGE_AREA.getValue(), WmsConstant.GRATING_RELIEVE_CMD.STORAGE_GRATING.getKey());
-            put(WmsConstant.AREA_INFO.EXIT_AREA.getValue(), WmsConstant.GRATING_RELIEVE_CMD.EXIT_GRATING.getKey());
+            put(AmsConstant.AREA_INFO.STORAGE_AREA.getValue(), AmsConstant.GRATING_RELIEVE_CMD.STORAGE_GRATING.getKey());
+            put(AmsConstant.AREA_INFO.EXIT_AREA.getValue(), AmsConstant.GRATING_RELIEVE_CMD.EXIT_GRATING.getKey());
         }
     };
 
@@ -89,10 +89,10 @@ public class WcsServiceImpl implements IWcsService {
      */
     private static final Map<String, String> buttonBoxAreaMap= new HashMap<String, String>(){
         {
-            put(EXIT_AREA_IP, WmsConstant.AREA_INFO.EXIT_AREA.getValue());
-            put(STORAGE_AREA_IP, WmsConstant.AREA_INFO.STORAGE_AREA.getValue());
-            put(NEW_EXIT_AREA_IP, WmsConstant.AREA_INFO.EXIT_AREA.getValue());
-            put(NEW_STORAGE_AREA_IP, WmsConstant.AREA_INFO.STORAGE_AREA.getValue());
+            put(EXIT_AREA_IP, AmsConstant.AREA_INFO.EXIT_AREA.getValue());
+            put(STORAGE_AREA_IP, AmsConstant.AREA_INFO.STORAGE_AREA.getValue());
+            put(NEW_EXIT_AREA_IP, AmsConstant.AREA_INFO.EXIT_AREA.getValue());
+            put(NEW_STORAGE_AREA_IP, AmsConstant.AREA_INFO.STORAGE_AREA.getValue());
         }
     };
 
@@ -103,11 +103,11 @@ public class WcsServiceImpl implements IWcsService {
 
         String op = buttonBoxAreaMap.get(btnOpForm.getIp());
         String businessType = buttonBoxControlMap.get(btnOpForm.getOpType());
-        if (WmsConstant.TASK_BUSINESS_TYPE.TASK_75.getValue().equals(businessType)
-                && redisCache.checkIsExist(WmsConstant.AREA_INFO.getKeyByValue(op))) {
-            insertAmsTask(op, WmsConstant.TASK_BUSINESS_TYPE.TASK_77.getValue());
+        if (AmsConstant.TASK_BUSINESS_TYPE.TASK_75.getValue().equals(businessType)
+                && redisCache.checkIsExist(AmsConstant.AREA_INFO.getKeyByValue(op))) {
+            insertAmsTask(op, AmsConstant.TASK_BUSINESS_TYPE.TASK_77.getValue());
             redisCache.setCacheObject(buttonBoxGratingRedisKeyMap.get(op), Boolean.TRUE, 3, TimeUnit.SECONDS);
-            redisCache.deleteObject(WmsConstant.AREA_INFO.getKeyByValue(op));
+            redisCache.deleteObject(AmsConstant.AREA_INFO.getKeyByValue(op));
         }
         insertAmsTask(op, businessType);
     }
@@ -116,8 +116,8 @@ public class WcsServiceImpl implements IWcsService {
         AmsTask amsTask = new AmsTask();
         amsTask.setTaskNo(IdWorker.getIdStr());
         amsTask.setIkey(Long.parseLong(String.valueOf(CRC16Util.calcCrc16(ByteUtil.string2byteArray(amsTask.getTaskNo())))));
-        amsTask.setStFrom(Integer.valueOf(WmsConstant.LOC_MIDDLE_CACHE.toString()));
-        amsTask.setStTo(Integer.valueOf(WmsConstant.LOC_SORTATION_CACHE.toString()));
+        amsTask.setStFrom(Integer.valueOf(AmsConstant.LOC_MIDDLE_CACHE.toString()));
+        amsTask.setStTo(Integer.valueOf(AmsConstant.LOC_SORTATION_CACHE.toString()));
         amsTask.setPriority(1);
         amsTask.setBusinessType(businessType);
         amsTask.setExt1(op);

+ 2 - 12
warewms-ams/src/main/java/com/warewms/common/constant/Constants.java

@@ -134,16 +134,6 @@ public class Constants
      */
     public static final String SYS_DICT_KEY = "sys_dict:";
 
-    /**
-     * agv点位缓存key
-     */
-    public static final String WMS_CORRESPOND_AGV_STATION_KEY = "wms_correspond_agv_station:";
-
-    /**
-     * 区域信息缓存key
-     */
-    public static final String LOCATION_ROW_KEY = "location_row:";
-
     /**
      * 资源映射路径 前缀
      */
@@ -167,13 +157,13 @@ public class Constants
     /**
      * 定时任务白名单配置(仅允许访问的包名,如其他需要可以自行添加)
      */
-    public static final String[] JOB_WHITELIST_STR = { "com.ruoyi" };
+    public static final String[] JOB_WHITELIST_STR = { "com.warewms" };
 
     /**
      * 定时任务违规的字符
      */
     public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
-            "org.springframework", "org.apache", "com.ruoyi.common.utils.file" };
+            "org.springframework", "org.apache", "com.warewms.common.utils.file" };
 
     /**
      *  升序

+ 1 - 1
warewms-ams/src/main/java/com/warewms/framework/config/CaptchaConfig.java

@@ -65,7 +65,7 @@ public class CaptchaConfig
         // KAPTCHA_SESSION_KEY
         properties.setProperty(KAPTCHA_SESSION_CONFIG_KEY, "kaptchaCodeMath");
         // 验证码文本生成器
-        properties.setProperty(KAPTCHA_TEXTPRODUCER_IMPL, "com.ruoyi.framework.config.KaptchaTextCreator");
+        properties.setProperty(KAPTCHA_TEXTPRODUCER_IMPL, "com.warewms.framework.config.KaptchaTextCreator");
         // 验证码文本字符间距 默认为2
         properties.setProperty(KAPTCHA_TEXTPRODUCER_CHAR_SPACE, "3");
         // 验证码文本字符长度 默认为5

+ 21 - 0
warewms-ams/src/main/java/com/warewms/framework/config/RestTemplateConfig.java

@@ -0,0 +1,21 @@
+package com.warewms.framework.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+import org.springframework.web.client.RestTemplate;
+
+@Configuration
+public class RestTemplateConfig {
+
+    @Bean
+    public RestTemplate restTemplate() {
+        //配置HTTP超时时间
+        HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory();
+        httpRequestFactory.setConnectionRequestTimeout(6000);
+        httpRequestFactory.setConnectTimeout(6000);
+        httpRequestFactory.setReadTimeout(6000);
+        return new RestTemplate(httpRequestFactory);
+    }
+
+}

+ 1 - 1
warewms-ams/src/main/resources/logback.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration>
     <!-- 日志存放路径 -->
-	<property name="log.path" value="../../../logs" />
+	<property name="log.path" value="../../../warewms/logs" />
     <!-- 日志输出格式 -->
 	<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
 

+ 191 - 0
warewms-ams/src/main/resources/mapper/ams/BaseLocationInfoMapper.xml

@@ -4,4 +4,195 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.warewms.ams.ndc.mapper.BaseLocationInfoMapper">
 
+    <resultMap type="BaseLocationInfo" id="BaseLocationInfoResult">
+        <result property="id"    column="id"    />
+        <result property="warehouseId"    column="warehouse_id"    />
+        <result property="zoneId"    column="zone_id"    />
+        <result property="locationNo"    column="location_no"    />
+        <result property="rowNo"    column="row_no"    />
+        <result property="rowIndex"    column="row_index"    />
+        <result property="colNo"    column="col_no"    />
+        <result property="colIndex"    column="col_index"    />
+        <result property="shiftNo"    column="shift_no"    />
+        <result property="shiftIndex"    column="shift_index"    />
+        <result property="stockStatus"    column="stock_status"    />
+        <result property="isEmpty"    column="is_empty"    />
+        <result property="bindSku"    column="bind_sku"    />
+        <result property="locationType"    column="location_type"    />
+        <result property="rackId"    column="rack_id"    />
+        <result property="agvStation"    column="agv_station"    />
+        <result property="foldedTag"    column="folded_tag"    />
+        <result property="heightLimit"    column="height_limit"    />
+        <result property="weightLimit"    column="weight_limit"    />
+    </resultMap>
+
+    <sql id="selectBaseLocationInfoVo">
+        select id, warehouse_id, zone_id, location_no, location_barcode, row_no, row_index, col_no, col_index, shift_no, shift_index, stock_status, is_empty, bind_sku, location_type, rack_id, agv_station, folded_tag, folded_count,height_limit,weight_limit, userdefine1, userdefine2, userdefine3, userdefine4, userdefine5, userdefine6, userdefine7, userdefine8, userdefine9, userdefine10, create_by, create_time, update_by, update_time, remark from base_location_info
+    </sql>
+
+    <select id="selectBaseLocationInfoList" parameterType="BaseLocationInfo" resultMap="BaseLocationInfoResult">
+        select t1.*,t2.zone_name
+        from base_location_info t1
+        left join base_location_zone t2 on t2.zone_id=t1.zone_id
+        <where>
+            <if test="id != null "> and id like concat('%', #{id}, '%')</if>
+            <if test="warehouseId != null "> and t1.warehouse_id = #{warehouseId}</if>
+            <if test="zoneId != null "> and t1.zone_id = #{zoneId}</if>
+            <if test="zoneName != null "> and zone_name = #{zoneName}</if>
+            <if test="locationNo != null  and locationNo != ''"> and location_no like concat('%', #{locationNo}, '%')</if>
+            <if test="agvStation != null  and agvStation != ''"> and agv_station like concat('%', #{agvStation}, '%')</if>
+            <if test="stockStatus != null  and stockStatus != ''"> and stock_status = #{stockStatus}</if>
+            <if test="isEmpty != null  and isEmpty != ''"> and is_empty = #{isEmpty}</if>
+            <if test="locationType != null  and locationType != ''"> and location_type = #{locationType}</if>
+        </where>
+        order by location_no
+    </select>
+
+    <select id="selectBaseLocationInfoById" parameterType="Long" resultMap="BaseLocationInfoResult">
+        <include refid="selectBaseLocationInfoVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertBaseLocationInfo" parameterType="BaseLocationInfo" useGeneratedKeys="true" keyProperty="id">
+        insert into base_location_info
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="warehouseId != null">warehouse_id,</if>
+            <if test="zoneId != null">zone_id,</if>
+            <if test="locationNo != null">location_no,</if>
+            <if test="locationBarcode != null">location_barcode,</if>
+            <if test="rowNo != null">row_no,</if>
+            <if test="rowIndex != null">row_index,</if>
+            <if test="colNo != null">col_no,</if>
+            <if test="colIndex != null">col_index,</if>
+            <if test="shiftNo != null">shift_no,</if>
+            <if test="shiftIndex != null">shift_index,</if>
+            <if test="stockStatus != null">stock_status,</if>
+            <if test="isEmpty != null">is_empty,</if>
+            <if test="bindSku != null">bind_sku,</if>
+            <if test="locationType != null">location_type,</if>
+            <if test="rackId != null">rack_id,</if>
+            <if test="agvStation != null">agv_station,</if>
+            <if test="foldedTag != null">folded_tag,</if>
+            <if test="foldedCount != null">folded_count,</if>
+            <if test="heightLimit != null">height_limit,</if>
+            <if test="weightLimit != null">weight_limit,</if>
+            <if test="userdefine1 != null">userdefine1,</if>
+            <if test="userdefine2 != null">userdefine2,</if>
+            <if test="userdefine3 != null">userdefine3,</if>
+            <if test="userdefine4 != null">userdefine4,</if>
+            <if test="userdefine5 != null">userdefine5,</if>
+            <if test="userdefine6 != null">userdefine6,</if>
+            <if test="userdefine7 != null">userdefine7,</if>
+            <if test="userdefine8 != null">userdefine8,</if>
+            <if test="userdefine9 != null">userdefine9,</if>
+            <if test="userdefine10 != null">userdefine10,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="remark != null">remark,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="warehouseId != null">#{warehouseId},</if>
+            <if test="zoneId != null">#{zoneId},</if>
+            <if test="locationNo != null">#{locationNo},</if>
+            <if test="locationBarcode != null">#{locationBarcode},</if>
+            <if test="rowNo != null">#{rowNo},</if>
+            <if test="rowIndex != null">#{rowIndex},</if>
+            <if test="colNo != null">#{colNo},</if>
+            <if test="colIndex != null">#{colIndex},</if>
+            <if test="shiftNo != null">#{shiftNo},</if>
+            <if test="shiftIndex != null">#{shiftIndex},</if>
+            <if test="stockStatus != null">#{stockStatus},</if>
+            <if test="isEmpty != null">#{isEmpty},</if>
+            <if test="bindSku != null">#{bindSku},</if>
+            <if test="locationType != null">#{locationType},</if>
+            <if test="rackId != null">#{rackId},</if>
+            <if test="agvStation != null">#{agvStation},</if>
+            <if test="foldedTag != null">#{foldedTag},</if>
+            <if test="foldedCount != null">#{foldedCount},</if>
+            <if test="heightLimit != null">#{heightLimit},</if>
+            <if test="weightLimit != null">#{weightLimit},</if>
+            <if test="userdefine1 != null">#{userdefine1},</if>
+            <if test="userdefine2 != null">#{userdefine2},</if>
+            <if test="userdefine3 != null">#{userdefine3},</if>
+            <if test="userdefine4 != null">#{userdefine4},</if>
+            <if test="userdefine5 != null">#{userdefine5},</if>
+            <if test="userdefine6 != null">#{userdefine6},</if>
+            <if test="userdefine7 != null">#{userdefine7},</if>
+            <if test="userdefine8 != null">#{userdefine8},</if>
+            <if test="userdefine9 != null">#{userdefine9},</if>
+            <if test="userdefine10 != null">#{userdefine10},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="remark != null">#{remark},</if>
+         </trim>
+    </insert>
+
+    <update id="updateBaseLocationInfo" parameterType="BaseLocationInfo">
+        update base_location_info
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
+            <if test="zoneId != null">zone_id = #{zoneId},</if>
+            <if test="locationNo != null">location_no = #{locationNo},</if>
+            <if test="locationBarcode != null">location_barcode = #{locationBarcode},</if>
+            <if test="rowNo != null">row_no = #{rowNo},</if>
+            <if test="rowIndex != null">row_index = #{rowIndex},</if>
+            <if test="colNo != null">col_no = #{colNo},</if>
+            <if test="colIndex != null">col_index = #{colIndex},</if>
+            <if test="shiftNo != null">shift_no = #{shiftNo},</if>
+            <if test="shiftIndex != null">shift_index = #{shiftIndex},</if>
+            <if test="stockStatus != null">stock_status = #{stockStatus},</if>
+            <if test="isEmpty != null">is_empty = #{isEmpty},</if>
+            <if test="bindSku != null">bind_sku = #{bindSku},</if>
+            <if test="locationType != null">location_type = #{locationType},</if>
+            <if test="rackId != null">rack_id = #{rackId},</if>
+            <if test="agvStation != null">agv_station = #{agvStation},</if>
+            <if test="foldedTag != null">folded_tag = #{foldedTag},</if>
+            <if test="foldedCount != null">folded_count = #{foldedCount},</if>
+            <if test="heightLimit != null">height_limit = #{heightLimit},</if>
+            <if test="weightLimit != null">weight_limit = #{weightLimit},</if>
+            <if test="userdefine1 != null">userdefine1 = #{userdefine1},</if>
+            <if test="userdefine2 != null">userdefine2 = #{userdefine2},</if>
+            <if test="userdefine3 != null">userdefine3 = #{userdefine3},</if>
+            <if test="userdefine4 != null">userdefine4 = #{userdefine4},</if>
+            <if test="userdefine5 != null">userdefine5 = #{userdefine5},</if>
+            <if test="userdefine6 != null">userdefine6 = #{userdefine6},</if>
+            <if test="userdefine7 != null">userdefine7 = #{userdefine7},</if>
+            <if test="userdefine8 != null">userdefine8 = #{userdefine8},</if>
+            <if test="userdefine9 != null">userdefine9 = #{userdefine9},</if>
+            <if test="userdefine10 != null">userdefine10 = #{userdefine10},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteBaseLocationInfoById" parameterType="Long">
+        delete from base_location_info where id = #{id}
+    </delete>
+
+    <delete id="deleteBaseLocationInfoByIds" parameterType="String">
+        delete from base_location_info where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+    <select id="selectSortedLocationListByZoneId" parameterType="BaseLocationInfo" resultMap="BaseLocationInfoResult">
+        <include refid="selectBaseLocationInfoVo"/>
+        where warehouse_id = #{warehouseId} and zone_id = #{zoneId}
+        <if test="orderByClause != null and orderByClause != ''" >
+            order by  ${orderByClause}
+        </if>
+        <if test="orderByClause == null or orderByClause == ''">
+            order by shift_no + 0,shift_index
+        </if>
+    </select>
+
 </mapper>