luxiaotao1123
2024-04-11 74be59f7ae8fe0a4435dc0b532e9a5ba32ab56de
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
@@ -15,12 +15,10 @@
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;
@@ -46,12 +44,10 @@
    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<>();
@@ -934,17 +930,9 @@
        // 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::getDeviceType, DeviceCtgType.SHUTTLE.val())
                .eq(Device::getHostId, task.getHostId())
                .eq(Device::getStatus, 1));
        if (device == null) {
@@ -995,17 +983,9 @@
        String targetLoc = task.getDestLoc();//任务目标(借用字段)
        String targetSite = task.getDestSite();//任务类型(借用字段)
        //获取穿梭车类型
        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::getDeviceType, DeviceCtgType.SHUTTLE.val())
                .eq(Device::getHostId, task.getHostId())
                .eq(Device::getStatus, 1));
        if (device == null) {
@@ -1031,11 +1011,11 @@
                // 穿梭车走行至目标库位
                motionList.addAll(kernelService.shuttleMove(
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
                            dto.setShuttleNo(device.getId().intValue());
                            dto.setLocNo(shuttleLocNo);
                        })),
                        MotionDto.build((dto -> {
                            dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());
                            dto.setShuttleNo(device.getId().intValue());
                            dto.setLocNo(targetLoc);
                        })),
                        MotionCtgType.SHUTTLE_MOVE
@@ -1046,28 +1026,28 @@
            //托盘顶升
            motionList.add(Motion.build(motion -> {
                motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val());
                motion.setDevice(String.valueOf(task.getShuttleNo()));
                motion.setDevice(String.valueOf(device.getId()));
                motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_LIFT.val());
            }));
        } else if (targetSite.equals("palletDown")) {
            //托盘下降
            motionList.add(Motion.build(motion -> {
                motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val());
                motion.setDevice(String.valueOf(task.getShuttleNo()));
                motion.setDevice(String.valueOf(device.getId()));
                motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_DOWN.val());
            }));
        } else if (targetSite.equals("chargeOpen")) {
            //充电开
            motionList.add(Motion.build(motion -> {
                motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val());
                motion.setDevice(String.valueOf(task.getShuttleNo()));
                motion.setDevice(String.valueOf(device.getId()));
                motion.setMotionCtg(MotionCtgType.SHUTTLE_CHARGE_ON.val());
            }));
        } else if (targetSite.equals("chargeClose")) {
            //充电关
            motionList.add(Motion.build(motion -> {
                motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val());
                motion.setDevice(String.valueOf(task.getShuttleNo()));
                motion.setDevice(String.valueOf(device.getId()));
                motion.setMotionCtg(MotionCtgType.SHUTTLE_CHARGE_OFF.val());
            }));
        } else if (targetSite.equals("reset")) {