#
Junjie
4 天以前 6d99081f3f6e0363b0bd28053e545a8e4589b979
src/main/java/com/zy/core/utils/StationOperateProcessUtils.java
@@ -15,6 +15,7 @@
import com.zy.core.cache.SlaveConnection;
import com.zy.core.enums.RedisKeyType;
import com.zy.core.enums.SlaveType;
import com.zy.core.enums.StationCommandType;
import com.zy.core.enums.WrkStsType;
import com.zy.core.model.StationObjModel;
import com.zy.core.model.Task;
@@ -37,6 +38,8 @@
    private CommonService commonService;
    @Autowired
    private BasCrnpService basCrnpService;
    @Autowired
    private BasDualCrnpService basDualCrnpService;
    @Autowired
    private RedisUtil redisUtil;
    @Autowired
@@ -87,11 +90,6 @@
                        continue;
                    }
                    if (!wrkMast.getWrkNo().equals(stationProtocol.getTaskNo())) {
                        News.taskInfo(stationProtocol.getStationId(), "输送站点工作号:{}与条码搜索到的任务工作号:{}不一致", stationProtocol.getTaskNo(), wrkMast.getWrkNo());
                        continue;
                    }
                    String locNo = wrkMast.getLocNo();
                    FindCrnNoResult findCrnNoResult = commonService.findCrnNoByLocNo(locNo);
                    if (findCrnNoResult == null) {
@@ -105,7 +103,7 @@
                        continue;
                    }
                    StationCommand command = stationThread.getMoveCommand(wrkMast.getWrkNo(), stationId, targetStationId, 0);
                    StationCommand command = stationThread.getCommand(StationCommandType.MOVE, wrkMast.getWrkNo(), stationId, targetStationId, 0);
                    if(command == null){
                        News.taskInfo(wrkMast.getWrkNo(), "获取输送线命令失败");
                        continue;
@@ -130,15 +128,24 @@
    public synchronized void stationOutExecute() {
        List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("wrk_sts", WrkStsType.OUTBOUND_RUN_COMPLETE.sts));
        for (WrkMast wrkMast : wrkMasts) {
            List<StationObjModel> outStationList = new ArrayList<>();
            BasCrnp basCrnp = basCrnpService.selectOne(new EntityWrapper<BasCrnp>().eq("crn_no", wrkMast.getCrnNo()));
            if (basCrnp == null) {
                continue;
            if (basCrnp != null) {
                outStationList = basCrnp.getOutStationList$();
                if(outStationList.isEmpty()){
                    News.info("堆垛机:{} 出库站点未设置", basCrnp.getCrnNo());
                    continue;
                }
            }
            List<StationObjModel> outStationList = basCrnp.getOutStationList$();
            if(outStationList.isEmpty()){
                News.info("堆垛机:{} 出库站点未设置", basCrnp.getCrnNo());
                continue;
            BasDualCrnp basDualCrnp = basDualCrnpService.selectOne(new EntityWrapper<BasDualCrnp>().eq("crn_no", wrkMast.getDualCrnNo()));
            if (basDualCrnp != null) {
                outStationList = basDualCrnp.getOutStationList$();
                if(outStationList.isEmpty()){
                    News.info("双工位堆垛机:{} 出库站点未设置", basDualCrnp.getCrnNo());
                    continue;
                }
            }
            for (StationObjModel stationObjModel : outStationList) {
@@ -163,7 +170,7 @@
                        && stationProtocol.isLoading()
                        && stationProtocol.getTaskNo() == 0
                ) {
                    StationCommand command = stationThread.getMoveCommand(wrkMast.getWrkNo(), stationProtocol.getStationId(), wrkMast.getStaNo(), 0);
                    StationCommand command = stationThread.getCommand(StationCommandType.MOVE, wrkMast.getWrkNo(), stationProtocol.getStationId(), wrkMast.getStaNo(), 0);
                    if(command == null){
                        News.taskInfo(wrkMast.getWrkNo(), "获取输送线命令失败");
                        continue;
@@ -176,6 +183,7 @@
                        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);
                        redisUtil.set(RedisKeyType.STATION_OUT_EXECUTE_COMPLETE_LIMIT.key + wrkMast.getWrkNo(), "lock", 60 * 5);
                    }
                }
            }
@@ -187,6 +195,11 @@
        List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("wrk_sts", WrkStsType.STATION_RUN.sts));
        for (WrkMast wrkMast : wrkMasts) {
            Integer wrkNo = wrkMast.getWrkNo();
            Object lock = redisUtil.get(RedisKeyType.STATION_OUT_EXECUTE_COMPLETE_LIMIT.key + wrkNo);
            if (lock != null) {
                continue;
            }
            boolean complete = true;
            List<BasDevp> basDevps = basDevpService.selectList(new EntityWrapper<>());
@@ -295,7 +308,7 @@
                                continue;
                            }
                            StationCommand command = stationThread.getMoveCommand(wrkMast.getWrkNo(), stationProtocol.getStationId(), targetStationId, 0);
                            StationCommand command = stationThread.getCommand(StationCommandType.MOVE, wrkMast.getWrkNo(), stationProtocol.getStationId(), targetStationId, 0);
                            if(command == null){
                                News.taskInfo(wrkMast.getWrkNo(), "获取输送线命令失败");
                                continue;
@@ -331,7 +344,7 @@
                        }
                    }else {
                        //运行堵塞,重新计算路线
                        StationCommand command = stationThread.getMoveCommand(wrkMast.getWrkNo(), stationProtocol.getStationId(), wrkMast.getStaNo(), 0);
                        StationCommand command = stationThread.getCommand(StationCommandType.MOVE, wrkMast.getWrkNo(), stationProtocol.getStationId(), wrkMast.getStaNo(), 0);
                        if(command == null){
                            News.taskInfo(wrkMast.getWrkNo(), "获取输送线命令失败");
                            continue;