| | |
| | | } |
| | | |
| | | @Override |
| | | public AjaxResult generatorPlan() |
| | | { |
| | | public AjaxResult generatorPlan() { |
| | | String plateOrderPlanKey = PLATE_ORDER_PLAN.getKey(); |
| | | boolean existsLock = redisLockUtils.existLock(plateOrderPlanKey, PLAN_TASK_TYPE.PLATE_PLAN.getCode()); |
| | | if (existsLock){ |
| | |
| | | if (existsDbTask){ |
| | | return AjaxResult.warn("钣金工单计划任务正在执行中!!"); |
| | | } |
| | | String currentBatchNum = requireBatchService.getNewBatchNumber(); |
| | | try { |
| | | redisLockUtils.getLock(plateOrderPlanKey,PLAN_TASK_TYPE.PLATE_PLAN.getCode(), 3*60L); |
| | | String batchNum= requireBatchService.getNewBatchNumber(); |
| | | this.savePlanTask(batchNum); |
| | | apsPlateStandardRequireService.generatorPlan(batchNum); |
| | | this.updateTaskStatus(batchNum, PLAN_TASK_STATUS.FINISHED); |
| | | redisLockUtils.getLock(plateOrderPlanKey, PLAN_TASK_TYPE.PLATE_PLAN.getCode(), 15 * 60L); |
| | | this.savePlanTask(currentBatchNum); |
| | | //Thread.sleep(60*1000); |
| | | apsPlateStandardRequireService.generatorPlan(currentBatchNum); |
| | | /*清除已经存在的 工单计划完工时间*/ |
| | | orderEndDayMapper.batchRemove(); |
| | | log.info("计划任务执行完成!"+batchNum); |
| | | this.updateTaskStatus(currentBatchNum, PLAN_TASK_STATUS.FINISHED); |
| | | log.info("计划任务执行完成!" + currentBatchNum); |
| | | return success(); |
| | | }catch (Exception e){ |
| | | redisLockUtils.releaseLock(plateOrderPlanKey,PLAN_TASK_TYPE.PLATE_PLAN.getCode()); |
| | | log.error("计划任务执行失败!"+e.getMessage()); |
| | | this.updateTaskStatus(currentBatchNum, PLAN_TASK_STATUS.ERROR); |
| | | return AjaxResult.error("计划任务执行失败!"+e.getMessage()); |
| | | }finally { |
| | | redisLockUtils.releaseLock(plateOrderPlanKey,PLAN_TASK_TYPE.PLATE_PLAN.getCode()); |