From 63d251325f7029a9681e234bd690edb58d6cd98b Mon Sep 17 00:00:00 2001 From: lgh Date: Mon, 28 Nov 2022 17:02:29 +0800 Subject: [PATCH 1/3] =?UTF-8?q?update:=20=E5=AE=89=E5=85=A8=E8=B7=9D?= =?UTF-8?q?=E7=A6=BB3.8=E7=B1=B3=EF=BC=9B=20=E5=81=9C=E6=AD=A2=E6=8E=A5?= =?UTF-8?q?=E6=94=B6=E4=BB=BB=E5=8A=A1=E5=90=AF=E7=94=A8=EF=BC=9B=20?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E4=BD=9C=E5=BA=9F=EF=BC=9B=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E4=BB=BB=E5=8A=A1=E7=8A=B6=E6=80=81=E6=8F=90=E4=BA=A4?= =?UTF-8?q?apms;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CurrTaskServiceImpl.java | 64 +++++++++++++++++-- .../service/impl/OrderInfoServiceImpl.java | 5 +- .../com/mt/wms/empty/task/ScheduledTask.java | 12 ++++ .../mt/wms/empty/task/TaskDistanceUtils.java | 6 +- 4 files changed, 75 insertions(+), 12 deletions(-) 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 8b63836..7499568 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 @@ -390,6 +390,13 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService if (!status.equals(currTask.getStatus())) { //修改为加工中,多步骤任务修改为加工中,查询缓存区,查询前置任务状态,并修改 if (status == 1) { + currTask.setStatus(1); + currTask.setIsIn(1); + currTask.setUpdaterId(99); + currTask.setUpdateTime(LocalDateTime.now()); + currTask.setBeginTime(LocalDateTime.now()); + //生产炉号 + createStoveCode(currTask); InStockInfo inStockInfo = inStockInfoServiceBiz.getOne(new QueryWrapper().eq(InStockInfo.TASK_ID, currTask.getId())); if (inStockInfo != null) { //更新库位状态为未占用 @@ -420,6 +427,8 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService currTask1.setUpdaterId(99); currTask1.setUpdateTime(LocalDateTime.now()); currTaskServiceBiz.updateById(currTask1); + apmsEndProcess(currTask1); + apmsStartProcess(currTask); } else if (currTask.getId().equals(autoExeTask.getThTaskId())) { //该任务为自动任务第三条,修改自动任务第二条的状态 CurrTask currTask2 = currTaskServiceBiz.getById(autoExeTask.getFTaskId()); @@ -429,15 +438,11 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService currTask2.setUpdaterId(99); currTask2.setUpdateTime(LocalDateTime.now()); currTaskServiceBiz.updateById(currTask2); + apmsEndProcess(currTask2); + apmsStartProcess(currTask); } } - currTask.setStatus(1); - currTask.setIsIn(1); - currTask.setUpdaterId(99); - currTask.setUpdateTime(LocalDateTime.now()); - currTask.setBeginTime(LocalDateTime.now()); - //生产炉号 - createStoveCode(currTask); + currTaskServiceBiz.updateById(currTask); logger.info("修改任务" + currTask.getId() + "状态为加工中成功"); } @@ -781,6 +786,51 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService return true; } } + /** + * 上报apms开始加工 + * + * @param currTask + * @return + */ + private Boolean apmsStartProcess(CurrTask currTask) { + String code = kilnInfoServiceBiz.getById(currTask.getKilnId()).getCode(); + ApmsStartProcess apmsStartProcess = new ApmsStartProcess(); + apmsStartProcess.setStartUser("QJJP03"); + apmsStartProcess.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); + apmsStartProcess.setTechName(currTask.getCraftCodeId().toString()); + apmsStartProcess.setSheetNo(currTask.getSheetNo()); + if (currTask.getStoveCode() != null) { + apmsStartProcess.setStoveCode(currTask.getStoveCode()); + } + + R apmsStartProcessR = apmsControl.startProcess(apmsStartProcess); + if (apmsStartProcessR.getCode() != 0) { + logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms失败"); + return false; + } + logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms成功"); + 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 apmsEndProcessVoR = apmsControl.endProcess(apmsEndProcess); + if (apmsEndProcessVoR.getCode() != 0) { + logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单完成处理上报apms失败"); + return false; + } + logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单完成处理上报apms成功"); + return true; + } /** * 生成炉号 * 多步骤任务除了第一步为清洗炉外,每步都生成炉号 diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OrderInfoServiceImpl.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OrderInfoServiceImpl.java index b9fa907..64c028f 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OrderInfoServiceImpl.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OrderInfoServiceImpl.java @@ -119,6 +119,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic .like(StringUtils.isNotBlank(param.getOrderNo()), OrderInfo.ORDER_NO, param.getOrderNo()) .like(StringUtils.isNotBlank(param.getCustomerName()),OrderInfo.CUSTOMER_NAME,param.getCustomerName()) .in(OrderInfo.STATUS,0,1) + .eq(OrderInfo.ORDER_VOID,1) .orderByDesc(OrderInfo.CREATE_TIME); Page page = orderInfoService.page(new Page<>(param.getCurrent(), param.getSize()), wrapper); PageVo orderInfoVoPageVo = new PageVo<>(page, OrderInfoVo.class); @@ -219,7 +220,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic @Override public R getTaskInfoByIdenCardNum(String idenCardNum) { QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(OrderInfo.IDEN_CARD_NUM, idenCardNum).eq(OrderInfo.VALID, 1); + wrapper.eq(OrderInfo.IDEN_CARD_NUM, idenCardNum).eq(OrderInfo.VALID, 1).eq(OrderInfo.ORDER_VOID,1); OrderInfo one = orderInfoService.getOne(wrapper); Assert.notNull("未找到该标识卡信息!", one); OrderInfoVo build = OrderInfoVo.builder().build(); @@ -261,7 +262,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic for (TaskCreateDetParam detParam : detParams) { QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(OrderInfo.IDEN_CARD_NUM, detParam.getIdenCardNum()).eq(OrderInfo.VALID, 1); + wrapper.eq(OrderInfo.IDEN_CARD_NUM, detParam.getIdenCardNum()).eq(OrderInfo.VALID, 1).eq(OrderInfo.ORDER_VOID,1); OrderInfo one = orderInfoService.getOne(wrapper); Assert.notNull("错误,标识卡号" + detParam.getIdenCardNum() + "在订单中不存在!", one); } 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 37b4335..d74bef4 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 @@ -584,6 +584,9 @@ public class ScheduledTask extends BaseService { if (vehicleInfos.size() > 0) { return; } + if (kilnStopRecTask(kilnInfo.getId())){ + continue; + } Boolean kilnReadyIn = false; if (kilnInfo.getType() == 1) { kilnReadyIn = kilnReadyIn(kilnInfo.getId()); @@ -791,6 +794,15 @@ public class ScheduledTask extends BaseService { return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString()); } + private Boolean kilnStopRecTask(Long kilnId) { + PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper() + .eq(PlcNameSpace.EQ_TYPE, 0) + .eq(PlcNameSpace.EQ_ID, kilnId) + .eq(PlcNameSpace.TYPE, 0)); + String nameSpaceNote = nameSpace.getName(); + String result = readPlcToString(nameSpaceNote, "StopRecTask"); + return Boolean.valueOf(JSONObject.parseObject(result).get("result").toString()); + } private Boolean kilnReadyIn(Long kilnId) { PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper() .eq(PlcNameSpace.EQ_TYPE, 0) 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 d00341f..7f04059 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); - //另一辆小车在在小车路径上比如冲突,不在小车路径上时判定一下安全距离(4米) + //另一辆小车在在小车路径上比如冲突,不在小车路径上时判定一下安全距离(3.8米) if (otherNowPosition>=minDistance&&otherNowPosition<=maxDistance){ return true; }else { - if (Math.abs(otherNowPosition-maxDistance)<3.5){ + if (Math.abs(otherNowPosition-maxDistance)<3.8){ return true; } - if (Math.abs(otherNowPosition-minDistance)<3.5){ + if (Math.abs(otherNowPosition-minDistance)<3.8){ return true; } return false; From 21a4cfab238189c4997a888799b119d3059b0f76 Mon Sep 17 00:00:00 2001 From: lgh Date: Fri, 2 Dec 2022 15:42:02 +0800 Subject: [PATCH 2/3] =?UTF-8?q?update:=20=E7=9B=91=E5=90=AC=E5=88=B0?= =?UTF-8?q?=E5=8A=A0=E5=B7=A5=E7=82=89=E5=AE=8C=E6=88=90=E5=8A=A0=E5=B7=A5?= =?UTF-8?q?=E5=90=8E=E5=B0=B1=E7=BB=93=E6=9D=9F=E5=BD=93=E5=89=8D=E5=B7=A5?= =?UTF-8?q?=E8=89=BA=EF=BC=8C=E9=98=B2=E6=AD=A2=E5=BC=80=E5=A7=8B=E6=96=B0?= =?UTF-8?q?=E7=9A=84=E5=B7=A5=E8=89=BA=E6=97=B6=E4=B8=8A=E6=8A=A5=E5=87=BA?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mt/wms/empty/task/ScheduledTask.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) 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 d74bef4..f009966 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 @@ -12,6 +12,9 @@ import com.mt.wms.core.utils.CodeGeneratorHelper; 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.empty.controller.ApmsController; +import com.mt.wms.empty.params.ApmsEndProcess; +import com.mt.wms.empty.vo.ApmsEndProcessVo; import com.mt.wms.empty.vo.CurrTaskDetVo; import com.mt.wms.empty.vo.NowCurrTaskDetVo; import com.mt.wms.empty.websocket.WebSocketServer; @@ -25,6 +28,7 @@ import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.io.IOException; import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -81,6 +85,8 @@ public class ScheduledTask extends BaseService { private TaskHisServiceBiz taskHisServiceBiz; @Resource private TaskDetHisServiceBiz taskDetHisServiceBiz; + @Resource + private ApmsController apmsController; //@Scheduled(fixedDelay = 1000*20) @@ -242,6 +248,8 @@ public class ScheduledTask extends BaseService { taskDetHisServiceBiz.saveBatch(taskDetHisList); //加工结束而没有立马出炉,加工结束记录能源消耗值只记录一次 asynRunTaskService.asynEndRecordConsume(currTask.getId(), kilnId); + apmsEndProcess(currTask); + logger.info(currTask+"上报apms结束当前工艺加工"); logger.info(kilnInfo.getCode() + "炉子中的任务:" + currTask.getId() + "已加工结束,记录加工结束能源消耗值"); } runTaskUtils.runTaskForOutKiln(kilnId); @@ -882,4 +890,23 @@ public class ScheduledTask extends BaseService { Boolean free = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString()); return free; } + /** + * 上报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 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; + } } From 395817f10e5ec1a33599b7fd648447fdb77a837c Mon Sep 17 00:00:00 2001 From: lgh Date: Tue, 27 Dec 2022 18:01:05 +0800 Subject: [PATCH 3/3] 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;