From 4867a5cc26436cb75835faf3c4bd34b65e90ccf8 Mon Sep 17 00:00:00 2001 From: LGH <1746689524@qq.com> Date: Fri, 8 Jul 2022 23:51:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=B7=A5=E7=82=89=E8=AF=86=E5=88=AB?= =?UTF-8?q?=E5=88=B0ReadyIn=E5=B0=B1=E5=BC=80=E5=A7=8B=E5=8F=91=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mt/wms/empty/task/ScheduledTask.java | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) 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 6cbe2d1..966bcd5 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 @@ -123,7 +123,7 @@ public class ScheduledTask extends BaseService { /** * 正在加工的加工任务详情 */ - @Scheduled(fixedDelay = 1000*60) + //@Scheduled(fixedDelay = 1000*60) public void screen() throws IOException { //查询出正在进炉加工的curr_task,查询对应炉号是否Working,查询计划时间,剩余时间,查询标识卡详情 List currTaskList = currTaskServiceBiz.list(new QueryWrapper().eq(CurrTask.IS_IN, 1)); @@ -212,7 +212,7 @@ public class ScheduledTask extends BaseService { } //查询出正在加工的窑炉,遍历,根据采集频率的不同,采集高频数据能源消耗。暂定30秒 - @Scheduled(fixedDelay = 1000*30) + //@Scheduled(fixedDelay = 1000*30) public void getFastValue(){ logger.info("==采集高频能耗数据开始=="); //加工炉列表 @@ -307,7 +307,7 @@ public class ScheduledTask extends BaseService { } //查询出正在加工的窑炉,遍历,根据采集频率的不同,采集低频数据能源消耗。暂定3分钟一次 - @Scheduled(fixedDelay = 1000*60*3) + //@Scheduled(fixedDelay = 1000*60*3) public void getSlowValue(){ logger.info("==开始采集低频数据=="); List kilnInfoList = kilnInfoServiceBiz.list(); @@ -458,7 +458,7 @@ public class ScheduledTask extends BaseService { //@Scheduled(fixedDelay = 1000*60) public void runTaskForEmptyKiln() throws IOException { List kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper() - .eq(KilnInfo.VALID, 1).eq(KilnInfo.STATUS, 0)); + .eq(KilnInfo.VALID, 1).eq(KilnInfo.STATUS, 0).orderByAsc(KilnInfo.TYPE)); // 呼叫车辆运送货物给炉子 //存在空闲窑炉 if (kilnInfoList.size()!=0) { @@ -469,9 +469,13 @@ public class ScheduledTask extends BaseService { if (vehicleInfos.size()>0){ return; } + Boolean kilnReadyIn=false; + if (kilnInfo.getType()==1){ + kilnReadyIn = kilnReadyIn(kilnInfo.getId()); + } //查询炉子是否allowIn Boolean kilnAllowIn = kilnAllowIn(kilnInfo.getId()); - if (kilnAllowIn){ + if (kilnReadyIn||kilnAllowIn){ //缓存区是否有目标位置为窑炉的待加工任务 List inStockInfoList = inStockInfoServiceBiz.list(new QueryWrapper() .eq(InStockInfo.TYPE, 1) @@ -502,7 +506,7 @@ public class ScheduledTask extends BaseService { } //遍历正在工作炉子的报警变量,记录报警 - @Scheduled(fixedDelay = 1000*60) + //@Scheduled(fixedDelay = 1000*60) public void listenKilnAlarm(){ List kilnInfoList = kilnInfoServiceBiz.list(); logger.info("==开始查询炉子是否有报警=="); @@ -623,6 +627,16 @@ public class ScheduledTask extends BaseService { return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString()); } + private Boolean kilnReadyIn(Long kilnId){ + PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper() + .eq(PlcNameSpace.EQ_TYPE, 0) + .eq(PlcNameSpace.EQ_ID, kilnId) + .eq(PlcNameSpace.TYPE,0)); + String nameSpaceNote = nameSpace.getName(); + String result = readPlcToString(nameSpaceNote, "ReadyIn"); + return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString()); + } + private Boolean kilnWorking(Long kilnId){ PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper() .eq(PlcNameSpace.EQ_TYPE, 0)