From 46054fc49e33fe4f1aba8da23b74b8f14664bdfe Mon Sep 17 00:00:00 2001 From: Junjie <xjj@123> Date: 星期日, 28 四月 2024 09:06:42 +0800 Subject: [PATCH] # --- zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 106 insertions(+), 10 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 ad43d4e..493ca83 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 @@ -2,14 +2,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.zy.asrs.framework.common.Cools; -import com.zy.asrs.framework.common.R; import com.zy.asrs.wcs.core.domain.dto.MotionDto; import com.zy.asrs.wcs.core.entity.ShuttleStandby; import com.zy.asrs.wcs.core.entity.Task; 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.TaskStsType; -import com.zy.asrs.wcs.core.model.enums.WorkZoneType; import com.zy.asrs.wcs.core.service.ShuttleStandbyService; import com.zy.asrs.wcs.core.service.TaskService; import com.zy.asrs.wcs.core.utils.ConveyorDispatcher; @@ -19,7 +17,6 @@ import com.zy.asrs.wcs.rcs.cache.SlaveConnection; import com.zy.asrs.wcs.core.entity.Motion; import com.zy.asrs.wcs.rcs.entity.Device; -import com.zy.asrs.wcs.rcs.model.enums.LiftProtocolStatusType; import com.zy.asrs.wcs.rcs.model.enums.SlaveType; import com.zy.asrs.wcs.rcs.model.protocol.LiftProtocol; import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol; @@ -32,10 +29,9 @@ import java.util.ArrayList; import java.util.List; -import java.util.Objects; /** - * todo:luxiaotao 1.鍏呯數浠诲姟锛�2.搴撲綅绉昏浆锛�3.灏忚溅杩佺Щ + * 1.鍏呯數浠诲姟锛�2.搴撲綅绉昏浆锛�3.灏忚溅杩佺Щ锛�4.鎵嬪姩浠诲姟 * Created by vincent on 2023/10/11 */ @Service @@ -972,16 +968,16 @@ // locNo String locNo = task.getDestLoc(); - Device device = deviceService.getOne(new LambdaQueryWrapper<Device>() + 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 (device == null) { + if (shuttleDevice == null) { return motionList; } - ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue()); + ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleDevice.getId().intValue()); if (shuttleThread == null) { return motionList; } @@ -999,11 +995,111 @@ // 绌挎杞﹁蛋琛岃嚦鐩爣搴撲綅 motionList.addAll(kernelService.shuttleMove( MotionDto.build((dto -> { - dto.setShuttleNo(device.getId().intValue()); + dto.setShuttleNo(shuttleDevice.getId().intValue()); dto.setLocNo(shuttleLocNo); })), MotionDto.build((dto -> { - dto.setShuttleNo(device.getId().intValue()); + dto.setShuttleNo(shuttleDevice.getId().intValue()); + dto.setLocNo(locNo); + })), + MotionCtgType.SHUTTLE_MOVE + )); + + } else { + //灏忚溅璺ㄥ眰 + + //鑾峰彇璺濈鐩爣浣嶇疆鏈�杩戠殑绌洪棽鎻愬崌鏈� + LiftThread liftThread = liftDispatcher.searchIdleLift(locNo, task.getHostId()); + if (liftThread == null) { + return motionList; + } + Device liftDevice = liftThread.getDevice(); + + //绌挎杞﹀埌鎻愬崌鏈哄簱浣嶅彿 + String liftLocNoTo = liftDispatcher.getLiftLocNo(liftThread, Utils.getLev(shuttleLocNo)); + + //绌挎杞﹀嚭鎻愬崌鏈哄簱浣嶅彿 + String liftLocNoFrom = liftDispatcher.getLiftLocNo(liftThread, Utils.getLev(task.getDestLoc())); + + //绌挎杞﹀埌鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙� + String standbyLocNoTo = liftDispatcher.getLiftStandByLocNo(liftThread, Utils.getLev(shuttleLocNo)); + + //绌挎杞﹀嚭鎻愬崌鏈哄緟鏈轰綅搴撲綅鍙� + String standbyLocNoFrom = liftDispatcher.getLiftStandByLocNo(liftThread, Utils.getLev(task.getDestLoc())); + + + // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄簱浣嶅緟鏈轰綅 + motionList.addAll(kernelService.shuttleMove( + MotionDto.build((dto -> { + dto.setShuttleNo(shuttleDevice.getId().intValue()); + dto.setLocNo(shuttleLocNo); + })), + MotionDto.build((dto -> { + dto.setShuttleNo(shuttleDevice.getId().intValue()); + dto.setLiftNo(liftDevice.getId().intValue()); + dto.setLocNo(standbyLocNoTo); + })), + MotionCtgType.SHUTTLE_MOVE + )); + + // 鎻愬崌鏈虹┖杞界Щ鍔ㄥ埌绌挎杞﹀眰 + motionList.addAll(kernelService.liftMove( + null + , MotionDto.build((dto -> { + dto.setLiftNo(liftDevice.getId().intValue()); + dto.setLev(Utils.getLev(shuttleLocNo)); + })) + )); + + // 绌挎杞﹀緟鏈轰綅鑷虫彁鍗囨満搴撲綅 + motionList.addAll(kernelService.shuttleMove( + MotionDto.build((dto -> { + dto.setShuttleNo(shuttleDevice.getId().intValue()); + dto.setLocNo(standbyLocNoTo); + })), + MotionDto.build((dto -> { + dto.setShuttleNo(shuttleDevice.getId().intValue()); + dto.setLiftNo(liftDevice.getId().intValue()); + dto.setLocNo(liftLocNoTo); + })), + MotionCtgType.SHUTTLE_MOVE_TO_LIFT + )); + + // 鎻愬崌鏈烘惉杞� 鑷� 鐩爣浣嶇疆灞� + motionList.addAll(kernelService.liftMoveShuttle( + MotionDto.build((dto -> { + dto.setLiftNo(liftDevice.getId().intValue()); + dto.setLev(Utils.getLev(shuttleLocNo)); + })), + MotionDto.build((dto -> { + dto.setLiftNo(liftDevice.getId().intValue()); + dto.setLev(Utils.getLev(locNo)); + })) + )); + + // 绌挎杞﹁蛋琛岃嚦鎻愬崌鏈哄緟鏈轰綅 + motionList.addAll(kernelService.shuttleMove( + MotionDto.build((dto -> { + dto.setShuttleNo(shuttleDevice.getId().intValue()); + dto.setLiftNo(liftDevice.getId().intValue()); + dto.setLocNo(liftLocNoFrom); + })), + MotionDto.build((dto -> { + dto.setShuttleNo(shuttleDevice.getId().intValue()); + dto.setLocNo(standbyLocNoFrom); + })), + MotionCtgType.SHUTTLE_MOVE_FROM_LIFT + )); + + // 绌挎杞︽彁鍗囨満寰呮満浣嶈嚦鐩爣浣嶇疆 + motionList.addAll(kernelService.shuttleMove( + MotionDto.build((dto -> { + dto.setShuttleNo(shuttleDevice.getId().intValue()); + dto.setLiftNo(liftDevice.getId().intValue()); + dto.setLocNo(standbyLocNoFrom); + })), + MotionDto.build((dto -> { + dto.setShuttleNo(shuttleDevice.getId().intValue()); dto.setLocNo(locNo); })), MotionCtgType.SHUTTLE_MOVE -- Gitblit v1.9.1