From 395817f10e5ec1a33599b7fd648447fdb77a837c Mon Sep 17 00:00:00 2001 From: lgh Date: Tue, 27 Dec 2022 18:01:05 +0800 Subject: [PATCH] update: --- .../empty/controller/EnergyController.java | 2 ++ .../service/impl/CurrTaskServiceImpl.java | 24 +++++++++++++++- .../mt/wms/empty/task/AsynRunTaskService.java | 28 +++++++++++-------- .../com/mt/wms/empty/task/ScheduledTask.java | 6 +++- .../mt/wms/empty/task/TaskDistanceUtils.java | 6 ++-- 5 files changed, 49 insertions(+), 17 deletions(-) diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/EnergyController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/EnergyController.java index 7aa5d58..03c0761 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/EnergyController.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/EnergyController.java @@ -614,6 +614,7 @@ public class EnergyController extends BaseController { carbonActVo.setValue(parGasValue.getActualNitPotValue()); carbonActVo.setUnit("%"); carbonActVo.setName("碳/氮势"); + carbonActVo.setTime(parGasValue.getCreateTime()); carbonActVo.setCode(currTask.getStoveCode()); carbon.add(carbonActVo); @@ -680,6 +681,7 @@ public class EnergyController extends BaseController { carbonActVo.setValue(parGasValue.getActualNitPotValue()); carbonActVo.setUnit("%"); carbonActVo.setName("碳/氮势"); + carbonActVo.setTime(parGasValue.getCreateTime()); carbonActVo.setCode(currTask.getStoveCode()); carbon.add(carbonActVo); diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java index 7499568..35e96aa 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java @@ -79,6 +79,10 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService CurrTaskDetServiceBiz currTaskDetServiceBiz; @Autowired InStockInfoServiceBiz inStockInfoServiceBiz; + @Autowired + TaskDetHisServiceBiz taskDetHisServiceBiz; + @Autowired + TaskHisServiceBiz taskHisServiceBiz; private Logger logger = LoggerFactory.getLogger(getClass()); @Override @@ -456,12 +460,23 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService locationServiceBiz.updateById(location); //删除库位缓存 inStockInfoServiceBiz.removeById(inStockInfo); + } currTask.setStatus(1); currTask.setCreatorId(99); currTask.setBeginTime(LocalDateTime.now()); currTaskServiceBiz.updateById(currTask); logger.info("修改任务" + currTask.getId() + "状态为加工完成成功"); + //存入历史任务表以便查询能源消耗 + TaskHis taskHis = new TaskHis(); + org.springframework.beans.BeanUtils.copyProperties(currTask, taskHis); + taskHis.setStatus(2); + taskHis.setIsIn(2); + taskHis.setTaskId(currTask.getId()); + taskHisServiceBiz.save(taskHis); + List currTaskDets = currTaskDetServiceBiz.list(new QueryWrapper().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId())); + List taskDetHisList = com.mt.wms.core.utils.BeanUtils.copyList(currTaskDets, TaskDetHis.class); + taskDetHisServiceBiz.saveBatch(taskDetHisList); } currTask.setStatus(status); currTask.setCreatorId(99); @@ -687,6 +702,9 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService if (currTask.getStatus() != 0) { return R.failed("该任务状态不为未执行,无法执行!"); } + if (currTask.getCacheSatatus()==2||currTask.getIsCache()==1){ + return R.failed("该任务已在缓存队列,状态不为未执行,无法执行!"); + } //是否为自动任务 if (currTask.getIsAuto() == 1) { List exeTaskList = autoExeTaskServiceBiz.list(new QueryWrapper().eq(AutoExeTask.F_TASK_ID, taskId)); @@ -820,7 +838,11 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService */ private Boolean apmsEndProcess(CurrTask currTask) { ApmsEndProcess apmsEndProcess = new ApmsEndProcess(); - apmsEndProcess.setEndTime(currTask.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + LocalDateTime date=LocalDateTime.now(); + if (currTask.getEndTime()!=null){ + date=currTask.getEndTime(); + } + apmsEndProcess.setEndTime(date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); apmsEndProcess.setEndUser("QJJP03"); apmsEndProcess.setSheetNo(currTask.getSheetNo()); R apmsEndProcessVoR = apmsControl.endProcess(apmsEndProcess); diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java index c768666..52e101f 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java @@ -507,15 +507,15 @@ public class AsynRunTaskService extends BaseService { //两辆小车是否冲突 Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, kilnInfo.getCode(), yeyaTaiCode, rgv2CurrPosition); if (conflictBoolean) { - Integer status = moveRgv(2, 1L, 2, 0); + Integer status = moveRgv(2, 1L, 1, 0); logger.info(status.toString()); if (status != 1) { - logger.info("===执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位2,执行失败==="); + logger.info("===执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位1,执行失败==="); // 2022/3/6 websocket通知页面 webSocketServer.sendtoAll(LocalDateTime.now() + "执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位2,执行失败"); } else { - logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位2,执行成功==="); + logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位1,执行成功==="); } } } else { @@ -606,14 +606,14 @@ public class AsynRunTaskService extends BaseService { //两辆小车是否冲突 Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, location.getCode(), yeyaTaiCode, rgv2CurrPosition); if (conflictBoolean) { - Integer status = moveRgv(2, 1L, 2, 0); + Integer status = moveRgv(2, 1L, 1, 0); if (status != 1) { - logger.info("===执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位39,执行失败==="); + logger.info("===执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位1,执行失败==="); // 2022/3/6 websocket通知页面 webSocketServer.sendtoAll(LocalDateTime.now() + "执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位39,执行失败"); return; } - logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位39,执行成功==="); + logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位1,执行成功==="); } } else { logger.info("RGV2不在线,跳过检测是否避让。"); @@ -629,12 +629,12 @@ public class AsynRunTaskService extends BaseService { if (conflictBoolean) { Integer status = moveRgv(1, 1L, 12, 0); if (status != 1) { - logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位1,执行失败==="); + logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位12,执行失败==="); // 2022/3/6 websocket通知页面 webSocketServer.sendtoAll(LocalDateTime.now() + "执行出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位1,执行失败"); return; } - logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位1,执行成功==="); + logger.info("===执行任务出库任务时车辆位置冲突,执行车辆位移任务,车辆" + vehicleId + "移动到点位12,执行成功==="); } } else { logger.info("RGV1不在线,跳过检测是否避让。"); @@ -1331,8 +1331,12 @@ public class AsynRunTaskService extends BaseService { * @return */ private Boolean apmsEndProcess(CurrTask currTask) { + LocalDateTime date=LocalDateTime.now(); + if (currTask.getEndTime()!=null){ + date=currTask.getEndTime(); + } ApmsEndProcess apmsEndProcess = new ApmsEndProcess(); - apmsEndProcess.setEndTime(currTask.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + apmsEndProcess.setEndTime(date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); apmsEndProcess.setEndUser("QJJP03"); apmsEndProcess.setSheetNo(currTask.getSheetNo()); R apmsEndProcessVoR = apmsController.endProcess(apmsEndProcess); @@ -1424,13 +1428,13 @@ public class AsynRunTaskService extends BaseService { //两辆小车是否冲突 Boolean conflictBoolean = taskDistanceUtils.conflictForVehicle(vehicleId, startPosition, targetPosition, rgv2CurrPosition); if (conflictBoolean) { - Integer status = moveRgv(2, currTaskId, 2, 0); + Integer status = moveRgv(2, currTaskId, 1, 0); logger.info(status.toString()); if (status != 1) { - logger.info("===执行任务:" + currTask.getTaskCode() + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位2,执行失败==="); + logger.info("===执行任务:" + currTask.getTaskCode() + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位1,执行失败==="); webSocketServer.sendtoAll(LocalDateTime.now() + "执行任务:" + currTask.getTaskCode() + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位2,执行失败"); } else { - logger.info("===执行任务:" + currTaskId + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位2,执行成功==="); + logger.info("===执行任务:" + currTaskId + " 时车辆位置冲突,执行车辆位移任务,车辆" + anotherVehicleId + "移动到点位1,执行成功==="); } } } else { diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java index f009966..714ece5 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java @@ -897,8 +897,12 @@ public class ScheduledTask extends BaseService { * @return */ private Boolean apmsEndProcess(CurrTask currTask) { + LocalDateTime date=LocalDateTime.now(); + if (currTask.getEndTime()!=null){ + date=currTask.getEndTime(); + } ApmsEndProcess apmsEndProcess = new ApmsEndProcess(); - apmsEndProcess.setEndTime(currTask.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + apmsEndProcess.setEndTime(date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); apmsEndProcess.setEndUser("QJJP03"); apmsEndProcess.setSheetNo(currTask.getSheetNo()); R apmsEndProcessVoR = apmsController.endProcess(apmsEndProcess); diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/TaskDistanceUtils.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/TaskDistanceUtils.java index 7f04059..978ae9d 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/TaskDistanceUtils.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/TaskDistanceUtils.java @@ -117,14 +117,14 @@ public class TaskDistanceUtils { logger.info("min"+minDistance); logger.info("max"+maxDistance); logger.info("other"+otherNowPosition); - //另一辆小车在在小车路径上比如冲突,不在小车路径上时判定一下安全距离(3.8米) + //另一辆小车在在小车路径上比如冲突,不在小车路径上时判定一下安全距离(4米) if (otherNowPosition>=minDistance&&otherNowPosition<=maxDistance){ return true; }else { - if (Math.abs(otherNowPosition-maxDistance)<3.8){ + if (Math.abs(otherNowPosition-maxDistance)<4){ return true; } - if (Math.abs(otherNowPosition-minDistance)<3.8){ + if (Math.abs(otherNowPosition-minDistance)<4){ return true; } return false;