From 6f0e487bc43c8a29d841967850eddb5e17cc57fd Mon Sep 17 00:00:00 2001 From: lgh Date: Fri, 8 Jul 2022 23:49:16 +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 --- .../java/com/mt/wms/basic/vo/VehicleVo.java | 6 ++++++ .../service/impl/CurrTaskServiceImpl.java | 1 + .../com/mt/wms/empty/task/ScheduledTask.java | 20 +++++++++++++++---- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/6.program/wms-basic/src/main/java/com/mt/wms/basic/vo/VehicleVo.java b/6.program/wms-basic/src/main/java/com/mt/wms/basic/vo/VehicleVo.java index 47e814c..49e0e62 100644 --- a/6.program/wms-basic/src/main/java/com/mt/wms/basic/vo/VehicleVo.java +++ b/6.program/wms-basic/src/main/java/com/mt/wms/basic/vo/VehicleVo.java @@ -60,4 +60,10 @@ public class VehicleVo extends BaseVo implements PageVo.ConvertVo{ */ @ApiModelProperty(value = "描述信息", example = "1") private String description; + + /** + * 描述信息 + */ + @ApiModelProperty(value = "车辆状态:0-空闲,1-占用", example = "1") + private Integer status; } 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 947c93e..7c7f9e7 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 @@ -121,6 +121,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService public R> currentTaskPage(CurrTaskQueryParam param) { QueryWrapper currTaskQueryWrapper = new QueryWrapper<>(); currTaskQueryWrapper.eq(CurrTask.VALID, 1); + currTaskQueryWrapper.in(CurrTask.STATUS,0,1); Page page = currTaskServiceBiz.page(new Page<>(param.getCurrent(), param.getSize()), currTaskQueryWrapper); return successful(new PageVo<>(page, CurrTaskQueryVo.class)); } 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 18acbb5..d4e9c0e 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 @@ -455,10 +455,10 @@ public class ScheduledTask extends BaseService { //遍历窑炉,空窑炉查询缓存区是否有等待加工的任务, //待加工任务存在且没有状态为正在进炉的情况下,按照先进先出的规则选择待加工任务呼叫车辆进炉 - //@Scheduled(fixedDelay = 1000*60) + @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) @@ -622,7 +626,15 @@ public class ScheduledTask extends BaseService { String result = readPlcToString(nameSpaceNote, "AllowIn"); 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)