自动化立体仓库 - WMS系统
zyh
昨天 3bf6f972604761c9ac59a2cb9ea01eeacaec2189
src/main/java/com/zy/asrs/controller/DigitalTwinController.java
@@ -1,18 +1,26 @@
package com.zy.asrs.controller;
import com.core.common.R;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zy.asrs.entity.LocChartPie;
import com.zy.asrs.entity.LocDetl;
import com.zy.asrs.entity.LocMast;
import com.zy.asrs.entity.digitaltwin.*;
import com.zy.asrs.mapper.ReportQueryMapper;
import com.zy.asrs.service.DigitalTwinService;
import com.zy.common.utils.HttpHandler;
import com.zy.common.web.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RequestMapping("/digitalTwin")
@RestController
@@ -20,6 +28,8 @@
    @Resource
    private DigitalTwinService digitalTwinService;
    @Autowired
    private ReportQueryMapper reportQueryMapper;
    /**
     * 数据总览
@@ -89,19 +99,6 @@
                           @RequestParam(required = false) String endDate){
        List<DtLocVo> locVoList = digitalTwinService.recentLoc(areaId, startDate, endDate);
//        DtLocVo dtLocVo = DtLocVo.builder()
//                .locDate("2025-10-22")
//                .idleNum(208)
//                .build();
//        DtLocVo dtLocVo2 = DtLocVo.builder()
//                .locDate("2025-10-23")
//                .idleNum(177)
//                .build();
//        List<DtLocVo> locVoList = new ArrayList<>();
//        locVoList.add(dtLocVo);
//        locVoList.add(dtLocVo2);
        return R.ok().add(locVoList);
    }
@@ -121,21 +118,6 @@
        List<DtInAndOutBoundVo> inAndOutBoundVoList = digitalTwinService.inAndOutBound(areaId, startDate, endDate);
//        DtInAndOutBoundVo dtInAndOutBoundVo = DtInAndOutBoundVo.builder()
//                .boundDate("2025-10-22")
//                .inBoundNum(237)
//                .outBoundNum(487)
//                .build();
//        DtInAndOutBoundVo dtInAndOutBoundVo2 = DtInAndOutBoundVo.builder()
//                .boundDate("2025-10-23")
//                .inBoundNum(187)
//                .outBoundNum(287)
//                .build();
//        List<DtInAndOutBoundVo> inAndOutBoundVoList = new ArrayList<>();
//        inAndOutBoundVoList.add(dtInAndOutBoundVo);
//        inAndOutBoundVoList.add(dtInAndOutBoundVo2);
        return R.ok().add(inAndOutBoundVoList);
    }
@@ -154,31 +136,6 @@
                             @RequestParam(required = false) Integer pageSize){
        List<DtDetainMatVo> detainMatVoList = digitalTwinService.recentDetainMat(areaId, overDayNum, pageIndex, pageSize);
//        DtDetainMatVo dtDetainMatVo = DtDetainMatVo.builder()
//                .belongAreaId("A1")
//                .belongAreaName("刀具库")
//                .matId("mat10001")
//                .matName("道具把")
//                .lokId("loc1001")
//                .lokName("库位10001")
//                .detainTime(765)
//                .inBoundTime("2025-10-11T11:15:16")
//                .build();
//        DtDetainMatVo dtDetainMatVo2 = DtDetainMatVo.builder()
//                .belongAreaId("A1")
//                .belongAreaName("刀具库")
//                .matId("mat10002")
//                .matName("道具把")
//                .lokId("loc1002")
//                .lokName("库位10002")
//                .detainTime(665)
//                .inBoundTime("2025-10-10T11:15:16")
//                .build();
//        List<DtDetainMatVo> detainMatVoList = new ArrayList<>();
//        detainMatVoList.add(dtDetainMatVo);
//        detainMatVoList.add(dtDetainMatVo2);
        return R.ok().add(detainMatVoList);
    }
@@ -192,35 +149,7 @@
//    @ManagerAuth
    public R equipment(@RequestParam(required = false) String areaId){
        DtEquipmentVo dtDetainMatVo = DtEquipmentVo.builder()
                .equipmentId("eq1001")
                .equipmentName("堆垛机1")
                .equipmentType(1)
                .belongAreaId("A1")
                .belongAreaName("刀具库")
                .verticalSpeed(288)
                .horizontalSpeed(203)
                .voltage(48)
                .status(1)
                .operateMethod(1)
                .build();
        DtEquipmentVo dtDetainMatVo2 = DtEquipmentVo.builder()
                .equipmentId("eq1002")
                .equipmentName("堆垛机2")
                .equipmentType(1)
                .belongAreaId("A1")
                .belongAreaName("刀具库")
                .verticalSpeed(208)
                .horizontalSpeed(253)
                .voltage(48)
                .status(1)
                .operateMethod(1)
                .build();
        List<DtEquipmentVo> dtEquipmentVoList = new ArrayList<>();
        dtEquipmentVoList.add(dtDetainMatVo);
        dtEquipmentVoList.add(dtDetainMatVo2);
        return R.ok().add(dtEquipmentVoList);
        return R.ok(digitalTwinService.equipment(areaId));
    }
    /**
@@ -232,74 +161,37 @@
    @RequestMapping(value = "/warehouseDetail")
//    @ManagerAuth
    public R warehouseDetail(@RequestParam(required = false) String areaId){
        List<DtLocDetailVo> dtLocDetailVoList = digitalTwinService.warehouseDetail(areaId);
        return R.ok().add(dtLocDetailVoList);
        return R.ok(digitalTwinService.warehouseDetail(areaId));
    }
//        List<DtLocDetailVo> dtLocDetailVoList = new ArrayList<>();
//        DtLocDetailVo dtLocDetailVo = new DtLocDetailVo();
//        dtLocDetailVo.setLocNo("CA0100202");
//        dtLocDetailVo.setLocSts("O");
//        dtLocDetailVo.setAreaId(10010L);
//        dtLocDetailVo.setAreaName("刀具库");
//        dtLocDetailVo.setRow1(1);
//        dtLocDetailVo.setBay1(2);
//        dtLocDetailVo.setLev1(2);
//
//        LocMast locMast = new LocMast();
//        locMast.setLocNo("CA0100202");
//        locMast.setLocSts("O");
//        locMast.setRow1(1);
//        locMast.setBay1(2);
//        locMast.setLev1(2);
//        dtLocDetailVo.setLocMast(locMast);
//
//        LocDetl locDetl = new LocDetl();
//        locDetl.setLocNo("CA0100202");
//        locDetl.setAreaId(10010L);
//        locDetl.setAreaName("刀具库");
//        locDetl.setMatnr("mat10001");
//        locDetl.setMaktx("刀把");
//        dtLocDetailVo.setLocDetl(locDetl);
//        dtLocDetailVoList.add(dtLocDetailVo);
//
//
//        DtLocDetailVo dtLocDetailVo2 = new DtLocDetailVo();
//        dtLocDetailVo2.setLocNo("CA0100202");
//        dtLocDetailVo2.setLocSts("O");
//        dtLocDetailVo2.setAreaId(10010L);
//        dtLocDetailVo2.setAreaName("刀具库");
//        dtLocDetailVo2.setRow1(1);
//        dtLocDetailVo2.setBay1(2);
//        dtLocDetailVo2.setLev1(2);
//
//        LocMast locMast2 = new LocMast();
//        locMast2.setLocNo("CA0100203");
//        locMast2.setLocSts("O");
//        locMast2.setRow1(1);
//        locMast2.setBay1(2);
//        locMast2.setLev1(3);
//        dtLocDetailVo2.setLocMast(locMast2);
//
//        LocDetl locDetl2 = new LocDetl();
//        locDetl2.setLocNo("CA0100203");
//        locDetl2.setAreaId(10010L);
//        locDetl2.setAreaName("刀具库");
//        locDetl2.setMatnr("mat10001");
//        locDetl2.setMaktx("刀把");
//        dtLocDetailVo2.setLocDetl(locDetl2);
//        dtLocDetailVoList.add(dtLocDetailVo2);
//
//
////        LocDetl locDetl2 = new LocDetl();
////        locDetl2.setLocNo("1001");
////        locDetl2.setAreaId(10010L);
////        locDetl2.setAreaName("刀具库");
////        locDetl2.setMatnr("mat10001");
////        locDetl2.setMaktx("刀把");
////
//////        List<LocDetl> locDetlList = new ArrayList<>();
//////        locDetlList.add(locDetl);
//////        locDetlList.add(locDetl2);
    /**
     * 查询所有库位状态和物料-二机床信息化数字孪生用
     */
    @RequestMapping(value = "/getAllLocations")
    public R getAllLocations() {
        return digitalTwinService.getAllLocations();
    }
    /**
     * 查询在库数量等信息
     */
    @RequestMapping(value = "/getLocalInfo")
    public LocChartPie getLocalInfo() {
        LocChartPie locUseRate = reportQueryMapper.getLocUseRate();
        return locUseRate;
    }
    /**
     * 查询所有库的库存明细
     */
    @RequestMapping(value = "/getLocalDetal")
    public R getLocalDetal() throws IOException {
        return R.ok(digitalTwinService.getLocalDetal());
    }
}