| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 四向穿梭车电量检测 ===>> 发起充电 |
| | | */ |
| | | public synchronized void loopShuttleCharge() { |
| | | // ShuttleChargeType shuttleCharge = ShuttleChargeType.CHARGE_1; |
| | | // for (ShuttleSlave shuttle : slaveProperties.getShuttle()) { |
| | | // // 判断充电位是否被占用 |
| | | // if (wrkChargeService.hasShuttleInChargeLoc(shuttleCharge.locNo, shuttle.getId())) { |
| | | // continue; |
| | | // } |
| | | // |
| | | // //获取四向穿梭车线程 |
| | | // ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttle.getId()); |
| | | // ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); |
| | | // if (shuttleProtocol == null) { |
| | | // continue; |
| | | // } |
| | | // if (motionService.selectCount(new EntityWrapper<Motion>() |
| | | // .eq("device_ctg", DeviceCtgType.SHUTTLE.val()) |
| | | // .eq("device", shuttle.getId()) |
| | | // .eq("motion_sts", MotionStsType.EXECUTING.val())) > 0) { |
| | | // continue; |
| | | // } |
| | | // |
| | | // //判断当前小车是否满足需要充电要求 |
| | | // if (!shuttleProtocol.isRequireCharge()) { |
| | | // continue; |
| | | // } |
| | | // |
| | | // WrkCharge wrkCharge = wrkChargeService.selectWorking(null); |
| | | // if (wrkCharge != null) {//已有充电任务 |
| | | // continue; |
| | | // } |
| | | // |
| | | // String chargeLocNo = shuttleCharge.locNo; |
| | | // wrkCharge = new WrkCharge(); |
| | | // wrkCharge.setShuttleNo(shuttle.getId()); |
| | | // wrkCharge.setCharge(shuttleCharge.id); |
| | | // wrkCharge.setWrkNo(commonService.getChargeWorkNo(4)); |
| | | // wrkCharge.setUuid(String.valueOf(snowflakeIdWorker.nextId())); |
| | | // wrkCharge.setWrkSts(WrkMastStsType.NEW_CHARGE.sts); // 充电任务 |
| | | // wrkCharge.setIoType(WrkIoTypeType.CHARGE.sts); |
| | | // wrkCharge.setIoPri((double) 10); |
| | | // wrkCharge.setLocNo(chargeLocNo); |
| | | // wrkCharge.setMemo("charge"); |
| | | // wrkCharge.setAppeTime(new Date()); |
| | | // |
| | | // // generate motion list |
| | | // List<Motion> motionList = analyzeService.generateChargeMotion(wrkCharge); |
| | | // if (Cools.isEmpty(motionList)) { |
| | | // News.error("保存{}号四向穿梭车充电任务失败!!!", shuttle.getId()); |
| | | // continue; |
| | | // } |
| | | // motionService.batchInsert(motionList, wrkCharge.getUuid(), wrkCharge.getWrkNo()); |
| | | // |
| | | // wrkCharge.setWrkSts(WrkMastStsType.ANALYZE_CHARGE.sts); |
| | | // |
| | | // if (!wrkChargeService.insert(wrkCharge)) { |
| | | // News.error("保存{}号四向穿梭车充电任务失败!!!", shuttle.getId()); |
| | | // continue; |
| | | // } |
| | | // |
| | | // News.info("保存{}号四向穿梭车充电任务成功!!!", shuttle.getId()); |
| | | // } |
| | | } |
| | | |
| | | /** |
| | | * 四向穿梭车电量检测 ===>> 满电后回到待机位 |
| | | */ |
| | | public synchronized void loopShuttleToStandbyCauseCharge() { |
| | | // ShuttleChargeType shuttleCharge = ShuttleChargeType.CHARGE_1; |
| | | // Integer enoughPower = 90; |
| | | // Config config = configService.selectOne(new EntityWrapper<Config>() |
| | | // .eq("code", "chargeMaxValue") |
| | | // .eq("status", 1)); |
| | | // if (config != null) { |
| | | // enoughPower = Integer.parseInt(config.getValue()); |
| | | // } |
| | | // |
| | | // for (ShuttleSlave shuttle : slaveProperties.getShuttle()) { |
| | | // //获取四向穿梭车线程 |
| | | // ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttle.getId()); |
| | | // ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); |
| | | // if (shuttleProtocol == null) { |
| | | // continue; |
| | | // } |
| | | // // 是否存在充电任务 |
| | | // WrkCharge wrkCharge = wrkChargeService.selectWorking(shuttle.getId()); |
| | | // if (wrkCharge == null) { |
| | | // continue; |
| | | // } |
| | | // |
| | | // if (motionService.selectCount(new EntityWrapper<Motion>() |
| | | // .eq("device_ctg", DeviceCtgType.SHUTTLE.val()) |
| | | // .eq("device", shuttle.getId()) |
| | | // .eq("motion_sts", MotionStsType.EXECUTING.val())) > 0) { |
| | | // continue; |
| | | // } |
| | | // // 不处于充电中 |
| | | // if (!shuttleProtocol.getPlcOutputCharge()) { |
| | | // continue; |
| | | // } |
| | | // // 在充电位 |
| | | // if (!shuttleProtocol.getCurrentLocNo().equals(shuttleCharge.locNo)) { |
| | | // continue; |
| | | // } |
| | | // // 电量是否达到满电要求 |
| | | // if (shuttleProtocol.getBatteryPower$().intValue() < enoughPower) { |
| | | // continue; |
| | | // } |
| | | // // 已有迁移任务 |
| | | // if (wrkChargeService.selectMoveWorking(shuttle.getId()) != null) { |
| | | // continue; |
| | | // } |
| | | // |
| | | // // 待机位 |
| | | // String standByLocNo = ShuttleTempLocType.query(shuttleProtocol.getShuttleNo().intValue(), 2, Utils.getLev(shuttleCharge.locNo)).locNo; |
| | | // |
| | | // shuttleDispatcher.generateShuttleChargeWrkComplete(shuttleProtocol.getShuttleNo().intValue(), standByLocNo); |
| | | // |
| | | // wrkCharge.setWrkSts(WrkMastStsType.COMPLETE_CHARGE.sts); |
| | | // wrkCharge.setIoTime(new Date()); |
| | | // wrkChargeMapper.updateById(wrkCharge); |
| | | // } |
| | | } |
| | | |
| | | } |