| | |
| | | convert(param, wrapper); |
| | | allLike(BasCrnpOpt.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | wrapper.orderBy("send_time", false); |
| | | return R.ok(basCrnpOptService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | |
| | | convert(param, wrapper); |
| | | allLike(BasDualCrnpOpt.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | wrapper.orderBy("send_time", false); |
| | | return R.ok(basDualCrnpOptService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | |
| | | convert(param, wrapper); |
| | | allLike(BasRgvOpt.class, param.keySet(), wrapper, condition); |
| | | if (!Cools.isEmpty(orderByField)){wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType));} |
| | | wrapper.orderBy("send_time", false); |
| | | return R.ok(basRgvOptService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | |
| | | DEVICE_STATION_MOVE_RESET("device_station_move_reset_"), |
| | | |
| | | CRN_SEND_COMMAND_LOCK("crn_send_command_lock_"), |
| | | DUAL_CRN_SEND_COMMAND_LOCK("dual_crn_send_command_lock_"), |
| | | |
| | | GENERATE_IN_TASK_LIMIT("generate_in_task_limit_"), |
| | | |
| | |
| | | |
| | | DUAL_CRN_PICK_WAIT_NEXT_TASK("dual_crn_pick_wait_next_task_"), |
| | | DUAL_CRN_OUT_TASK_STATION_INFO("dual_crn_out_task_station_info_"), |
| | | DUAL_CRN_OUT_TASK_COMPLETE_STATION_INFO("dual_crn_out_task_complete_station_info_"), |
| | | CRN_OUT_TASK_COMPLETE_STATION_INFO("crn_out_task_complete_station_info_"), |
| | | |
| | | CURRENT_CIRCLE_TASK_CRN_NO("current_circle_task_crn_no_"), |
| | | ASYNC_WMS_IN_TASK_REQUEST("async_wms_in_task_request_"), |
| | |
| | | import com.zy.asrs.service.BasCrnpOptService; |
| | | import com.zy.asrs.service.BasDualCrnpOptService; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.utils.RedisUtil; |
| | | import com.zy.core.News; |
| | | import com.zy.core.cache.OutputQueue; |
| | | import com.zy.core.enums.RedisKeyType; |
| | | import com.zy.core.model.CommandResponse; |
| | | import com.zy.core.model.command.DualCrnCommand; |
| | | import com.zy.core.network.api.ZyDualCrnConnectApi; |
| | |
| | | if(connect.IsSuccess){ |
| | | connected = true; |
| | | OutputQueue.CRN.offer(MessageFormat.format( "【{0}双工位堆垛机plc连接成功 ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort())); |
| | | News.info("SiemensDualCrn 双工位堆垛机plc连接成功 ===>> [id:{}] [ip:{}] [port:{}]", deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort()); |
| | | News.info("双工位堆垛机plc连接成功 ===>> [id:{}] [ip:{}] [port:{}]", deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort()); |
| | | } else { |
| | | OutputQueue.CRN.offer(MessageFormat.format("【{0}双工位堆垛机plc连接失败!!! ===>> [id:{1}] [ip:{2}] [port:{3}]", DateUtils.convert(new Date()), deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort())); |
| | | News.error("SiemensDualCrn 双工位堆垛机plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort()); |
| | | News.error("双工位堆垛机plc连接失败!!! ===>> [id:{}] [ip:{}] [port:{}]", deviceConfig.getDeviceNo(), deviceConfig.getIp(), deviceConfig.getPort()); |
| | | } |
| | | // siemensNet.ConnectClose(); |
| | | return connected; |
| | |
| | | crnStatus.setXDuration((double) siemensNet.getByteTransform().TransSingle(result.Content, 62)); |
| | | crnStatus.setYDuration((double) siemensNet.getByteTransform().TransSingle(result.Content, 66)); |
| | | |
| | | if (crnStatus.getStatus() == 0 && crnStatus.getTaskReceive() == 0) { |
| | | if ((crnStatus.getStatus() == 0 || crnStatus.getStatus() == 20) && crnStatus.getTaskReceive() == 0) { |
| | | OperateResultExOne<byte[]> taskResult = siemensNet.Read("DB100.0", (short) 18); |
| | | if (taskResult.IsSuccess) { |
| | | short taskNo = siemensNet.getByteTransform().TransInt16(taskResult.Content, 0); |
| | |
| | | short confirm = siemensNet.getByteTransform().TransInt16(taskResult.Content, 16); |
| | | |
| | | if(taskNo != 0 || taskMode != 0 || sourcePosX != 0 || sourcePosY != 0 || sourcePosZ != 0 || destinationPosX != 0 || destinationPosY != 0 || destinationPosZ != 0 || confirm != 0) { |
| | | short[] array = new short[10]; |
| | | short[] array = new short[9]; |
| | | array[0] = (short) 0; |
| | | array[1] = (short) 0; |
| | | array[2] = (short) 0; |
| | |
| | | array[6] = (short) 0; |
| | | array[7] = (short) 0; |
| | | array[8] = (short) 0; |
| | | array[9] = (short) 0; |
| | | OperateResult taskClearResult = siemensNet.Write("DB100.0", array); |
| | | |
| | | RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class); |
| | | Object lock = redisUtil.get(RedisKeyType.DUAL_CRN_SEND_COMMAND_LOCK.key + deviceConfig.getDeviceNo()); |
| | | if (lock == null) { |
| | | OperateResult taskClearResult = siemensNet.Write("DB100.0", array); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (crnStatus.getStatusTwo() == 0 && crnStatus.getTaskReceiveTwo() == 0) { |
| | | if ((crnStatus.getStatusTwo() == 0 || crnStatus.getStatusTwo() == 20) && crnStatus.getTaskReceiveTwo() == 0) { |
| | | OperateResultExOne<byte[]> taskResult = siemensNet.Read("DB100.18", (short) 18); |
| | | if (taskResult.IsSuccess) { |
| | | short taskNo = siemensNet.getByteTransform().TransInt16(taskResult.Content, 0); |
| | |
| | | short confirm = siemensNet.getByteTransform().TransInt16(taskResult.Content, 16); |
| | | |
| | | if(taskNo != 0 || taskMode != 0 || sourcePosX != 0 || sourcePosY != 0 || sourcePosZ != 0 || destinationPosX != 0 || destinationPosY != 0 || destinationPosZ != 0 || confirm != 0) { |
| | | short[] array = new short[10]; |
| | | short[] array = new short[9]; |
| | | array[0] = (short) 0; |
| | | array[1] = (short) 0; |
| | | array[2] = (short) 0; |
| | |
| | | array[6] = (short) 0; |
| | | array[7] = (short) 0; |
| | | array[8] = (short) 0; |
| | | array[9] = (short) 0; |
| | | OperateResult taskClearResult = siemensNet.Write("DB100.18", array); |
| | | |
| | | RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class); |
| | | Object lock = redisUtil.get(RedisKeyType.DUAL_CRN_SEND_COMMAND_LOCK.key + deviceConfig.getDeviceNo()); |
| | | if (lock == null) { |
| | | OperateResult taskClearResult = siemensNet.Write("DB100.18", array); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | @Override |
| | | public CommandResponse sendCommand(DualCrnCommand command) { |
| | | RedisUtil redisUtil = SpringUtils.getBean(RedisUtil.class); |
| | | redisUtil.set(RedisKeyType.DUAL_CRN_SEND_COMMAND_LOCK.key + deviceConfig.getDeviceNo(), "lock", 5); |
| | | CommandResponse response = new CommandResponse(false); |
| | | try { |
| | | if (null == command) { |
| | |
| | | // 执行输送站点入库任务 |
| | | stationOperateProcessUtils.stationInExecute(); |
| | | // 执行输送站点出库任务 |
| | | stationOperateProcessUtils.stationOutExecute(); |
| | | stationOperateProcessUtils.crnStationOutExecute(); |
| | | // 检测输送站点出库任务执行完成 |
| | | stationOperateProcessUtils.stationOutExecuteFinish(); |
| | | |
| | |
| | | //执行输送站点入库任务 |
| | | stationOperateProcessUtils.stationInExecute(); |
| | | //执行输送站点出库任务 |
| | | stationOperateProcessUtils.stationOutExecute(); |
| | | stationOperateProcessUtils.crnStationOutExecute(); |
| | | //检测输送站点出库任务执行完成 |
| | | stationOperateProcessUtils.stationOutExecuteFinish(); |
| | | |
| | |
| | | crnOperateUtils.crnIoExecuteFinish(); |
| | | //执行输送站点入库任务 |
| | | stationOperateProcessUtils.stationInExecute(); |
| | | //执行输送站点出库任务 |
| | | stationOperateProcessUtils.stationOutExecute(); |
| | | //执行堆垛机输送站点出库任务 |
| | | stationOperateProcessUtils.crnStationOutExecute(); |
| | | //执行双工位堆垛机输送站点出库任务 |
| | | stationOperateProcessUtils.dualCrnStationOutExecute(); |
| | | //检测输送站点出库任务执行完成 |
| | | stationOperateProcessUtils.stationOutExecuteFinish(); |
| | | //检测输送站点是否运行堵塞 |
| | |
| | | try { |
| | | deviceLogCollectTime = Utils.getDeviceLogCollectTime(); |
| | | readStatus(); |
| | | Thread.sleep(100); |
| | | Thread.sleep(50); |
| | | } catch (Exception e) { |
| | | log.error("CrnThread Fail", e); |
| | | } |
| | |
| | | try { |
| | | deviceLogCollectTime = Utils.getDeviceLogCollectTime(); |
| | | readStatus(); |
| | | Thread.sleep(100); |
| | | Thread.sleep(50); |
| | | } catch (Exception e) { |
| | | log.error("DualCrnThread Fail", e); |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.serializer.SerializerFeature; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.domain.enums.NotifyMsgType; |
| | |
| | | }else if(wrkMast.getWrkSts() == WrkStsType.OUTBOUND_RUN.sts){ |
| | | updateWrkSts = WrkStsType.OUTBOUND_RUN_COMPLETE.sts; |
| | | notifyUtils.notify(String.valueOf(SlaveType.Crn), crnProtocol.getCrnNo(), String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.CRN_OUT_TASK_COMPLETE, null); |
| | | |
| | | List<StationObjModel> outStationList = basCrnp.getOutStationList$(); |
| | | if(outStationList.isEmpty()){ |
| | | News.info("堆垛机:{} 出库站点未设置", basCrnp.getCrnNo()); |
| | | return; |
| | | } |
| | | |
| | | StationObjModel outStationObjModel = null; |
| | | for (StationObjModel stationObjModel : outStationList) { |
| | | if (stationObjModel.getStationId().equals(wrkMast.getSourceStaNo())) { |
| | | outStationObjModel = stationObjModel; |
| | | break; |
| | | } |
| | | } |
| | | redisUtil.set(RedisKeyType.CRN_OUT_TASK_COMPLETE_STATION_INFO.key + wrkMast.getWrkNo(), JSON.toJSONString(outStationObjModel, SerializerFeature.DisableCircularReferenceDetect), 60 * 60 * 24); |
| | | }else if(wrkMast.getWrkSts() == WrkStsType.LOC_MOVE_RUN.sts){ |
| | | updateWrkSts = WrkStsType.COMPLETE_LOC_MOVE.sts; |
| | | notifyUtils.notify(String.valueOf(SlaveType.Crn), crnProtocol.getCrnNo(), String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.CRN_TRANSFER_TASK_COMPLETE, null); |
| | |
| | | return false; |
| | | } |
| | | |
| | | List<StationObjModel> enableUseStationList = new ArrayList<>(); |
| | | for (StationObjModel stationObjModel : outStationList) { |
| | | if (!stationObjModel.getStationId().equals(wrkMast.getSourceStaNo())) { |
| | | continue; |
| | | } |
| | | |
| | | if(stationObjModel.getDualCrnExecuteStation().equals(station)) { |
| | | enableUseStationList.add(stationObjModel); |
| | | } |
| | | |
| | | StationObjModel dualCrnSlaveStation = stationObjModel.getDualCrnSlaveStation(); |
| | | if(dualCrnSlaveStation != null) { |
| | | if (dualCrnSlaveStation.getDualCrnExecuteStation().equals(station)) { |
| | | enableUseStationList.add(stationObjModel); |
| | | } |
| | | } |
| | | } |
| | | |
| | | for (StationObjModel stationObjModel : enableUseStationList) { |
| | | StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, stationObjModel.getDeviceNo()); |
| | | if (stationThread == null) { |
| | | continue; |
| | |
| | | } else if (wrkMast.getWrkSts() == WrkStsType.OUTBOUND_RUN.sts) { |
| | | updateWrkSts = WrkStsType.OUTBOUND_RUN_COMPLETE.sts; |
| | | notifyUtils.notify(String.valueOf(SlaveType.DualCrn), basDualCrnp.getCrnNo(), String.valueOf(wrkMast.getWrkNo()), wrkMast.getWmsWrkNo(), NotifyMsgType.DUAL_CRN_OUT_TASK_COMPLETE, null); |
| | | |
| | | |
| | | List<StationObjModel> outStationList = basDualCrnp.getOutStationList$(); |
| | | if(outStationList.isEmpty()){ |
| | | News.info("双工位堆垛机:{} 出库站点未设置", basDualCrnp.getCrnNo()); |
| | | return; |
| | | } |
| | | |
| | | StationObjModel outStationObjModel = null; |
| | | for (StationObjModel stationObjModel : outStationList) { |
| | | if (stationObjModel.getStationId().equals(wrkMast.getSourceStaNo())) { |
| | | outStationObjModel = stationObjModel; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (outStationObjModel == null) { |
| | | News.info("双工位堆垛机:{} 未找到匹配的任务出库站", basDualCrnp.getCrnNo()); |
| | | return; |
| | | } |
| | | |
| | | if (station == 1) { |
| | | redisUtil.set(RedisKeyType.DUAL_CRN_OUT_TASK_COMPLETE_STATION_INFO.key + wrkMast.getWrkNo(), JSON.toJSONString(outStationObjModel, SerializerFeature.DisableCircularReferenceDetect), 60 * 60 * 24); |
| | | }else { |
| | | redisUtil.set(RedisKeyType.DUAL_CRN_OUT_TASK_COMPLETE_STATION_INFO.key + wrkMast.getWrkNo(), JSON.toJSONString(outStationObjModel.getDualCrnSlaveStation(), SerializerFeature.DisableCircularReferenceDetect), 60 * 60 * 24); |
| | | } |
| | | |
| | | if(mainProcessPlugin.contains("Fake")) { |
| | | //生成仿真站点数据 |
| | | List<StationObjModel> outStationList = basDualCrnp.getOutStationList$(); |
| | | if(outStationList.isEmpty()){ |
| | | News.info("双工位堆垛机:{} 出库站点未设置", basDualCrnp.getCrnNo()); |
| | | return; |
| | | } |
| | | |
| | | for (StationObjModel stationObjModel : outStationList) { |
| | | if (!stationObjModel.getStationId().equals(wrkMast.getSourceStaNo())) { |
| | | continue; |
| | |
| | | } |
| | | } |
| | | |
| | | //执行输送站点出库任务 |
| | | public synchronized void stationOutExecute() { |
| | | List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().eq("wrk_sts", WrkStsType.OUTBOUND_RUN_COMPLETE.sts)); |
| | | //执行堆垛机输送站点出库任务 |
| | | public synchronized void crnStationOutExecute() { |
| | | List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>() |
| | | .eq("wrk_sts", WrkStsType.OUTBOUND_RUN_COMPLETE.sts) |
| | | .isNotNull("crn_no") |
| | | ); |
| | | for (WrkMast wrkMast : wrkMasts) { |
| | | List<StationObjModel> outStationList = new ArrayList<>(); |
| | | |
| | | BasCrnp basCrnp = basCrnpService.selectOne(new EntityWrapper<BasCrnp>().eq("crn_no", wrkMast.getCrnNo())); |
| | | if (basCrnp != null) { |
| | | outStationList = basCrnp.getOutStationList$(); |
| | | if(outStationList.isEmpty()){ |
| | | News.info("堆垛机:{} 出库站点未设置", basCrnp.getCrnNo()); |
| | | continue; |
| | | } |
| | | Object infoObj = redisUtil.get(RedisKeyType.CRN_OUT_TASK_COMPLETE_STATION_INFO.key + wrkMast.getWrkNo()); |
| | | if (infoObj == null) { |
| | | News.info("出库任务{}数据缓存不存在", wrkMast.getWrkNo()); |
| | | 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; |
| | | } |
| | | StationObjModel stationObjModel = JSON.parseObject(infoObj.toString(), StationObjModel.class); |
| | | StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, stationObjModel.getDeviceNo()); |
| | | if(stationThread == null){ |
| | | continue; |
| | | } |
| | | |
| | | for (StationObjModel stationObjModel : outStationList) { |
| | | StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, stationObjModel.getDeviceNo()); |
| | | if(stationThread == null){ |
| | | Map<Integer, StationProtocol> stationMap = stationThread.getStatusMap(); |
| | | StationProtocol stationProtocol = stationMap.get(stationObjModel.getStationId()); |
| | | if (stationProtocol == null) { |
| | | continue; |
| | | } |
| | | |
| | | Object lock = redisUtil.get(RedisKeyType.STATION_OUT_EXECUTE_LIMIT.key + stationProtocol.getStationId()); |
| | | if (lock != null) { |
| | | continue; |
| | | } |
| | | |
| | | //满足自动、有物、工作号0 |
| | | if (stationProtocol.isAutoing() |
| | | && stationProtocol.isLoading() |
| | | && stationProtocol.getTaskNo() == 0 |
| | | ) { |
| | | StationCommand command = stationThread.getCommand(StationCommandType.MOVE, wrkMast.getWrkNo(), stationProtocol.getStationId(), wrkMast.getStaNo(), 0); |
| | | if(command == null){ |
| | | News.taskInfo(wrkMast.getWrkNo(), "获取输送线命令失败"); |
| | | continue; |
| | | } |
| | | |
| | | Map<Integer, StationProtocol> stationMap = stationThread.getStatusMap(); |
| | | StationProtocol stationProtocol = stationMap.get(stationObjModel.getStationId()); |
| | | if (stationProtocol == null) { |
| | | wrkMast.setWrkSts(WrkStsType.STATION_RUN.sts); |
| | | wrkMast.setSystemMsg(""); |
| | | wrkMast.setIoTime(new Date()); |
| | | 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); |
| | | redisUtil.set(RedisKeyType.STATION_OUT_EXECUTE_COMPLETE_LIMIT.key + wrkMast.getWrkNo(), "lock", 60 * 5); |
| | | redisUtil.del(RedisKeyType.CRN_OUT_TASK_COMPLETE_STATION_INFO.key + wrkMast.getWrkNo()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //执行双工位堆垛机输送站点出库任务 |
| | | public synchronized void dualCrnStationOutExecute() { |
| | | List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>() |
| | | .eq("wrk_sts", WrkStsType.OUTBOUND_RUN_COMPLETE.sts) |
| | | .isNotNull("dual_crn_no") |
| | | ); |
| | | for (WrkMast wrkMast : wrkMasts) { |
| | | Object infoObj = redisUtil.get(RedisKeyType.DUAL_CRN_OUT_TASK_COMPLETE_STATION_INFO.key + wrkMast.getWrkNo()); |
| | | if (infoObj == null) { |
| | | News.info("出库任务{}数据缓存不存在", wrkMast.getWrkNo()); |
| | | continue; |
| | | } |
| | | |
| | | StationObjModel stationObjModel = JSON.parseObject(infoObj.toString(), StationObjModel.class); |
| | | StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, stationObjModel.getDeviceNo()); |
| | | if(stationThread == null){ |
| | | continue; |
| | | } |
| | | |
| | | Map<Integer, StationProtocol> stationMap = stationThread.getStatusMap(); |
| | | StationProtocol stationProtocol = stationMap.get(stationObjModel.getStationId()); |
| | | if (stationProtocol == null) { |
| | | continue; |
| | | } |
| | | |
| | | Object lock = redisUtil.get(RedisKeyType.STATION_OUT_EXECUTE_LIMIT.key + stationProtocol.getStationId()); |
| | | if (lock != null) { |
| | | continue; |
| | | } |
| | | |
| | | //满足自动、有物、工作号0 |
| | | if (stationProtocol.isAutoing() |
| | | && stationProtocol.isLoading() |
| | | && stationProtocol.getTaskNo() == 0 |
| | | ) { |
| | | StationCommand command = stationThread.getCommand(StationCommandType.MOVE, wrkMast.getWrkNo(), stationProtocol.getStationId(), wrkMast.getStaNo(), 0); |
| | | if(command == null){ |
| | | News.taskInfo(wrkMast.getWrkNo(), "获取输送线命令失败"); |
| | | continue; |
| | | } |
| | | |
| | | Object lock = redisUtil.get(RedisKeyType.STATION_OUT_EXECUTE_LIMIT.key + stationProtocol.getStationId()); |
| | | if (lock != null) { |
| | | continue; |
| | | } |
| | | |
| | | //满足自动、有物、工作号0 |
| | | if (stationProtocol.isAutoing() |
| | | && stationProtocol.isLoading() |
| | | && stationProtocol.getTaskNo() == 0 |
| | | ) { |
| | | StationCommand command = stationThread.getCommand(StationCommandType.MOVE, wrkMast.getWrkNo(), stationProtocol.getStationId(), wrkMast.getStaNo(), 0); |
| | | if(command == null){ |
| | | News.taskInfo(wrkMast.getWrkNo(), "获取输送线命令失败"); |
| | | continue; |
| | | } |
| | | |
| | | wrkMast.setWrkSts(WrkStsType.STATION_RUN.sts); |
| | | wrkMast.setSystemMsg(""); |
| | | wrkMast.setIoTime(new Date()); |
| | | 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); |
| | | redisUtil.set(RedisKeyType.STATION_OUT_EXECUTE_COMPLETE_LIMIT.key + wrkMast.getWrkNo(), "lock", 60 * 5); |
| | | } |
| | | wrkMast.setWrkSts(WrkStsType.STATION_RUN.sts); |
| | | wrkMast.setSystemMsg(""); |
| | | wrkMast.setIoTime(new Date()); |
| | | 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); |
| | | redisUtil.set(RedisKeyType.STATION_OUT_EXECUTE_COMPLETE_LIMIT.key + wrkMast.getWrkNo(), "lock", 60 * 5); |
| | | redisUtil.del(RedisKeyType.DUAL_CRN_OUT_TASK_COMPLETE_STATION_INFO.key + wrkMast.getWrkNo()); |
| | | } |
| | | } |
| | | } |