| | |
| | | } |
| | | } |
| | | |
| | | StaProtocol staProtocolOther = devpThread.getStation().get(crnStn.getStaNoOther()); |
| | | if (staProtocolOther == null) { |
| | | continue; |
| | | } else { |
| | | staProtocolOther = staProtocolOther.clone(); |
| | | } |
| | | |
| | | // 查询站点详细信息 |
| | | BasDevp staDetlOther = basDevpService.selectById(crnStn.getStaNoOther()); |
| | | if (staDetlOther == null) { |
| | | log.error("入库 ===>> 堆垛机站点在数据库不存在, 站点编号={}", crnStn.getStaNoOther()); |
| | | continue; |
| | | } |
| | | if (staProtocolOther.getWorkNo()!=0){ |
| | | WrkMast wrkMastOther = wrkMastMapper.selectPakInStep3(staProtocolOther.getWorkNo()); |
| | | if (Cools.isEmpty(wrkMastOther)){ |
| | | log.error("Other查询工作档案无数据--工作号{},站点号:{}", staProtocolOther.getWorkNo(),staProtocolOther.getSiteId()); |
| | | continue; |
| | | } |
| | | // 获取库位信息 |
| | | LocMast locMastOther = locMastService.selectById(wrkMastOther.getLocNo()); |
| | | if (locMastOther == null) { |
| | | log.error("查询库存无数据--库位号{}", locMastOther.getLocNo()); |
| | | continue; |
| | | } |
| | | if (!locMastOther.getLocSts().equals("S") && !locMastOther.getLocSts().equals("Q")) { |
| | | log.error("入库操作库位状态不符合--状态, 库位号={},库位状态={}", wrkMastOther.getLocNo(), locMastOther.getLocSts()); |
| | | continue; |
| | | } |
| | | if (locMastOther.getBay1()!=81){ |
| | | if (staProtocolOther.isAutoing() && staProtocolOther.isLoading() |
| | | && staProtocolOther.isInEnable() && staDetlOther.getCanining() != null && staDetlOther.getCanining().equals("Y")) { |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | CrnCommandParam crnCommandParam = new CrnCommandParam(); |
| | | crnCommandParam.setCrnNo(slave.getId()); // 堆垛机编号 |
| | | |
| | | crnCommandParam.setTaskNo2(wrkMast.getWrkNo().shortValue()); // 工作号 |
| | | crnCommandParam.setAckFinish2((short) 0); // 任务完成确认位 |
| | | crnCommandParam.setTaskMode2(CrnTaskModeType.SEPARATE_TAKE); // 任务模式: 单取货 |
| | | crnCommandParam.setSourcePosX2(crnStn.getRow().shortValue()); // 源库位排 |
| | | crnCommandParam.setSourcePosY2(crnStn.getBay().shortValue()); // 源库位列 |
| | | crnCommandParam.setSourcePosZ2(crnStn.getLev().shortValue()); // 源库位层 |
| | | crnCommandParam.setDestinationPosX2((short)0); // 目标库位排 |
| | | crnCommandParam.setDestinationPosY2((short)0); // 目标库位列 |
| | | crnCommandParam.setDestinationPosZ2((short)0); // 目标库位层 |
| | | |
| | | crnCommandParam.setTaskNo(wrkMastOther.getWrkNo().shortValue()); // 工作号 |
| | | crnCommandParam.setAckFinish((short) 0); // 任务完成确认位 |
| | | crnCommandParam.setTaskMode(CrnTaskModeType.SEPARATE_TAKE); // 任务模式: 单取货 |
| | | crnCommandParam.setSourcePosX(crnStn.getRow().shortValue()); // 源库位排 |
| | | crnCommandParam.setSourcePosY(crnStn.getBay().shortValue()); // 源库位列 |
| | | crnCommandParam.setSourcePosZ(crnStn.getLev().shortValue()); // 源库位层 |
| | | crnCommandParam.setDestinationPosX((short)0); // 目标库位排 |
| | | crnCommandParam.setDestinationPosY((short)0); // 目标库位列 |
| | | crnCommandParam.setDestinationPosZ((short)0); // 目标库位层 |
| | | if (!MessageQueue.offer(SlaveType.Crn, crnCommandParam.getCrnNo(), new Task(9, crnCommandParam))) { |
| | | log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSONString(crnCommandParam)); |
| | | } else { |
| | | // 修改工作档状态 2.设备上走 => 3.吊车入库中 |
| | | Date now = new Date(); |
| | | wrkMast.setWrkSts(3L); |
| | | wrkMast.setCrnStrTime(now); |
| | | wrkMast.setModiTime(now); |
| | | WrkMastSplitTwin wrkMastSplitTwin = new WrkMastSplitTwin(wrkMast,2,now); |
| | | wrkMastSplitTwin.setWrkSts(1); |
| | | wrkMastSplitTwin.setWrkStart(wrkMast.getStaNo().toString()); |
| | | wrkMastSplitTwin.setWrkEnd(wrkMast.getLocNo()); |
| | | wrkMastSplitTwin.setStartRow(crnStn.getRow()); |
| | | wrkMastSplitTwin.setStartBay(crnStn.getBay()); |
| | | wrkMastSplitTwin.setStartLev(crnStn.getLev()); |
| | | wrkMastSplitTwin.setEndRow(locMast.getRow1()); |
| | | wrkMastSplitTwin.setEndBay(locMast.getBay1()); |
| | | wrkMastSplitTwin.setEndLev(locMast.getLev1()); |
| | | wrkMastSplitTwin.setWrkType(1); |
| | | wrkMastSplitTwin.setIoType(1); |
| | | |
| | | wrkMastOther.setWrkSts(3L); |
| | | wrkMastOther.setCrnStrTime(now); |
| | | wrkMastOther.setModiTime(now); |
| | | WrkMastSplitTwin wrkMastSplitTwinOther = new WrkMastSplitTwin(wrkMastOther,1,now); |
| | | wrkMastSplitTwinOther.setWrkSts(1); |
| | | wrkMastSplitTwinOther.setWrkStart(wrkMastOther.getStaNo().toString()); |
| | | wrkMastSplitTwinOther.setWrkEnd(wrkMastOther.getLocNo()); |
| | | wrkMastSplitTwinOther.setStartRow(crnStn.getRow()); |
| | | wrkMastSplitTwinOther.setStartBay(crnStn.getBay()); |
| | | wrkMastSplitTwinOther.setStartLev(crnStn.getLev()); |
| | | wrkMastSplitTwinOther.setEndRow(locMastOther.getRow1()); |
| | | wrkMastSplitTwinOther.setEndBay(locMastOther.getBay1()); |
| | | wrkMastSplitTwinOther.setEndLev(locMastOther.getLev1()); |
| | | wrkMastSplitTwinOther.setWrkType(1); |
| | | wrkMastSplitTwinOther.setIoType(1); |
| | | |
| | | if (wrkMastMapper.updateById(wrkMast) == 0) { |
| | | log.error("修改工作档状态 2.设备上走 => 3.吊车入库中 失败!!,工作号={}", wrkMast.getWrkNo()); |
| | | } |
| | | |
| | | if (wrkMastSplitTwinMapper.insert(wrkMastSplitTwin)==0){ |
| | | log.error("创建 堆垛机执行任务 失败!!,工作号={},堆垛机号={}", wrkMast.getWrkNo(),wrkMast.getCrnNo()); |
| | | } |
| | | |
| | | if (wrkMastMapper.updateById(wrkMastOther) == 0) { |
| | | log.error("Other修改工作档状态 2.设备上走 => 3.吊车入库中 失败!!,工作号={}", wrkMast.getWrkNo()); |
| | | } |
| | | |
| | | if (wrkMastSplitTwinMapper.insert(wrkMastSplitTwinOther)==0){ |
| | | log.error("Other创建 堆垛机执行任务 失败!!,工作号={},堆垛机号={}", wrkMast.getWrkNo(),wrkMast.getCrnNo()); |
| | | } |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | return; |
| | | } |
| | | StaProtocol staProtocolOther1 = devpThread.getStation().get(crnStn.getStaNoOther1()); |
| | | if (staProtocolOther1 == null) { |
| | | continue; |
| | | } else { |
| | | staProtocolOther1 = staProtocolOther1.clone(); |
| | | } |
| | | |
| | | if (staProtocolOther1.isAutoing() && staProtocolOther1.getWorkNo()!=0){ |
| | | return; |
| | | } |
| | | |
| | | |
| | | StaProtocol staProtocolOther2 = devpThread.getStation().get(crnStn.getStaNoOther2()); |
| | | if (staProtocolOther2 == null) { |
| | | continue; |
| | | } else { |
| | | staProtocolOther2 = staProtocolOther2.clone(); |
| | | } |
| | | if (staProtocolOther2.isAutoing() && staProtocolOther2.getWorkNo()!=0){ |
| | | return; |
| | | } |
| | | crnStation = 2; |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | CrnCommand crnCommand = new CrnCommand(); |
| | | crnCommand.setCrnNo(slave.getId()); // 堆垛机编号 |
| | |
| | | crnCommand.setDestinationPosX((short)0); // 目标库位排 |
| | | crnCommand.setDestinationPosY((short)0); // 目标库位列 |
| | | crnCommand.setDestinationPosZ((short)0); // 目标库位层 |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(crnStation==1? 2:5, crnCommand))) { |
| | | |
| | | staProtocol.setWorkNo(wrkMast.getWrkNo()); |
| | | staProtocol.setStaNo(wrkMast.getStaNo()); |
| | | |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | |
| | | if (!MessageQueue.offer(SlaveType.Devp, crnStn.getDevpPlcId(), new Task(99, crnCommand.getCrnNo()-2))) { |
| | | log.error("输送线锁定命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), crnCommand.getCrnNo()-2); |
| | | continue; |
| | | } |
| | | if (!MessageQueue.offer(SlaveType.Crn, wrkMast.getCrnNo(), new Task(5, crnCommand))) { |
| | | log.error("堆垛机命令下发失败,堆垛机号={},任务数据={}", wrkMast.getCrnNo(), JSON.toJSONString(crnCommand)); |
| | | } else { |
| | | // 修改工作档状态 2.设备上走 => 3.吊车入库中 |