diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java index dd7ec07..0bb02f0 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java @@ -404,10 +404,6 @@ public class AsynRunTaskService extends BaseService { currTask.setUpdateTime(LocalDateTime.now()); logger.info("修改currTask任务状态"); currTaskServiceBiz.updateById(currTask); - //新增历史任务表 - TaskHis taskHis=new TaskHis(); - BeanUtils.copyProperties(currTask,taskHis); - taskHisServiceBiz.save(taskHis); //更新in_stock_info表 inStockInfo.setStatus(2); inStockInfo.setInTime(LocalDateTime.now()); diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java index 6b3b904..bbd59d7 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java @@ -76,6 +76,8 @@ public class ScheduledTask extends BaseService { private OrderInfoServiceBiz orderInfoServiceBiz; @Resource private AutoExeTaskServiceBiz autoExeTaskServiceBiz; + @Resource + private TaskHisServiceBiz taskHisServiceBiz; //@Scheduled(fixedDelay = 1000*20) @Test @@ -225,15 +227,19 @@ public class ScheduledTask extends BaseService { if (resultBoolean){ //调用RunTaskUtils.runTaskForOutKiln logger.info(kilnInfo.getCode()+kilnInfo.getKilnAlias()+"识别到允许出炉信号,进入出库程序!"); - //加工结束而没有立马出炉,加工结束记录能源消耗值只记录一次 - if (currTask.getEndTime()!=null){ - asynRunTaskService.asynEndRecordConsume(currTask.getId(),kilnId); - logger.info(kilnInfo.getCode()+"炉子中的任务:"+currTask.getId()+"已加工结束,记录加工结束能源消耗值"); - } - //更新加工单工艺结束时间,只更新一次,因为可能因为不满住出炉条件而进入到下一次定时任务 - if (String.valueOf(currTask.getEndTime()).equals("null")){ + //更新加工单工艺结束时间,只更新一次,因为可能因为不满住出炉条件而进入到下一次定时任务, + if ("null".equals(String.valueOf(currTask.getEndTime()))){ currTask.setEndTime(LocalDateTime.now()); currTaskServiceBiz.updateById(currTask); + //存入历史任务表以便查询能源消耗 + TaskHis taskHis=new TaskHis(); + org.springframework.beans.BeanUtils.copyProperties(currTask,taskHis); + taskHis.setStatus(2); + taskHis.setIsIn(2); + taskHisServiceBiz.save(taskHis); + //加工结束而没有立马出炉,加工结束记录能源消耗值只记录一次 + asynRunTaskService.asynEndRecordConsume(currTask.getId(),kilnId); + logger.info(kilnInfo.getCode()+"炉子中的任务:"+currTask.getId()+"已加工结束,记录加工结束能源消耗值"); } runTaskUtils.runTaskForOutKiln(kilnId); break;