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)