From f46e6a76cee1e4f231fab74981a87947bf84677d Mon Sep 17 00:00:00 2001 From: Junjie <xjj@123> Date: 星期二, 15 十月 2024 11:02:47 +0800 Subject: [PATCH] # --- zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java | 122 ++++++++++++++++++++++++++++++++-------- 1 files changed, 98 insertions(+), 24 deletions(-) diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java index 936f22f..be5cc3e 100644 --- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java +++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java @@ -1,17 +1,14 @@ package com.zy.asrs.wcs.core.kernel; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.zy.asrs.wcs.core.domain.dto.MotionDto; import com.zy.asrs.wcs.core.entity.*; -import com.zy.asrs.wcs.core.model.enums.DeviceCtgType; -import com.zy.asrs.wcs.core.model.enums.MotionCtgType; -import com.zy.asrs.wcs.core.model.enums.TaskCtgType; -import com.zy.asrs.wcs.core.model.enums.TaskStsType; +import com.zy.asrs.wcs.core.model.NavigateNode; +import com.zy.asrs.wcs.core.model.enums.*; import com.zy.asrs.wcs.core.service.*; -import com.zy.asrs.wcs.core.utils.ConveyorDispatcher; -import com.zy.asrs.wcs.core.utils.LiftDispatcher; -import com.zy.asrs.wcs.core.utils.ShuttleDispatcher; -import com.zy.asrs.wcs.core.utils.Utils; +import com.zy.asrs.wcs.core.utils.*; +import com.zy.asrs.wcs.rcs.News; import com.zy.asrs.wcs.rcs.cache.SlaveConnection; import com.zy.asrs.wcs.rcs.entity.Device; import com.zy.asrs.wcs.rcs.model.enums.SlaveType; @@ -155,6 +152,9 @@ //绌挎杞﹀嚭鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙� String standbyLocNoFrom = shuttleStandbyFrom.getDeviceStandbyLoc(); + //鎹㈠眰闇�瑕侀攣瀹氱殑璺緞 + List<String> lockPath = shuttleStandbyFrom.getLockPath$(); + // 鍏ュ簱鐩爣灞傛湁绌挎杞� if (Utils.getLev(shuttleLocNo) == Utils.getLev(task.getDestLoc())) { @@ -196,7 +196,7 @@ MotionCtgType.SHUTTLE_PALLET_LIFT )); - // 绌挎杞﹁蛋琛岃嚦鐩爣搴撲綅 + // 绌挎杞﹁浇璐ц蛋琛岃嚦鐩爣搴撲綅 motionList.addAll(kernelService.shuttleMove( MotionDto.build((dto -> { dto.setShuttleNo(shuttleDevice.getId().intValue()); @@ -207,7 +207,7 @@ dto.setLiftNo(transferLiftDevice.getId().intValue()); dto.setLocNo(destLoc); })), - MotionCtgType.SHUTTLE_MOVE + MotionCtgType.SHUTTLE_TRANSPORT )); // 绌挎杞﹀叆搴撴墭鐩樹笅闄� @@ -253,12 +253,12 @@ MotionCtgType.SHUTTLE_MOVE )); - // 閿佸畾鐩爣妤煎眰绌挎杞﹀緟鏈轰綅璺緞 + // 閿佸畾鎹㈠眰璺緞 motionList.addAll(kernelService.mapLockPath( null, MotionDto.build((dto -> { dto.setShuttleNo(shuttleDevice.getId().intValue()); - dto.setLocNo(standbyLocNoFrom); + dto.setLocNo(JSON.toJSONString(lockPath)); })) )); @@ -353,6 +353,15 @@ })) )); + // 瑙i攣鎹㈠眰璺緞 + motionList.addAll(kernelService.mapUnlockPath( + null, + MotionDto.build((dto -> { + dto.setShuttleNo(shuttleDevice.getId().intValue()); + dto.setLocNo(JSON.toJSONString(lockPath)); + })) + )); + // 绌挎杞﹀叆搴撻《鍗� motionList.addAll(kernelService.shuttleAction( null, @@ -362,7 +371,7 @@ MotionCtgType.SHUTTLE_PALLET_LIFT )); - // 绌挎杞﹁蛋琛岃嚦鐩爣搴撲綅 + // 绌挎杞﹁浇璐ц蛋琛岃嚦鐩爣搴撲綅 motionList.addAll(kernelService.shuttleMove( MotionDto.build((dto -> { dto.setShuttleNo(shuttleDevice.getId().intValue()); @@ -373,7 +382,7 @@ dto.setLiftNo(transferLiftDevice.getId().intValue()); dto.setLocNo(destLoc); })), - MotionCtgType.SHUTTLE_MOVE + MotionCtgType.SHUTTLE_TRANSPORT )); // 绌挎杞﹀叆搴撴墭鐩樹笅闄� @@ -470,6 +479,9 @@ //绌挎杞﹀嚭鎻愬崌鏈哄悗灏忚溅寰呮満浣� String shuttleFromLiftStandbyLoc = shuttleStandbyFrom.getStandbyLoc(); + //鎹㈠眰闇�瑕侀攣瀹氱殑璺緞 + List<String> lockPath = shuttleStandbyFrom.getLockPath$(); + //鑾峰彇鍑哄簱浠诲姟绫诲瀷 TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>() .eq(TaskCtg::getFlag, String.valueOf(TaskCtgType.OUT)) @@ -485,6 +497,19 @@ if (basConveyorPath == null) { return motionList; } + + //璁$畻璺緞骞跺垎瑙f垚涓ゆ鍔ㄤ綔 + List<NavigateNode> nodeList = NavigateUtils.calc(originLoc, standbyLocNoTo, NavigationMapType.DFX.id, Utils.getShuttlePoints(Integer.parseInt(shuttleDevice.getDeviceNo()), Utils.getLev(originLoc))); + if (nodeList == null) { + News.error("{} dash {} can't find navigate path!", originLoc, standbyLocNoTo); + return null; + } + //鑾峰彇鍒嗘璺緞 + ArrayList<ArrayList<NavigateNode>> data = NavigateUtils.getSectionPath(nodeList); + //鍙栧嚭鏈�鍚庝竴娈佃矾寰� + ArrayList<NavigateNode> navigateNodes = data.get(data.size() - 1); + NavigateNode startNode = navigateNodes.get(0); + String lastPathStartLoc = Utils.getLocNo(startNode.getX(), startNode.getY(), startNode.getZ()); /** * 鍑哄簱 @@ -516,7 +541,7 @@ MotionCtgType.SHUTTLE_PALLET_LIFT )); - // 绌挎杞﹀嚭搴撹嚦鎻愬崌鏈哄緟鏈轰綅 + // 绌挎杞﹁浇璐у嚭搴撹嚦鏈�鍚庝竴娈佃矾寰勭瓑寰� motionList.addAll(kernelService.shuttleMove( MotionDto.build((dto -> { dto.setShuttleNo(shuttleDevice.getId().intValue()); @@ -524,10 +549,24 @@ })), MotionDto.build((dto -> { dto.setShuttleNo(shuttleDevice.getId().intValue()); + dto.setLocNo(lastPathStartLoc); + })), + MotionCtgType.SHUTTLE_TRANSPORT + )); + + // 绌挎杞﹁浇璐ц嚦鎻愬崌鏈哄緟鏈轰綅 + motionList.addAll(kernelService.shuttleMove( + MotionDto.build((dto -> { + dto.setShuttleNo(shuttleDevice.getId().intValue()); + dto.setLocNo(lastPathStartLoc); + })), + MotionDto.build((dto -> { + dto.setShuttleNo(shuttleDevice.getId().intValue()); dto.setLiftNo(transferLiftDevice.getId().intValue()); dto.setLocNo(standbyLocNoTo); + dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//杈撻�佺珯 })), - MotionCtgType.SHUTTLE_MOVE + MotionCtgType.SHUTTLE_TRANSPORT_TO_CONVEYOR )); // 绌挎杞﹀嚭搴撴墭鐩樹笅闄� @@ -602,12 +641,12 @@ MotionCtgType.SHUTTLE_MOVE )); - // 閿佸畾鐩爣妤煎眰绌挎杞﹀緟鏈轰綅璺緞 + // 閿佸畾鎹㈠眰璺緞 motionList.addAll(kernelService.mapLockPath( null, MotionDto.build((dto -> { dto.setShuttleNo(shuttleDevice.getId().intValue()); - dto.setLocNo(standbyLocNoFrom); + dto.setLocNo(JSON.toJSONString(lockPath)); })) )); @@ -702,6 +741,15 @@ })) )); + // 瑙i攣鎹㈠眰璺緞 + motionList.addAll(kernelService.mapUnlockPath( + null, + MotionDto.build((dto -> { + dto.setShuttleNo(shuttleDevice.getId().intValue()); + dto.setLocNo(JSON.toJSONString(lockPath)); + })) + )); + // 绌挎杞︽彁鍗囨満寰呮満浣嶈嚦鍑哄簱搴撲綅 motionList.addAll(kernelService.shuttleMove( MotionDto.build((dto -> { @@ -725,7 +773,7 @@ MotionCtgType.SHUTTLE_PALLET_LIFT )); - // 绌挎杞﹀嚭搴撹嚦鎻愬崌鏈哄緟鏈轰綅 + // 绌挎杞﹁浇璐у嚭搴撹嚦鏈�鍚庝竴娈佃矾寰勭瓑寰� motionList.addAll(kernelService.shuttleMove( MotionDto.build((dto -> { dto.setShuttleNo(shuttleDevice.getId().intValue()); @@ -733,10 +781,24 @@ })), MotionDto.build((dto -> { dto.setShuttleNo(shuttleDevice.getId().intValue()); + dto.setLocNo(lastPathStartLoc); + })), + MotionCtgType.SHUTTLE_TRANSPORT + )); + + // 绌挎杞﹁浇璐ц嚦鎻愬崌鏈哄緟鏈轰綅 + motionList.addAll(kernelService.shuttleMove( + MotionDto.build((dto -> { + dto.setShuttleNo(shuttleDevice.getId().intValue()); + dto.setLocNo(lastPathStartLoc); + })), + MotionDto.build((dto -> { + dto.setShuttleNo(shuttleDevice.getId().intValue()); dto.setLiftNo(transferLiftDevice.getId().intValue()); dto.setLocNo(standbyLocNoFrom); + dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//杈撻�佺珯 })), - MotionCtgType.SHUTTLE_MOVE + MotionCtgType.SHUTTLE_TRANSPORT_TO_CONVEYOR )); // 绌挎杞﹀嚭搴撴墭鐩樹笅闄� @@ -1157,6 +1219,9 @@ //绌挎杞﹀嚭鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙� String standbyLocNoFrom = liftDispatcher.getLiftStandByLocNo(liftThread, Utils.getLev(task.getDestLoc())); + //鎹㈠眰闇�瑕侀攣瀹氱殑璺緞 + List<String> lockPath = liftDispatcher.getLockPathByLocNo(liftThread, Utils.getLev(task.getDestLoc())); + // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄簱浣嶅緟鏈轰綅 motionList.addAll(kernelService.shuttleMove( @@ -1172,12 +1237,12 @@ MotionCtgType.SHUTTLE_MOVE )); - // 閿佸畾鐩爣妤煎眰绌挎杞﹀緟鏈轰綅璺緞 + // 閿佸畾鎹㈠眰璺緞 motionList.addAll(kernelService.mapLockPath( null, MotionDto.build((dto -> { dto.setShuttleNo(shuttleDevice.getId().intValue()); - dto.setLocNo(standbyLocNoFrom); + dto.setLocNo(JSON.toJSONString(lockPath)); })) )); @@ -1268,6 +1333,15 @@ null , MotionDto.build((dto -> { dto.setLiftNo(liftDevice.getId().intValue()); + })) + )); + + // 瑙i攣鎹㈠眰璺緞 + motionList.addAll(kernelService.mapUnlockPath( + null, + MotionDto.build((dto -> { + dto.setShuttleNo(shuttleDevice.getId().intValue()); + dto.setLocNo(JSON.toJSONString(lockPath)); })) )); @@ -1400,7 +1474,7 @@ motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_LIFT.val()); })); - // 绌挎杞﹁蛋琛岃嚦鐩爣搴撲綅 + // 绌挎杞﹁浇璐ц蛋琛岃嚦鐩爣搴撲綅 motionList.addAll(kernelService.shuttleMove( MotionDto.build((dto -> { dto.setShuttleNo(device.getId().intValue()); @@ -1410,7 +1484,7 @@ dto.setShuttleNo(device.getId().intValue()); dto.setLocNo(targetLoc); })), - MotionCtgType.SHUTTLE_MOVE + MotionCtgType.SHUTTLE_TRANSPORT )); //鎵樼洏涓嬮檷 -- Gitblit v1.9.1