| | |
| | | import com.zy.common.model.MatDto; |
| | | import com.zy.common.model.SearchLocParam; |
| | | import com.zy.common.model.StartupDto; |
| | | import com.zy.common.model.enums.WrkChargeType; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.common.utils.CollectionUtils; |
| | | import com.zy.common.utils.HttpHandler; |
| | |
| | | String shallowLocNo = Utils.getShallowLoc(slaveProperties, wrkMast.getLocNo()); |
| | | LocMast shallowLoc = locMastService.selectById(shallowLocNo); |
| | | // O.空库位、Q.拣料/盘点/并板再入库、S.入库预约、X.禁用 直接搬! |
| | | switch (shallowLoc.getLocSts()) { |
| | | case "P": |
| | | case "R": { |
| | | WrkMast waitWrkMast = wrkMastMapper.selectBySourceLocNo(shallowLocNo); |
| | | if (null == waitWrkMast) { |
| | | log.error("{}库位异常,未检索到相应工作档!", shallowLocNo); |
| | | } else { |
| | | if (waitWrkMast.getWrkSts() < 17) { |
| | | waitWrkMast.setIoPri(20D); |
| | | waitWrkMast.setModiTime(new Date()); |
| | | if (wrkMastMapper.updateById(waitWrkMast) == 0) { |
| | | log.error("调整工作档优先级失败!工作号={}", waitWrkMast.getWrkNo()); |
| | | } |
| | | //20220719 Add,如果浅库位状态为P/R,工作状态为14/15,说明浅库位已经空了,可以执行入库任务 |
| | | continue; |
| | | if (shallowLoc.getLocSts().equals("P") || shallowLoc.getLocSts().equals("R")) { |
| | | WrkMast waitWrkMast = wrkMastMapper.selectBySourceLocNo(shallowLocNo); |
| | | if (null == waitWrkMast) { |
| | | log.error("{}库位异常,未检索到相应工作档!", shallowLocNo); |
| | | } else { |
| | | if (waitWrkMast.getWrkSts() < 17) { |
| | | waitWrkMast.setIoPri(30D); |
| | | waitWrkMast.setModiTime(new Date()); |
| | | if (wrkMastMapper.updateById(waitWrkMast) == 0) { |
| | | log.error("调整工作档优先级失败!工作号={}", waitWrkMast.getWrkNo()); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | case "F": |
| | | case "D": |
| | | // 此标记避免多次执行移库任务 |
| | | if (Cools.isEmpty(wrkMast.getUpdMk()) || "N".equals(wrkMast.getUpdMk())) { |
| | | wrkMast.setUpdMk("Y"); |
| | | wrkMast.setIoPri(20D); |
| | | wrkMastMapper.updateById(wrkMast); |
| | | // 生成工作档、改变浅库位的源库/目标库 库位状态、下发堆垛机命令(立马执行) |
| | | moveLocForDeepLoc(slave, shallowLoc); |
| | | } |
| | | continue; |
| | | case "Q": { |
| | | WrkMast waitWrkMast = wrkMastMapper.selectBySourceLocNo(shallowLocNo); |
| | | if (null != waitWrkMast && waitWrkMast.getWrkSts() == 9) { |
| | | //20220719 Add,如果浅库位状态为P/R,工作状态为14/15,说明浅库位已经空了,可以执行入库任务 |
| | | continue; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | if (shallowLoc.getLocSts().equals("F") || shallowLoc.getLocSts().equals("D")) { |
| | | // 此标记避免多次执行移库任务 |
| | | if (Cools.isEmpty(wrkMast.getUpdMk()) || "N".equals(wrkMast.getUpdMk())) { |
| | | wrkMast.setUpdMk("Y"); |
| | | wrkMast.setIoPri(20D); |
| | | wrkMastMapper.updateById(wrkMast); |
| | | // 生成工作档、改变浅库位的源库/目标库 库位状态、下发堆垛机命令(立马执行) |
| | | moveLocForDeepLoc(slave, shallowLoc); |
| | | } |
| | | continue; |
| | | } |
| | | if (shallowLoc.getLocSts().equals("Q")) { |
| | | WrkMast waitWrkMast = wrkMastMapper.selectBySourceLocNo(shallowLocNo); |
| | | if (null != waitWrkMast && waitWrkMast.getWrkSts() == 9) { |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | |
| | | // 获取堆垛机信息 |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, ste.getId()); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | if (steProtocol == null) { continue; } |
| | | if (Utils.getGroupRow(locNo, true).equals(Utils.getGroupRow(steProtocol.getRow().intValue(), true)) |
| | | && steProtocol.getBay() == Utils.getBay(locNo) |
| | | && steProtocol.getLev() == Utils.getLev(locNo)) { |
| | | return steProtocol.getSteNo().intValue(); |
| | | BasSte basSte = basSteService.selectById(ste.getId()); |
| | | if (Cools.isEmpty(steProtocol, basSte)) { continue; } |
| | | if (Utils.getGroupRow(locNo, true).equals(Utils.getGroupRow(basSte.getRow(), true)) |
| | | && basSte.getBay() == Utils.getBay(locNo) |
| | | && basSte.getLev() == Utils.getLev(locNo)) { |
| | | return ste.getId(); |
| | | } |
| | | } |
| | | return null; |
| | |
| | | if (steProtocol == null) { return; } |
| | | if (steProtocol.isIdle()) { |
| | | // 堆垛机空闲 |
| | | if (crnProtocol.getStatusType().equals(CrnStatusType.IDLE) || crnProtocol.getTaskNo() == 0) { |
| | | if (crnProtocol.getStatusType().equals(CrnStatusType.IDLE) && crnProtocol.getTaskNo() == 0) { |
| | | LocMast locMast; |
| | | // 入库搬 |
| | | if (wrkMast.getWrkSts() <= 10) { |
| | |
| | | // 穿梭车空闲 |
| | | if (steProtocol.isIdle()) { |
| | | // 堆垛机空闲 |
| | | if (crnProtocol.getStatusType().equals(CrnStatusType.IDLE) || crnProtocol.getTaskNo() == 0) { |
| | | if (crnProtocol.getStatusType().equals(CrnStatusType.IDLE) && crnProtocol.getTaskNo() == 0) { |
| | | |
| | | BasSte basSte = basSteService.selectById(steNo); |
| | | if (basSte == null) { |
| | |
| | | */ |
| | | @SuppressWarnings("serial") |
| | | public synchronized void loopSteCharge() { |
| | | if (null != wrkChargeService.selectWorking(null, "reset")) { |
| | | if (null != wrkChargeService.selectWorking(null, WrkChargeType.reset.toString())) { |
| | | return; |
| | | } |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | |
| | | if (steProtocol.getCharge() > Float.parseFloat(basSte.getChargeLine())) { |
| | | continue; |
| | | } |
| | | WrkCharge wrkCharge = wrkChargeService.selectWorking(null, "charge"); |
| | | WrkCharge wrkCharge = wrkChargeService.selectWorking(null, WrkChargeType.charge.toString()); |
| | | |
| | | if (wrkCharge == null && steProtocol.getChargeStatus() == 0) { |
| | | // 寻找空闲充电桩 |
| | |
| | | */ |
| | | public synchronized void queryChargeLocOfComplete() { |
| | | // 与充电任务不同步进行 |
| | | if (null != wrkChargeService.selectWorking(null, "charge")) { return; } |
| | | if (null != wrkChargeService.selectWorking(null, WrkChargeType.charge.toString())) { return; } |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, 1); |
| | | // 检索充电桩 |
| | | for (SteChargeType value : SteChargeType.values()) { |
| | |
| | | continue; |
| | | } |
| | | |
| | | WrkCharge wrkCharge = wrkChargeService.selectWorking(steNo, "reset"); |
| | | WrkCharge wrkCharge = wrkChargeService.selectWorking(steNo, WrkChargeType.reset.toString()); |
| | | |
| | | if (wrkCharge == null) { |
| | | // 开始穿梭车复位任务 |
| | |
| | | * 小车从充电桩 至 待机库位 |
| | | */ |
| | | public synchronized void steFromChargeToIdleLoc() { |
| | | WrkCharge wrkCharge = wrkChargeService.selectWorking(null, "reset"); |
| | | WrkCharge wrkCharge = wrkChargeService.selectWorking(null, WrkChargeType.reset.toString()); |
| | | if (wrkCharge == null) { return; } |
| | | SteThread steThread = (SteThread) SlaveConnection.get(SlaveType.Ste, wrkCharge.getSteNo()); |
| | | SteProtocol steProtocol = steThread.getSteProtocol(); |
| | | BasSte basSte = basSteService.selectById(wrkCharge.getSteNo()); |