#
Junjie
2025-04-15 d56b8093dc9e3e75f8efe1a0f1aa6d821c9c3dfb
zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/rcs/controller/LiftController.java
@@ -2,13 +2,13 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zy.asrs.framework.common.R;
import com.zy.asrs.wcs.core.model.enums.DeviceCtgType;
import com.zy.asrs.wcs.rcs.cache.SlaveConnection;
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.LiftProtocol;
import com.zy.asrs.wcs.rcs.service.DeviceService;
import com.zy.asrs.wcs.rcs.service.DeviceTypeService;
import com.zy.asrs.wcs.rcs.thread.LiftThread;
import com.zy.asrs.wcs.system.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
@@ -26,24 +26,14 @@
    @Autowired
    private DeviceService deviceService;
    @Autowired
    private DeviceTypeService deviceTypeService;
    @GetMapping("/lift/status/list")
    public R getLiftStatusList() {
        DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>()
                .eq(DeviceType::getHostId, getHostId())
                .eq(DeviceType::getStatus, 1)
                .eq(DeviceType::getFlag, String.valueOf(SlaveType.Lift)));
        if (deviceType == null) {
            return R.error("设备类型不存在");
        }
        ArrayList<LiftProtocol> data = new ArrayList<>();
        List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>()
                .eq(Device::getHostId, getHostId())
                .eq(Device::getStatus, 1)
                .eq(Device::getDeviceType, deviceType.getId()));
                .eq(Device::getDeviceType, DeviceCtgType.LIFT.val()));
        for (Device device : list) {
            LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, device.getId().intValue());
            LiftProtocol status = liftThread.getStatus();
@@ -54,18 +44,10 @@
    @GetMapping("/lift/status/one/{deviceNo}")
    public R getLiftStatus(@PathVariable String deviceNo) {
        DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>()
                .eq(DeviceType::getHostId, getHostId())
                .eq(DeviceType::getStatus, 1)
                .eq(DeviceType::getFlag, String.valueOf(SlaveType.Lift)));
        if (deviceType == null) {
            return R.error("设备类型不存在");
        }
        Device device = deviceService.getOne(new LambdaQueryWrapper<Device>()
                .eq(Device::getHostId, getHostId())
                .eq(Device::getStatus, 1)
                .eq(Device::getDeviceType, deviceType.getId())
                .eq(Device::getDeviceType, DeviceCtgType.LIFT.val())
                .eq(Device::getDeviceNo, deviceNo));
        LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, device.getId().intValue());