增加置顶任务;
加工结束能源消耗只记录一次。
This commit is contained in:
parent
6eb2839b7a
commit
dae060d573
@ -285,6 +285,12 @@ public class CurrTaskController extends BaseController {
|
|||||||
public R<String> deleteById(@Validated @RequestBody IdParam param) {
|
public R<String> deleteById(@Validated @RequestBody IdParam param) {
|
||||||
return currTaskService.deleteById(param);
|
return currTaskService.deleteById(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "top")
|
||||||
|
@ApiOperation(value = "置顶该任务")
|
||||||
|
public R<String> top(@Validated @RequestBody IdParam param) {
|
||||||
|
return currTaskService.top(param);
|
||||||
|
}
|
||||||
@PostMapping(value = "runTask")
|
@PostMapping(value = "runTask")
|
||||||
@ApiOperation(value = "执行任务")
|
@ApiOperation(value = "执行任务")
|
||||||
public R<String> runTask(@Validated @RequestBody IdParam param) throws InterruptedException, IOException {
|
public R<String> runTask(@Validated @RequestBody IdParam param) throws InterruptedException, IOException {
|
||||||
|
@ -99,4 +99,7 @@ public interface CurrTaskService {
|
|||||||
R<String> runTask(Long taskId) throws InterruptedException, IOException;
|
R<String> runTask(Long taskId) throws InterruptedException, IOException;
|
||||||
|
|
||||||
R<String> createAutoTask(AutoCurrTaskParam autoCurrTaskParam);
|
R<String> createAutoTask(AutoCurrTaskParam autoCurrTaskParam);
|
||||||
|
|
||||||
|
//置顶
|
||||||
|
R<String> top(IdParam idParam);
|
||||||
}
|
}
|
||||||
|
@ -35,6 +35,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,6 +83,8 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
LocationServiceBiz locationServiceBiz;
|
LocationServiceBiz locationServiceBiz;
|
||||||
@Autowired
|
@Autowired
|
||||||
CurrTaskDetServiceBiz currTaskDetServiceBiz;
|
CurrTaskDetServiceBiz currTaskDetServiceBiz;
|
||||||
|
@Autowired
|
||||||
|
InStockInfoServiceBiz inStockInfoServiceBiz;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CurrTaskVo getCurrTask(IdParam idParam) {
|
public CurrTaskVo getCurrTask(IdParam idParam) {
|
||||||
@ -309,4 +312,34 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
public R<String> createAutoTask(AutoCurrTaskParam autoCurrTaskParam) {
|
public R<String> createAutoTask(AutoCurrTaskParam autoCurrTaskParam) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 传入任务id,查询任务炉子,然后根据炉子查询等待列表,然后时间置为早
|
||||||
|
* @param idParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public R<String> top(IdParam idParam) {
|
||||||
|
CurrTask currTask = currTaskServiceBiz.getById(idParam.getId());
|
||||||
|
currTask.getIsCache();
|
||||||
|
if (currTask.getIsCache()==0){
|
||||||
|
return R.failed("当前任务未进入等待队列,不能置顶");
|
||||||
|
}
|
||||||
|
Long kilnId = currTask.getKilnId();
|
||||||
|
List<InStockInfo> inStockInfoList = inStockInfoServiceBiz.list(new QueryWrapper<InStockInfo>()
|
||||||
|
.eq(InStockInfo.KILN_ID, kilnId)
|
||||||
|
.eq(InStockInfo.TYPE,1)
|
||||||
|
.eq(InStockInfo.STATUS,0)
|
||||||
|
.orderByAsc(InStockInfo.IN_TIME));
|
||||||
|
|
||||||
|
if (inStockInfoList.size()<2){
|
||||||
|
return R.failed("当前加工炉等待队列只有一个任务,无需置顶");
|
||||||
|
}
|
||||||
|
LocalDateTime inTime=null;
|
||||||
|
inTime = inStockInfoList.get(0).getInTime();
|
||||||
|
InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper<InStockInfo>().eq(InStockInfo.LOCATION_ID, currTask.getLocationId()));
|
||||||
|
inStockInfo.setInTime(inTime.minusHours(1));
|
||||||
|
inStockInfoServiceBiz.updateById(inStockInfo);
|
||||||
|
return R.ok("当前任务置顶成功","");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,6 +81,8 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
private AutoExeTaskServiceBiz autoExeTaskServiceBiz;
|
private AutoExeTaskServiceBiz autoExeTaskServiceBiz;
|
||||||
@Resource
|
@Resource
|
||||||
private CurrTaskDetServiceBiz currTaskDetServiceBiz;
|
private CurrTaskDetServiceBiz currTaskDetServiceBiz;
|
||||||
|
@Resource
|
||||||
|
private TaskHisServiceBiz taskHisServiceBiz;
|
||||||
|
|
||||||
//工业炉可用未满的情况下,调用车辆起点为提升台终点为工业炉
|
//工业炉可用未满的情况下,调用车辆起点为提升台终点为工业炉
|
||||||
@Async("asyncServiceExecutor")
|
@Async("asyncServiceExecutor")
|
||||||
@ -397,6 +399,10 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
currTask.setUpdateTime(LocalDateTime.now());
|
currTask.setUpdateTime(LocalDateTime.now());
|
||||||
logger.info("修改currTask任务状态");
|
logger.info("修改currTask任务状态");
|
||||||
currTaskServiceBiz.updateById(currTask);
|
currTaskServiceBiz.updateById(currTask);
|
||||||
|
//新增历史任务表
|
||||||
|
TaskHis taskHis=new TaskHis();
|
||||||
|
BeanUtils.copyProperties(currTask,taskHis);
|
||||||
|
taskHisServiceBiz.save(taskHis);
|
||||||
//更新in_stock_info表
|
//更新in_stock_info表
|
||||||
inStockInfo.setStatus(2);
|
inStockInfo.setStatus(2);
|
||||||
inStockInfo.setInTime(LocalDateTime.now());
|
inStockInfo.setInTime(LocalDateTime.now());
|
||||||
|
@ -225,8 +225,11 @@ public class ScheduledTask extends BaseService {
|
|||||||
if (resultBoolean){
|
if (resultBoolean){
|
||||||
//调用RunTaskUtils.runTaskForOutKiln
|
//调用RunTaskUtils.runTaskForOutKiln
|
||||||
logger.info(kilnInfo.getCode()+kilnInfo.getKilnAlias()+"识别到允许出炉信号,进入出库程序!");
|
logger.info(kilnInfo.getCode()+kilnInfo.getKilnAlias()+"识别到允许出炉信号,进入出库程序!");
|
||||||
asynRunTaskService.asynEndRecordConsume(currTask.getId(),kilnId);
|
//加工结束而没有立马出炉,加工结束记录能源消耗值只记录一次
|
||||||
logger.info(kilnInfo.getCode()+"炉子中的任务:"+currTask.getId()+"已加工结束,记录加工结束能源消耗值");
|
if (currTask.getEndTime()!=null){
|
||||||
|
asynRunTaskService.asynEndRecordConsume(currTask.getId(),kilnId);
|
||||||
|
logger.info(kilnInfo.getCode()+"炉子中的任务:"+currTask.getId()+"已加工结束,记录加工结束能源消耗值");
|
||||||
|
}
|
||||||
//更新加工单工艺结束时间,只更新一次,因为可能因为不满住出炉条件而进入到下一次定时任务
|
//更新加工单工艺结束时间,只更新一次,因为可能因为不满住出炉条件而进入到下一次定时任务
|
||||||
if (String.valueOf(currTask.getEndTime()).equals("null")){
|
if (String.valueOf(currTask.getEndTime()).equals("null")){
|
||||||
currTask.setEndTime(LocalDateTime.now());
|
currTask.setEndTime(LocalDateTime.now());
|
||||||
@ -348,9 +351,16 @@ public class ScheduledTask extends BaseService {
|
|||||||
Long kilnId = kilnInfo.getId();
|
Long kilnId = kilnInfo.getId();
|
||||||
String identificationNumber = readPlcToString(nameSpaceNote, "DischargeIdentNumber");
|
String identificationNumber = readPlcToString(nameSpaceNote, "DischargeIdentNumber");
|
||||||
Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString());
|
Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString());
|
||||||
|
|
||||||
if (currTaskId==0){
|
if (currTaskId==0){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
|
||||||
|
if (currTask!=null){
|
||||||
|
if (currTask.getEndTime()!=null){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
//加工炉
|
//加工炉
|
||||||
if (kilnInfo.getType()==1){
|
if (kilnInfo.getType()==1){
|
||||||
//实际温度
|
//实际温度
|
||||||
@ -539,10 +549,10 @@ public class ScheduledTask extends BaseService {
|
|||||||
//判断炉子是否在工作状态
|
//判断炉子是否在工作状态
|
||||||
String working = readPlcToString(kilnNameSpace.getName(), "Working");
|
String working = readPlcToString(kilnNameSpace.getName(), "Working");
|
||||||
JSONObject jsonObject = JSON.parseObject(working);
|
JSONObject jsonObject = JSON.parseObject(working);
|
||||||
Boolean aBoolean = Boolean.valueOf(String.valueOf(jsonObject.get("msg")));
|
Boolean aBoolean = Boolean.valueOf(String.valueOf(jsonObject.get("result")));
|
||||||
if (aBoolean){
|
if (aBoolean){
|
||||||
//命名空间前缀
|
//命名空间前缀
|
||||||
String nameSpace = kilnNameSpace.getNote();
|
String nameSpace = kilnNameSpace.getName();
|
||||||
//炉子的报警变量
|
//炉子的报警变量
|
||||||
List<PlcNameSpace> alarmNameList = plcNameSpaceServiceBiz.list(new QueryWrapper<PlcNameSpace>()
|
List<PlcNameSpace> alarmNameList = plcNameSpaceServiceBiz.list(new QueryWrapper<PlcNameSpace>()
|
||||||
.eq(PlcNameSpace.EQ_TYPE, 1)
|
.eq(PlcNameSpace.EQ_TYPE, 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user