bug修改

This commit is contained in:
lgh 2022-07-13 22:15:09 +08:00
parent 22c6288659
commit 52dfdc9c7f
4 changed files with 37 additions and 11 deletions

View File

@ -2,6 +2,7 @@ package com.mt.wms.empty.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mt.wms.basic.service.KilnInfoService; import com.mt.wms.basic.service.KilnInfoService;
import com.mt.wms.basic.vo.KilnInfoVo; import com.mt.wms.basic.vo.KilnInfoVo;
import com.mt.wms.core.base.BaseController; import com.mt.wms.core.base.BaseController;

View File

@ -114,6 +114,7 @@ public class AsynRunTaskService extends BaseService {
runTaskServiceBiz.updateById(runTask); runTaskServiceBiz.updateById(runTask);
//更新currTask表状态 //更新currTask表状态
currTask.setIsIn(1); currTask.setIsIn(1);
currTask.setStatus(1);
currTask.setRunTaskId(runTask.getId()); currTask.setRunTaskId(runTask.getId());
currTask.setUpdateTime(LocalDateTime.now()); currTask.setUpdateTime(LocalDateTime.now());
currTask.setBeginTime(LocalDateTime.now()); currTask.setBeginTime(LocalDateTime.now());
@ -132,6 +133,7 @@ public class AsynRunTaskService extends BaseService {
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId)); AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
CurrTask firstCurrTask = currTaskServiceBiz.getById(autoExeTask.getFTaskId()); CurrTask firstCurrTask = currTaskServiceBiz.getById(autoExeTask.getFTaskId());
firstCurrTask.setIsIn(2); firstCurrTask.setIsIn(2);
firstCurrTask.setStatus(2);
currTaskServiceBiz.updateById(firstCurrTask); currTaskServiceBiz.updateById(firstCurrTask);
apmsEndProcess(firstCurrTask); apmsEndProcess(firstCurrTask);
//再上报第二步开始处理 //再上报第二步开始处理
@ -143,6 +145,7 @@ public class AsynRunTaskService extends BaseService {
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId)); AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId));
CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getFTaskId()); CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getFTaskId());
secondCurrTask.setIsIn(2); secondCurrTask.setIsIn(2);
secondCurrTask.setStatus(2);
currTaskServiceBiz.updateById(secondCurrTask); currTaskServiceBiz.updateById(secondCurrTask);
apmsEndProcess(secondCurrTask); apmsEndProcess(secondCurrTask);
//再上报第三步开始处理 //再上报第三步开始处理
@ -207,6 +210,7 @@ public class AsynRunTaskService extends BaseService {
locationServiceBiz.updateById(location); locationServiceBiz.updateById(location);
//更新currTask表状态 //更新currTask表状态
currTask.setIsIn(1); currTask.setIsIn(1);
currTask.setStatus(1);
currTask.setRunTaskId(runTask.getId()); currTask.setRunTaskId(runTask.getId());
currTask.setUpdateTime(LocalDateTime.now()); currTask.setUpdateTime(LocalDateTime.now());
currTask.setBeginTime(LocalDateTime.now()); currTask.setBeginTime(LocalDateTime.now());
@ -318,11 +322,13 @@ public class AsynRunTaskService extends BaseService {
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId)); AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
CurrTask firstCurrTask = currTaskServiceBiz.getById(autoExeTask.getFTaskId()); CurrTask firstCurrTask = currTaskServiceBiz.getById(autoExeTask.getFTaskId());
firstCurrTask.setIsIn(2); firstCurrTask.setIsIn(2);
firstCurrTask.setStatus(2);
currTaskServiceBiz.updateById(firstCurrTask); currTaskServiceBiz.updateById(firstCurrTask);
}else { }else {
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId)); AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId));
CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getThTaskId()); CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getTTaskId());
secondCurrTask.setIsIn(2); secondCurrTask.setIsIn(2);
secondCurrTask.setStatus(2);
currTaskServiceBiz.updateById(secondCurrTask); currTaskServiceBiz.updateById(secondCurrTask);
} }
} }
@ -387,7 +393,9 @@ public class AsynRunTaskService extends BaseService {
currTask.setIsOut(2); currTask.setIsOut(2);
currTask.setUpdateTime(LocalDateTime.now()); currTask.setUpdateTime(LocalDateTime.now());
currTask.setStatus(2); currTask.setStatus(2);
currTask.setEndTime(LocalDateTime.now()); currTask.setIsIn(2);
currTask.setUpdateTime(LocalDateTime.now());
logger.info("修改currTask任务状态");
currTaskServiceBiz.updateById(currTask); currTaskServiceBiz.updateById(currTask);
//更新in_stock_info表 //更新in_stock_info表
inStockInfo.setStatus(2); inStockInfo.setStatus(2);
@ -397,12 +405,17 @@ public class AsynRunTaskService extends BaseService {
vehicle.setStatus(0); vehicle.setStatus(0);
vehicleInfoServiceBiz.updateById(vehicle); vehicleInfoServiceBiz.updateById(vehicle);
//任务为非自动任务上报apms-end-finish //任务为非自动任务上报apms-end-finish
if (currTask.getIsOut()==0) { if (currTask.getIsAuto()==0) {
//上报apms完成处理 //上报apms完成处理
logger.info("此任务为单步骤任务任务结束上报apms-end-finish"); logger.info("此任务为单步骤任务任务结束上报apms-end-finish");
apmsEndProcess(currTask); apmsEndProcess(currTask);
apmsFinishProcess(currTask); apmsFinishProcess(currTask);
} else { } else {
int firstSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTaskId));
if (firstSetp>0){
//当前任务为自动任务的第一步
apmsEndProcess(currTask);
}
int secondSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId)); int secondSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
if (secondSetp>0){ if (secondSetp>0){
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId)); AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
@ -412,6 +425,9 @@ public class AsynRunTaskService extends BaseService {
apmsEndProcess(currTask); apmsEndProcess(currTask);
//再上报apms-finishProcess //再上报apms-finishProcess
apmsFinishProcess(currTask); apmsFinishProcess(currTask);
}else {
//当前任务为三步中的第二步
apmsEndProcess(currTask);
} }
} }
int threeSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId)); int threeSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId));
@ -422,9 +438,7 @@ public class AsynRunTaskService extends BaseService {
//再上报apms-finishProcess //再上报apms-finishProcess
apmsFinishProcess(currTask); apmsFinishProcess(currTask);
} }
logger.info("此任务为为自动任务里的第一步或第二步任务结束上报apms-end-finish");
//为自动任务的非第三步
apmsEndProcess(currTask);
} }
} else { } else {
runTask.setStatus(3); runTask.setStatus(3);
@ -520,6 +534,7 @@ public class AsynRunTaskService extends BaseService {
//更新库位状态 //更新库位状态
location.setStatus(0); location.setStatus(0);
locationServiceBiz.updateById(location); locationServiceBiz.updateById(location);
//更新车辆状态 //更新车辆状态
VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId); VehicleInfo vehicleInfo = vehicleInfoServiceBiz.getById(vehicleId);
vehicleInfo.setStatus(0); vehicleInfo.setStatus(0);
@ -1253,7 +1268,7 @@ public class AsynRunTaskService extends BaseService {
* @return 单步骤任务true多步骤任务第一步true,其他false * @return 单步骤任务true多步骤任务第一步true,其他false
*/ */
public Boolean isFirstTask(CurrTask currTask){ public Boolean isFirstTask(CurrTask currTask){
if (currTask.getIsOut()==1){ if (currTask.getIsAuto()==1){
int count = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTask.getId())); int count = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTask.getId()));
return count>0; return count>0;
}else { }else {

View File

@ -221,9 +221,9 @@ public class RunTaskUtils {
Long thTaskId = autoExeTask.getThTaskId(); Long thTaskId = autoExeTask.getThTaskId();
CurrTask currTaskThree = currTaskServiceBiz.getById(thTaskId); CurrTask currTaskThree = currTaskServiceBiz.getById(thTaskId);
try { try {
logger.info("自动任务第二步:"+currTask.getTaskCode()+"已执行完成。开始执行第三步任务:"+currTaskThree); logger.info("自动任务第二步:"+currTask.getTaskCode()+"已执行完成。开始执行第三步任务:"+currTaskThree.getId());
// 2022/2/27 websocket推送到页面显示 // 2022/2/27 websocket推送到页面显示
webSocketServer.sendtoAll("自动任务第二步:"+currTask.getTaskCode()+"已执行完成。开始执行第三步任务:"+currTaskThree); webSocketServer.sendtoAll("自动任务第二步:"+currTask.getTaskCode()+"已执行完成。开始执行第三步任务:"+currTaskThree.getId());
return runTaskForInKiln(thTaskId); return runTaskForInKiln(thTaskId);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
@ -231,7 +231,6 @@ public class RunTaskUtils {
} }
} }
} }
} }
//查询缓存区库位是否已满 //查询缓存区库位是否已满

View File

@ -74,9 +74,20 @@ public class ScheduledTask extends BaseService {
private CurrTaskDetServiceBiz currTaskDetServiceBiz; private CurrTaskDetServiceBiz currTaskDetServiceBiz;
@Resource @Resource
private OrderInfoServiceBiz orderInfoServiceBiz; private OrderInfoServiceBiz orderInfoServiceBiz;
@Resource
private AutoExeTaskServiceBiz autoExeTaskServiceBiz;
//@Scheduled(fixedDelay = 1000*20) //@Scheduled(fixedDelay = 1000*20)
@Test
public void test() throws IOException { public void test() throws IOException {
CurrTask currTask = currTaskServiceBiz.getById(342);
if (currTask.getIsOut()==1){
int count = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTask.getId()));
System.out.println(count>0);;
}else {
System.out.println(true);
}
} }
//@Scheduled(fixedDelay = 1000*60) //@Scheduled(fixedDelay = 1000*60)
public void testWebsocket() throws IOException { public void testWebsocket() throws IOException {
@ -488,7 +499,7 @@ public class ScheduledTask extends BaseService {
} }
//查询炉子是否allowIn //查询炉子是否allowIn
Boolean kilnAllowIn = kilnAllowIn(kilnInfo.getId()); Boolean kilnAllowIn = kilnAllowIn(kilnInfo.getId());
if (kilnReadyIn||kilnAllowIn){ if (kilnReadyIn&&kilnAllowIn){
//缓存区是否有目标位置为工业炉的待加工任务 //缓存区是否有目标位置为工业炉的待加工任务
List<InStockInfo> inStockInfoList = inStockInfoServiceBiz.list(new QueryWrapper<InStockInfo>() List<InStockInfo> inStockInfoList = inStockInfoServiceBiz.list(new QueryWrapper<InStockInfo>()
.eq(InStockInfo.TYPE, 1) .eq(InStockInfo.TYPE, 1)