| | |
| | | |
| | | 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.common.Cools; |
| | | import com.zy.asrs.domain.param.CreateInTaskParam; |
| | |
| | | // 执行输送站点入库任务 |
| | | stationOperateProcessUtils.stationInExecute(); |
| | | // 执行输送站点出库任务 |
| | | stationOperateProcessUtils.stationOutExecute(); |
| | | stationOperateProcessUtils.crnStationOutExecute(); |
| | | // 检测输送站点出库任务执行完成 |
| | | stationOperateProcessUtils.stationOutExecuteFinish(); |
| | | |
| | |
| | | |
| | | // 生成仿真模拟出库任务 |
| | | private synchronized void generateFakeOutTask() { |
| | | if (!enableFake.equals("Y")) { |
| | | return; |
| | | } |
| | | |
| | | if (fakeRealTaskRequestWms.equals("Y")) { |
| | | return; |
| | | } |
| | | |
| | | if (!fakeGenerateOutTask.equals("Y")) { |
| | | return; |
| | | } |
| | | |
| | | List<BasDevp> basDevps = basDevpService.selectList(new EntityWrapper<>()); |
| | | for (BasDevp basDevp : basDevps) { |
| | | StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basDevp.getDevpNo()); |
| | | if (stationThread == null) { |
| | | continue; |
| | | try { |
| | | if (!enableFake.equals("Y")) { |
| | | return; |
| | | } |
| | | |
| | | Map<Integer, StationProtocol> stationMap = stationThread.getStatusMap(); |
| | | if (fakeRealTaskRequestWms.equals("Y")) { |
| | | return; |
| | | } |
| | | |
| | | List<StationObjModel> list = basDevp.getOutStationList$(); |
| | | for (StationObjModel entity : list) { |
| | | Integer stationId = entity.getStationId(); |
| | | if (!stationMap.containsKey(stationId)) { |
| | | if (!fakeGenerateOutTask.equals("Y")) { |
| | | return; |
| | | } |
| | | |
| | | List<BasDevp> basDevps = basDevpService.selectList(new EntityWrapper<>()); |
| | | for (BasDevp basDevp : basDevps) { |
| | | StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp, basDevp.getDevpNo()); |
| | | if (stationThread == null) { |
| | | continue; |
| | | } |
| | | |
| | | StationProtocol stationProtocol = stationMap.get(stationId); |
| | | if (stationProtocol == null) { |
| | | continue; |
| | | } |
| | | Map<Integer, StationProtocol> stationMap = stationThread.getStatusMap(); |
| | | |
| | | Object object = redisUtil.get(RedisKeyType.GENERATE_FAKE_OUT_TASK_LIMIT.key + stationId); |
| | | if (object != null) { |
| | | return; |
| | | } |
| | | |
| | | // 满足自动、无物、工作号0,生成出库数据 |
| | | if (stationProtocol.isAutoing() |
| | | && !stationProtocol.isLoading() |
| | | && stationProtocol.getTaskNo() == 0) { |
| | | List<LocMast> locMastList = locMastService |
| | | .selectList(new EntityWrapper<LocMast>().eq("loc_sts", String.valueOf(LocStsType.F))); |
| | | if (locMastList.isEmpty()) { |
| | | List<StationObjModel> list = basDevp.getOutStationList$(); |
| | | for (StationObjModel entity : list) { |
| | | Integer stationId = entity.getStationId(); |
| | | if (!stationMap.containsKey(stationId)) { |
| | | continue; |
| | | } |
| | | |
| | | LocMast locMast = locMastList.get(0); |
| | | StationProtocol stationProtocol = stationMap.get(stationId); |
| | | if (stationProtocol == null) { |
| | | continue; |
| | | } |
| | | |
| | | CreateOutTaskParam taskParam = new CreateOutTaskParam(); |
| | | taskParam.setTaskNo(String.valueOf(commonService.getWorkNo(WrkIoType.OUT.id))); |
| | | taskParam.setStaNo(stationId); |
| | | taskParam.setLocNo(locMast.getLocNo()); |
| | | boolean result = commonService.createOutTask(taskParam); |
| | | redisUtil.set(RedisKeyType.GENERATE_FAKE_OUT_TASK_LIMIT.key + stationId, "lock", 10); |
| | | Object object = redisUtil.get(RedisKeyType.GENERATE_FAKE_OUT_TASK_LIMIT.key + stationId); |
| | | if (object != null) { |
| | | return; |
| | | } |
| | | |
| | | // 满足自动、无物、工作号0,生成出库数据 |
| | | if (stationProtocol.isAutoing() |
| | | && !stationProtocol.isLoading() |
| | | && stationProtocol.getTaskNo() == 0) { |
| | | List<LocMast> locMastList = locMastService |
| | | .selectList(new EntityWrapper<LocMast>().eq("loc_sts", String.valueOf(LocStsType.F))); |
| | | if (locMastList.isEmpty()) { |
| | | continue; |
| | | } |
| | | |
| | | LocMast locMast = locMastList.get(0); |
| | | |
| | | CreateOutTaskParam taskParam = new CreateOutTaskParam(); |
| | | taskParam.setTaskNo(String.valueOf(commonService.getWorkNo(WrkIoType.OUT.id))); |
| | | taskParam.setStaNo(stationId); |
| | | taskParam.setLocNo(locMast.getLocNo()); |
| | | boolean result = commonService.createOutTask(taskParam); |
| | | redisUtil.set(RedisKeyType.GENERATE_FAKE_OUT_TASK_LIMIT.key + stationId, "lock", 10); |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | |
| | | StationCommand command = stationThread.getCommand(StationCommandType.WRITE_INFO, 9998, |
| | | wrkMast.getSourceStaNo(), 0, 0); |
| | | MessageQueue.offer(SlaveType.Devp, stationObjModel.getDeviceNo(), new Task(2, command)); |
| | | redisUtil.set(RedisKeyType.CRN_OUT_TASK_COMPLETE_STATION_INFO.key + wrkMast.getWrkNo(), JSON.toJSONString(stationObjModel, SerializerFeature.DisableCircularReferenceDetect), 60 * 60 * 24); |
| | | } |
| | | } else if (wrkMast.getWrkSts() == WrkStsType.LOC_MOVE_RUN.sts) { |
| | | updateWrkSts = WrkStsType.COMPLETE_LOC_MOVE.sts; |