Compare commits

...

4 Commits

Author SHA1 Message Date
lgh
8c735058a1 修改为检测到炉子加工完成时,记录taskhis且只记录一次 2022-07-17 10:46:01 +08:00
lgh
c73289bcc0 修改为检测到炉子加工完成时,记录taskhis且只记录一次 2022-07-17 10:39:07 +08:00
lgh
03d2e453fb Merge branch 'master' of http://git.picaiba.com/mt-ck/mt-qj-wms-hd 2022-07-17 10:26:04 +08:00
lgh
dae060d573 增加置顶任务;
加工结束能源消耗只记录一次。
2022-07-17 10:25:51 +08:00
6 changed files with 65 additions and 11 deletions

View File

@ -285,6 +285,12 @@ public class CurrTaskController extends BaseController {
public R<String> deleteById(@Validated @RequestBody IdParam 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")
@ApiOperation(value = "执行任务")
public R<String> runTask(@Validated @RequestBody IdParam param) throws InterruptedException, IOException {

View File

@ -99,4 +99,7 @@ public interface CurrTaskService {
R<String> runTask(Long taskId) throws InterruptedException, IOException;
R<String> createAutoTask(AutoCurrTaskParam autoCurrTaskParam);
//置顶
R<String> top(IdParam idParam);
}

View File

@ -35,6 +35,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.*;
/**
@ -82,6 +83,8 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
LocationServiceBiz locationServiceBiz;
@Autowired
CurrTaskDetServiceBiz currTaskDetServiceBiz;
@Autowired
InStockInfoServiceBiz inStockInfoServiceBiz;
@Override
public CurrTaskVo getCurrTask(IdParam idParam) {
@ -309,4 +312,34 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
public R<String> createAutoTask(AutoCurrTaskParam autoCurrTaskParam) {
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("当前任务置顶成功","");
}
}

View File

@ -404,10 +404,6 @@ public class AsynRunTaskService extends BaseService {
currTask.setUpdateTime(LocalDateTime.now());
logger.info("修改currTask任务状态");
currTaskServiceBiz.updateById(currTask);
//新增历史任务表
TaskHis taskHis=new TaskHis();
BeanUtils.copyProperties(currTask,taskHis);
taskHisServiceBiz.save(taskHis);
//更新in_stock_info表
inStockInfo.setStatus(2);
inStockInfo.setInTime(LocalDateTime.now());

View File

@ -76,6 +76,8 @@ public class ScheduledTask extends BaseService {
private OrderInfoServiceBiz orderInfoServiceBiz;
@Resource
private AutoExeTaskServiceBiz autoExeTaskServiceBiz;
@Resource
private TaskHisServiceBiz taskHisServiceBiz;
//@Scheduled(fixedDelay = 1000*20)
@Test
@ -225,12 +227,19 @@ public class ScheduledTask extends BaseService {
if (resultBoolean){
//调用RunTaskUtils.runTaskForOutKiln
logger.info(kilnInfo.getCode()+kilnInfo.getKilnAlias()+"识别到允许出炉信号,进入出库程序!");
asynRunTaskService.asynEndRecordConsume(currTask.getId(),kilnId);
logger.info(kilnInfo.getCode()+"炉子中的任务:"+currTask.getId()+"已加工结束,记录加工结束能源消耗值");
//更新加工单工艺结束时间,只更新一次因为可能因为不满住出炉条件而进入到下一次定时任务
if (String.valueOf(currTask.getEndTime()).equals("null")){
//更新加工单工艺结束时间,只更新一次因为可能因为不满住出炉条件而进入到下一次定时任务
if ("null".equals(String.valueOf(currTask.getEndTime()))){
currTask.setEndTime(LocalDateTime.now());
currTaskServiceBiz.updateById(currTask);
//存入历史任务表以便查询能源消耗
TaskHis taskHis=new TaskHis();
org.springframework.beans.BeanUtils.copyProperties(currTask,taskHis);
taskHis.setStatus(2);
taskHis.setIsIn(2);
taskHisServiceBiz.save(taskHis);
//加工结束而没有立马出炉加工结束记录能源消耗值只记录一次
asynRunTaskService.asynEndRecordConsume(currTask.getId(),kilnId);
logger.info(kilnInfo.getCode()+"炉子中的任务:"+currTask.getId()+"已加工结束,记录加工结束能源消耗值");
}
runTaskUtils.runTaskForOutKiln(kilnId);
break;
@ -348,9 +357,16 @@ public class ScheduledTask extends BaseService {
Long kilnId = kilnInfo.getId();
String identificationNumber = readPlcToString(nameSpaceNote, "DischargeIdentNumber");
Long currTaskId = Long.valueOf(JSONObject.parseObject(identificationNumber).get("result").toString());
if (currTaskId==0){
continue;
}
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
if (currTask!=null){
if (currTask.getEndTime()!=null){
continue;
}
}
//加工炉
if (kilnInfo.getType()==1){
//实际温度
@ -539,10 +555,10 @@ public class ScheduledTask extends BaseService {
//判断炉子是否在工作状态
String working = readPlcToString(kilnNameSpace.getName(), "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){
//命名空间前缀
String nameSpace = kilnNameSpace.getNote();
String nameSpace = kilnNameSpace.getName();
//炉子的报警变量
List<PlcNameSpace> alarmNameList = plcNameSpaceServiceBiz.list(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_TYPE, 1)

View File

@ -69,7 +69,7 @@ public class CurrTaskQueryVo extends BaseVo implements PageVo.ConvertVo {
private LocalDateTime aEndTime;
@ApiModelProperty("工业炉工艺号")
private String craftCode;
private Long craftCodeId;
/**
* 开始位置
*/