From d8b1f82c07cf723b2590cae5a432ff78a514b05e Mon Sep 17 00:00:00 2001 From: gtsxc <3272660260@qq.com> Date: 星期一, 25 十一月 2024 10:30:30 +0800 Subject: [PATCH] # --- zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java | 145 ++++++++++++++++++++++++++++++++++++------------ 1 files changed, 109 insertions(+), 36 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..6660003 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())) { @@ -170,7 +170,7 @@ dto.setLev(Utils.getLev(task.getDestLoc())); dto.setStaNo(getStaByLev(Utils.getLev(task.getDestLoc()))); dto.setDevpNo(basConveyorStaDest.getConveyorDeviceId().intValue()); -// dto.setSync();//寮傛鎵ц + dto.setReleaseLift(1);//鎵ц瀹屾垚鍚庨噴鏀炬彁鍗囨満 })) )); @@ -196,7 +196,7 @@ MotionCtgType.SHUTTLE_PALLET_LIFT )); - // 绌挎杞﹁蛋琛岃嚦鐩爣搴撲綅 + // 绌挎杞﹁浇璐ц蛋琛岃嚦鐩爣搴撲綅 motionList.addAll(kernelService.shuttleMove( MotionDto.build((dto -> { dto.setShuttleNo(shuttleDevice.getId().intValue()); @@ -206,8 +206,9 @@ dto.setShuttleNo(shuttleDevice.getId().intValue()); dto.setLiftNo(transferLiftDevice.getId().intValue()); dto.setLocNo(destLoc); +// dto.setReleaseLift(2);//鎵ц涓噴鏀炬彁鍗囨満 })), - MotionCtgType.SHUTTLE_MOVE + MotionCtgType.SHUTTLE_TRANSPORT )); // 绌挎杞﹀叆搴撴墭鐩樹笅闄� @@ -236,6 +237,7 @@ dto.setLev(Utils.getLev(task.getDestLoc())); dto.setStaNo(getStaByLev(Utils.getLev(task.getDestLoc()))); dto.setDevpNo(basConveyorStaDest.getConveyorDeviceId().intValue()); + dto.setReleaseLift(1);//鎵ц瀹屾垚鍚庨噴鏀炬彁鍗囨満 })) )); @@ -253,12 +255,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 +355,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 +373,7 @@ MotionCtgType.SHUTTLE_PALLET_LIFT )); - // 绌挎杞﹁蛋琛岃嚦鐩爣搴撲綅 + // 绌挎杞﹁浇璐ц蛋琛岃嚦鐩爣搴撲綅 motionList.addAll(kernelService.shuttleMove( MotionDto.build((dto -> { dto.setShuttleNo(shuttleDevice.getId().intValue()); @@ -373,7 +384,7 @@ dto.setLiftNo(transferLiftDevice.getId().intValue()); dto.setLocNo(destLoc); })), - MotionCtgType.SHUTTLE_MOVE + MotionCtgType.SHUTTLE_TRANSPORT )); // 绌挎杞﹀叆搴撴墭鐩樹笅闄� @@ -467,8 +478,11 @@ //绌挎杞﹀嚭鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙� String standbyLocNoFrom = shuttleStandbyFrom.getDeviceStandbyLoc(); - //绌挎杞﹀嚭鎻愬崌鏈哄悗灏忚溅寰呮満浣� - String shuttleFromLiftStandbyLoc = shuttleStandbyFrom.getStandbyLoc(); + //绌挎杞﹀嚭鎻愬崌鏈哄悗鍏ㄩ儴寰呮満浣� + String standbyLocs = shuttleStandbyFrom.getStandbyLoc();//鑾峰彇鍏ㄩ儴寰呮満浣� + + //鎹㈠眰闇�瑕侀攣瀹氱殑璺緞 + List<String> lockPath = shuttleStandbyFrom.getLockPath$(); //鑾峰彇鍑哄簱浠诲姟绫诲瀷 TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>() @@ -484,6 +498,12 @@ .eq(BasConveyorPath::getTypeNo, taskCtg.getId())); if (basConveyorPath == null) { return motionList; + } + + //鍒嗘瀽鍑哄簱璺緞寰呮満搴撲綅 + String lastPathStartLoc = shuttleDispatcher.analyzeOutPathWaitLoc(originLoc, standbyLocNoTo, shuttleDevice); + if (lastPathStartLoc == null) { + return motionList;//鏈垎鏋愭垚鍔� } /** @@ -516,18 +536,34 @@ MotionCtgType.SHUTTLE_PALLET_LIFT )); - // 绌挎杞﹀嚭搴撹嚦鎻愬崌鏈哄緟鏈轰綅 + if (!originLoc.equals(lastPathStartLoc)) { + // 绌挎杞﹁浇璐у嚭搴撹嚦鏈�鍚庝竴娈佃矾寰勭瓑寰� + motionList.addAll(kernelService.shuttleMove( + MotionDto.build((dto -> { + dto.setShuttleNo(shuttleDevice.getId().intValue()); + dto.setLocNo(originLoc); + })), + 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(originLoc); + 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 )); // 绌挎杞﹀嚭搴撴墭鐩樹笅闄� @@ -539,7 +575,7 @@ MotionCtgType.SHUTTLE_PALLET_DOWN )); - // 绌挎杞︽彁鍗囨満寰呮満浣� - 鍒板緟鏈轰綅 + // 绌挎杞︽彁鍗囨満寰呮満浣� - 鍒板緟鏈轰綅(鑷姩閫夋嫨鍚堥�傚緟鏈轰綅) motionList.addAll(kernelService.shuttleMove( MotionDto.build((dto -> { dto.setShuttleNo(shuttleDevice.getId().intValue()); @@ -547,11 +583,11 @@ })), MotionDto.build((dto -> { dto.setShuttleNo(shuttleDevice.getId().intValue()); - dto.setLocNo(shuttleFromLiftStandbyLoc); + dto.setLocNo(standbyLocs); dto.setSync(0);//寮傛鎵ц dto.setReleaseShuttle(1);//鎵ц瀹屾垚鍚庨噴鏀惧皬杞� })), - MotionCtgType.SHUTTLE_MOVE + MotionCtgType.SHUTTLE_MOVE_STANDBY )); // 鎻愬崌鏈鸿浇璐хЩ鍔� @@ -602,12 +638,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 +738,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,18 +770,34 @@ MotionCtgType.SHUTTLE_PALLET_LIFT )); - // 绌挎杞﹀嚭搴撹嚦鎻愬崌鏈哄緟鏈轰綅 + if (!originLoc.equals(lastPathStartLoc)) { + // 绌挎杞﹁浇璐у嚭搴撹嚦鏈�鍚庝竴娈佃矾寰勭瓑寰� + motionList.addAll(kernelService.shuttleMove( + MotionDto.build((dto -> { + dto.setShuttleNo(shuttleDevice.getId().intValue()); + dto.setLocNo(originLoc); + })), + 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(originLoc); + 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 )); // 绌挎杞﹀嚭搴撴墭鐩樹笅闄� @@ -748,7 +809,7 @@ MotionCtgType.SHUTTLE_PALLET_DOWN )); - // 绌挎杞︽彁鍗囨満寰呮満浣� - 鍒板緟鏈轰綅 + // 绌挎杞︽彁鍗囨満寰呮満浣� - 鍒板緟鏈轰綅(鑷姩閫夋嫨鍚堥�傚緟鏈轰綅) motionList.addAll(kernelService.shuttleMove( MotionDto.build((dto -> { dto.setShuttleNo(shuttleDevice.getId().intValue()); @@ -756,11 +817,11 @@ })), MotionDto.build((dto -> { dto.setShuttleNo(shuttleDevice.getId().intValue()); - dto.setLocNo(shuttleFromLiftStandbyLoc); + dto.setLocNo(standbyLocs); dto.setSync(0);//寮傛鎵ц - dto.setReleaseShuttle(1);//鎵ц瀹屾垚鍚庨噴鏀剧┛姊溅 + dto.setReleaseShuttle(1);//鎵ц瀹屾垚鍚庨噴鏀惧皬杞� })), - MotionCtgType.SHUTTLE_MOVE + MotionCtgType.SHUTTLE_MOVE_STANDBY )); // 鎻愬崌鏈鸿浇璐хЩ鍔� @@ -1157,6 +1218,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 +1236,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 +1332,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 +1473,7 @@ motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_LIFT.val()); })); - // 绌挎杞﹁蛋琛岃嚦鐩爣搴撲綅 + // 绌挎杞﹁浇璐ц蛋琛岃嚦鐩爣搴撲綅 motionList.addAll(kernelService.shuttleMove( MotionDto.build((dto -> { dto.setShuttleNo(device.getId().intValue()); @@ -1410,7 +1483,7 @@ dto.setShuttleNo(device.getId().intValue()); dto.setLocNo(targetLoc); })), - MotionCtgType.SHUTTLE_MOVE + MotionCtgType.SHUTTLE_TRANSPORT )); //鎵樼洏涓嬮檷 -- Gitblit v1.9.1