| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Arith; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.domain.dto.AxisBean; |
| | | import com.zy.asrs.domain.dto.WorkChartAxis; |
| | | import com.zy.asrs.domain.vo.LocChartPie; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.mapper.ReportQueryMapper; |
| | | import com.zy.asrs.service.impl.LocMastServiceImpl; |
| | | import com.zy.common.model.annotations.RateLimit; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.core.CrnThread; |
| | |
| | | private ReportQueryMapper reportQueryMapper; |
| | | @Autowired |
| | | private SlaveProperties slaveProperties; |
| | | @Autowired |
| | | private LocMastServiceImpl locMastService; |
| | | |
| | | /** |
| | | * 获取当前时间 |
| | |
| | | */ |
| | | @RateLimit(2) |
| | | @GetMapping("/loc/rep") |
| | | public R monitorLocRep(){ |
| | | public R monitorLocRep(@RequestParam("crnId") Integer crnId, @RequestParam("ledId") Integer ledId){ |
| | | List<Map<String, Object>> pie = new ArrayList<>(); |
| | | |
| | | LocChartPie locUseRate = reportQueryMapper.getLocUseRate(); |
| | | if(locUseRate!=null) { |
| | | // LocChartPie locUseRate = reportQueryMapper.getLocUseRate(); |
| | | int Fqty = 0; |
| | | int Oqty = 0; |
| | | int Uqty = 0; |
| | | int Xqty = 0; |
| | | if(crnId!=null&&crnId<=2) { |
| | | Fqty=locMastService.selectCount(new EntityWrapper<LocMast>().in("crn_no", 1, 2).eq("loc_sts","F")); |
| | | Oqty = locMastService.selectCount(new EntityWrapper<LocMast>().in("crn_no", 1, 2).eq("loc_sts","O")); |
| | | Uqty = locMastService.selectCount(new EntityWrapper<LocMast>().in("crn_no", 1, 2).in("loc_sts", "R","Q","S","P")); |
| | | Xqty = locMastService.selectCount(new EntityWrapper<LocMast>().in("crn_no", 1, 2).eq("loc_sts", "X")); |
| | | }else if(crnId!=null&&crnId==3) { |
| | | Fqty=locMastService.selectCount(new EntityWrapper<LocMast>().in("crn_no", 3).eq("loc_sts","F")); |
| | | Oqty = locMastService.selectCount(new EntityWrapper<LocMast>().in("crn_no", 3).eq("loc_sts","O")); |
| | | Uqty = locMastService.selectCount(new EntityWrapper<LocMast>().in("crn_no", 3).in("loc_sts", "R","Q","S","P")); |
| | | Xqty = locMastService.selectCount(new EntityWrapper<LocMast>().in("crn_no", 3).eq("loc_sts", "X")); |
| | | } |
| | | if(crnId!=null) { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("name", "在库"); |
| | | map.put("value", locUseRate.getFqty()); |
| | | map.put("value", Fqty); |
| | | pie.add(map); |
| | | |
| | | Map<String, Object> map1 = new HashMap<>(); |
| | | map1.put("name", "空"); |
| | | map1.put("value", locUseRate.getOqty()); |
| | | map1.put("value", Oqty); |
| | | pie.add(map1); |
| | | |
| | | Map<String, Object> map2 = new HashMap<>(); |
| | | map2.put("name", "使用"); |
| | | map2.put("value", locUseRate.getUqty()); |
| | | map2.put("value", Uqty); |
| | | pie.add(map2); |
| | | |
| | | Map<String, Object> map3 = new HashMap<>(); |
| | | map3.put("name", "禁用"); |
| | | map3.put("value", locUseRate.getXqty()); |
| | | map3.put("value", Xqty); |
| | | pie.add(map3); |
| | | } |
| | | |
| | | // 总库位数 |
| | | Integer total = (int) Arith.add(0, locUseRate.getFqty(), locUseRate.getOqty(), locUseRate.getUqty(), locUseRate.getXqty()); |
| | | Integer total = (int) Arith.add(0,Fqty,Oqty,Uqty,Xqty); |
| | | // 使用中 |
| | | Integer used = locUseRate.getFqty() + locUseRate.getUqty(); |
| | | Integer used = Fqty + Uqty; |
| | | // 库位使用率 |
| | | double usedDivides = Arith.divides(3, used, total); |
| | | double usedPr = Arith.multiplys(1, usedDivides, 100); |
| | | |
| | | return R.ok( |
| | | Cools.add("pie", pie) |
| | | .add("stockCunt", locUseRate.getFqty()) |
| | | .add("emptyCount", locUseRate.getOqty()) |
| | | .add("noneCount", locUseRate.getXqty()) |
| | | .add("stockCunt",Fqty) |
| | | .add("emptyCount",Oqty) |
| | | .add("noneCount",Xqty) |
| | | .add("total", total) |
| | | .add("used", used) |
| | | .add("usedPr", usedPr) |