| | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | |
| | | @TableField("barcode_station_list") |
| | | private String barcodeStationList; |
| | | |
| | | /** |
| | | * 入库站点数据 |
| | | */ |
| | | @ApiModelProperty(value= "入库站点数据") |
| | | @TableField("in_station_list") |
| | | private String inStationList; |
| | | |
| | | /** |
| | | * 出库站点数据 |
| | | */ |
| | | @ApiModelProperty(value= "出库站点数据") |
| | | @TableField("out_station_list") |
| | | private String outStationList; |
| | | |
| | | public BasDevp() {} |
| | | |
| | | public BasDevp(Integer devpNo,Integer status,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo,String stationList) { |
| | | public BasDevp(Integer devpNo,Integer status,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo,String stationList,String barcodeStationList,String inStationList,String outStationList) { |
| | | this.devpNo = devpNo; |
| | | this.status = status; |
| | | this.createBy = createBy; |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.BasMap; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.service.BasMapService; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.utils.RedisUtil; |
| | | import com.zy.core.enums.MapNodeType; |
| | | import com.zy.core.enums.RedisKeyType; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * 立体仓库WCS系统主流程业务 |
| | |
| | | @Service("mainService") |
| | | public class MainServiceImpl { |
| | | |
| | | @Autowired |
| | | private BasMapService basMapService; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | //初始化库位地图数据结构 |
| | | public void initLocMap() { |
| | | Object object = redisUtil.get(RedisKeyType.LOC_MAP_BASE.key); |
| | | if (object != null) { |
| | | return; |
| | | } |
| | | |
| | | BasMap basMap = basMapService.selectOne(new EntityWrapper<BasMap>().eq("lev", 1)); |
| | | if (Cools.isEmpty(basMap)){ |
| | | //缺少初始化库位地图 |
| | | return; |
| | | } |
| | | |
| | | List<List<JSONObject>> dataList = JSON.parseObject(basMap.getData(), List.class); |
| | | List<List<HashMap<String, Object>>> mapNodeList = new ArrayList<>(); |
| | | for (int i = 0; i < dataList.size(); i++) { |
| | | List<JSONObject> row = dataList.get(i); |
| | | List<HashMap<String, Object>> mapNodeRow = new ArrayList<>(); |
| | | |
| | | for (int j = 0; j < row.size(); j++) { |
| | | JSONObject map = row.get(j); |
| | | |
| | | HashMap<String, Object> mapNode = new HashMap<>(); |
| | | mapNode.put("id", i + "-" + j); |
| | | |
| | | String nodeType = map.getString("type"); |
| | | if("shelf".equals(nodeType)) { |
| | | mapNode.put("value", MapNodeType.NORMAL_PATH.id); |
| | | }else { |
| | | mapNode.put("value", MapNodeType.DISABLE.id); |
| | | } |
| | | |
| | | mapNodeRow.add(mapNode); |
| | | } |
| | | mapNodeList.add(mapNodeRow); |
| | | } |
| | | |
| | | redisUtil.set(RedisKeyType.LOC_MAP_BASE.key, mapNodeList); |
| | | } |
| | | |
| | | } |
| | |
| | | continue; |
| | | } |
| | | |
| | | // 初始化库位地图数据结构 |
| | | mainService.initLocMap(); |
| | | |
| | | // 间隔 |
| | | Thread.sleep(200); |
| | | } catch (Exception e) { |
| New file |
| | |
| | | package com.zy.core.task; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.zy.asrs.entity.BasMap; |
| | | import com.zy.asrs.service.BasMapService; |
| | | import com.zy.common.utils.RedisUtil; |
| | | import com.zy.core.enums.MapNodeType; |
| | | import com.zy.core.enums.RedisKeyType; |
| | | |
| | | @Component |
| | | public class InitLocMapScheduler { |
| | | |
| | | @Autowired |
| | | private BasMapService basMapService; |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | //初始化库位地图数据结构 |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | public void initLocMap() { |
| | | Object object = redisUtil.get(RedisKeyType.LOC_MAP_BASE.key); |
| | | if (object != null) { |
| | | return; |
| | | } |
| | | |
| | | BasMap basMap = basMapService.selectOne(new EntityWrapper<BasMap>().eq("lev", 1)); |
| | | if (Cools.isEmpty(basMap)){ |
| | | //缺少初始化库位地图 |
| | | return; |
| | | } |
| | | |
| | | List<List<JSONObject>> dataList = JSON.parseObject(basMap.getData(), List.class); |
| | | List<List<HashMap<String, Object>>> mapNodeList = new ArrayList<>(); |
| | | for (int i = 0; i < dataList.size(); i++) { |
| | | List<JSONObject> row = dataList.get(i); |
| | | List<HashMap<String, Object>> mapNodeRow = new ArrayList<>(); |
| | | |
| | | for (int j = 0; j < row.size(); j++) { |
| | | JSONObject map = row.get(j); |
| | | |
| | | HashMap<String, Object> mapNode = new HashMap<>(); |
| | | mapNode.put("id", i + "-" + j); |
| | | |
| | | String nodeType = map.getString("type"); |
| | | if("shelf".equals(nodeType)) { |
| | | mapNode.put("value", MapNodeType.NORMAL_PATH.id); |
| | | }else { |
| | | mapNode.put("value", MapNodeType.DISABLE.id); |
| | | } |
| | | |
| | | mapNodeRow.add(mapNode); |
| | | } |
| | | mapNodeList.add(mapNodeRow); |
| | | } |
| | | |
| | | redisUtil.set(RedisKeyType.LOC_MAP_BASE.key, mapNodeList); |
| | | } |
| | | |
| | | } |
| | |
| | | <result column="memo" property="memo" /> |
| | | <result column="station_list" property="stationList" /> |
| | | <result column="barcode_station_list" property="barcodeStationList" /> |
| | | <result column="in_station_list" property="inStationList" /> |
| | | <result column="out_station_list" property="outStationList" /> |
| | | |
| | | </resultMap> |
| | | |
| | |
| | | { field: "memo", align: "center", title: "备注" }, |
| | | { field: "stationList", align: "center", title: "站点数据" }, |
| | | { field: "barcodeStationList", align: "center", title: "条码站点数据" }, |
| | | { field: "inStationList", align: "center", title: "入库站点数据" }, |
| | | { field: "outStationList", align: "center", title: "出库站点数据" }, |
| | | |
| | | { |
| | | fixed: "right", |
| | |
| | | <input class="layui-input" name="barcodeStationList" placeholder="请输入条码站点数据"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">入库站点数据: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="inStationList" placeholder="请输入入库站点数据"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">出库站点数据: </label> |
| | | <div class="layui-input-block"> |
| | | <input class="layui-input" name="outStationList" placeholder="请输入出库站点数据"> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |