加工炉识别到ReadyIn就开始发任务

This commit is contained in:
lgh 2022-07-08 23:49:16 +08:00
parent 936dc5b71a
commit 6f0e487bc4
3 changed files with 23 additions and 4 deletions

View File

@ -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;
}

View File

@ -121,6 +121,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
public R<PageVo<CurrTaskQueryVo>> currentTaskPage(CurrTaskQueryParam param) {
QueryWrapper<CurrTask> currTaskQueryWrapper = new QueryWrapper<>();
currTaskQueryWrapper.eq(CurrTask.VALID, 1);
currTaskQueryWrapper.in(CurrTask.STATUS,0,1);
Page<CurrTask> page = currTaskServiceBiz.page(new Page<>(param.getCurrent(), param.getSize()), currTaskQueryWrapper);
return successful(new PageVo<>(page, CurrTaskQueryVo.class));
}

View File

@ -455,10 +455,10 @@ public class ScheduledTask extends BaseService {
//遍历窑炉空窑炉查询缓存区是否有等待加工的任务
//待加工任务存在且没有状态为正在进炉的情况下按照先进先出的规则选择待加工任务呼叫车辆进炉
//@Scheduled(fixedDelay = 1000*60)
@Scheduled(fixedDelay = 1000*60)
public void runTaskForEmptyKiln() throws IOException {
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper<KilnInfo>()
.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<InStockInfo> inStockInfoList = inStockInfoServiceBiz.list(new QueryWrapper<InStockInfo>()
.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<PlcNameSpace>()
.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<PlcNameSpace>()
.eq(PlcNameSpace.EQ_TYPE, 0)