|
|
|
|
@ -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<Long> seriesInfo = new ArrayList<Long>();
|
|
|
|
|
List<String> xAxisInfo = new ArrayList<String>();
|
|
|
|
|
List<BoxStock> list=service.selectStock(id);
|
|
|
|
|
list.stream().forEach(t->{
|
|
|
|
|
List<String> xAxisInfo = new ArrayList<String>();
|
|
|
|
|
List<BoxStock> 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<Long> seriesInfo = new ArrayList<Long>();
|
|
|
|
|
List<String> xAxisInfo = new ArrayList<String>();
|
|
|
|
|
|
|
|
|
|
List<BoxOutputByType> info = service.selectOutputByType();
|
|
|
|
|
// Map<String,List<BoxOutputByType>> 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<BoxOutput> info = service.selectOutputByType();
|
|
|
|
|
String jsonInfo = JSONArray.toJSONString(info);
|
|
|
|
|
System.out.println("根据型号统计产量:" + jsonInfo);
|
|
|
|
|
return jsonInfo;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/selectOutputByTime")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
@ApiOperation("箱壳按小时查询产量")
|
|
|
|
|
public String selectOutputByTime() {
|
|
|
|
|
List<BoxOutput> info = service.selectOutputByTime();
|
|
|
|
|
String jsonInfo = JSONArray.toJSONString(info);
|
|
|
|
|
System.out.println("根据型号统计产量:" + jsonInfo);
|
|
|
|
|
return jsonInfo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/getProductPlanInfo")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public String getProductPlanInfo(){
|
|
|
|
|
public String getProductPlanInfo() {
|
|
|
|
|
List<List<Object>> planInfoList = new ArrayList<List<Object>>();
|
|
|
|
|
List<OrderInfo> planInfo = service.getUHullPlanInfo();
|
|
|
|
|
|
|
|
|
|
planInfo.forEach(x->{
|
|
|
|
|
planInfo.forEach(x -> {
|
|
|
|
|
planInfoList.add(
|
|
|
|
|
new ArrayList<Object>() {
|
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|