| | |
| | | import com.zy.core.action.ForkLiftAction; |
| | | import com.zy.core.action.ShuttleAction; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.dispatcher.ForkLiftDispatchUtils; |
| | | import com.zy.core.dispatcher.ShuttleDispatchUtils; |
| | | import com.zy.core.enums.*; |
| | | import com.zy.core.model.command.*; |
| | | import com.zy.core.model.protocol.ForkLiftProtocol; |
| | | import com.zy.core.model.protocol.ForkLiftStaProtocol; |
| | | import com.zy.core.model.protocol.LiftStaProtocol; |
| | | import com.zy.core.model.protocol.ShuttleProtocol; |
| | | import com.zy.core.thread.ForkLiftThread; |
| | | import com.zy.core.thread.ShuttleThread; |
| | |
| | | |
| | | /** |
| | | * 立体仓库WCS系统主流程业务 |
| | | * Created by vincent on 2020/8/6 |
| | | */ |
| | | @Slf4j |
| | | @Service("forkMainService") |
| | |
| | | @Autowired |
| | | private ConfigService configService; |
| | | @Autowired |
| | | private NavigateMapUtils navigateMapUtils; |
| | | @Autowired |
| | | private NavigateMapData navigateMapData; |
| | | @Autowired |
| | | private NavigateUtils navigateUtils; |
| | |
| | | private BasShuttleChargeService basShuttleChargeService; |
| | | @Autowired |
| | | private DeviceConfigService deviceConfigService; |
| | | @Autowired |
| | | private ForkLiftDispatchUtils forkLiftDispatchUtils; |
| | | |
| | | /** |
| | | * 初始化实时地图 |
| | |
| | | News.error("提升机已确认且任务完成状态,复位失败,但未找到工作档。提升机号={},工作号={}", forkLiftProtocol.getLiftNo(), forkLiftProtocol.getWrkNo()); |
| | | } |
| | | }else { |
| | | boolean checkPreviewDispatchForkLift = commonService.checkWorkNoContainMk(forkLiftProtocol.getWrkNo(), WrkIoType.FORKLIFT_MOVE.id); |
| | | boolean checkPreviewDispatchForkLift = commonService.checkWorkNoContainMk(forkLiftProtocol.getWrkNo(), WrkIoType.PREVIEW_LIFT_MOVE.id); |
| | | if (checkPreviewDispatchForkLift) { |
| | | //属于提升机预调度移动任务 |
| | | //无工作档支撑,直接确认完成 |
| | |
| | | return false; |
| | | } |
| | | |
| | | //获取源输送站 |
| | | ForkLiftStaProtocol liftSta = ForkLiftUtils.getLiftStaByStaNo(wrkMast.getSourceStaNo()); |
| | | if (liftSta == null) { |
| | | return false;//找不到站点 |
| | | //搜索最近且无故障提升机 |
| | | ForkLiftStaProtocol recentLiftStation = forkLiftDispatchUtils.getRecentLiftStation(shuttleProtocol.getShuttleNo(), Utils.getLev(wrkMast.getLocNo())); |
| | | if(recentLiftStation == null) { |
| | | News.info("{}号小车,{}目标库位,没有可用空闲输送站点", shuttleProtocol.getShuttleNo(), wrkMast.getLocNo()); |
| | | return false; |
| | | } |
| | | |
| | | if (liftSta.getHasTray()) { |
| | | if (recentLiftStation.getHasTray()) { |
| | | News.taskInfo(wrkMast.getWrkNo(), "{}任务,源站存在托盘", wrkMast.getWrkNo()); |
| | | return false; |
| | | } |
| | | |
| | | if (liftSta.getHasCar()) { |
| | | if (recentLiftStation.getHasCar()) { |
| | | News.taskInfo(wrkMast.getWrkNo(), "{}任务,源站存在小车", wrkMast.getWrkNo()); |
| | | return false; |
| | | } |
| | | |
| | | //获取目标输送站 |
| | | ForkLiftStaProtocol liftStaTarget = ForkLiftUtils.getLiftStaByStaNo(wrkMast.getStaNo()); |
| | | ForkLiftStaProtocol liftStaTarget = ForkLiftUtils.getLiftStaByLev(recentLiftStation.getLiftNo(), Utils.getLev(wrkMast.getLocNo())); |
| | | if (liftStaTarget == null) { |
| | | return false;//找不到站点 |
| | | } |
| | |
| | | assignCommand.setAuto(true);//自动模式 |
| | | |
| | | //计算近点位置 |
| | | String endLocation = navigateUtils.calcEndLocation(shuttleProtocol.getCurrentLocNo(), liftSta.getLocNo(), NavigationMapType.getMapTypes(NavigationMapType.NORMAL), null, null, 1); |
| | | String endLocation = navigateUtils.calcEndLocation(shuttleProtocol.getCurrentLocNo(), recentLiftStation.getLocNo(), NavigationMapType.getMapTypes(NavigationMapType.NORMAL), null, null, 1); |
| | | if (endLocation == null) { |
| | | News.taskInfo(wrkMast.getWrkNo(), "{}任务,小车近点位置计算失败", wrkMast.getWrkNo()); |
| | | return false; |
| | |
| | | assignCommand.setCommands(commands); |
| | | |
| | | wrkMast.setWrkSts(WrkStsType.MOVE_NEARBY.sts);//小车移动到提升机中 301.生成小车移库任务 ==> 302.小车移动至近点中 |
| | | wrkMast.setSourceStaNo(recentLiftStation.getStaNo()); |
| | | wrkMast.setStaNo(liftStaTarget.getStaNo()); |
| | | wrkMast.setModiTime(now); |
| | | wrkMast.setSystemMsg("");//清空消息 |
| | | if (wrkMastService.updateById(wrkMast)) { |
| | |
| | | } |
| | | |
| | | //移动 |
| | | int workNo = commonService.getWorkNo(WrkIoType.FORKLIFT_MOVE.id);//获取任务号 |
| | | int workNo = commonService.getWorkNo(WrkIoType.PREVIEW_LIFT_MOVE.id);//获取任务号 |
| | | |
| | | //获取提升机命令 |
| | | ForkLiftCommand liftCommand = forkLiftThread.getMoveCommand(workNo, forkLiftProtocol.getLev(), Utils.getLev(wrkMast.getSourceLocNo())); |