From 46efdc0db072246c4f33366bb427d52e9d351430 Mon Sep 17 00:00:00 2001 From: Junjie <xjj@123> Date: 星期日, 07 四月 2024 14:29:29 +0800 Subject: [PATCH] # --- zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java | 72 +++++++++++++++++++++++++++++++++++ 1 files changed, 71 insertions(+), 1 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 357d9c6..08280d0 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,5 +1,6 @@ package com.zy.asrs.wcs.core.kernel; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.zy.asrs.framework.common.Cools; import com.zy.asrs.wcs.core.domain.dto.MotionDto; import com.zy.asrs.wcs.core.entity.Task; @@ -12,9 +13,13 @@ import com.zy.asrs.wcs.core.utils.Utils; 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.entity.DeviceType; import com.zy.asrs.wcs.rcs.model.enums.SlaveType; import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol; import com.zy.asrs.wcs.core.service.MotionService; +import com.zy.asrs.wcs.rcs.service.DeviceService; +import com.zy.asrs.wcs.rcs.service.DeviceTypeService; import com.zy.asrs.wcs.rcs.thread.ShuttleThread; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -40,8 +45,12 @@ private ShuttleDispatcher shuttleDispatcher; @Autowired private LiftDispatcher liftDispatcher; -// @Autowired + // @Autowired // private ConveyorDispatcher conveyorDispatcher; + @Autowired + private DeviceService deviceService; + @Autowired + private DeviceTypeService deviceTypeService; public List<Motion> generateMotion(Task task) { List<Motion> motionList = new ArrayList<>(); @@ -912,6 +921,67 @@ return motionList; } + /** + * 鐢熸垚灏忚溅杩佺Щ鍔ㄤ綔 + */ + public List<Motion> generateShuttleMoveMotion(Task task) { + List<Motion> motionList = new ArrayList<>(); + if (task.getTaskSts() != TaskStsType.NEW_MOVE.sts) { + return motionList; + } + + // locNo + String locNo = task.getDestLoc(); + + //鑾峰彇绌挎杞︾被鍨� + DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>() + .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle)) + .eq(DeviceType::getStatus, 1)); + if (deviceType == null) { + return motionList; + } + + Device device = deviceService.getOne(new LambdaQueryWrapper<Device>() + .eq(Device::getDeviceNo, task.getShuttleNo()) + .eq(Device::getDeviceType, deviceType.getId()) + .eq(Device::getHostId, task.getHostId()) + .eq(Device::getStatus, 1)); + if (device == null) { + return motionList; + } + + ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue()); + if (shuttleThread == null) { + return motionList; + } + + ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(); + if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) { + return motionList; + } + + String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); + + // 鍒ゆ柇绌挎杞︽槸鍚﹀湪鐩爣灞� + if (Utils.getLev(shuttleLocNo) == Utils.getLev(locNo)) { + + // 绌挎杞﹁蛋琛岃嚦鐩爣搴撲綅 + motionList.addAll(kernelService.shuttleMove( + MotionDto.build((dto -> { + dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); + dto.setLocNo(shuttleLocNo); + })), + MotionDto.build((dto -> { + dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); + dto.setLocNo(locNo); + })), + MotionCtgType.SHUTTLE_MOVE + )); + + } + return motionList; + } + } -- Gitblit v1.9.1