|
|
|
@ -1,14 +1,21 @@
|
|
|
|
|
package com.dsic.gj_erp.controller.kban;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.util.ObjUtil;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
|
import com.dsic.gj_erp.annotation.AuthFunction;
|
|
|
|
|
import com.dsic.gj_erp.bean.ResultBean;
|
|
|
|
|
import com.dsic.gj_erp.bean.jcsj.DmBzry;
|
|
|
|
|
import com.dsic.gj_erp.bean.jhgk.DmSygdMx;
|
|
|
|
|
import com.dsic.gj_erp.bean.jhgk.DmYdjh;
|
|
|
|
|
import com.dsic.gj_erp.bean.jhgk.DmYdjhxf;
|
|
|
|
|
import com.dsic.gj_erp.exception.ServiceException;
|
|
|
|
@ -17,15 +24,11 @@ import com.dsic.gj_erp.service.jcsj.DmBzryService;
|
|
|
|
|
import com.dsic.gj_erp.service.jhgk.DmSygdMxService;
|
|
|
|
|
import com.dsic.gj_erp.service.sy.impl.SyMsgService;
|
|
|
|
|
import com.dsic.gj_erp.service.zyjh.ZyjhService;
|
|
|
|
|
import lombok.AllArgsConstructor;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import cn.hutool.core.util.ObjUtil;
|
|
|
|
|
import lombok.AllArgsConstructor;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 各作业区划分规则
|
|
|
|
@ -48,12 +51,170 @@ public class KbanController {
|
|
|
|
|
private final SyMsgService msgService;
|
|
|
|
|
private final DmSygdMxService service;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 30天作业区完成情况折线图
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/today_zyjhzx")
|
|
|
|
|
public ResultBean<?> todayXZyjhzx() {
|
|
|
|
|
return new ResultBean<>(this.kbanService.todayZyjhzx());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 30天作业区完成情况折线图
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/zyjhzx")
|
|
|
|
|
public ResultBean<?> zyjhzx() {
|
|
|
|
|
return new ResultBean<>(this.kbanService.zyjhzx());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 前方需求汇总表
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/zyjhzxTable")
|
|
|
|
|
public ResultBean<?> zyjhzxTable() {
|
|
|
|
|
Map<String, Object> map=this.kbanService.zyjhzxTable();
|
|
|
|
|
DateTime date = DateUtil.date();
|
|
|
|
|
String from = DateUtil.beginOfMonth(date).toString("yyyy/MM/dd");
|
|
|
|
|
String to = DateUtil.endOfMonth(date).toString("yyyy/MM/dd");
|
|
|
|
|
List<DmYdjh> list = zyjhService
|
|
|
|
|
.list(Wrappers.<DmYdjh>lambdaQuery().ge(DmYdjh::getZt, 2).between(DmYdjh::getJssj, from, to));
|
|
|
|
|
|
|
|
|
|
AtomicInteger 上料计划 = new AtomicInteger(0);
|
|
|
|
|
AtomicInteger 上料完成 = new AtomicInteger(0);
|
|
|
|
|
HashMap<String, Object> 上料 = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
AtomicInteger 二区计划1k = new AtomicInteger(0);
|
|
|
|
|
AtomicInteger 二区完成1k = new AtomicInteger(0);
|
|
|
|
|
AtomicInteger 二区计划3k = new AtomicInteger(0);
|
|
|
|
|
AtomicInteger 二区完成3k = new AtomicInteger(0);
|
|
|
|
|
HashMap<String, Object> 二区1k = new HashMap<>();
|
|
|
|
|
HashMap<String, Object> 二区3k = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
AtomicInteger 三区计划 = new AtomicInteger(0);
|
|
|
|
|
AtomicInteger 三区完成 = new AtomicInteger(0);
|
|
|
|
|
HashMap<String, Object> 三区 = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
AtomicInteger 四区计划 = new AtomicInteger(0);
|
|
|
|
|
AtomicInteger 四区完成 = new AtomicInteger(0);
|
|
|
|
|
HashMap<String, Object> 四区 = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
list.forEach(item -> {
|
|
|
|
|
String subStr = item.getTzbh().substring(5, 6);
|
|
|
|
|
int zt = 0;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
zt = Integer.parseInt(item.getZt());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (zt == 11) {
|
|
|
|
|
上料计划.incrementAndGet();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (zt > 11) {
|
|
|
|
|
上料完成.incrementAndGet();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 二区
|
|
|
|
|
if ("1".equals(subStr)) {
|
|
|
|
|
if (zt >= 2) {
|
|
|
|
|
二区计划1k.incrementAndGet();
|
|
|
|
|
}
|
|
|
|
|
if (zt >= 62) {
|
|
|
|
|
二区完成1k.incrementAndGet();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ("3".equals(subStr)) {
|
|
|
|
|
if (zt >= 2) {
|
|
|
|
|
二区计划3k.incrementAndGet();
|
|
|
|
|
}
|
|
|
|
|
if (zt >= 62) {
|
|
|
|
|
二区完成3k.incrementAndGet();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 三区
|
|
|
|
|
if ("2".equals(subStr)) {
|
|
|
|
|
if (zt >= 2) {
|
|
|
|
|
三区计划.incrementAndGet();
|
|
|
|
|
}
|
|
|
|
|
if (zt >= 62) {
|
|
|
|
|
三区完成.incrementAndGet();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 四区
|
|
|
|
|
if ("4".equals(subStr)) {
|
|
|
|
|
if (zt >= 2) {
|
|
|
|
|
四区计划.incrementAndGet();
|
|
|
|
|
}
|
|
|
|
|
if (zt >= 62) {
|
|
|
|
|
四区完成.incrementAndGet();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
ArrayList<Object> result = new ArrayList<>();
|
|
|
|
|
// 上料.put("zyq", "一区");
|
|
|
|
|
// 上料.put("sl", 上料计划.get());
|
|
|
|
|
// 上料.put("wc", 上料完成.get());
|
|
|
|
|
// result.add(上料);
|
|
|
|
|
|
|
|
|
|
二区1k.put("zyq", "二区");
|
|
|
|
|
二区1k.put("kw", "一垮");
|
|
|
|
|
二区1k.put("sl", 二区计划1k.get());
|
|
|
|
|
二区1k.put("wc", 二区完成1k.get());
|
|
|
|
|
result.add(二区1k);
|
|
|
|
|
|
|
|
|
|
二区3k.put("zyq", "二区");
|
|
|
|
|
二区3k.put("kw", "三垮");
|
|
|
|
|
二区3k.put("sl", 二区计划3k.get());
|
|
|
|
|
二区3k.put("wc", 二区完成3k.get());
|
|
|
|
|
result.add(二区3k);
|
|
|
|
|
|
|
|
|
|
三区.put("zyq", "三区");
|
|
|
|
|
三区.put("kw", "二垮");
|
|
|
|
|
三区.put("sl", 三区计划.get());
|
|
|
|
|
三区.put("wc", 三区完成.get());
|
|
|
|
|
result.add(三区);
|
|
|
|
|
|
|
|
|
|
四区.put("zyq", "四区");
|
|
|
|
|
四区.put("kw", "四五六垮");
|
|
|
|
|
四区.put("sl", 四区计划.get());
|
|
|
|
|
四区.put("wc", 四区完成.get());
|
|
|
|
|
result.add(四区);
|
|
|
|
|
|
|
|
|
|
map.put("detail", result);
|
|
|
|
|
return new ResultBean<>(map);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 前方需求柱状图
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/qfxqWc")
|
|
|
|
|
public ResultBean<?> qfxqWcqk() {
|
|
|
|
|
return new ResultBean<>(this.kbanService.qfxqWcqk());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 前方需求汇总表
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/qfxqTable")
|
|
|
|
|
public ResultBean<?> qfxqTable() {
|
|
|
|
|
return new ResultBean<>(this.kbanService.qfxqTable());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 作业区完成情况饼图
|
|
|
|
|
*/
|
|
|
|
|
@GetMapping("/zxqwcqk")
|
|
|
|
|
public ResultBean<?> getZxqwcqk(){
|
|
|
|
|
List<DmYdjh> list=zyjhService.list(Wrappers.<DmYdjh>lambdaQuery().ge(DmYdjh::getZt,2));
|
|
|
|
|
DateTime date = DateUtil.date();
|
|
|
|
|
String from = DateUtil.beginOfMonth(date).toString("yyyy/MM/dd");
|
|
|
|
|
String to = DateUtil.endOfMonth(date).toString("yyyy/MM/dd");
|
|
|
|
|
List<DmYdjh> list=zyjhService.list(Wrappers.<DmYdjh>lambdaQuery().ge(DmYdjh::getZt,2).between(DmYdjh::getJssj,from,to));
|
|
|
|
|
|
|
|
|
|
AtomicInteger 上料计划 = new AtomicInteger(0);
|
|
|
|
|
AtomicInteger 上料完成 = new AtomicInteger(0);
|
|
|
|
@ -72,11 +233,11 @@ public class KbanController {
|
|
|
|
|
HashMap<String, Object> 四区 = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
list.forEach(item->{
|
|
|
|
|
String subStr=item.getTzbh().substring(6,7);
|
|
|
|
|
String subStr=item.getTzbh().substring(5,6);
|
|
|
|
|
int zt=0;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
zt = Integer.parseInt(subStr);
|
|
|
|
|
zt = Integer.parseInt(item.getZt());
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
@ -141,7 +302,7 @@ public class KbanController {
|
|
|
|
|
四区.put("wc",四区完成.get());
|
|
|
|
|
result.add(四区);
|
|
|
|
|
|
|
|
|
|
return new ResultBean<>(list);
|
|
|
|
|
return new ResultBean<>(result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|