| | |
| | | } |
| | | } |
| | | |
| | | // @Scheduled(cron = "0/1 * * * * ? ") |
| | | // public synchronized void executeWrkCharge() { |
| | | // Date now = new Date(); |
| | | // // ANALYZE_INBOUND |
| | | // for (WrkCharge wrkCharge : wrkChargeMapper.selectByAnalyzeSts()) { |
| | | // Motion executingMotion = motionService.selectOfTop1(wrkCharge.getUuid(), MotionStsType.EXECUTING.val()); |
| | | // if (executingMotion != null) {//存在正在执行的motion |
| | | // continue; |
| | | // } |
| | | // |
| | | // Motion motion = motionService.selectOfTop1(wrkCharge.getUuid(), MotionStsType.INIT.val()); |
| | | // if (null != motion) { |
| | | // boolean result = this.executeMotion(motion); |
| | | // if (!result) { |
| | | // continue; |
| | | // } |
| | | // // 更新wrkMast |
| | | // switch (WrkMastStsType.query(wrkCharge.getWrkSts())) { |
| | | // case ANALYZE_CHARGE: |
| | | // wrkCharge.setWrkSts(WrkMastStsType.EXECUTE_CHARGE.sts); |
| | | // break; |
| | | // case ANALYZE_MOVE: |
| | | // wrkCharge.setWrkSts(WrkMastStsType.EXECUTE_MOVE.sts); |
| | | // break; |
| | | // } |
| | | // wrkCharge.setModiTime(now); |
| | | // if (wrkChargeMapper.updateById(wrkCharge) == 0) { |
| | | // log.error("{}其他工作档更新状态失败!", wrkCharge.getWrkNo()); |
| | | // } |
| | | // } |
| | | // } |
| | | // // EXECUTE_INBOUND |
| | | // for (WrkCharge wrkCharge : wrkChargeMapper.selectByExecuteSts()) { |
| | | // if (!motionService.hasRunningMotion(wrkCharge.getUuid())) { |
| | | // Motion motion = motionService.selectOfTop1(wrkCharge.getUuid(), MotionStsType.WAITING.val()); |
| | | // if (null != motion) { |
| | | // boolean result = this.executeMotion(motion); |
| | | // if (!result) { |
| | | // continue; |
| | | // } |
| | | // } else { |
| | | // if (motionService.selectOfTop1(wrkCharge.getUuid(), MotionStsType.EXECUTING.val()) != null) { |
| | | // continue; |
| | | // } |
| | | // |
| | | // // 更新wrkMast |
| | | // switch (WrkMastStsType.query(wrkCharge.getWrkSts())) { |
| | | // case EXECUTE_CHARGE: |
| | | // wrkCharge.setWrkSts(WrkMastStsType.CHARGE_WORKING.sts); |
| | | // break; |
| | | // case EXECUTE_MOVE: |
| | | // wrkCharge.setWrkSts(WrkMastStsType.COMPLETE_MOVE.sts); |
| | | // break; |
| | | // } |
| | | // wrkCharge.setModiTime(now); |
| | | // if (wrkChargeMapper.updateById(wrkCharge) == 0) { |
| | | // log.error("{}他工作档更新状态失败!", wrkCharge.getWrkNo()); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | @Scheduled(cron = "0/1 * * * * ? ") |
| | | public synchronized void executeChargeTask() { |
| | | Date now = new Date(); |
| | | // ANALYZE_CHARGE |
| | | for (Task taskCharge : taskService.selectChargeByAnalyzeSts()) { |
| | | Motion executingMotion = motionService.selectOfTop1(taskCharge.getUuid(), MotionStsType.EXECUTING.val(), taskCharge.getHostId()); |
| | | if (executingMotion != null) {//存在正在执行的motion |
| | | continue; |
| | | } |
| | | |
| | | Motion motion = motionService.selectOfTop1(taskCharge.getUuid(), MotionStsType.INIT.val(), taskCharge.getHostId()); |
| | | if (null != motion) { |
| | | boolean result = this.executeMotion(motion); |
| | | if (!result) { |
| | | continue; |
| | | } |
| | | // 更新Task |
| | | switch (TaskStsType.query(taskCharge.getTaskSts())) { |
| | | case ANALYZE_CHARGE: |
| | | taskCharge.setTaskSts(TaskStsType.EXECUTE_CHARGE.sts); |
| | | break; |
| | | case ANALYZE_MOVE: |
| | | taskCharge.setTaskSts(TaskStsType.EXECUTE_MOVE.sts); |
| | | break; |
| | | } |
| | | taskCharge.setUpdateTime(now); |
| | | if (!taskService.updateById(taskCharge)) { |
| | | log.error("{}其他工作档更新状态失败!", taskCharge.getTaskNo()); |
| | | } |
| | | } |
| | | } |
| | | // EXECUTE_CHARGE |
| | | for (Task taskCharge : taskService.selectChargeByExecuteSts()) { |
| | | if (!motionService.hasRunningMotion(taskCharge.getUuid(), taskCharge.getHostId())) { |
| | | Motion motion = motionService.selectOfTop1(taskCharge.getUuid(), MotionStsType.WAITING.val(), taskCharge.getHostId()); |
| | | if (null != motion) { |
| | | boolean result = this.executeMotion(motion); |
| | | if (!result) { |
| | | continue; |
| | | } |
| | | } else { |
| | | if (motionService.selectOfTop1(taskCharge.getUuid(), MotionStsType.EXECUTING.val(), taskCharge.getHostId()) != null) { |
| | | continue; |
| | | } |
| | | |
| | | // 更新Task |
| | | switch (TaskStsType.query(taskCharge.getTaskSts())) { |
| | | case EXECUTE_CHARGE: |
| | | taskCharge.setTaskSts(TaskStsType.CHARGE_WORKING.sts); |
| | | break; |
| | | case EXECUTE_MOVE: |
| | | taskCharge.setTaskSts(TaskStsType.COMPLETE_MOVE.sts); |
| | | break; |
| | | } |
| | | taskCharge.setUpdateTime(now); |
| | | if (!taskService.updateById(taskCharge)) { |
| | | log.error("{}他工作档更新状态失败!", taskCharge.getTaskNo()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Scheduled(cron = "0/1 * * * * ? ") |
| | | public synchronized void executeManualTask() { |