From 23733d8b91d0a5e83dc47978db12f6aea102975a Mon Sep 17 00:00:00 2001
From: zjj <3272660260@qq.com>
Date: 星期四, 27 二月 2025 08:58:16 +0800
Subject: [PATCH] #
---
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java | 333 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 333 insertions(+), 0 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 e645221..72c684e 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
@@ -1605,4 +1605,337 @@
return motionList;
}
+ /**
+ * 鐢熸垚灏忚溅杞借揣杩佺Щ鍔ㄤ綔
+ */
+ public List<Motion> generateShuttleLadenMoveMotion(Task task) {
+ List<Motion> motionList = new ArrayList<>();
+ if (task.getTaskSts() != TaskStsType.NEW_LADEN_MOVE.sts) {
+ return motionList;
+ }
+ //originLoc 婧愬簱浣�
+ String originLoc = task.getOriginLoc();
+ // locNo 鐩爣搴撲綅
+ String locNo = task.getDestLoc();
+
+ // shuttle
+ Device shuttleDevice = deviceService.getOne(new LambdaQueryWrapper<Device>()
+ .eq(Device::getDeviceNo, task.getShuttleNo())
+ .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val())
+ .eq(Device::getHostId, task.getHostId())
+ .eq(Device::getStatus, 1));
+ if (shuttleDevice == null) {
+ return motionList;
+ }
+ ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleDevice.getId().intValue());
+ ShuttleProtocol shuttleProtocol = shuttleThread.getStatus();
+ if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) {
+ return motionList;
+ }
+ if (!shuttleThread.isIdle()) {
+ return motionList;
+ }
+
+ String shuttleLocNo = shuttleProtocol.getCurrentLocNo();
+
+ //鑾峰彇璺濈鐩爣浣嶇疆鏈�杩戠殑绌洪棽鍙崲灞傛彁鍗囨満
+ LiftThread liftThread = liftDispatcher.searchIdleLift(shuttleLocNo, task.getHostId(), true);
+ if (liftThread == null) {
+ return motionList;
+ }
+ Device transferLiftDevice = liftThread.getDevice();
+
+ LiftProtocol liftProtocol = liftThread.getStatus();
+ if (liftProtocol == null || liftProtocol.getLiftNo() == null) {
+ return motionList;
+ }
+
+ //妫�娴嬬┛姊溅鏄惁鏈変换鍔$粦瀹�
+ boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleDevice, task.getTaskNo());
+ if (shuttleResult) {
+ //瀛樺湪浠诲姟锛岀姝㈣В鏋�
+ return motionList;
+ }
+
+ //鑾峰彇灏忚溅寰呮満搴撲綅 ==> 杩涙彁鍗囨満
+ ShuttleStandby shuttleStandbyTo = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>()
+ .eq(ShuttleStandby::getDeviceId, transferLiftDevice.getId())
+ .eq(ShuttleStandby::getDeviceLev, Utils.getLev(shuttleLocNo))
+ .eq(ShuttleStandby::getStatus, 1));
+
+ //鑾峰彇灏忚溅寰呮満搴撲綅 ==> 鍑烘彁鍗囨満
+ ShuttleStandby shuttleStandbyFrom = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>()
+ .eq(ShuttleStandby::getDeviceId, transferLiftDevice.getId())
+ .eq(ShuttleStandby::getDeviceLev, Utils.getLev(originLoc))
+ .eq(ShuttleStandby::getStatus, 1));
+ if (shuttleStandbyTo == null || shuttleStandbyFrom == null) {
+ return motionList;
+ }
+
+ //绌挎杞﹁繘鎻愬崌鏈哄簱浣嶅彿
+ String liftLocNoTo = shuttleStandbyTo.getDeviceLoc();
+
+ //绌挎杞﹀嚭鎻愬崌鏈哄簱浣嶅彿
+ String liftLocNoFrom = shuttleStandbyFrom.getDeviceLoc();
+
+ //绌挎杞﹁繘鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙�
+ String standbyLocNoTo = shuttleStandbyTo.getDeviceStandbyLoc();
+
+ //绌挎杞﹀嚭鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙�
+ String standbyLocNoFrom = shuttleStandbyFrom.getDeviceStandbyLoc();
+
+ //绌挎杞﹀嚭鎻愬崌鏈哄悗鍏ㄩ儴寰呮満浣�
+ String standbyLocs = shuttleStandbyFrom.getStandbyLoc();//鑾峰彇鍏ㄩ儴寰呮満浣�
+
+ //鎹㈠眰闇�瑕侀攣瀹氱殑璺緞
+ List<String> lockPath = shuttleStandbyFrom.getLockPath$();
+
+ //鑾峰彇鍑哄簱浠诲姟绫诲瀷
+ TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>()
+ .eq(TaskCtg::getFlag, String.valueOf(TaskCtgType.MOVE))
+ .eq(TaskCtg::getStatus, 1));
+ if (taskCtg == null) {
+ return motionList;
+ }
+
+
+
+
+ /**
+ * 鍑哄簱
+ */
+ if (Utils.getLev(shuttleLocNo) == Utils.getLev(originLoc)) {
+
+ //绌挎杞︿笉鍦ㄥ嚭搴撳簱浣�
+ if (!shuttleLocNo.equals(task.getOriginLoc())) {
+ // 绌挎杞﹁蛋琛岃嚦鍑哄簱搴撲綅
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(shuttleLocNo);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLocNo(originLoc);
+ })),
+ MotionCtgType.SHUTTLE_MOVE
+ ));
+ }
+
+ // 绌挎杞﹀嚭搴撻《鍗�
+ motionList.addAll(kernelService.shuttleAction(
+ null,
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ })),
+ MotionCtgType.SHUTTLE_PALLET_LIFT
+ ));
+
+ // 绌挎杞﹁蛋琛岃嚦鐩爣搴撲綅
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(originLoc);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLocNo(locNo);
+ })),
+ MotionCtgType.SHUTTLE_TRANSPORT
+ ));
+
+ // 绌挎杞﹀嚭搴撴墭鐩樹笅闄�
+ motionList.addAll(kernelService.shuttleAction(
+ null,
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ })),
+ MotionCtgType.SHUTTLE_PALLET_DOWN
+ ));
+
+
+
+ /**
+ * 浜屻�佸嚭搴撹捣濮嬪眰娌℃湁绌挎杞�
+ */
+ } else {
+
+ // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄簱浣嶅緟鏈轰綅
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(shuttleLocNo);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLocNo(standbyLocNoTo);
+ })),
+ MotionCtgType.SHUTTLE_MOVE
+ ));
+
+ // 閿佸畾鎹㈠眰璺緞
+ motionList.addAll(kernelService.mapLockPath(
+ null,
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(JSON.toJSONString(lockPath));
+ }))
+ ));
+
+ // 鎻愬崌鏈虹┖杞界Щ鍔ㄥ埌绌挎杞﹀眰
+ motionList.addAll(kernelService.liftMove(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLev(Utils.getLev(shuttleLocNo));
+ }))
+ ));
+
+ // 閿佸畾鎻愬崌鏈�
+ motionList.addAll(kernelService.liftLock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ }))
+ ));
+
+ // 绌挎杞﹀緟鏈轰綅鑷虫彁鍗囨満
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(standbyLocNoTo);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLocNo(liftLocNoTo);
+ })),
+ MotionCtgType.SHUTTLE_MOVE_TO_LIFT
+ ));
+
+ // 瑙i攣鎻愬崌鏈�
+ motionList.addAll(kernelService.liftUnlock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ }))
+ ));
+
+ // 鎻愬崌鏈烘惉杞� 鑷� 鐩爣浣嶇疆灞�
+ motionList.addAll(kernelService.liftMoveShuttle(
+ MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLev(Utils.getLev(shuttleLocNo));
+ })),
+ MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLev(Utils.getLev(liftLocNoFrom));
+ }))
+ ));
+
+ // 閿佸畾鎻愬崌鏈�
+ motionList.addAll(kernelService.liftLock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ }))
+ ));
+
+ // 鏇存柊灏忚溅鍧愭爣
+ motionList.addAll(kernelService.shuttleUpdateLocation(
+ null
+ , MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(liftLocNoFrom);
+ }))
+ ));
+
+ // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄緟鏈轰綅
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLocNo(liftLocNoFrom);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLocNo(standbyLocNoFrom);
+ })),
+ MotionCtgType.SHUTTLE_MOVE_FROM_LIFT
+ ));
+
+ // 瑙i攣鎻愬崌鏈�
+ motionList.addAll(kernelService.liftUnlock(
+ null
+ , MotionDto.build((dto -> {
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setReleaseLift(1);//鎵ц瀹屾垚鍚庨噴鏀炬彁鍗囨満
+ }))
+ ));
+
+ // 瑙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 -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLiftNo(transferLiftDevice.getId().intValue());
+ dto.setLocNo(standbyLocNoFrom);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLocNo(originLoc);
+ })),
+ MotionCtgType.SHUTTLE_MOVE
+ ));
+
+ // 绌挎杞﹀嚭搴撻《鍗�
+ motionList.addAll(kernelService.shuttleAction(
+ null,
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ })),
+ MotionCtgType.SHUTTLE_PALLET_LIFT
+ ));
+
+ // 绌挎杞﹁蛋琛岃嚦鐩爣搴撲綅
+ motionList.addAll(kernelService.shuttleMove(
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setLocNo(originLoc);
+ })),
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ dto.setShuttleDevice(shuttleDevice);
+ dto.setLocNo(locNo);
+ })),
+ MotionCtgType.SHUTTLE_TRANSPORT
+ ));
+
+ // 绌挎杞﹀嚭搴撴墭鐩樹笅闄�
+ motionList.addAll(kernelService.shuttleAction(
+ null,
+ MotionDto.build((dto -> {
+ dto.setShuttleNo(shuttleDevice.getId().intValue());
+ })),
+ MotionCtgType.SHUTTLE_PALLET_DOWN
+ ));
+
+ }
+ return motionList;
+ }
}
--
Gitblit v1.9.1