| src/main/java/com/zy/asrs/controller/DigitalTwinController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/zy/asrs/service/DigitalTwinService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| src/main/java/com/zy/asrs/service/impl/DigitalTwinServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/zy/asrs/controller/DigitalTwinController.java
@@ -1,12 +1,14 @@ 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; @@ -16,7 +18,9 @@ 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 @@ -331,14 +335,18 @@ return digitalTwinService.getAllLocations(); } /** * 查询在库数量等信息 */ /** * 查询所有库的库位状态总数量 */ @RequestMapping(value = "/getLocalInfo") public LocChartPie getLocalInfo() { LocChartPie locUseRate = reportQueryMapper.getLocUseRate(); return locUseRate; public Map<String, Object> getLocalInfo() throws IOException { Map<String, Object> locInfo = digitalTwinService.getLocInfo(); return locInfo; } /** * 查询所有库的库存明细 */ src/main/java/com/zy/asrs/service/DigitalTwinService.java
@@ -85,4 +85,6 @@ List<Map<String, Object>> getLocalDetal(); Map<String, Object> getLocInfo(); } src/main/java/com/zy/asrs/service/impl/DigitalTwinServiceImpl.java
@@ -12,6 +12,7 @@ import com.zy.asrs.mapper.DigitalTwinMapper; import com.zy.asrs.mapper.LocCountMapper; import com.zy.asrs.mapper.LocDetlMapper; import com.zy.asrs.mapper.LocMastMapper; import com.zy.asrs.service.BasCrnpService; import com.zy.asrs.service.DigitalTwinService; import com.zy.asrs.service.LocDetlService; @@ -36,6 +37,8 @@ private LocCountMapper locCountMapper; @Autowired private LocDetlMapper locDetlMapper; @Autowired private LocMastMapper locMastMapper; /** * 总览:总库位、已用库位、剩余库位、今日出库、今日入库、剩余库位 @@ -432,4 +435,57 @@ return result; } public Map<String, Object> getLocInfo() { List<LocMast> LocMasts = locMastMapper.selectList(new EntityWrapper<>()); Map<String, Object> result = new HashMap<>(); // 初始化计数器 int emptyLocCount = 0; int fullZpalletCount = 0; int emptyZpalletCount = 0; int pickOutCount = 0; int pickInCount = 0; int outboundCount = 0; int inboundCount = 0; int disableCount = 0; int mergeCount = 0; // 统计每种状态的库位数量 for (LocMast locMast : LocMasts) { String locSts = locMast.getLocSts(); if (locSts.equals("O")) { emptyLocCount++; } else if (locSts.equals("F")) { fullZpalletCount++; } else if (locSts.equals("D")) { emptyZpalletCount++; } else if (locSts.equals("P")) { pickOutCount++; } else if (locSts.equals("Q")) { pickInCount++; } else if (locSts.equals("R")) { outboundCount++; } else if (locSts.equals("S")) { inboundCount++; } else if (locSts.equals("X")) { disableCount++; } else if (locSts.equals("Y")) { mergeCount++; } } // 将统计结果放入Map中 result.put("EmptyLoc", emptyLocCount); result.put("FullZpallet", fullZpalletCount); result.put("EmptyZpallet", emptyZpalletCount); result.put("PickOut", pickOutCount); result.put("PickIn", pickInCount); result.put("Outbound", outboundCount); result.put("Inbound", inboundCount); result.put("Disable", disableCount); result.put("Merge", mergeCount); return result; } }