From 9cc6ef98f92350a35d40d3227611afe2132530b0 Mon Sep 17 00:00:00 2001 From: lgh Date: Thu, 7 Jul 2022 23:50:43 +0800 Subject: [PATCH] =?UTF-8?q?apms=E7=9A=84ip=E7=AB=AF=E5=8F=A3=E5=8F=B7?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E8=83=BD=E6=BA=90=E6=B6=88=E8=80=97?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E4=BC=98=E5=8C=96=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E7=94=9F=E4=BA=A7=E5=8D=95=E7=94=A8=E4=B8=B4=E6=97=B6=E5=B7=A5?= =?UTF-8?q?=E8=89=BA=E5=8F=B7=EF=BC=88=E5=89=8D=E7=AB=AF=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=90=8E=E8=A6=81=E6=94=B9=E5=9B=9E=EF=BC=89=20=E5=A4=9A?= =?UTF-8?q?=E6=AD=A5=E9=AA=A4=E4=BB=BB=E5=8A=A1=E6=89=A7=E8=A1=8Cbug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wms/empty/controller/ApmsController.java | 2 +- .../empty/controller/CurrTaskController.java | 2 +- .../service/impl/CurrTaskServiceImpl.java | 4 ++- .../mt/wms/empty/task/AsynRunTaskService.java | 2 +- .../com/mt/wms/empty/task/RunTaskUtils.java | 2 +- .../com/mt/wms/empty/task/ScheduledTask.java | 26 ++++++++++++++----- 6 files changed, 26 insertions(+), 12 deletions(-) diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/ApmsController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/ApmsController.java index d63a6a3..9f66f0f 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/ApmsController.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/ApmsController.java @@ -50,7 +50,7 @@ public class ApmsController extends BaseController { // static String Token = "eyJhbGciOiJIUzI1NiJ9.eyJkYXRlIjozMTkyNzU4NDk4ODA3LCJwbGF0Rm9ybUlkIjoyLCJhcGlLZXkiOiI3ZWU4ZjU5YmJhZWFlMjdlIiwiZXhwIjozMTkyNzU4NDk4LCJpYXQiOjE2Mzc1NTg0OTh9.RH3MRQr1dCBYW996-WXN69eXu1ZFblAQHfhZHNbTmCg"; static String Token = ""; static LocalDateTime TokenExpireTime = LocalDateTime.now(); - static String ApiAddress = "http://59.110.171.25:9010"; + static String ApiAddress = "http://192.168.1.109:80"; @PostMapping(value = "apmsPostOrder") @ApiOperation(value = "WMS接收APMS推送订单信息") diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java index 7816473..0333254 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java @@ -233,7 +233,7 @@ public class CurrTaskController extends BaseController { currTaskById.setSheetNo(sheetNo); currTaskService.updateCurrTaskById(currTaskById); //生成详细任务中的检验结果数据在apms推送生产单结果时创建 - return successful("创建成功,任务添加至等待执行队列。"); + //return successful("创建成功,任务添加至等待执行队列。"); } else diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java index 5170b4a..1eb3b1b 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java @@ -102,10 +102,12 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService BeanUtils.copyProperties(param, currTask); currTask.setTaskType(TaskTypeEnum.WTK.getValue()); //根据工艺号查询工艺id以及工艺plc值 - CraftInfo one = craftInfoServiceBiz.getOne(new QueryWrapper().eq(CraftInfo.CREATOR_ID, param.getCraftCode())); + // TODO: 2022/7/7 工艺号临时 + CraftInfo one = craftInfoServiceBiz.getOne(new QueryWrapper().eq(CraftInfo.CRAFT_CODE, 1)); currTask.setCraftCodeId(one.getId()); currTask.setPlcValue(one.getPlcValue()); currTask.setInterCode(IDGenerator.gen("RW", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "TASK_CODE")); + currTask.setTaskCode(IDGenerator.gen("RW", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "TASK_CODE")); setCommonField(currTask); currTaskServiceBiz.save(currTask); return successful(IdVo.builder().id(currTask.getId()).build()); 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 9e19563..d1808a3 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 @@ -132,7 +132,7 @@ public class AsynRunTaskService extends BaseService { //执行成功,托盘进炉 if (status==1){ // TODO: 2022/7/7 开始记录能源消耗 - //asynStartRecordConsume(currTaskId,currTask.getKilnId()); + asynStartRecordConsume(currTaskId,currTask.getKilnId()); logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功==="); //更新调度表状态为完成 runTask.setUpdateTime(LocalDateTime.now()); diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTaskUtils.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTaskUtils.java index d60dec5..fe397e7 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTaskUtils.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTaskUtils.java @@ -203,7 +203,7 @@ public class RunTaskUtils { } else { //当前加工步骤不为第一步 int secondCount = autoExeTaskServiceBiz.count(new QueryWrapper().eq(AutoExeTask.T_TASK_ID, currTask.getId())); - if (secondCount == 2) { + if (secondCount == 1) { //当前为自动任务第二步 AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper().eq(AutoExeTask.T_TASK_ID, currTask.getId())); //该自动任务的工艺类型为2,还有第三步 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 573a980..e5870b3 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 @@ -179,7 +179,7 @@ public class ScheduledTask extends BaseService { /** * 查询加工完成的窑炉 */ - @Scheduled(fixedDelay = 1000*60*2) + //@Scheduled(fixedDelay = 1000*60*2) public void taskForStockToKiln() throws IOException { //两辆车是否都空闲,只有两辆车都空闲才被允许做任务 List vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper().eq(VehicleInfo.STATUS, 0)); @@ -212,8 +212,9 @@ public class ScheduledTask extends BaseService { } //查询出正在加工的窑炉,遍历,根据采集频率的不同,采集高频数据能源消耗。暂定30秒 - //@Scheduled(fixedDelay = 1000*30) + @Scheduled(fixedDelay = 1000*30) public void getFastValue(){ + logger.info("==采集高频能耗数据开始=="); //加工炉列表 List kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper().in(KilnInfo.TYPE,1,3)); for (KilnInfo kilnInfo:kilnInfoList @@ -230,6 +231,10 @@ public class ScheduledTask extends BaseService { Long kilnId = kilnInfo.getId(); String identificationNumber = readPlcToString(nameSpaceNote, "DischargeIdentNumber"); Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString()); + if (currTaskId==0){ + logger.info("==当前加工的为手动加工任务,不记录能耗=="); + continue; + } //加工炉 if (kilnInfo.getType()==1){ //一号油搅拌转速 @@ -295,14 +300,16 @@ public class ScheduledTask extends BaseService { parGasValue3.setCreateTime(LocalDateTime.now()); parGasValueServiceBiz.save(parGasValue3); } + } } + logger.info("==采集高频能耗数据结束=="); } //查询出正在加工的窑炉,遍历,根据采集频率的不同,采集低频数据能源消耗。暂定3分钟一次 - //@Scheduled(fixedDelay = 1000*60*3) + @Scheduled(fixedDelay = 1000*60*3) public void getSlowValue(){ - System.out.println("开始采集数据"); + logger.info("==开始采集低频数据=="); List kilnInfoList = kilnInfoServiceBiz.list(); for (KilnInfo kilnInfo:kilnInfoList ) { @@ -317,6 +324,10 @@ public class ScheduledTask extends BaseService { Long kilnId = kilnInfo.getId(); String identificationNumber = readPlcToString(nameSpaceNote, "DischargeIdentNumber"); Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString()); + if (currTaskId==0){ + logger.info("==当前加工的为手动加工任务,不记录能耗=="); + continue; + } //加工炉 if (kilnInfo.getType()==1){ //实际温度 @@ -439,7 +450,7 @@ public class ScheduledTask extends BaseService { } } } - System.out.println("采集完成"); + logger.info("==结束采集低频数据=="); } //遍历窑炉,空窑炉查询缓存区是否有等待加工的任务, @@ -491,9 +502,10 @@ public class ScheduledTask extends BaseService { } //遍历正在工作炉子的报警变量,记录报警 - //@Scheduled(fixedDelay = 1000*30) + @Scheduled(fixedDelay = 1000*60) public void listenKilnAlarm(){ List kilnInfoList = kilnInfoServiceBiz.list(); + logger.info("==开始查询炉子是否有报警=="); for (KilnInfo kilnInfo:kilnInfoList ) { PlcNameSpace kilnNameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper() @@ -545,7 +557,7 @@ public class ScheduledTask extends BaseService { } } } - + logger.info("==结束查询炉子是否有报警=="); } //监听车辆是否在线(暂时不用)