#
Junjie
16 小时以前 fd837cb1e5b3f5ebfba12c29f32fe34dd4c38669
src/main/java/com/zy/asrs/controller/ConsoleController.java
@@ -3,8 +3,8 @@
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.core.annotations.ManagerAuth;
import com.core.common.Cools;
import com.core.common.R;
@@ -13,6 +13,7 @@
import com.zy.asrs.domain.param.SystemSwitchParam;
import com.zy.asrs.domain.vo.CrnDetailVo;
import com.zy.asrs.domain.vo.CrnLatestDataVo;
import com.zy.asrs.domain.vo.FakeTaskTraceVo;
import com.zy.asrs.domain.vo.StationLatestDataVo;
import com.zy.asrs.domain.vo.RgvLatestDataVo;
import com.zy.asrs.entity.*;
@@ -30,6 +31,7 @@
import com.zy.core.thread.StationThread;
import com.zy.core.thread.RgvThread;
import com.zy.core.model.protocol.RgvProtocol;
import com.zy.core.network.fake.FakeTaskTraceRegistry;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -61,6 +63,8 @@
    private BasMapService basMapService;
    @Autowired
    private StationCycleCapacityService stationCycleCapacityService;
    @Autowired
    private FakeTaskTraceRegistry fakeTaskTraceRegistry;
    @PostMapping("/system/running/status")
    @ManagerAuth(memo = "系统运行状态")
@@ -92,10 +96,10 @@
    public R stationLatestData() {
        List<StationLatestDataVo> vos = new ArrayList<>();
        WrkLastno inTaskRange = wrkLastnoService.selectById(WrkIoType.IN.id);
        WrkLastno outTaskRange = wrkLastnoService.selectById(WrkIoType.OUT.id);
        WrkLastno inTaskRange = wrkLastnoService.getById(WrkIoType.IN.id);
        WrkLastno outTaskRange = wrkLastnoService.getById(WrkIoType.OUT.id);
        List<DeviceConfig> devpList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
        List<DeviceConfig> devpList = deviceConfigService.list(new QueryWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Devp)));
        for (DeviceConfig deviceConfig : devpList) {
            StationThread stationThread = (StationThread) SlaveConnection.get(SlaveType.Devp,
@@ -156,10 +160,10 @@
    }
    private boolean isInRange(Integer taskNo, WrkLastno taskRange) {
        if (taskRange == null || taskRange.getSNo() == null || taskRange.getENo() == null) {
        if (taskRange == null || taskRange.getsNo() == null || taskRange.geteNo() == null) {
            return false;
        }
        return taskNo >= taskRange.getSNo() && taskNo <= taskRange.getENo();
        return taskNo >= taskRange.getsNo() && taskNo <= taskRange.geteNo();
    }
    @PostMapping("/latest/data/crn")
@@ -167,7 +171,7 @@
    public R crnLatestData() {
        List<CrnLatestDataVo> vos = new ArrayList<>();
        List<DeviceConfig> crnList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
        List<DeviceConfig> crnList = deviceConfigService.list(new QueryWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Crn)));
        for (DeviceConfig deviceConfig : crnList) {
            // 获取堆垛机信息
@@ -194,7 +198,7 @@
                vo.setCrnStatus(CrnStatusType.MACHINE_ERROR);
            } else {
                if (crnProtocol.getTaskNo() > 0) {
                    WrkMast wrkMast = wrkMastService.selectById(crnProtocol.getTaskNo());
                    WrkMast wrkMast = wrkMastService.getById(crnProtocol.getTaskNo());
                    if (wrkMast != null) {
                        vo.setCrnStatus(CrnStatusType.process(wrkMast.getIoType()));
                    } else {
@@ -215,7 +219,7 @@
    @ManagerAuth(memo = "双工位堆垛机实时数据")
    public R dualCrnLatestData() {
        List<CrnLatestDataVo> vos = new ArrayList<>();
        List<DeviceConfig> dualCrnList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
        List<DeviceConfig> dualCrnList = deviceConfigService.list(new QueryWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.DualCrn)));
        for (DeviceConfig deviceConfig : dualCrnList) {
            DualCrnThread crnThread = (DualCrnThread) SlaveConnection.get(SlaveType.DualCrn, deviceConfig.getDeviceNo());
@@ -248,7 +252,7 @@
    @ManagerAuth(memo = "RGV实时数据")
    public R rgvLatestData(){
        List<RgvLatestDataVo> vos = new ArrayList<>();
        List<DeviceConfig> rgvList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>()
        List<DeviceConfig> rgvList = deviceConfigService.list(new QueryWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Rgv)));
        for (DeviceConfig deviceConfig : rgvList) {
            RgvThread rgvThread = (RgvThread) SlaveConnection.get(SlaveType.Rgv, deviceConfig.getDeviceNo());
@@ -272,6 +276,13 @@
    @GetMapping("/latest/data/station/cycle/capacity")
    public R stationCycleCapacity() {
        return R.ok().add(stationCycleCapacityService.getLatestSnapshot());
    }
    @PostMapping("/latest/data/fake/trace")
    @ManagerAuth(memo = "仿真任务轨迹实时数据")
    public R fakeTaskTraceLatestData() {
        List<FakeTaskTraceVo> traceList = fakeTaskTraceRegistry.listActiveTraces();
        return R.ok().add(traceList);
    }
    // @PostMapping("/latest/data/barcode")
@@ -300,7 +311,7 @@
        }
        CrnDetailVo vo = new CrnDetailVo();
        DeviceConfig deviceConfig = deviceConfigService.selectOne(new EntityWrapper<DeviceConfig>()
        DeviceConfig deviceConfig = deviceConfigService.getOne(new QueryWrapper<DeviceConfig>()
                .eq("device_type", String.valueOf(SlaveType.Crn))
                .eq("device_no", crnNo));
@@ -315,12 +326,12 @@
        vo.setCrnStatus(crnProtocol.getStatusType().desc);
        if (crnProtocol.getAlarm() > 0) {
            BasCrnpErr crnError = basCrnpErrService.selectById(crnProtocol.getAlarm());
            BasCrnpErr crnError = basCrnpErrService.getById(crnProtocol.getAlarm());
            vo.setError(crnError == null ? "未知异常" : crnError.getErrName());
        }
        if (crnProtocol.getTaskNo() > 0) {
            WrkMast wrkMast = wrkMastService.selectById(crnProtocol.getTaskNo());
            WrkMast wrkMast = wrkMastService.getById(crnProtocol.getTaskNo());
            if (wrkMast != null) {
                vo.setSourceStaNo(String.valueOf(wrkMast.getSourceStaNo()));
                vo.setStaNo(String.valueOf(wrkMast.getStaNo()));
@@ -398,7 +409,7 @@
    }
    private List<List<HashMap<String, Object>>> buildLocMapBase() {
        BasMap basMap = basMapService.selectOne(new EntityWrapper<BasMap>().eq("lev", 1));
        BasMap basMap = basMapService.getOne(new QueryWrapper<BasMap>().eq("lev", 1));
        if (Cools.isEmpty(basMap) || Cools.isEmpty(basMap.getData())) {
            return null;
        }
@@ -477,9 +488,9 @@
            JSONArray data = JSON.parseArray(object.toString());
            return R.ok().add(data);
        }
        EntityWrapper<LocMast> wrapper = new EntityWrapper<>();
        QueryWrapper<LocMast> wrapper = new QueryWrapper<>();
        wrapper.eq("lev1", 1);
        List<LocMast> locMasts = locMastService.selectList(wrapper);
        List<LocMast> locMasts = locMastService.list(wrapper);
        redisUtil.set(RedisKeyType.LOC_MAST_MAP_LIST.key, JSON.toJSONString(locMasts), 60 * 60 * 24);
        return R.ok().add(locMasts);
    }