From c73289bcc0cf144c39b013f704ff9a36c982c420 Mon Sep 17 00:00:00 2001 From: lgh Date: Sun, 17 Jul 2022 10:39:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=BA=E6=A3=80=E6=B5=8B?= =?UTF-8?q?=E5=88=B0=E7=82=89=E5=AD=90=E5=8A=A0=E5=B7=A5=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E8=AE=B0=E5=BD=95taskhis=E4=B8=94=E5=8F=AA?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E4=B8=80=E6=AC=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mt/wms/empty/task/AsynRunTaskService.java | 4 ---- .../com/mt/wms/empty/task/ScheduledTask.java | 20 ++++++++++++------- 2 files changed, 13 insertions(+), 11 deletions(-) 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;