From 18959656f9bf75e40a5802c3befd545ec33621d7 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期一, 18 十一月 2024 12:17:24 +0800 Subject: [PATCH] # --- zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java index 4fcedee..7329135 100644 --- a/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/core/service/MainService.java @@ -254,6 +254,10 @@ if (!Cools.isEmpty(taskService.selectInSts(agvId, TaskStsType.ASSIGN, TaskStsType.PROGRESS))) { throw new CoolException("AGV[" + agv.getUuid() + "]鍒嗛厤浠诲姟澶辫触锛屽凡瀛樺湪鎵ц浠诲姟..."); } + if (!Cools.isEmpty(segmentService.getByAgvAndState(agv.getId(), SegmentStateType.WAITING.toString())) + || !Cools.isEmpty(segmentService.getByAgvAndState(agv.getId(), SegmentStateType.RUNNING.toString()))) { + throw new CoolException("AGV[" + agv.getUuid() + "] failed to assign锛宐ecause already has the segment in running..."); + } // execute ---------------------------------------------------- Date now = new Date(); @@ -491,17 +495,19 @@ * 鍏呯數 鍥炲緟鏈轰綅浠诲姟 */ @Transactional(propagation = Propagation.REQUIRES_NEW) // although there is a Transactional here that the lock is isolated, but we can't join the caller's Transactional - public boolean buildMinorTask(Agv agv, AgvDetail agvDetail, TaskTypeType taskType, String destination) { + public boolean buildMinorTask(Agv agv, TaskTypeType taskType, String destination, Jam jam) { if (Cools.isEmpty(agv, taskType)) { return false; } try { - if (null == agvDetail) { - agvDetail = agvDetailService.selectByAgvId(agv.getId()); - } + AgvDetail agvDetail = agvDetailService.selectByAgvId(agv.getId()); if (!agvService.judgeEnable(agv.getId())) { return false; } if (!Cools.isEmpty(taskService.selectInSts(agv.getId(), TaskStsType.ASSIGN, TaskStsType.PROGRESS))) { throw new CoolException("AGV[" + agv.getUuid() + "] failed to assign锛宐ecause already has the task in running..."); + } + if (!Cools.isEmpty(segmentService.getByAgvAndState(agv.getId(), SegmentStateType.WAITING.toString())) + || !Cools.isEmpty(segmentService.getByAgvAndState(agv.getId(), SegmentStateType.RUNNING.toString()))) { + throw new CoolException("AGV[" + agv.getUuid() + "] failed to assign锛宐ecause already has the segment in running..."); } Date now = new Date(); @@ -602,6 +608,10 @@ } if (!segmentService.save(next)) { throw new BusinessException("segment failed to save"); + } else { + if (null != jam && i == 0) { + jam.setAvoSeg(next.getId()); + } } } @@ -621,10 +631,6 @@ default: break; } - -// if (taskType.equals(TaskTypeType.TO_STANDBY)) { -// redis.setObject(RedisConstant.AGV_TO_STANDBY_FLAG, agv.getUuid(), false); -// } return true; } catch (Exception e) { -- Gitblit v1.9.1