DigitalTwinsController.java 2.99 KB
package com.huaheng.api.digitalTwins.controller;

import com.huaheng.api.digitalTwins.domain.InventoryInOutInfo;
import com.huaheng.api.digitalTwins.domain.MaterialTypeProportionDto;
import com.huaheng.api.digitalTwins.domain.WarehouseInfoOverviewDto;
import com.huaheng.api.digitalTwins.service.InventoryStatisticsService;
import com.huaheng.api.digitalTwins.service.LocationStatisticsService;
import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 数字孪生面板 控制器
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/wms/digitalTwins")
public class DigitalTwinsController {

    private final InventoryStatisticsService inventoryStatisticsService;
    private final LocationStatisticsService locationStatisticsService;
    private final TaskHeaderService taskHeaderService;

    /**
     * 仓库数据概况
     */
    @GetMapping("/getWarehouseInfoOverview")
    public WarehouseInfoOverviewDto getWarehouseInfoOverview() {
        WarehouseInfoOverviewDto warehouseInfoOverviewDto = new WarehouseInfoOverviewDto();
        locationStatisticsService.getLocationInfoOverview(warehouseInfoOverviewDto);
        inventoryStatisticsService.getInventoryInfoOverview(warehouseInfoOverviewDto);
        return warehouseInfoOverviewDto;
    }

    /**
     * 年度入出库数量对比
     */
    @GetMapping("/getMonthlyInventoryInOutQty")
    public Map<Integer, InventoryInOutInfo> getMonthlyInventoryInOutQty() {
        return inventoryStatisticsService.getMonthlyInventoryInOutQty();
    }

    /**
     * 当日入出库数量对比
     */
    @GetMapping("/getDailyInventoryInOutQty")
    public Map<String, InventoryInOutInfo> getDailyInventoryInOutQty() {
        return inventoryStatisticsService.getDailyInventoryInOutQty();
    }

    /**
     * 库容使用率
     */
    @GetMapping("/getLocationUtilizationRate")
    public BigDecimal getLocationUtilizationRate() {
        return locationStatisticsService.getLocationUtilizationRate();
    }

    /**
     * 物资分类占比
     */
    @GetMapping("/getMaterialTypeProportion")
    public List<MaterialTypeProportionDto> getMaterialTypeProportion() {
        return inventoryStatisticsService.getMaterialTypeProportion();
    }

    /**
     * 物资周转率
     * 该期间出库总金额×2/(期初库存金额+期末库存金额)
     */
    @GetMapping("get3")
    public Map<Integer, InventoryInOutInfo> get3() {
        return null;
    }

    /**
     * 仓库信息变化
     * 展示未完成任务
     */
    @GetMapping("getWarehouseInformationChange")
    public List<TaskHeader> getWarehouseInfoChange() {
        return taskHeaderService.getUnCompleteTaskList();
    }
}