diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/broad/BoxBroadController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/broad/BoxBroadController.java index 2fda6c1..62f2f06 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/broad/BoxBroadController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/broad/BoxBroadController.java @@ -2,11 +2,8 @@ package com.ruoyi.web.controller.broad; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import com.alibaba.fastjson.JSONPObject; -import com.ruoyi.common.core.text.Convert; import com.ruoyi.system.domain.*; import com.ruoyi.system.service.IBroadDataService; -import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -15,8 +12,6 @@ import org.springframework.web.bind.annotation.*; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; /** * @author wanghao @@ -36,77 +31,70 @@ public class BoxBroadController { @PostMapping("/planCompletion") @ResponseBody - @ApiOperation("查询计划数量完成情况") + @ApiOperation("箱壳查询计划数量完成情况") public String selectplanCompletion() { - BoxPlanCompletion completion= service.selectplanCompletion(); + BoxPlanCompletion completion = service.selectplanCompletion(); return JSONObject.toJSONString(completion); } -// 库存 + + // 库存 @PostMapping("/selectStock/{id}") @ResponseBody - public String selectStock(@PathVariable("id")String id){ + @ApiOperation("箱壳查询库存") + public String selectStock(@PathVariable("id") String id) { List seriesInfo = new ArrayList(); - List xAxisInfo = new ArrayList(); - List list=service.selectStock(id); - list.stream().forEach(t->{ + List xAxisInfo = new ArrayList(); + List list = service.selectStock(id); + list.stream().forEach(t -> { seriesInfo.add(Long.valueOf(t.getStock())); xAxisInfo.add(t.getOrder_type()); }); - return JSONObject.toJSONString(new EchartsDTO(xAxisInfo,seriesInfo)); + return JSONObject.toJSONString(new EchartsDTO(xAxisInfo, seriesInfo)); } + private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); -// 按类型查询产量 + @PostMapping("/selectOutputByType") @ResponseBody - public String selectOutputByType(){ - - EchartsDTO echarts = new EchartsDTO(); - List seriesInfo = new ArrayList(); - List xAxisInfo = new ArrayList(); - - List info = service.selectOutputByType(); -// Map> orderInfoMap = info.stream().collect(Collectors.groupingBy(BoxOutputByType:: getPlan_type)); -// -// for (String key : orderInfoMap.keySet()) { -// xAxisInfo.add(key); -// seriesInfo.add(Convert.toLong(orderInfoMap.get(key).stream().mapToDouble(BoxOutputByType:: getActual_production).sum())); -// } - - for (BoxOutputByType byType:info ) { - xAxisInfo.add(byType.getPlan_type()); - seriesInfo.add(Long.valueOf(byType.getActual_production())); - } - - echarts.setSeriesInfo(seriesInfo); - echarts.setXAxisInfo(xAxisInfo); - - String jsonInfo = JSONArray.toJSONString(echarts); - - System.out.println("根据型号统计产量:"+jsonInfo); + @ApiOperation("箱壳按类型查询产量") + public String selectOutputByType() { + List info = service.selectOutputByType(); + String jsonInfo = JSONArray.toJSONString(info); + System.out.println("根据型号统计产量:" + jsonInfo); return jsonInfo; - - } + + @PostMapping("/selectOutputByTime") + @ResponseBody + @ApiOperation("箱壳按小时查询产量") + public String selectOutputByTime() { + List info = service.selectOutputByTime(); + String jsonInfo = JSONArray.toJSONString(info); + System.out.println("根据型号统计产量:" + jsonInfo); + return jsonInfo; + } + + @PostMapping("/getProductPlanInfo") @ResponseBody - public String getProductPlanInfo(){ + public String getProductPlanInfo() { List> planInfoList = new ArrayList>(); List planInfo = service.getUHullPlanInfo(); - planInfo.forEach(x->{ + planInfo.forEach(x -> { planInfoList.add( new ArrayList() { { this.add(x.getOrderType()); this.add(x.getPlannedProduction()); this.add(x.getActualProduction()); - this.add(x.getPlannedProduction()-x.getActualProduction()); - if(x.getPlannedProduction() == 0 || x.getActualProduction() ==0){ + this.add(x.getPlannedProduction() - x.getActualProduction()); + if (x.getPlannedProduction() == 0 || x.getActualProduction() == 0) { this.add("0%"); - }else { - this.add(((double)x.getActualProduction()/(double)x.getPlannedProduction()*100)+"%"); + } else { + this.add(((double) x.getActualProduction() / (double) x.getPlannedProduction() * 100) + "%"); } if (x.getEndTime() != null) { this.add(dateFormat.format(x.getEndTime())); @@ -119,7 +107,7 @@ public class BoxBroadController { String jsonInfo = JSONArray.toJSONString(planInfoList); - System.out.println("MES生产计划信息查询:"+jsonInfo); + System.out.println("MES生产计划信息查询:" + jsonInfo); return jsonInfo; } diff --git a/ruoyi-admin/src/main/resources/templates/broad/box.html b/ruoyi-admin/src/main/resources/templates/broad/box.html index 3424800..3fdbd1c 100644 --- a/ruoyi-admin/src/main/resources/templates/broad/box.html +++ b/ruoyi-admin/src/main/resources/templates/broad/box.html @@ -505,7 +505,8 @@ { type: 'category', axisTick: { - alignWithLabel: true + alignWithLabel: true, + interval:0 }, axisLabel: { color: '#ffffff', @@ -556,7 +557,7 @@ ], series: [ { - name: '内胆库', + name: '内胆积存库', type: 'bar', barWidth: '20rem', itemStyle: { @@ -588,7 +589,7 @@ }, }, { - name: '箱体壳', + name: '围板积存库', type: 'bar', barWidth: '20rem', itemStyle: { diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/BoxOutput.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BoxOutput.java new file mode 100644 index 0000000..2199e08 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BoxOutput.java @@ -0,0 +1,26 @@ +package com.ruoyi.system.domain; + +/** + * @author wanghao + * @date 2022/7/7 19:03 + */ +public class BoxOutput { + private String name; + private int qty; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getQty() { + return qty; + } + + public void setQty(int qty) { + this.qty = qty; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/BoxOutputByType.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BoxOutputByType.java deleted file mode 100644 index bbc605c..0000000 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/BoxOutputByType.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.ruoyi.system.domain; - -/** - * @author wanghao - * @date 2022/7/7 19:03 - */ -public class BoxOutputByType { - private String plan_type; - private int actual_production; - - public String getPlan_type() { - return plan_type; - } - - public void setPlan_type(String plan_type) { - this.plan_type = plan_type; - } - - public int getActual_production() { - return actual_production; - } - - public void setActual_production(int actual_production) { - this.actual_production = actual_production; - } -} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BroadDataMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BroadDataMapper.java index 7ec1e5a..39da4e3 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BroadDataMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/BroadDataMapper.java @@ -1,14 +1,11 @@ package com.ruoyi.system.mapper; -import com.ruoyi.common.annotation.DataSource; -import com.ruoyi.common.enums.DataSourceType; -import com.ruoyi.system.domain.BoxOutputByType; +import com.ruoyi.system.domain.BoxOutput; import com.ruoyi.system.domain.BoxPlanCompletion; import com.ruoyi.system.domain.BoxStock; import com.ruoyi.system.domain.OrderInfo; import org.springframework.stereotype.Repository; -import javax.swing.*; import java.util.List; /** @@ -21,7 +18,9 @@ public interface BroadDataMapper { List selectStock(String id); - List selectOutputByType(); + List selectOutputByType(); List getUHullPlanInfo(); + + List selectOutputByTime(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/IBroadDataService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBroadDataService.java index 84401c4..95621b4 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/IBroadDataService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/IBroadDataService.java @@ -15,7 +15,9 @@ public interface IBroadDataService { List selectStock(String id); - List selectOutputByType(); + List selectOutputByType(); List getUHullPlanInfo(); + + List selectOutputByTime(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BroadDataServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BroadDataServiceImpl.java index 52ebd2d..a3eac34 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BroadDataServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BroadDataServiceImpl.java @@ -1,22 +1,13 @@ package com.ruoyi.system.service.impl; import com.ruoyi.common.annotation.DataSource; -import com.ruoyi.common.constant.Constants; -import com.ruoyi.common.constant.UserConstants; -import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.enums.DataSourceType; -import com.ruoyi.common.exception.ServiceException; -import com.ruoyi.common.utils.CacheUtils; -import com.ruoyi.common.utils.StringUtils; import com.ruoyi.system.domain.*; import com.ruoyi.system.mapper.BroadDataMapper; -import com.ruoyi.system.mapper.SysConfigMapper; import com.ruoyi.system.service.IBroadDataService; -import com.ruoyi.system.service.ISysConfigService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import javax.annotation.PostConstruct; import java.util.List; /** @@ -43,7 +34,7 @@ public class BroadDataServiceImpl implements IBroadDataService } @Override - public List selectOutputByType() { + public List selectOutputByType() { return mapper.selectOutputByType(); } @@ -51,4 +42,9 @@ public class BroadDataServiceImpl implements IBroadDataService public List getUHullPlanInfo() { return mapper.getUHullPlanInfo(); } + + @Override + public List selectOutputByTime() { + return mapper.selectOutputByTime(); + } } diff --git a/ruoyi-system/src/main/resources/mapper/system/BroadDataMapper.xml b/ruoyi-system/src/main/resources/mapper/system/BroadDataMapper.xml index 7d128e9..0a3653e 100644 --- a/ruoyi-system/src/main/resources/mapper/system/BroadDataMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/system/BroadDataMapper.xml @@ -17,7 +17,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" plan_shift from IMOS_PR_PLAN where plan_date is not null - -- and factory_code = '2701' and process_code = '1002' and detial_type_code = '1002' and delete_flag = '0' @@ -51,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" order by material_name - select substr(MATERIAL_NAME, case when instr(MATERIAL_NAME, '/', 1, 1) = 0 then instr(MATERIAL_NAME, ',', 1, 1) + 1 @@ -65,12 +64,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" case when instr(MATERIAL_NAME, '/', 1, 1) = 0 then instr(MATERIAL_NAME, ',', 1, 1) + 1 else instr(MATERIAL_NAME, '/', 1, 1) + 1 - end) as plan_type, - SUM(ACTUAL_QTY) as actual_production + end) as name, + SUM(ACTUAL_QTY) as qty from IMOS_PR_PLAN where to_char(plan_date, 'yyyy-MM-dd') = to_char(sysdate, 'yyyy-MM-dd') and PROCESS_CODE = 1002 - group by MATERIAL_NAME; + group by MATERIAL_NAME @@ -98,4 +97,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" group by PLAN_NO, MATERIAL_NAME + + \ No newline at end of file