#
Junjie
20 小时以前 7a546480f6ddfaee1366f280981a002a08412c11
src/main/java/com/zy/core/utils/StationOperateProcessUtils.java
@@ -11,9 +11,11 @@
import com.zy.asrs.service.BasDevpService;
import com.zy.asrs.service.WrkMastService;
import com.zy.common.service.CommonService;
import com.zy.common.utils.RedisUtil;
import com.zy.core.News;
import com.zy.core.cache.MessageQueue;
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.RedisKeyType;
import com.zy.core.enums.SlaveType;
import com.zy.core.enums.WrkStsType;
import com.zy.core.model.StationObjModel;
@@ -39,6 +41,8 @@
    private CommonService commonService;
    @Autowired
    private BasCrnpService basCrnpService;
    @Autowired
    private RedisUtil redisUtil;
    //执行输送站点入库任务
    public synchronized void stationInExecute() {
@@ -51,7 +55,7 @@
            Map<Integer, StationProtocol> stationMap = stationThread.getStatusMap();
            List<StationObjModel> list = basDevp.getInStationList$();
            List<StationObjModel> list = basDevp.getBarcodeStationList$();
            for (StationObjModel entity : list) {
                Integer stationId = entity.getStationId();
                if(!stationMap.containsKey(stationId)){
@@ -63,10 +67,15 @@
                    continue;
                }
                //满足自动、有物、工作号9999
                Object lock = redisUtil.get(RedisKeyType.STATION_IN_EXECUTE_LIMIT.key + stationId);
                if(lock != null){
                    continue;
                }
                //满足自动、有物、有工作号
                if (stationProtocol.isAutoing()
                        && stationProtocol.isLoading()
                        && stationProtocol.getTaskNo() == 9999
                        && stationProtocol.getTaskNo() > 0
                ) {
                    //检测任务是否生成
                    WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("barcode", stationProtocol.getBarcode()));
@@ -75,6 +84,11 @@
                    }
                    if (wrkMast.getWrkSts() == WrkStsType.INBOUND_DEVICE_RUN.sts) {
                        continue;
                    }
                    if (!wrkMast.getWrkNo().equals(stationProtocol.getTaskNo())) {
                        News.taskInfo(stationProtocol.getStationId(), "输送站点工作号:{}与条码搜索到的任务工作号:{}不一致", stationProtocol.getTaskNo(), wrkMast.getWrkNo());
                        continue;
                    }
@@ -105,6 +119,7 @@
                    if (wrkMastService.updateById(wrkMast)) {
                        MessageQueue.offer(SlaveType.Devp, basDevp.getDevpNo(), new Task(2, command));
                        News.info("输送站点入库命令下发成功,站点号={},工作号={},命令数据={}", stationId, wrkMast.getWrkNo(), JSON.toJSONString(command));
                        redisUtil.set(RedisKeyType.STATION_IN_EXECUTE_LIMIT.key + stationId, "lock", 5);
                    }
                }
            }
@@ -138,6 +153,11 @@
                    continue;
                }
                Object lock = redisUtil.get(RedisKeyType.STATION_OUT_EXECUTE_LIMIT.key + stationProtocol.getStationId());
                if (lock != null) {
                    continue;
                }
                //满足自动、有物、工作号0
                if (stationProtocol.isAutoing()
                        && stationProtocol.isLoading()
@@ -155,6 +175,7 @@
                    if (wrkMastService.updateById(wrkMast)) {
                        MessageQueue.offer(SlaveType.Devp, stationObjModel.getDeviceNo(), new Task(2, command));
                        News.info("输送站点出库命令下发成功,站点号={},工作号={},命令数据={}", stationProtocol.getStationId(), wrkMast.getWrkNo(), JSON.toJSONString(command));
                        redisUtil.set(RedisKeyType.STATION_OUT_EXECUTE_LIMIT.key + stationProtocol.getStationId(), "lock", 5);
                    }
                }
            }