diff --git a/cpte-boot-module/cpte-module-wms/src/main/java/org/cpte/modules/tesAgv/service/impl/ITesAgvServiceImpl.java b/cpte-boot-module/cpte-module-wms/src/main/java/org/cpte/modules/tesAgv/service/impl/ITesAgvServiceImpl.java index 0bc0af4..c5e7251 100644 --- a/cpte-boot-module/cpte-module-wms/src/main/java/org/cpte/modules/tesAgv/service/impl/ITesAgvServiceImpl.java +++ b/cpte-boot-module/cpte-module-wms/src/main/java/org/cpte/modules/tesAgv/service/impl/ITesAgvServiceImpl.java @@ -214,10 +214,37 @@ public class ITesAgvServiceImpl implements ITesAgvService { @Override @Transactional(rollbackFor = Exception.class) public void containerUp(ContainerUpRequest containerUpRequest) { - String id = containerUpRequest.getContent().getBizID(); + ContainerUpRequest.Content content = containerUpRequest.getContent(); + String id = content.getBizID(); AgvTask agvTask = agvTaskMapper.selectById(Long.parseLong(id)); - agvTask.setOutBinTime(new Date()); - agvTaskMapper.updateById(agvTask); + if (agvTask == null) { + throw new RuntimeException("【" + id + "】任务不存在"); + } + if(agvTask.getOutBinTime()!=null){ + return; + } + + String businessType = agvTask.getType(); + String startCode = agvTask.getStartCode(); + boolean needUpdateOutBinTime = false; // 标记是否需要更新时间 + + if (BusinessTypeEnum.INBOUND.getValue().equals(businessType)) { + String stationCode = content.getStationCode(); + if (stationCode.equals(startCode)) { + agvTask.setOutBinTime(new Date()); + needUpdateOutBinTime = true; + } + } else if (BusinessTypeEnum.OUTBOUND.getValue().equals(businessType) + || BusinessTypeEnum.MOVE.getValue().equals(businessType)) { + String nodeCode = content.getNodeCode(); + if (nodeCode.equals(startCode)) { + agvTask.setOutBinTime(new Date()); + needUpdateOutBinTime = true; + } + } + if (needUpdateOutBinTime) { + agvTaskMapper.updateById(agvTask); + } }