Compare commits
No commits in common. "dd2ae384adb6205a41e7d33e159c4ec832900aba" and "5ae410020561cbff8c576893f5dda0f14c5b76cd" have entirely different histories.
dd2ae384ad
...
5ae4100205
@ -278,12 +278,6 @@ public class CurrTaskController extends BaseController {
|
|||||||
public R<String> deleteBySheetNo(@Validated @RequestBody CurrTaskQueryParam param) {
|
public R<String> deleteBySheetNo(@Validated @RequestBody CurrTaskQueryParam param) {
|
||||||
return currTaskService.deleteBySheetNo(param.getSheetNo());
|
return currTaskService.deleteBySheetNo(param.getSheetNo());
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping(value = "deleteById")
|
|
||||||
@ApiOperation(value = "人工id删除未正式开始的生产单")
|
|
||||||
public R<String> deleteById(@Validated @RequestBody IdParam param) {
|
|
||||||
return currTaskService.deleteById(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 {
|
||||||
|
@ -84,7 +84,7 @@ public interface CurrTaskService {
|
|||||||
* @param
|
* @param
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
R<String> deleteById(IdParam idParam);
|
R<String> deleteBySheetNo(IdParam idParam);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首页 获取当前执行的任务
|
* 首页 获取当前执行的任务
|
||||||
|
@ -80,8 +80,6 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
KilnInfoServiceBiz kilnInfoServiceBiz;
|
KilnInfoServiceBiz kilnInfoServiceBiz;
|
||||||
@Autowired
|
@Autowired
|
||||||
LocationServiceBiz locationServiceBiz;
|
LocationServiceBiz locationServiceBiz;
|
||||||
@Autowired
|
|
||||||
CurrTaskDetServiceBiz currTaskDetServiceBiz;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CurrTaskVo getCurrTask(IdParam idParam) {
|
public CurrTaskVo getCurrTask(IdParam idParam) {
|
||||||
@ -232,25 +230,8 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public R<String> deleteById(IdParam idParam) {
|
public R<String> deleteBySheetNo(IdParam idParam) {
|
||||||
CurrTask currTask = currTaskServiceBiz.getById(idParam.getId());
|
return null;
|
||||||
if (currTask.getIsAuto()==1){
|
|
||||||
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()));
|
|
||||||
for (CurrTask currTask1:currTaskList
|
|
||||||
) {
|
|
||||||
if (currTask1.getStatus()!=0){
|
|
||||||
return R.failed("该自动任务已有步骤在执行中或执行完成,不能删除!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//能删除
|
|
||||||
autoExeTaskServiceBiz.removeById(currTask.getAutoExeTaskId());
|
|
||||||
for (CurrTask currTask1:currTaskList
|
|
||||||
) {
|
|
||||||
currTaskDetServiceBiz.remove(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID,currTask1.getId()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
currTaskServiceBiz.removeById(idParam);
|
|
||||||
return R.ok(idParam.getId().toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -99,6 +99,20 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
runTask.setEndPosition(currTask.getTargetPosition());
|
runTask.setEndPosition(currTask.getTargetPosition());
|
||||||
runTask.setBeginTime(LocalDateTime.now());
|
runTask.setBeginTime(LocalDateTime.now());
|
||||||
runTaskServiceBiz.save(runTask);
|
runTaskServiceBiz.save(runTask);
|
||||||
|
//任务为自动任务第一步或任务为非自动任务时创建生产单,其他情况下开始生产单
|
||||||
|
if (isFirstTask(currTask)) {
|
||||||
|
//通知apms创建一个生产单
|
||||||
|
Boolean createProcess = apmsCreateProcess(currTask);
|
||||||
|
if (!createProcess) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//通知apms开始生产单
|
||||||
|
Boolean startProcess = apmsStartProcess(currTask);
|
||||||
|
if (!startProcess) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
//调用车辆填入起终点,得到车辆执行结果
|
//调用车辆填入起终点,得到车辆执行结果
|
||||||
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode();
|
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode();
|
||||||
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();
|
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();
|
||||||
@ -106,6 +120,8 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
logger.info(String.valueOf(status));
|
logger.info(String.valueOf(status));
|
||||||
//执行成功,托盘进炉
|
//执行成功,托盘进炉
|
||||||
if (status == 1) {
|
if (status == 1) {
|
||||||
|
// TODO: 2022/7/7 开始记录能源消耗
|
||||||
|
|
||||||
logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行成功===");
|
logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行成功===");
|
||||||
//更新调度表状态为完成
|
//更新调度表状态为完成
|
||||||
runTask.setUpdateTime(LocalDateTime.now());
|
runTask.setUpdateTime(LocalDateTime.now());
|
||||||
@ -121,42 +137,15 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
//更新小车状态
|
//更新小车状态
|
||||||
vehicle.setStatus(0);
|
vehicle.setStatus(0);
|
||||||
vehicleInfoServiceBiz.updateById(vehicle);
|
vehicleInfoServiceBiz.updateById(vehicle);
|
||||||
//任务为自动任务第一步或任务为非自动任务时创建生产单,其他情况下开始生产单
|
|
||||||
if (isFirstTask(currTask)) {
|
|
||||||
//通知apms创建一个生产单
|
|
||||||
apmsCreateProcess(currTask);
|
|
||||||
} else {
|
|
||||||
int secondSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
|
|
||||||
if (secondSetp>0){
|
|
||||||
//当前任务为自动任务里的第二步,先上报第一步的apms-endProcess
|
|
||||||
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
|
|
||||||
CurrTask firstCurrTask = currTaskServiceBiz.getById(autoExeTask.getFTaskId());
|
|
||||||
firstCurrTask.setIsIn(2);
|
|
||||||
currTaskServiceBiz.updateById(firstCurrTask);
|
|
||||||
apmsEndProcess(firstCurrTask);
|
|
||||||
//再上报第二步开始处理
|
|
||||||
apmsStartProcess(currTask);
|
|
||||||
}
|
|
||||||
int threeSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId));
|
|
||||||
if (threeSetp>0){
|
|
||||||
//当前任务为自动任务里的第三步,先上报第二步的apms处理endProcess
|
|
||||||
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId));
|
|
||||||
CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getFTaskId());
|
|
||||||
secondCurrTask.setIsIn(2);
|
|
||||||
currTaskServiceBiz.updateById(secondCurrTask);
|
|
||||||
apmsEndProcess(secondCurrTask);
|
|
||||||
//再上报第三步开始处理
|
|
||||||
apmsStartProcess(currTask);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
asynStartRecordConsume(currTaskId, currTask.getKilnId());
|
asynStartRecordConsume(currTaskId, currTask.getKilnId());
|
||||||
} else {
|
} else {
|
||||||
runTask.setStatus(3);
|
runTask.setStatus(3);
|
||||||
runTask.setUpdateTime(LocalDateTime.now());
|
runTask.setUpdateTime(LocalDateTime.now());
|
||||||
runTaskServiceBiz.updateById(runTask);
|
runTaskServiceBiz.updateById(runTask);
|
||||||
logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行失败===");
|
logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行失败===");
|
||||||
logger.info("任务 " + currTask.getTaskCode() + " 车辆从起点"+startPoint+"台到加工炉过程中失败。");
|
logger.info("任务 " + currTask.getTaskCode() + " 车辆从液压台台到加工炉过程中失败。");
|
||||||
webSocketServer.sendtoAll("任务 " + currTask.getTaskCode() + " 车辆从起点"+startPoint+"台到加工炉过程中失败。");
|
// TODO: 2021/12/14 websocket推送到前端,小车管理界面添加一个重置小车状态的接口。
|
||||||
|
webSocketServer.sendtoAll("任务 " + currTask.getTaskCode() + " 车辆从液压台台到加工炉过程中失败。");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,6 +171,20 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
//修改缓存区存储情况表状态
|
//修改缓存区存储情况表状态
|
||||||
inStockInfo.setStatus(1);
|
inStockInfo.setStatus(1);
|
||||||
inStockInfoServiceBiz.updateById(inStockInfo);
|
inStockInfoServiceBiz.updateById(inStockInfo);
|
||||||
|
//任务为自动任务第一步或任务为非自动任务时创建生产单,其他情况下开始生产单
|
||||||
|
if (isFirstTask(currTask)) {
|
||||||
|
//通知apms创建一个生产单
|
||||||
|
Boolean createProcess = apmsCreateProcess(currTask);
|
||||||
|
if (!createProcess) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//通知apms开始生产单
|
||||||
|
Boolean startProcess = apmsStartProcess(currTask);
|
||||||
|
if (!startProcess) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
// 调用车辆填入起终点,得到车辆执行结果
|
// 调用车辆填入起终点,得到车辆执行结果
|
||||||
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode();
|
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode();
|
||||||
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();
|
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();
|
||||||
@ -214,35 +217,7 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
//更新小车状态
|
//更新小车状态
|
||||||
vehicle.setStatus(0);
|
vehicle.setStatus(0);
|
||||||
vehicleInfoServiceBiz.updateById(vehicle);
|
vehicleInfoServiceBiz.updateById(vehicle);
|
||||||
//任务为自动任务第一步或任务为非自动任务时创建生产单,其他情况下开始生产单
|
// TODO: 2022/7/7
|
||||||
if (isFirstTask(currTask)) {
|
|
||||||
//通知apms创建一个生产单
|
|
||||||
apmsCreateProcess(currTask);
|
|
||||||
} else {
|
|
||||||
int secondSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
|
|
||||||
if (secondSetp>0){
|
|
||||||
//当前任务为自动任务里的第二步,先上报第一步的apms-endProcess
|
|
||||||
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
|
|
||||||
CurrTask firstCurrTask = currTaskServiceBiz.getById(autoExeTask.getFTaskId());
|
|
||||||
firstCurrTask.setIsIn(2);
|
|
||||||
currTaskServiceBiz.updateById(firstCurrTask);
|
|
||||||
apmsEndProcess(firstCurrTask);
|
|
||||||
//再上报第二步开始处理
|
|
||||||
apmsStartProcess(currTask);
|
|
||||||
}
|
|
||||||
int threeSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId));
|
|
||||||
if (threeSetp>0){
|
|
||||||
//当前任务为自动任务里的第三步,先上报第二步的apms处理endProcess
|
|
||||||
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId));
|
|
||||||
CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getFTaskId());
|
|
||||||
secondCurrTask.setIsIn(2);
|
|
||||||
currTaskServiceBiz.updateById(secondCurrTask);
|
|
||||||
apmsEndProcess(secondCurrTask);
|
|
||||||
//再上报第三步开始处理
|
|
||||||
apmsStartProcess(currTask);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 记录开始加工时的消耗值
|
|
||||||
asynStartRecordConsume(currTaskId, currTask.getKilnId());
|
asynStartRecordConsume(currTaskId, currTask.getKilnId());
|
||||||
} else {
|
} else {
|
||||||
runTask.setStatus(3);
|
runTask.setStatus(3);
|
||||||
@ -309,24 +284,6 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
//更新小车状态
|
//更新小车状态
|
||||||
vehicle.setStatus(0);
|
vehicle.setStatus(0);
|
||||||
vehicleInfoServiceBiz.updateById(vehicle);
|
vehicleInfoServiceBiz.updateById(vehicle);
|
||||||
//如果任务为多步骤任务的非第一步,置前置任务isIn为2
|
|
||||||
if (currTask.getIsAuto()==1){
|
|
||||||
int count = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTaskId));
|
|
||||||
if (count==0){
|
|
||||||
int secondCount = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
|
|
||||||
if (secondCount==1){
|
|
||||||
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
|
|
||||||
CurrTask firstCurrTask = currTaskServiceBiz.getById(autoExeTask.getFTaskId());
|
|
||||||
firstCurrTask.setIsIn(2);
|
|
||||||
currTaskServiceBiz.updateById(firstCurrTask);
|
|
||||||
}else {
|
|
||||||
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId));
|
|
||||||
CurrTask secondCurrTask = currTaskServiceBiz.getById(autoExeTask.getThTaskId());
|
|
||||||
secondCurrTask.setIsIn(2);
|
|
||||||
currTaskServiceBiz.updateById(secondCurrTask);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
runTask.setStatus(3);
|
runTask.setStatus(3);
|
||||||
runTask.setUpdateTime(LocalDateTime.now());
|
runTask.setUpdateTime(LocalDateTime.now());
|
||||||
@ -377,6 +334,8 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();
|
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();
|
||||||
Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue());
|
Integer status = sendTaskToRgv(vehicleId, currTaskId, startPoint, endPoint, currTask.getPlcValue());
|
||||||
if (status == 1) {
|
if (status == 1) {
|
||||||
|
// TODO: 2022/7/7 加工完成,记录结束时能源消耗
|
||||||
|
|
||||||
logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行成功===");
|
logger.info("===执行任务:" + currTaskId + " ,车辆搬运任务,车辆:" + vehicleId + " ,起点:" + startPoint + " ,终点:" + endPoint + "任务执行成功===");
|
||||||
//更新关系表状态为完成
|
//更新关系表状态为完成
|
||||||
runTask.setUpdateTime(LocalDateTime.now());
|
runTask.setUpdateTime(LocalDateTime.now());
|
||||||
@ -396,35 +355,50 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
//更新小车状态
|
//更新小车状态
|
||||||
vehicle.setStatus(0);
|
vehicle.setStatus(0);
|
||||||
vehicleInfoServiceBiz.updateById(vehicle);
|
vehicleInfoServiceBiz.updateById(vehicle);
|
||||||
//任务为非自动任务上报apms-end-finish
|
asynEndRecordConsume(currTaskId, currTask.getKilnId());
|
||||||
if (currTask.getIsOut()==0) {
|
// TODO: 2022/7/6 上报apms加工完成.每次进炉加工完成后就上报apms完成处理生产单,等所有加工步骤都完成后上报apms完成生产单。
|
||||||
//上报apms完成处理
|
logger.info("任务:" + currTaskId + " 生产单号:" + currTask.getSheetNo() + "开始上报apm完成处理生产单!");
|
||||||
logger.info("此任务为单步骤任务,任务结束,上报apms-end-finish");
|
ApmsEndProcess apmsEndProcess = new ApmsEndProcess();
|
||||||
apmsEndProcess(currTask);
|
apmsEndProcess.setEndTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||||
apmsFinishProcess(currTask);
|
apmsEndProcess.setEndUser("QJJP03");
|
||||||
} else {
|
apmsEndProcess.setSheetNo(currTask.getSheetNo());
|
||||||
int secondSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
|
R<ApmsEndProcessVo> apmsEndProcessVoR = apmsController.endProcess(apmsEndProcess);
|
||||||
if (secondSetp>0){
|
if (apmsEndProcessVoR.getCode() != 0) {
|
||||||
AutoExeTask autoExeTask = autoExeTaskServiceBiz.getOne(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.T_TASK_ID, currTaskId));
|
logger.info("任务:" + currTaskId + " 生产单号:" + currTask.getSheetNo() + "上报apm完成处理生产单失败!");
|
||||||
if (autoExeTask.getProcessFlowType()==1){
|
}
|
||||||
logger.info("此任务为为自动任务里的第二步且一共只有两步,任务结束,上报apms-end-finish");
|
if (currTask.getIsAuto() == 1) {
|
||||||
//当前任务为自动任务里的第三步且一共只有两步,先上报apms处理endProcess
|
//两步且是第二步
|
||||||
apmsEndProcess(currTask);
|
List<AutoExeTask> twoSpet = autoExeTaskServiceBiz.list(new QueryWrapper<AutoExeTask>()
|
||||||
//再上报apms-finishProcess
|
.eq(AutoExeTask.PROCESS_FLOW_TYPE, 1)
|
||||||
apmsFinishProcess(currTask);
|
.eq(AutoExeTask.T_TASK_ID, currTaskId));
|
||||||
}
|
//三步且是第三步
|
||||||
|
List<AutoExeTask> threeSpet = autoExeTaskServiceBiz.list(new QueryWrapper<AutoExeTask>()
|
||||||
|
.eq(AutoExeTask.PROCESS_FLOW_TYPE, 2)
|
||||||
|
.eq(AutoExeTask.TH_TASK_ID, currTaskId));
|
||||||
|
if (!(threeSpet.size() != 0 || twoSpet.size() != 0)) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
int threeSetp = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.TH_TASK_ID, currTaskId));
|
}
|
||||||
if (threeSetp>0){
|
logger.info("任务:" + currTask.getTaskCode() + "开始上报apms完成生产单!");
|
||||||
logger.info("此任务为为自动任务里的第三步,任务结束,上报apms-end-finish");
|
ApmsFinishProcessSheet apmsFinishProcessSheet = new ApmsFinishProcessSheet();
|
||||||
//当前任务为自动任务里的第三步,先上报apms处理endProcess
|
apmsFinishProcessSheet.setSheetNo(currTask.getSheetNo());
|
||||||
apmsEndProcess(currTask);
|
apmsFinishProcessSheet.setEndTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||||
//再上报apms-finishProcess
|
apmsFinishProcessSheet.setEndUser("QJJP03");
|
||||||
apmsFinishProcess(currTask);
|
List<FinishItem> finishItems = new ArrayList<>();
|
||||||
}
|
List<CurrTaskDet> currTaskDets = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTaskId));
|
||||||
logger.info("此任务为为自动任务里的第一步或第二步,任务结束,上报apms-end-finish");
|
for (CurrTaskDet currTaskDet : currTaskDets
|
||||||
//为自动任务的非第三步
|
) {
|
||||||
apmsEndProcess(currTask);
|
FinishItem finishItem = new FinishItem();
|
||||||
|
BigDecimal bigDecimal = new BigDecimal(currTaskDet.getWeight());
|
||||||
|
finishItem.setFinishWeight(bigDecimal.doubleValue());
|
||||||
|
finishItem.setFinishQuantity(Math.round(currTaskDet.getQuantity()));
|
||||||
|
finishItem.setItemCode(currTaskDet.getIdenCardNum());
|
||||||
|
finishItems.add(finishItem);
|
||||||
|
}
|
||||||
|
apmsFinishProcessSheet.setItems(finishItems);
|
||||||
|
R<ApmsFinishProcessSheetVo> apmsFinishProcessSheetVoR = apmsController.finishProcessSheet(apmsFinishProcessSheet);
|
||||||
|
if (apmsFinishProcessSheetVoR.getCode() != 0) {
|
||||||
|
logger.info("任务:" + currTask.getTaskCode() + "完成后上报apms完成生产单失败!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
runTask.setStatus(3);
|
runTask.setStatus(3);
|
||||||
@ -1114,56 +1088,6 @@ public class AsynRunTaskService extends BaseService {
|
|||||||
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms成功");
|
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms成功");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 上报apms-end
|
|
||||||
* @param currTask
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private Boolean apmsEndProcess(CurrTask currTask){
|
|
||||||
ApmsEndProcess apmsEndProcess = new ApmsEndProcess();
|
|
||||||
apmsEndProcess.setEndTime(currTask.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
|
||||||
apmsEndProcess.setEndUser("QJJP03");
|
|
||||||
apmsEndProcess.setSheetNo(currTask.getSheetNo());
|
|
||||||
R<ApmsEndProcessVo> apmsEndProcessVoR = apmsController.endProcess(apmsEndProcess);
|
|
||||||
if (apmsEndProcessVoR.getCode() != 0) {
|
|
||||||
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单完成处理上报apms失败");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单完成处理上报apms成功");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 上报apms-finish
|
|
||||||
* @param currTask
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private Boolean apmsFinishProcess(CurrTask currTask){
|
|
||||||
logger.info("任务:" + currTask.getTaskCode() + "开始上报apms完成生产单!");
|
|
||||||
ApmsFinishProcessSheet apmsFinishProcessSheet = new ApmsFinishProcessSheet();
|
|
||||||
apmsFinishProcessSheet.setSheetNo(currTask.getSheetNo());
|
|
||||||
apmsFinishProcessSheet.setEndTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
|
||||||
apmsFinishProcessSheet.setEndUser("QJJP03");
|
|
||||||
List<FinishItem> finishItems = new ArrayList<>();
|
|
||||||
List<CurrTaskDet> currTaskDets = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId()));
|
|
||||||
for (CurrTaskDet currTaskDet : currTaskDets
|
|
||||||
) {
|
|
||||||
FinishItem finishItem = new FinishItem();
|
|
||||||
BigDecimal bigDecimal = new BigDecimal(currTaskDet.getWeight());
|
|
||||||
finishItem.setFinishWeight(bigDecimal.doubleValue());
|
|
||||||
finishItem.setFinishQuantity(Math.round(currTaskDet.getQuantity()));
|
|
||||||
finishItem.setItemCode(currTaskDet.getIdenCardNum());
|
|
||||||
finishItems.add(finishItem);
|
|
||||||
}
|
|
||||||
apmsFinishProcessSheet.setItems(finishItems);
|
|
||||||
R<ApmsFinishProcessSheetVo> apmsFinishProcessSheetVoR = apmsController.finishProcessSheet(apmsFinishProcessSheet);
|
|
||||||
if (apmsFinishProcessSheetVoR.getCode() != 0) {
|
|
||||||
logger.info("任务:" + currTask.getTaskCode() + "完成后上报apms完成生产单失败!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* 车辆是否在线
|
* 车辆是否在线
|
||||||
* @param vehicleId 车辆id
|
* @param vehicleId 车辆id
|
||||||
@ -1253,13 +1177,11 @@ 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.getAutoExeTaskId()==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 {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,6 @@ import com.mt.wms.core.dal.entity.*;
|
|||||||
import com.mt.wms.core.dal.service.*;
|
import com.mt.wms.core.dal.service.*;
|
||||||
import com.mt.wms.core.utils.HttpClient;
|
import com.mt.wms.core.utils.HttpClient;
|
||||||
import com.mt.wms.core.vo.R;
|
import com.mt.wms.core.vo.R;
|
||||||
import com.mt.wms.empty.controller.ApmsController;
|
|
||||||
import com.mt.wms.empty.params.ApmsEndProcess;
|
|
||||||
import com.mt.wms.empty.vo.ApmsEndProcessVo;
|
|
||||||
import com.mt.wms.empty.websocket.WebSocketServer;
|
import com.mt.wms.empty.websocket.WebSocketServer;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -21,7 +18,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -59,8 +55,6 @@ public class RunTaskUtils {
|
|||||||
private PlcNameSpaceServiceBiz plcNameSpaceServiceBiz;
|
private PlcNameSpaceServiceBiz plcNameSpaceServiceBiz;
|
||||||
@Resource
|
@Resource
|
||||||
private WebSocketServer webSocketServer;
|
private WebSocketServer webSocketServer;
|
||||||
@Resource
|
|
||||||
private ApmsController apmsController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 进炉加工
|
* 进炉加工
|
||||||
@ -206,7 +200,11 @@ public class RunTaskUtils {
|
|||||||
logger.info("自动任务第一步:"+currTask.getTaskCode()+"已执行完成。开始执行第二步任务:"+currTaskTwo);
|
logger.info("自动任务第一步:"+currTask.getTaskCode()+"已执行完成。开始执行第二步任务:"+currTaskTwo);
|
||||||
// 2022/2/27 websocket推送到页面显示
|
// 2022/2/27 websocket推送到页面显示
|
||||||
webSocketServer.sendtoAll("自动任务第一步:"+currTask.getTaskCode()+"已执行完成。开始执行第二步任务:"+currTaskTwo);
|
webSocketServer.sendtoAll("自动任务第一步:"+currTask.getTaskCode()+"已执行完成。开始执行第二步任务:"+currTaskTwo);
|
||||||
return runTaskForInKiln(taskId);
|
// TODO: 2022/7/12 第一步任务的结束上报
|
||||||
|
currTask.setEndTime(LocalDateTime.now());
|
||||||
|
currTask.setIsIn(2);
|
||||||
|
currTaskServiceBiz.updateById(currTask);
|
||||||
|
return runTaskForInKiln(taskId);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -224,6 +222,7 @@ public class RunTaskUtils {
|
|||||||
logger.info("自动任务第二步:"+currTask.getTaskCode()+"已执行完成。开始执行第三步任务:"+currTaskThree);
|
logger.info("自动任务第二步:"+currTask.getTaskCode()+"已执行完成。开始执行第三步任务:"+currTaskThree);
|
||||||
// 2022/2/27 websocket推送到页面显示
|
// 2022/2/27 websocket推送到页面显示
|
||||||
webSocketServer.sendtoAll("自动任务第二步:"+currTask.getTaskCode()+"已执行完成。开始执行第三步任务:"+currTaskThree);
|
webSocketServer.sendtoAll("自动任务第二步:"+currTask.getTaskCode()+"已执行完成。开始执行第三步任务:"+currTaskThree);
|
||||||
|
// TODO: 2022/7/12 第二步任务的结束上报
|
||||||
return runTaskForInKiln(thTaskId);
|
return runTaskForInKiln(thTaskId);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -9,7 +9,6 @@ import com.mt.wms.core.dal.service.*;
|
|||||||
import com.mt.wms.core.utils.BeanUtils;
|
import com.mt.wms.core.utils.BeanUtils;
|
||||||
import com.mt.wms.core.utils.CodeGeneratorHelper;
|
import com.mt.wms.core.utils.CodeGeneratorHelper;
|
||||||
import com.mt.wms.core.utils.HttpClient;
|
import com.mt.wms.core.utils.HttpClient;
|
||||||
import com.mt.wms.core.utils.StringUtils;
|
|
||||||
import com.mt.wms.core.vo.R;
|
import com.mt.wms.core.vo.R;
|
||||||
import com.mt.wms.empty.vo.CurrTaskDetVo;
|
import com.mt.wms.empty.vo.CurrTaskDetVo;
|
||||||
import com.mt.wms.empty.vo.NowCurrTaskDetVo;
|
import com.mt.wms.empty.vo.NowCurrTaskDetVo;
|
||||||
@ -75,6 +74,7 @@ public class ScheduledTask extends BaseService {
|
|||||||
@Resource
|
@Resource
|
||||||
private OrderInfoServiceBiz orderInfoServiceBiz;
|
private OrderInfoServiceBiz orderInfoServiceBiz;
|
||||||
|
|
||||||
|
@Test
|
||||||
//@Scheduled(fixedDelay = 1000*20)
|
//@Scheduled(fixedDelay = 1000*20)
|
||||||
public void test() throws IOException {
|
public void test() throws IOException {
|
||||||
}
|
}
|
||||||
@ -216,11 +216,10 @@ public class ScheduledTask extends BaseService {
|
|||||||
logger.info(kilnInfo.getCode()+kilnInfo.getKilnAlias()+"识别到允许出炉信号,进入出库程序!");
|
logger.info(kilnInfo.getCode()+kilnInfo.getKilnAlias()+"识别到允许出炉信号,进入出库程序!");
|
||||||
asynRunTaskService.asynEndRecordConsume(currTask.getId(),kilnId);
|
asynRunTaskService.asynEndRecordConsume(currTask.getId(),kilnId);
|
||||||
logger.info(kilnInfo.getCode()+"炉子中的任务:"+currTask.getId()+"已加工结束,记录加工结束能源消耗值");
|
logger.info(kilnInfo.getCode()+"炉子中的任务:"+currTask.getId()+"已加工结束,记录加工结束能源消耗值");
|
||||||
//更新加工单工艺结束时间,只更新一次,因为可能因为不满住出炉条件而进入到下一次定时任务
|
//更新加工单工艺结束时间
|
||||||
if (StringUtils.isBlank(currTask.getEndTime().toString())){
|
currTask.setEndTime(LocalDateTime.now());
|
||||||
currTask.setEndTime(LocalDateTime.now());
|
currTaskServiceBiz.updateById(currTask);
|
||||||
currTaskServiceBiz.updateById(currTask);
|
//上报apms结束加工
|
||||||
}
|
|
||||||
runTaskUtils.runTaskForOutKiln(kilnId);
|
runTaskUtils.runTaskForOutKiln(kilnId);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user