Merge remote-tracking branch 'origin/master'
# Conflicts: # mes/hd/nladmin-system/src/main/java/org/nl/wms/product_manage/service/workorder/dao/mapper/PdmProduceWorkorderMapper.java # mes/hd/nladmin-system/src/main/java/org/nl/wms/product_manage/service/workorder/dao/mapper/PdmProduceWorkorderMapper.xml # mes/hd/nladmin-system/src/main/java/org/nl/wms/product_manage/service/workorder/impl/IPdmProduceWorkorderServiceImpl.java
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package org.nl.wms.analysis_manage.productCapacity.controller;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/10/8 10:24
|
||||
*/
|
||||
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.product_manage.service.workorder.IPdmProduceWorkorderService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.nl.wms.analysis_manage.productCapacity.service.dto.ProductCapQuery;
|
||||
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/productCap")
|
||||
@Slf4j
|
||||
public class ProductCapController {
|
||||
|
||||
@Autowired
|
||||
private IPdmProduceWorkorderService workorderService;
|
||||
|
||||
@GetMapping()
|
||||
@Log("查询产能利用率")
|
||||
public ResponseEntity<Object> byMaterial(ProductCapQuery query, PageQuery page) {
|
||||
Page<Object> result = PageHelper.startPage(page.getPage() + 1, page.getSize());
|
||||
List<Map> list = workorderService.productCap(query);
|
||||
TableDataInfo build = TableDataInfo.build(list);
|
||||
build.setTotalElements(result.getTotal());
|
||||
return new ResponseEntity<>(build, HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.nl.wms.analysis_manage.productCapacity.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/10/8 10:25
|
||||
*/
|
||||
@Data
|
||||
public class ProductCapQuery {
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String device_code;
|
||||
/**
|
||||
* 工序id
|
||||
*/
|
||||
private String workprocedure_id;
|
||||
/**
|
||||
* 车间
|
||||
*/
|
||||
private String product_area;
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
private String[] create_time;
|
||||
private String start_time;
|
||||
private String end_time;
|
||||
|
||||
|
||||
public void setCreate_time(String[] create_time) {
|
||||
this.create_time = create_time;
|
||||
if (create_time!=null && create_time.length == 2){
|
||||
this.start_time = create_time[0];
|
||||
this.end_time = create_time[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,284 @@
|
||||
package org.nl.wms.analysis_manage.qlmanage.controller;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/10/8 10:24
|
||||
*/
|
||||
|
||||
|
||||
import cn.hutool.core.date.*;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.wms.analysis_manage.qlmanage.dto.QualityQuery;
|
||||
import org.nl.wms.product_manage.service.device.IPdmBiDeviceService;
|
||||
import org.nl.wms.product_manage.service.device.dao.PdmBiDevice;
|
||||
import org.nl.wms.product_manage.service.workorder.IPdmProduceWorkorderService;
|
||||
import org.nl.wms.product_manage.service.workprocedure.IPdmBiWorkprocedureService;
|
||||
import org.nl.wms.product_manage.service.workprocedure.dao.PdmBiWorkprocedure;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.spring.web.json.Json;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/qualityanalysis")
|
||||
@Slf4j
|
||||
public class QualityController {
|
||||
|
||||
@Autowired
|
||||
private IPdmProduceWorkorderService workorderService;
|
||||
@Autowired
|
||||
private IPdmBiWorkprocedureService workprocedureService;
|
||||
@Autowired
|
||||
private IPdmBiDeviceService deviceService;
|
||||
|
||||
@GetMapping()
|
||||
@Log("查询质量分析")
|
||||
public ResponseEntity<Object> byMaterial(QualityQuery query, PageQuery page) {
|
||||
long between = 30;
|
||||
between = checkDateLimit(query, between);
|
||||
|
||||
QueryWrapper<PdmBiWorkprocedure> wrapper = new QueryWrapper<>();
|
||||
if (StringUtils.isEmpty(query.getProduct_area())){
|
||||
query.setProduct_area("A1");
|
||||
}
|
||||
wrapper.eq("product_area",query.getProduct_area());
|
||||
if (!StringUtils.isEmpty(query.getWorkprocedure_id())){
|
||||
wrapper.eq("workprocedure_id",query.getWorkprocedure_id());
|
||||
}
|
||||
Page<Map<String, Object>> page1 = workprocedureService.pageMaps(page.build(PdmBiWorkprocedure.class), wrapper);
|
||||
String collect = page1.getRecords().stream().map(a->String.valueOf(a.get("workprocedure_id"))).collect(Collectors.joining("','"));
|
||||
query.setWorkprocedure_id("('"+collect+"')");
|
||||
List<Map> list = workorderService.qualityAna(query);
|
||||
if (!CollectionUtils.isEmpty(list)){
|
||||
System.out.println("有数据了!!!!"+list.size());
|
||||
}
|
||||
Map<String, List<Map>> workprocedure_idMap = list.stream().collect(Collectors.groupingBy(map -> String.valueOf(map.get("workprocedure_id"))));
|
||||
|
||||
//数据封装
|
||||
List<Map<String,Object>> result = new ArrayList<>();
|
||||
String time = query.getStart_time();
|
||||
String mo =DatePattern.NORM_MONTH_FORMAT.format(DateUtil.parse(query.getStart_time()));
|
||||
int minWeek = DateUtil.weekOfYear(DateUtil.parse(query.getStart_time()));
|
||||
int minYear = DateUtil.year(DateUtil.parse(query.getStart_time()));
|
||||
for (Map record : page1.getRecords()) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
List<Map> maps = workprocedure_idMap.get(record.get("workprocedure_id"));
|
||||
item.put("workprocedure_id",record.get("workprocedure_id"));
|
||||
item.put("workprocedure_name",record.get("workprocedure_name"));
|
||||
item.put("workprocedure_code",record.get("workprocedure_code"));
|
||||
item.put("product_area",record.get("product_area"));
|
||||
Map<String, Map> collectByAnalysis = new HashMap<>();
|
||||
if (!CollectionUtils.isEmpty(maps)){
|
||||
collectByAnalysis = maps.stream().collect(HashMap::new, (k, v) -> k.put(String.valueOf(v.get(query.getAnalysis())), v), HashMap::putAll);
|
||||
}else {
|
||||
maps = new ArrayList<>();
|
||||
}
|
||||
String weektime = minYear+"_"+minWeek;
|
||||
String motime = mo;
|
||||
String datetime = time;
|
||||
for (int i = 1; i <= between; i++) {
|
||||
switch (query.getAnalysis()){
|
||||
case "1":
|
||||
Map itemData = collectByAnalysis.get(datetime);
|
||||
if (itemData==null){
|
||||
maps.add(MapOf.of("order_count", "0", "plan_qty", "0", "real_qty", "0", "nok_qty", "0","nok_rate",0,"header",datetime,"sort",i));
|
||||
}else {
|
||||
itemData.put("sort",i);
|
||||
itemData.put("header",datetime);
|
||||
}
|
||||
datetime = DatePattern.NORM_DATE_FORMAT.format(DateUtil.offset(DateUtil.parse(query.getStart_time()),DateField.DAY_OF_MONTH,i));
|
||||
break;
|
||||
case "2":
|
||||
Map weekData = collectByAnalysis.get(weektime);
|
||||
if (weekData==null){
|
||||
maps.add(MapOf.of("order_count", "0", "plan_qty", "0", "real_qty", "0", "nok_qty", "0","nok_rate",0,"header",weektime,"sort",i));
|
||||
}else {
|
||||
weekData.put("sort",i);
|
||||
weekData.put("header",weektime);
|
||||
}
|
||||
DateTime offset = DateUtil.offset(DateUtil.parse(query.getStart_time()), DateField.WEEK_OF_YEAR, i);
|
||||
weektime = DateUtil.year(offset)+"_"+DateUtil.weekOfYear(offset);
|
||||
break;
|
||||
case "3":
|
||||
Map moDAta = collectByAnalysis.get(motime);
|
||||
if (moDAta==null){
|
||||
maps.add(MapOf.of("order_count", "0", "plan_qty", "0", "real_qty", "0", "nok_qty", "0","nok_rate",0,"header",motime,"sort",i));
|
||||
}else {
|
||||
moDAta.put("header",motime);
|
||||
moDAta.put("sort",i);
|
||||
}
|
||||
motime = DatePattern.NORM_MONTH_FORMAT.format(DateUtil.offset(DateUtil.parse(query.getStart_time()),DateField.MONTH,i));
|
||||
break;
|
||||
default:throw new BadRequestException("统计周期未定义");
|
||||
}
|
||||
}
|
||||
maps.removeIf(map -> map.get("sort")==null);
|
||||
maps.sort(Comparator.comparing(a->(int)a.get("sort")));
|
||||
item.put("item",maps);
|
||||
item.put("viewData",maps.stream().map(a->a.get("nok_rate")).collect(Collectors.toList()));
|
||||
item.put("header",maps.stream().map(a->a.get("header")).collect(Collectors.toList()));
|
||||
item.put("total_real_qty",maps.stream().mapToLong(a->Long.valueOf(String.valueOf(a.get("real_qty")))).sum());
|
||||
item.put("total_nok_qty",maps.stream().mapToLong(a->Long.valueOf(String.valueOf(a.get("nok_qty")))).sum());
|
||||
item.put("total_order_count",maps.stream().mapToLong(a->Long.valueOf(String.valueOf(a.get("order_count")))).sum());
|
||||
result.add(item);
|
||||
}
|
||||
page1.setRecords(result);
|
||||
System.out.println(list.size());
|
||||
return new ResponseEntity<>(TableDataInfo.build(page1), HttpStatus.OK);
|
||||
}
|
||||
|
||||
private long checkDateLimit(QualityQuery query, long between) {
|
||||
if (StringUtils.isEmpty(query.getAnalysis())){
|
||||
query.setAnalysis("1");
|
||||
}
|
||||
if (query.getAnalysis().equals("1")){
|
||||
if (query.getStart_time()!=null){
|
||||
between = DateUtil.between(DateUtil.parse(query.getStart_time()), DateUtil.parse(query.getEnd_time()), DateUnit.DAY);
|
||||
if (between >30){
|
||||
throw new BadRequestException("日汇总请选择时间周期为一个月之内");
|
||||
}
|
||||
}else {
|
||||
query.setEnd_time(DateUtil.today());
|
||||
query.setStart_time(DatePattern.NORM_DATE_FORMAT.format(DateUtil.lastMonth()));
|
||||
}
|
||||
}
|
||||
if (query.getAnalysis().equals("2")){
|
||||
if (query.getStart_time()!=null){
|
||||
between = DateUtil.between(DateUtil.parse(query.getStart_time()), DateUtil.parse(query.getEnd_time()), DateUnit.WEEK);
|
||||
if (between >30){
|
||||
throw new BadRequestException("日汇总请选择时间周期为一个月之内");
|
||||
}
|
||||
}else {
|
||||
query.setEnd_time(DateUtil.today());
|
||||
query.setStart_time(DatePattern.NORM_DATE_FORMAT.format(DateUtil.offset(new Date(), DateField.WEEK_OF_MONTH, -30)));
|
||||
}
|
||||
}
|
||||
if (query.getAnalysis().equals("3")){
|
||||
if (query.getStart_time()!=null){
|
||||
between = DateUtil.betweenMonth(DateUtil.parse(query.getStart_time()), DateUtil.parse(query.getEnd_time()),true)+1;
|
||||
if (between >24){
|
||||
throw new BadRequestException("月汇总请选择时间周期为2年之内");
|
||||
}
|
||||
}else {
|
||||
query.setEnd_time(DateUtil.today());
|
||||
query.setStart_time(DatePattern.NORM_DATE_FORMAT.format(DateUtil.offset(new Date(), DateField.MONTH, -24)));
|
||||
between =24;
|
||||
}
|
||||
}
|
||||
return between;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/bydevice")
|
||||
@Log("查询质量分析")
|
||||
public ResponseEntity<Object> bydevice(QualityQuery query, PageQuery page) {
|
||||
long between = 30;
|
||||
between = checkDateLimit(query, between);
|
||||
|
||||
QueryWrapper<PdmBiDevice> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("workprocedure_id",query.getWorkprocedure_id());
|
||||
|
||||
Page<Map<String, Object>> page1 = deviceService.pageMaps(page.build(PdmBiDevice.class), wrapper);
|
||||
String collect = page1.getRecords().stream().map(a->String.valueOf(a.get("device_code"))).collect(Collectors.joining("','"));
|
||||
query.setDevice_code("('"+collect+"')");
|
||||
List<Map> list = workorderService.qualityAnaByDevice(query);
|
||||
if (!CollectionUtils.isEmpty(list)){
|
||||
System.out.println("有数据了!!!!"+list.size());
|
||||
}
|
||||
Map<String, List<Map>> device_codeMap = list.stream().collect(Collectors.groupingBy(map -> String.valueOf(map.get("device_code"))));
|
||||
|
||||
//数据封装
|
||||
List<Map<String,Object>> result = new ArrayList<>();
|
||||
String time = query.getStart_time();
|
||||
String mo =DatePattern.NORM_MONTH_FORMAT.format(DateUtil.parse(query.getStart_time()));
|
||||
int minWeek = DateUtil.weekOfYear(DateUtil.parse(query.getStart_time()));
|
||||
int minYear = DateUtil.year(DateUtil.parse(query.getStart_time()));
|
||||
for (Map record : page1.getRecords()) {
|
||||
Map<String, Object> item = new HashMap<>();
|
||||
List<Map> maps = device_codeMap.get(record.get("device_code"));
|
||||
item.put("device_code",record.get("device_code"));
|
||||
item.put("device_name",record.get("device_name"));
|
||||
item.put("product_area",record.get("product_area"));
|
||||
Map<String, Map> collectByAnalysis = new HashMap<>();
|
||||
if (!CollectionUtils.isEmpty(maps)){
|
||||
collectByAnalysis = maps.stream().collect(HashMap::new, (k, v) -> k.put(String.valueOf(v.get(query.getAnalysis())), v), HashMap::putAll);
|
||||
}else {
|
||||
maps = new ArrayList<>();
|
||||
}
|
||||
String weektime = minYear+"_"+minWeek;
|
||||
String motime = mo;
|
||||
String datetime = time;
|
||||
for (int i = 1; i <= between; i++) {
|
||||
switch (query.getAnalysis()){
|
||||
case "1":
|
||||
Map itemData = collectByAnalysis.get(datetime);
|
||||
if (itemData==null){
|
||||
maps.add(MapOf.of("order_count", "0", "plan_qty", "0", "real_qty", "0", "nok_qty", "0","nok_rate",0,"header",datetime,"sort",i));
|
||||
}else {
|
||||
itemData.put("sort",i);
|
||||
itemData.put("header",datetime);
|
||||
}
|
||||
datetime = DatePattern.NORM_DATE_FORMAT.format(DateUtil.offset(DateUtil.parse(query.getStart_time()),DateField.DAY_OF_MONTH,i));
|
||||
break;
|
||||
case "2":
|
||||
Map weekData = collectByAnalysis.get(weektime);
|
||||
if (weekData==null){
|
||||
maps.add(MapOf.of("order_count", "0", "plan_qty", "0", "real_qty", "0", "nok_qty", "0","nok_rate",0,"header",weektime,"sort",i));
|
||||
}else {
|
||||
weekData.put("sort",i);
|
||||
weekData.put("header",weektime);
|
||||
}
|
||||
DateTime offset = DateUtil.offset(DateUtil.parse(query.getStart_time()), DateField.WEEK_OF_YEAR, i);
|
||||
weektime = DateUtil.year(offset)+"_"+DateUtil.weekOfYear(offset);
|
||||
break;
|
||||
case "3":
|
||||
Map moDAta = collectByAnalysis.get(motime);
|
||||
if (moDAta==null){
|
||||
maps.add(MapOf.of("order_count", "0", "plan_qty", "0", "real_qty", "0", "nok_qty", "0","nok_rate",0,"header",motime,"sort",i));
|
||||
}else {
|
||||
moDAta.put("header",motime);
|
||||
moDAta.put("sort",i);
|
||||
}
|
||||
motime = DatePattern.NORM_MONTH_FORMAT.format(DateUtil.offset(DateUtil.parse(query.getStart_time()),DateField.MONTH,i));
|
||||
break;
|
||||
default:throw new BadRequestException("统计周期未定义");
|
||||
}
|
||||
}
|
||||
maps.removeIf(map -> map.get("sort")==null);
|
||||
maps.sort(Comparator.comparing(a->(int)a.get("sort")));
|
||||
item.put("item",maps);
|
||||
item.put("viewData",maps.stream().map(a->a.get("nok_rate")).collect(Collectors.toList()));
|
||||
item.put("header",maps.stream().map(a->a.get("header")).collect(Collectors.toList()));
|
||||
item.put("total_real_qty",maps.stream().mapToLong(a->Long.valueOf(String.valueOf(a.get("real_qty")))).sum());
|
||||
item.put("total_nok_qty",maps.stream().mapToLong(a->Long.valueOf(String.valueOf(a.get("nok_qty")))).sum());
|
||||
item.put("total_order_count",maps.stream().mapToLong(a->Long.valueOf(String.valueOf(a.get("order_count")))).sum());
|
||||
result.add(item);
|
||||
}
|
||||
page1.setRecords(result);
|
||||
System.out.println(list.size());
|
||||
return new ResponseEntity<>(TableDataInfo.build(page1), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package org.nl.wms.analysis_manage.qlmanage.dto;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/10/8 10:25
|
||||
*/
|
||||
@Data
|
||||
public class QualityQuery {
|
||||
/**
|
||||
* 分析时间:1日2周3月
|
||||
*/
|
||||
private String analysis;
|
||||
/**
|
||||
* 工序id
|
||||
*/
|
||||
private String workprocedure_id;
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String device_code;
|
||||
/**
|
||||
* 车间
|
||||
*/
|
||||
private String product_area;
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
private String[] create_time;
|
||||
private String start_time;
|
||||
private String end_time;
|
||||
|
||||
|
||||
public void setCreate_time(String[] create_time) {
|
||||
this.create_time = create_time;
|
||||
if (create_time!=null && create_time.length == 2){
|
||||
this.start_time = create_time[0];
|
||||
this.end_time =create_time[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.nl.wms.analysis_manage.scrapRate.controller;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/10/8 10:24
|
||||
*/
|
||||
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.analysis_manage.scrapRate.service.dto.ScrapRateQuery;
|
||||
import org.nl.wms.analysis_manage.workingGoods.service.dto.ByProcessQuery;
|
||||
import org.nl.wms.product_manage.service.workorder.IPdmProduceWorkorderService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/scrapRate")
|
||||
@Slf4j
|
||||
public class ScrapRateController {
|
||||
|
||||
@Autowired
|
||||
private IPdmProduceWorkorderService workorderService;
|
||||
|
||||
@GetMapping()
|
||||
@Log("查询废品率")
|
||||
public ResponseEntity<Object> byMaterial(ScrapRateQuery query, PageQuery page) {
|
||||
Page<Object> result = PageHelper.startPage(page.getPage() + 1, page.getSize());
|
||||
List<Map> list = workorderService.scrapRate(query);
|
||||
TableDataInfo build = TableDataInfo.build(list);
|
||||
build.setTotalElements(result.getTotal());
|
||||
return new ResponseEntity<>(build, HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package org.nl.wms.analysis_manage.scrapRate.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/10/8 10:25
|
||||
*/
|
||||
@Data
|
||||
public class ScrapRateQuery {
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String device_code;
|
||||
/**
|
||||
* 工序id
|
||||
*/
|
||||
private String workprocedure_id;
|
||||
/**
|
||||
* 车间
|
||||
*/
|
||||
private String product_area;
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
private String[] create_time;
|
||||
private String start_time;
|
||||
private String end_time;
|
||||
|
||||
|
||||
public void setCreate_time(String[] create_time) {
|
||||
this.create_time = create_time;
|
||||
if (create_time!=null && create_time.length == 2){
|
||||
this.start_time = create_time[0];
|
||||
this.end_time = create_time[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package org.nl.wms.analysis_manage.workingGoods.service.dto;
|
||||
|
||||
/*
|
||||
* @author ZZQ
|
||||
* @Date 2023/10/7 10:11
|
||||
*/
|
||||
public class ByMaterialQuery {
|
||||
|
||||
public void sdfds(){
|
||||
System.out.println(this.getClass().getName()+"调用方法");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
System.out.println("对象被释放");
|
||||
}
|
||||
}
|
||||
class demo{
|
||||
public static void main(String[] args) {
|
||||
ByMaterialQuery query = new ByMaterialQuery();
|
||||
query.sdfds();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.device_manage.ios.service.structIvt.dao.mapper;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
@@ -28,4 +29,7 @@ public interface EmBiStructivtMapper extends BaseMapper<EmBiStructivt> {
|
||||
List<Map> getSemiProductIvt(@Param("query") StructIvtEmQuery query);
|
||||
|
||||
List<Map> getStructIvt(@Param("query") StructIvtEmQuery query);
|
||||
|
||||
List<JSONObject> getIvtPor();
|
||||
|
||||
}
|
||||
|
||||
@@ -186,4 +186,20 @@
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getIvtPor" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
mater.material_spec,
|
||||
MAX(unit.unit_name) AS unit_name,
|
||||
SUM(ivt.canuse_qty) AS canuse_qty,
|
||||
ROUND(SUM(ivt.canuse_qty) / (SELECT SUM(canuse_qty) FROM em_bi_structivt) * 100,2) AS pro
|
||||
FROM
|
||||
em_bi_structivt ivt
|
||||
LEFT JOIN md_me_materialbase mater ON ivt.material_id = mater.material_id
|
||||
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = ivt.qty_unit_id
|
||||
|
||||
GROUP BY ivt.material_id
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.ext_manage.acs.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
@@ -53,9 +54,12 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
@@ -357,11 +361,24 @@ public class AcsToWmsServiceImpl implements AcsToWmsService{
|
||||
return;
|
||||
}
|
||||
Iterator<String> iterator = param.keySet().iterator();
|
||||
Map<String, PdmProduceWorkorder> map = workorderService.list(new QueryWrapper<PdmProduceWorkorder>()
|
||||
.in("workorder_code", param.keySet()))
|
||||
.stream().collect(HashMap::new, (k, v) -> k.put(v.getWorkorder_code(), v), HashMap::putAll);
|
||||
Date now = new Date();
|
||||
BigDecimal divide = new BigDecimal(0);
|
||||
while (iterator.hasNext()){
|
||||
String workorderCode = iterator.next();
|
||||
BigDecimal dq_real_qty = param.getBigDecimal(workorderCode);
|
||||
PdmProduceWorkorder workorder = map.get(workorderCode);
|
||||
BigDecimal subtract = dq_real_qty.subtract(workorder.getDq_real_qty());
|
||||
if (workorder.getUpdate_time() !=null){
|
||||
divide = subtract.divide(new BigDecimal(DateUtil.between(workorder.getUpdate_time(), now, DateUnit.SECOND)), 3, RoundingMode.HALF_UP);
|
||||
}
|
||||
workorderService.update(new UpdateWrapper<PdmProduceWorkorder>()
|
||||
.set("dq_real_qty",dq_real_qty).eq("workorder_code",workorderCode));
|
||||
.set("dq_real_qty",dq_real_qty)
|
||||
.set("update_time",DateUtil.now())
|
||||
.set("slope",divide)
|
||||
.eq("workorder_code",workorderCode));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,12 +7,16 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.anno.Log;
|
||||
import org.nl.common.utils.RedissonUtils;
|
||||
import org.nl.wms.masterdata_manage.em.service.DevicerepairitemsService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -54,4 +58,14 @@ public class DevicerepairitemsController {
|
||||
devicerepairitemsService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入bom数据
|
||||
*/
|
||||
@Log("导入维修项")
|
||||
@PostMapping("/excelImport")
|
||||
public ResponseEntity<Object> excelImport(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
|
||||
RedissonUtils.lock(() -> devicerepairitemsService.excelImport(file, request), "导入设备档案", null);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,9 @@ package org.nl.wms.masterdata_manage.em.service;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.masterdata_manage.em.service.dto.DevicerepairitemsDto;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -69,4 +71,11 @@ public interface DevicerepairitemsService {
|
||||
* @param ids /
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 导入维修项目
|
||||
* @param file
|
||||
* @param request
|
||||
*/
|
||||
void excelImport(MultipartFile file, HttpServletRequest request);
|
||||
}
|
||||
|
||||
@@ -7,25 +7,34 @@ import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.poi.excel.ExcelReader;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.modules.wql.util.WqlUtil;
|
||||
import org.nl.wms.masterdata_manage.em.service.DevicerepairitemsService;
|
||||
import org.nl.wms.masterdata_manage.em.service.dto.DevicerepairitemsDto;
|
||||
import org.nl.wms.masterdata_manage.bfmaster.service.ClassstandardService;
|
||||
import org.nl.wms.system_manage.service.tableData.ColumnInfoService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
@@ -157,4 +166,55 @@ public class DevicerepairitemsServiceImpl implements DevicerepairitemsService {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void excelImport(MultipartFile file, HttpServletRequest request) {
|
||||
try {
|
||||
// 调用用 hutool 方法读取数据 调用第一个sheet白班数据
|
||||
ExcelReader excelReader = ExcelUtil.getReader(file.getInputStream(), 0);
|
||||
// 从第1行开始获取数据 excelReader.read的结果是一个2纬的list,外层是行,内层是行对应的所有列
|
||||
ColumnInfoService columnInfoService = SpringContextHolder.getBean(ColumnInfoService.class);
|
||||
Map<String, String> tableColumn = columnInfoService.TableColumn2("em_bi_devicerepairitems");
|
||||
List<List<Object>> read = excelReader.read(0, excelReader.getRowCount());
|
||||
Map<Integer, String> IndexValue = new HashMap<>();
|
||||
for (int i = 0; i < read.get(0).size(); i++) {
|
||||
String label = String.valueOf(read.get(0).get(i));
|
||||
String value = tableColumn.get(label);
|
||||
if (value != null) {
|
||||
IndexValue.put(i, value);
|
||||
}
|
||||
}
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
String now = DateUtil.now();
|
||||
JSONArray array = new JSONArray();
|
||||
List<String> ids = new ArrayList<>();
|
||||
for (int i = 1; i < read.size(); i++) {
|
||||
List<Object> list = read.get(i);
|
||||
JSONObject item = new JSONObject();
|
||||
for (int i1 = 0; i1 < list.size(); i1++) {
|
||||
String s = IndexValue.get(i1);
|
||||
if (s != null) {
|
||||
item.put(s, list.get(i1));
|
||||
|
||||
}
|
||||
}
|
||||
item.put("create_id", currentUserId);
|
||||
item.put("create_name", currentUsername);
|
||||
item.put("create_time", now);
|
||||
array.add(item);
|
||||
ids.add(item.getString("repair_item_id"));
|
||||
}
|
||||
System.out.println(array.size());
|
||||
WQLObject mstTab = WQLObject.getWQLObject("em_bi_devicerepairitems"); // 工艺路线主表
|
||||
mstTab.delete("repair_item_id in " + "('" + ids.stream().collect(Collectors.joining("','")) + "')");
|
||||
for (Object o : array) {
|
||||
mstTab.insert((JSONObject) o);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
throw new BadRequestException(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,5 +39,5 @@ public interface IMdPbBucketrecordService extends IService<MdPbBucketrecord> {
|
||||
*/
|
||||
void excelImport(MultipartFile file, HttpServletRequest request, HttpServletResponse response);
|
||||
|
||||
List<Map> getMstList(String storagevehicle_code);
|
||||
List<Map> getMstList(String storagevehicle_code,String sale_code);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.masterdata_manage.service.vehicle.dao.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.masterdata_manage.service.vehicle.dao.MdPbBucketrecord;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
@@ -18,5 +19,5 @@ public interface MdPbBucketrecordMapper extends BaseMapper<MdPbBucketrecord> {
|
||||
|
||||
List<Map> queryAll(Map<String,Object> map);
|
||||
|
||||
List<Map> getMstList(String storagevehicle_code);
|
||||
List<Map> getMstList(@Param("storagevehicle_code") String storagevehicle_code,@Param("sale_code") String sale_code);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
and ma.material_id = #{material_id}
|
||||
</if>
|
||||
<if test="sale_code != null and sale_code != ''">
|
||||
and re.sale_code like '${sale_code}%'
|
||||
and re.sale_code like '%${sale_code}%'
|
||||
</if>
|
||||
<if test="storagevehicle_type != null and storagevehicle_type != ''">
|
||||
and re.storagevehicle_type = #{storagevehicle_type}
|
||||
@@ -25,10 +25,10 @@
|
||||
and re.status = #{status}
|
||||
</if>
|
||||
<if test="storagevehicle_code != null and storagevehicle_code != ''">
|
||||
and re.storagevehicle_code like '${storagevehicle_code}%'
|
||||
and re.storagevehicle_code like '%${storagevehicle_code}%'
|
||||
</if>
|
||||
<if test="bucketunique != null and bucketunique != ''">
|
||||
and ( re.bucketunique like '${bucketunique}%' )
|
||||
and ( re.bucketunique like '%${bucketunique}%' )
|
||||
</if>
|
||||
|
||||
order by re.create_time DESC
|
||||
@@ -39,7 +39,10 @@
|
||||
from md_pb_bucketrecord,(select @rowcount := 0) as r
|
||||
where status = '1'
|
||||
<if test="storagevehicle_code != null and storagevehicle_code != ''">
|
||||
and storagevehicle_code like '${storagevehicle_code}%'
|
||||
and storagevehicle_code like '%${storagevehicle_code}%'
|
||||
</if>
|
||||
<if test="sale_code != null and sale_code != ''">
|
||||
and sale_code like '%${sale_code}%'
|
||||
</if>
|
||||
GROUP BY storagevehicle_code,sale_code,create_time
|
||||
</select>
|
||||
|
||||
@@ -278,7 +278,7 @@ public class MdPbBucketrecordServiceImpl extends ServiceImpl<MdPbBucketrecordMap
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> getMstList(String storagevehicle_code) {
|
||||
return this.baseMapper.getMstList(storagevehicle_code);
|
||||
public List<Map> getMstList(String storagevehicle_code,String sale_code) {
|
||||
return this.baseMapper.getMstList(storagevehicle_code,sale_code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +110,15 @@ public class StIvtStructivtDaily implements Serializable {
|
||||
*/
|
||||
private BigDecimal warehousing_qty;
|
||||
|
||||
/**
|
||||
* 入库数
|
||||
*/
|
||||
private BigDecimal in_qty;
|
||||
|
||||
/**
|
||||
* 出库数
|
||||
*/
|
||||
private BigDecimal out_qty;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -23,10 +23,22 @@ public interface StIvtStructivtDailyMapper extends BaseMapper<StIvtStructivtDail
|
||||
List<Map> selectStructivt(@Param("table") String table);
|
||||
|
||||
/**
|
||||
* 大屏数据 - 近一周工段产量
|
||||
* 获取历史库存
|
||||
* @param list /
|
||||
* @return /
|
||||
*/
|
||||
List<JSONObject> getHistoryivt(@Param("chanList") List<String> list, @Param("query") Map json);
|
||||
|
||||
/**
|
||||
* 获取当天出入库数量
|
||||
* @return /
|
||||
*/
|
||||
List<JSONObject> getIoNum(@Param("query") Map json);
|
||||
|
||||
/**
|
||||
* 收发存查询
|
||||
* @return /
|
||||
*/
|
||||
List<JSONObject> getPhyIvt(@Param("query") Map json);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,4 +29,96 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getIoNum" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
dis.material_id,
|
||||
SUM(dis.plan_qty) AS io_num
|
||||
FROM
|
||||
st_ivt_iostorinvdis_yl dis
|
||||
LEFT JOIN st_ivt_iostorinv_yl mst ON dis.iostorinv_id = mst.iostorinv_id
|
||||
WHERE
|
||||
mst.is_delete = '0'
|
||||
and LEFT(mst.confirm_time,10) = CURDATE()
|
||||
|
||||
<if test="query.io_type != null and query.io_type != ''">
|
||||
and mst.io_type = #{query.io_type}
|
||||
</if>
|
||||
|
||||
group by dis.material_id
|
||||
|
||||
UNION
|
||||
|
||||
SELECT
|
||||
dis.material_id,
|
||||
SUM(dis.plan_qty) AS io_num
|
||||
FROM
|
||||
st_ivt_iostorinvdis_cp dis
|
||||
LEFT JOIN st_ivt_iostorinv_cp mst ON dis.iostorinv_id = mst.iostorinv_id
|
||||
WHERE
|
||||
mst.is_delete = '0'
|
||||
and LEFT(mst.confirm_time,10) = CURDATE()
|
||||
|
||||
<if test="query.io_type != null and query.io_type != ''">
|
||||
and mst.io_type = #{query.io_type}
|
||||
</if>
|
||||
|
||||
group by dis.material_id
|
||||
|
||||
UNION
|
||||
|
||||
SELECT
|
||||
mst.material_id,
|
||||
SUM(mst.plan_qty) AS io_num
|
||||
FROM
|
||||
st_ivt_iostorinv_bcp mst
|
||||
WHERE
|
||||
mst.is_delete = '0'
|
||||
and LEFT(mst.update_time,10) = CURDATE()
|
||||
|
||||
<if test="query.io_type != null and query.io_type != ''">
|
||||
and mst.io_type = #{query.io_type}
|
||||
</if>
|
||||
|
||||
group by mst.material_id
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getPhyIvt" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
mater.material_id,
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
mater.material_spec,
|
||||
MAX(unit.unit_name) AS qty_unit_name,
|
||||
SUM(da.in_qty) AS in_qty,
|
||||
SUM(da.out_qty) AS out_qty,
|
||||
SUM(da.canuse_qty) AS canuse_qty
|
||||
FROM
|
||||
st_ivt_structivt_daily da
|
||||
LEFT JOIN md_me_materialbase mater ON da.material_id = mater.material_id
|
||||
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = da.qty_unit_id
|
||||
<where>
|
||||
1 = 1
|
||||
<if test="query.stor_id != null and query.stor_id != ''">
|
||||
and da.stor_id = #{query.stor_id}
|
||||
</if>
|
||||
|
||||
<if test="query.begin_time != null and query.begin_time != ''">
|
||||
and da.create_time >= #{query.begin_time}
|
||||
</if>
|
||||
|
||||
<if test="query.end_time != null and query.end_time != ''">
|
||||
and #{query.end_time} >= da.create_time
|
||||
</if>
|
||||
|
||||
<if test="query.material_code != null and query.material_code != ''">
|
||||
and (mater.material_code LIKE '%${query.material_code}%' or
|
||||
mater.material_name LIKE '%${query.material_code}%' or
|
||||
mater.material_spec LIKE '%${query.material_code}%')
|
||||
</if>
|
||||
|
||||
group by mater.material_id
|
||||
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -2,8 +2,10 @@ package org.nl.wms.masterdata_manage.storage.service.dailyStructivt.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -15,6 +17,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -48,6 +51,35 @@ public class StIvtStructivtDailyServiceImpl extends ServiceImpl<StIvtStructivtDa
|
||||
list.addAll(dailyList);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 统计今日入库数、出库数
|
||||
*/
|
||||
JSONObject param = new JSONObject();
|
||||
// 入库数
|
||||
param.put("io_type", "0");
|
||||
List<JSONObject> inNumList = this.baseMapper.getIoNum(param);
|
||||
|
||||
// 出库数
|
||||
param.put("io_type", "1");
|
||||
List<JSONObject> outNumList = this.baseMapper.getIoNum(param);
|
||||
|
||||
// 整理数据
|
||||
for (StIvtStructivtDaily dao : list) {
|
||||
|
||||
List<JSONObject> jsonIn = inNumList.stream()
|
||||
.filter(row -> row.getString("material_id").equals(dao.getMaterial_id()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
dao.setIn_qty(ObjectUtil.isNotEmpty(jsonIn) ? jsonIn.get(0).getBigDecimal("io_num") : BigDecimal.valueOf(0));
|
||||
|
||||
List<JSONObject> jsonOut = outNumList.stream()
|
||||
.filter(row -> row.getString("material_id").equals(dao.getMaterial_id()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
dao.setOut_qty(ObjectUtil.isNotEmpty(jsonOut) ? jsonOut.get(0).getBigDecimal("io_num") : BigDecimal.valueOf(0));
|
||||
}
|
||||
|
||||
if (!CollectionUtils.isEmpty(list)){
|
||||
List<StIvtStructivtDaily> errorData = list.stream().filter(stIvtStructivtDaily -> StringUtils.isEmpty(stIvtStructivtDaily.getStor_id()) || StringUtils.isEmpty(stIvtStructivtDaily.getMaterial_id())).collect(Collectors.toList());
|
||||
if (!CollectionUtils.isEmpty(errorData)){
|
||||
|
||||
@@ -408,6 +408,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService{
|
||||
map.put("update_id", currentUserId);
|
||||
map.put("update_name", nickName);
|
||||
map.put("update_time", DateUtil.now());
|
||||
map.put("confirm_time", DateUtil.now());
|
||||
map.put("realproduceend_date", DateUtil.now());
|
||||
wo.update(map, "workorder_id = '" + workorder_id + "'");
|
||||
//2.设置实际数量:数量待确认: 是否需要从报工记录表统计
|
||||
|
||||
@@ -92,13 +92,13 @@ public class PdaProductIosController {
|
||||
}
|
||||
|
||||
@PostMapping("/bucket")
|
||||
@Log("根据订单获取订单物料信息")
|
||||
@Log("查询订单组盘记录")
|
||||
//("根据订单获取订单物料信息")
|
||||
public ResponseEntity<Object> bucket(@RequestBody JSONObject param) {
|
||||
String storagevehicleCode = param.getString("storagevehicle_code");
|
||||
List mstList= new ArrayList<>();
|
||||
if (param.getString("sale_code")!=null){
|
||||
mstList = bucketrecordService.getMstList(storagevehicleCode);
|
||||
mstList = bucketrecordService.getMstList(storagevehicleCode,param.getString("sale_code"));
|
||||
}else {
|
||||
List<Map<String, Object>> maps = bucketrecordService.listMaps(new QueryWrapper<MdPbBucketrecord>()
|
||||
.eq("storagevehicle_code", storagevehicleCode).eq("status", "1"));
|
||||
|
||||
@@ -5,6 +5,9 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.common.TableDataInfo;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.analysis_manage.productCapacity.service.dto.ProductCapQuery;
|
||||
import org.nl.wms.analysis_manage.qlmanage.dto.QualityQuery;
|
||||
import org.nl.wms.analysis_manage.scrapRate.service.dto.ScrapRateQuery;
|
||||
import org.nl.wms.analysis_manage.workingGoods.service.dto.ByProcessQuery;
|
||||
import org.nl.wms.product_manage.service.workorder.dao.PdmProduceWorkorder;
|
||||
import org.nl.wms.product_manage.service.workorder.dto.PdmProduceWorkorderDto;
|
||||
@@ -155,8 +158,41 @@ public interface IPdmProduceWorkorderService extends IService<PdmProduceWorkorde
|
||||
|
||||
List<Map> reportQuery(ReportQuery query);
|
||||
|
||||
/**
|
||||
* 在制品统计分析
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<Map> goodAnilysis(ByProcessQuery query);
|
||||
|
||||
/**
|
||||
* 不合格品分析
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<Map> scrapRate(ScrapRateQuery query);
|
||||
|
||||
/**
|
||||
* 不合格品分析
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<Map> productCap(ProductCapQuery query);
|
||||
|
||||
/**
|
||||
* 车间质量统计分析
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<Map> qualityAna(QualityQuery query);
|
||||
|
||||
/**
|
||||
* 车间工序质量统计分析
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<Map> qualityAnaByDevice(QualityQuery query);
|
||||
|
||||
void download(Map map, HttpServletResponse response)
|
||||
throws IOException;
|
||||
|
||||
|
||||
@@ -176,6 +176,18 @@ public class PdmProduceWorkorder implements Serializable{
|
||||
* 下发时间
|
||||
*/
|
||||
private String down_time;
|
||||
|
||||
/**
|
||||
* 开工时间
|
||||
*/
|
||||
private String open_time;
|
||||
|
||||
|
||||
/**
|
||||
* 增长率
|
||||
*/
|
||||
private BigDecimal slope;
|
||||
|
||||
/**
|
||||
* 完工人
|
||||
*/
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package org.nl.wms.product_manage.service.workorder.dao.mapper;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.analysis_manage.productCapacity.service.dto.ProductCapQuery;
|
||||
import org.nl.wms.analysis_manage.qlmanage.dto.QualityQuery;
|
||||
import org.nl.wms.analysis_manage.scrapRate.service.dto.ScrapRateQuery;
|
||||
import org.nl.wms.analysis_manage.workingGoods.service.dto.ByProcessQuery;
|
||||
import org.nl.wms.product_manage.service.workorder.dao.PdmProduceWorkorder;
|
||||
import org.nl.wms.product_manage.service.workorder.dto.PdmProduceWorkorderDto;
|
||||
@@ -56,4 +58,25 @@ public interface PdmProduceWorkorderMapper extends BaseMapper<PdmProduceWorkorde
|
||||
List<Map> queryAdjustWorkOrder(String device_code);
|
||||
|
||||
|
||||
/**
|
||||
* 不合格品统计
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<Map> scrapRate(ScrapRateQuery query);
|
||||
/**
|
||||
* 不合格品统计
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<Map> productCap(ProductCapQuery query);
|
||||
/**
|
||||
* 工序质量统计
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
List<Map> qualityAnalysis(QualityQuery query);
|
||||
|
||||
List<Map> qualityAnalysisByDevice(QualityQuery query);
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
LEFT JOIN md_me_materialbase material ON material.material_id = ShiftOrder.material_id
|
||||
LEFT JOIN PDM_BI_WorkProcedure pro ON pro.workprocedure_id = ShiftOrder.workprocedure_id
|
||||
LEFT JOIN sys_user users ON users.user_id = ShiftOrder.current_produce_person_id
|
||||
LEFT JOIN pdm_bi_device device ON ShiftOrder.device_code = device.device_code
|
||||
LEFT JOIN pdm_bi_device device ON ShiftOrder.device_code = device.device_code
|
||||
WHERE
|
||||
ShiftOrder.is_delete = '0'
|
||||
<if test="query.workorder_code != null and query.workorder_code != ''">
|
||||
@@ -31,41 +31,40 @@
|
||||
and find_in_set(ShiftOrder.workorder_status, #{query.order_status})
|
||||
</if>
|
||||
<if test="query.device_code != null and query.device_code != ''">
|
||||
and (ShiftOrder.device_code like concat('%',${query.device_code},'%') or ShiftOrder.device_name like
|
||||
concat('%',${query.device_code},'%'))
|
||||
and (ShiftOrder.device_code like concat('%',${query.device_code},'%') or ShiftOrder.device_name like concat('%',${query.device_code},'%'))
|
||||
</if>
|
||||
<if test="query.shift_type_scode != null and query.shift_type_scode != ''">
|
||||
and ShiftOrder.shift_type_scode = #{query.shift_type_scode}
|
||||
and ShiftOrder.shift_type_scode = #{query.shift_type_scode}
|
||||
</if>
|
||||
<if test="query.workprocedure_id != null and query.workprocedure_id != ''">
|
||||
and pro.workprocedure_id = #{query.workprocedure_id}
|
||||
and pro.workprocedure_id = #{query.workprocedure_id}
|
||||
</if>
|
||||
<if test="query.workprocedure_codes != null and query.workprocedure_codes != ''">
|
||||
and pro.workprocedure_code IN #{query.workprocedure_codes}
|
||||
and pro.workprocedure_code IN #{query.workprocedure_codes}
|
||||
</if>
|
||||
<if test="query.product_area != null and query.product_area != ''">
|
||||
and ShiftOrder.product_area = #{query.product_area}
|
||||
and ShiftOrder.product_area = #{query.product_area}
|
||||
</if>
|
||||
<if test="query.is_error != null and query.is_error != ''">
|
||||
and ShiftOrder.is_error = #{query.is_error}
|
||||
and ShiftOrder.is_error = #{query.is_error}
|
||||
</if>
|
||||
<if test="query.product_series != null and query.product_series != ''">
|
||||
and ShiftOrder.materialprocess_series in ${query.product_series}
|
||||
and ShiftOrder.materialprocess_series in ${query.product_series}
|
||||
</if>
|
||||
<if test="query.start_time != null and query.start_time != ''">
|
||||
and ShiftOrder.realproducestart_date >= #{query.start_time}
|
||||
and ShiftOrder.realproducestart_date >= #{query.start_time}
|
||||
</if>
|
||||
<if test="query.end_time != null and query.end_time != ''">
|
||||
and ShiftOrder.realproduceend_date <= #{query.end_time}
|
||||
and ShiftOrder.realproduceend_date <= #{query.end_time}
|
||||
</if>
|
||||
<if test="query.plan_start_time != null and query.plan_start_time != ''">
|
||||
and STR_TO_DATE(ShiftOrder.planproducestart_date, '%Y/%m/%d %H:%i:%s') >= #{query.plan_start_time}
|
||||
</if>
|
||||
<if test="query.plan_end_time != null and query.plan_end_time != ''">
|
||||
and STR_TO_DATE(ShiftOrder.planproduceend_date, '%Y/%m/%d %H:%i:%s') <= #{query.plan_end_time}
|
||||
and STR_TO_DATE(ShiftOrder.planproduceend_date, '%Y/%m/%d %H:%i:%s') <= #{query.plan_end_time}
|
||||
</if>
|
||||
<if test="query.sale_id != null and query.sale_id != ''">
|
||||
and ShiftOrder.sale_id like '%${query.sale_id}%'
|
||||
and ShiftOrder.sale_id like '%${query.sale_id}%'
|
||||
</if>
|
||||
<if test="query.material != null and query.material != ''">
|
||||
and (
|
||||
@@ -222,14 +221,7 @@
|
||||
</select>
|
||||
|
||||
<insert id="insertBatch" keyProperty="workorder_id" useGeneratedKeys="false">
|
||||
insert into pdm_produce_workorder(workorder_id,workorder_code, shift_type_scode, workprocedure_id, product_area,
|
||||
plan_qty, person_real_qty, dq_real_qty, material_id, material_weight, planproducestart_date,
|
||||
planproduceend_date, realproducestart_date, realproduceend_date, device_code, current_produce_person_id,
|
||||
is_canupdate_update, materialprocess_series, workorder_status, is_needmove, sale_id, create_type, is_error,
|
||||
error_info, remark, create_id, create_name, create_time, is_delete, report_qty, order_type_scode, nok_qty,
|
||||
repare_qty, down_id, down_name, down_time, confirm_id, confirm_name, confirm_time, aps_workorder_status,
|
||||
aps_update_flag, aps_update_time, package_ext, is_used_fxx, aps_update_inner_flag,
|
||||
update_id, update_name, update_time, device_name)
|
||||
insert into pdm_produce_workorder(workorder_id,workorder_code, shift_type_scode, workprocedure_id, product_area, plan_qty, person_real_qty, dq_real_qty, material_id, material_weight, planproducestart_date, planproduceend_date, realproducestart_date, realproduceend_date, device_code, current_produce_person_id, is_canupdate_update, materialprocess_series, workorder_status, is_needmove, sale_id, create_type, is_error, error_info, remark, create_id, create_name, create_time, is_delete, report_qty, order_type_scode, nok_qty, repare_qty, down_id, down_name, down_time, confirm_id, confirm_name, confirm_time, aps_workorder_status, aps_update_flag, aps_update_time, package_ext, is_used_fxx, aps_workprocedure_no, aps_update_inner_flag, update_id, update_name, update_time, device_name)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.workorder_id},#{entity.workorder_code}, #{entity.shift_type_scode}, #{entity.workprocedure_id},
|
||||
@@ -281,8 +273,8 @@
|
||||
<if test="product_area != null and product_area != ''">
|
||||
and pdm_produce_workorder.product_area >= #{product_area}
|
||||
</if>
|
||||
<if test="start_time != null and start_time != ''">
|
||||
and #{end_time} >= pdm_produce_workorder.create_time
|
||||
<if test="end_time != null and end_time != ''">
|
||||
and #{end_time} >= pdm_produce_workorder.create_time
|
||||
</if>
|
||||
<if test="blurry != null and blurry != ''">
|
||||
and (
|
||||
|
||||
@@ -7,7 +7,6 @@ import cn.hutool.poi.excel.ExcelUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
@@ -28,13 +27,15 @@ import org.nl.common.utils.api.RestBusinessTemplate;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.common.utils.FileUtil;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.wms.analysis_manage.productCapacity.service.dto.ProductCapQuery;
|
||||
import org.nl.wms.analysis_manage.qlmanage.dto.QualityQuery;
|
||||
import org.nl.wms.analysis_manage.scrapRate.service.dto.ScrapRateQuery;
|
||||
import org.nl.wms.analysis_manage.workingGoods.service.dto.ByProcessQuery;
|
||||
import org.nl.wms.ext_manage.acs.service.WmsToAcsService;
|
||||
import org.nl.wms.masterdata_manage.master.service.classstandard.IMdPbClassstandardService;
|
||||
import org.nl.wms.masterdata_manage.service.material.IMdMeMaterialbaseService;
|
||||
import org.nl.wms.masterdata_manage.service.material.dao.MdMeMaterialbase;
|
||||
import org.nl.wms.mps_manage.other.service.dto.ProduceshiftorderDto;
|
||||
import org.nl.wms.mps_manage.saleorder.service.IMpsSaleOrderService;
|
||||
import org.nl.wms.mps_manage.saleorder.service.dao.MpsSaleOrder;
|
||||
import org.nl.wms.mps_manage.saleorder.service.impl.MpsSaleOrderServiceImpl;
|
||||
import org.nl.wms.product_manage.service.workorder.dao.WorkorderRecord;
|
||||
@@ -203,7 +204,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
this.update(updateWrapper);
|
||||
});
|
||||
}
|
||||
this.update(new UpdateWrapper<PdmProduceWorkorder>().set("workorder_status", WorkerOrderEnum.SEND.getCode()).set("down_id", SecurityUtils.getCurrentUserId()).set("down_name", SecurityUtils.getCurrentNickName()).set("down_time", new Date()).in("workorder_id", ids));
|
||||
this.update(new UpdateWrapper<PdmProduceWorkorder>().set("workorder_status", WorkerOrderEnum.SEND.getCode()).set("down_id", SecurityUtils.getCurrentUserId()).set("down_name", SecurityUtils.getCurrentNickName()).set("update_time", new Date()).set("down_time", new Date()).in("workorder_id", ids));
|
||||
this.recordWorkOrder(OptionRecord.OptionEnum.UPDATE, ids.toArray(new String[0]));
|
||||
}
|
||||
|
||||
@@ -269,6 +270,9 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
workorder.setRealproduceend_date(DateUtil.now().replace("-", "/"));
|
||||
workorder.setWorkorder_status(WorkerOrderEnum.COMPLETE.getCode());
|
||||
workorder.setAps_workorder_status("B");
|
||||
workorder.setConfirm_time(DateUtil.now());
|
||||
workorder.setConfirm_id(SecurityUtils.getCurrentUserId());
|
||||
workorder.setConfirm_name(SecurityUtils.getCurrentNickName());
|
||||
}
|
||||
else{
|
||||
workorder.setWorkorder_status(WorkerOrderEnum.STOP.getCode());
|
||||
@@ -685,6 +689,7 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
workOrder.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
workOrder.setUpdate_name(SecurityUtils.getCurrentNickName());
|
||||
workOrder.setReal_qty(null);
|
||||
workOrder.setOpen_time(DateUtil.now());
|
||||
this.update(workOrder, new QueryWrapper<PdmProduceWorkorder>().eq("workorder_id", param.getString("workorder_id")));
|
||||
//开工为首道工序时,更新订单状态为开工
|
||||
PdmBiWorkprocedure isFirst = workprocedureService.getOne(new LambdaUpdateWrapper<PdmBiWorkprocedure>().eq(PdmBiWorkprocedure::getWorkprocedure_id, workOrder.getWorkprocedure_id()).eq(PdmBiWorkprocedure::getIs_first, 1));
|
||||
@@ -886,4 +891,27 @@ public class IPdmProduceWorkorderServiceImpl extends ServiceImpl<PdmProduceWorko
|
||||
public List<Map> queryAdjustWorkOrder(String device_code) {
|
||||
return pdmProduceWorkorderMapper.queryAdjustWorkOrder(device_code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> scrapRate(ScrapRateQuery query) {
|
||||
return this.baseMapper.scrapRate(query);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> productCap(ProductCapQuery query) {
|
||||
List<Map> maps = this.baseMapper.productCap(query);
|
||||
return maps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> qualityAna(QualityQuery query) {
|
||||
List<Map> maps = this.baseMapper.qualityAnalysis(query);
|
||||
return maps;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map> qualityAnaByDevice(QualityQuery query) {
|
||||
List<Map> maps = this.baseMapper.qualityAnalysisByDevice(query);
|
||||
return maps;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
|
||||
package org.nl.wms.stata_manage.rest;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.stata_manage.service.PhyivtService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @date 2022-06-28
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "收发存查询")
|
||||
@RequestMapping("/api/phyivt")
|
||||
@Slf4j
|
||||
public class PhyivtController {
|
||||
|
||||
private final PhyivtService phyivtService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("库存查询")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(phyivtService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
package org.nl.wms.stata_manage.rest;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.stata_manage.service.RealTimeIvtService;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @date 2022-06-28
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "实时库存统计分析")
|
||||
@RequestMapping("/api/realtimeivt")
|
||||
@Slf4j
|
||||
public class RealTimeIvtController {
|
||||
|
||||
private final RealTimeIvtService realTimeIvtService;
|
||||
|
||||
@GetMapping
|
||||
@ApiOperation("库存查询")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(realTimeIvtService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/autoWeb")
|
||||
@ApiOperation("饼图")
|
||||
public ResponseEntity<Object> autoWeb(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(realTimeIvtService.autoWeb(whereJson), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
package org.nl.wms.stata_manage.service;
|
||||
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务接口
|
||||
* @date 2022-06-28
|
||||
**/
|
||||
public interface PhyivtService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
|
||||
package org.nl.wms.stata_manage.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务接口
|
||||
* @date 2022-06-28
|
||||
**/
|
||||
public interface RealTimeIvtService {
|
||||
|
||||
/**
|
||||
* 查询数据分页
|
||||
*
|
||||
* @param whereJson 条件
|
||||
* @param page 分页参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> queryAll(Map whereJson, Pageable page);
|
||||
|
||||
|
||||
/**
|
||||
* 饼图数据获取
|
||||
* @return /
|
||||
*/
|
||||
JSONObject autoWeb( JSONObject whereJson );
|
||||
|
||||
/**
|
||||
* 根据仓库查询不同仓库得来类型
|
||||
* @param whereJson 、
|
||||
* @return 、
|
||||
*/
|
||||
List<JSONObject> queryIvt(Map whereJson);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package org.nl.wms.stata_manage.service.dto;
|
||||
public class StorUtil {
|
||||
public static final String STOR_YL = "1528627964823080960";
|
||||
public static final String STOR_CP = "1528627995269533696";
|
||||
public static final String STOR_BCP = "15286279952695336962";
|
||||
public static final String STOR_HR_BCP = "15286279952695336963";
|
||||
public static final String STOR_BJ = "15286279952695336977";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
|
||||
package org.nl.wms.stata_manage.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.utils.PageUtil;
|
||||
import org.nl.wms.masterdata_manage.storage.service.dailyStructivt.dao.StIvtStructivtDaily;
|
||||
import org.nl.wms.masterdata_manage.storage.service.dailyStructivt.dao.mapper.StIvtStructivtDailyMapper;
|
||||
import org.nl.wms.stata_manage.service.PhyivtService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务实现
|
||||
* @date 2022-06-28
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class PhyivtServiceImpl implements PhyivtService {
|
||||
|
||||
@Autowired
|
||||
private StIvtStructivtDailyMapper stIvtStructivtDailyMapper;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
|
||||
whereJson.put("begin_time", MapUtil.getStr(whereJson, "begin_time").substring(0,10));
|
||||
whereJson.put("end_time", MapUtil.getStr(whereJson, "end_time").substring(0,10));
|
||||
|
||||
List<JSONObject> phyIvtList = stIvtStructivtDailyMapper.getPhyIvt(whereJson);
|
||||
|
||||
// 计算期初数
|
||||
List<StIvtStructivtDaily> beginList = stIvtStructivtDailyMapper.selectList(
|
||||
new QueryWrapper<StIvtStructivtDaily>().lambda()
|
||||
.eq(StIvtStructivtDaily::getCreate_time, MapUtil.getStr(whereJson, "begin_time").substring(0, 10))
|
||||
);
|
||||
|
||||
for(JSONObject json : phyIvtList) {
|
||||
|
||||
List<StIvtStructivtDaily> dao = beginList.stream()
|
||||
.filter(row -> row.getMaterial_id().equals(json.getString("material_id")))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
json.put("begin_qty", ObjectUtil.isNotEmpty(dao) ? dao.get(0).getCanuse_qty() : 0);
|
||||
|
||||
}
|
||||
|
||||
// 处理分页
|
||||
Map<String, Object> json = PageUtil.toPage(
|
||||
PageUtil.toPage(page.getPageNumber(), page.getPageSize(), phyIvtList),
|
||||
phyIvtList.size()
|
||||
);
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
|
||||
package org.nl.wms.stata_manage.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.common.utils.PageUtil;
|
||||
import org.nl.wms.device_manage.ios.service.structIvt.dao.mapper.EmBiStructivtMapper;
|
||||
import org.nl.wms.stata_manage.service.RealTimeIvtService;
|
||||
import org.nl.wms.stata_manage.service.dto.StorUtil;
|
||||
import org.nl.wms.storage_manage.productmanage.service.structIvt.dao.mapper.StIvtStructivtCpMapper;
|
||||
import org.nl.wms.storage_manage.rawmanage.service.structIvt.dao.mapper.StIvtStructivtYlMapper;
|
||||
import org.nl.wms.storage_manage.semimanage.service.structIvt.dao.mapper.StIvtStructivtBcpMapper;
|
||||
import org.nl.wms.storage_manage.semimanagehr.service.structIvt.dao.mapper.StIvtStructivtHrBcpMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Liuxy
|
||||
* @description 服务实现
|
||||
* @date 2022-06-28
|
||||
**/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class RealTimeIvtServiceImpl implements RealTimeIvtService {
|
||||
|
||||
@Autowired
|
||||
private StIvtStructivtYlMapper stIvtStructivtYlMapper; // 原料
|
||||
|
||||
@Autowired
|
||||
private StIvtStructivtBcpMapper stIvtStructivtBcpMapper; // 半成品
|
||||
|
||||
@Autowired
|
||||
private StIvtStructivtCpMapper stIvtStructivtCpMapper; // 成品
|
||||
|
||||
@Autowired
|
||||
private StIvtStructivtHrBcpMapper stIvtStructivtHrBcpMapper; // 海柔半成品
|
||||
|
||||
@Autowired
|
||||
private EmBiStructivtMapper emBiStructivtMapper; // 备件
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
List<JSONObject> allList = queryIvt(whereJson);
|
||||
|
||||
// 组织分页
|
||||
Map<String, Object> json = PageUtil.toPage(
|
||||
PageUtil.toPage(page.getPageNumber(), page.getPageSize(), allList),
|
||||
allList.size()
|
||||
);
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject autoWeb(JSONObject whereJson) {
|
||||
List<JSONObject> allList = queryIvt(whereJson);
|
||||
|
||||
// 处理数据
|
||||
List<JSONObject> resultList = allList.stream()
|
||||
.map(row -> {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("name", row.getString("material_code"));
|
||||
jsonObject.put("value", row.getDoubleValue("pro"));
|
||||
return jsonObject;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("ivtList", resultList);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JSONObject> queryIvt(Map whereJson) {
|
||||
|
||||
String stor_id = MapUtil.getStr(whereJson, "stor_id");
|
||||
|
||||
List<JSONObject> result = new ArrayList<>();
|
||||
|
||||
switch (stor_id) {
|
||||
case StorUtil.STOR_YL :
|
||||
result = stIvtStructivtYlMapper.getIvtPor();
|
||||
break;
|
||||
|
||||
case StorUtil.STOR_BCP :
|
||||
result = stIvtStructivtBcpMapper.getIvtPor();
|
||||
break;
|
||||
|
||||
case StorUtil.STOR_CP :
|
||||
result = stIvtStructivtCpMapper.getIvtPor();
|
||||
break;
|
||||
|
||||
case StorUtil.STOR_HR_BCP :
|
||||
result = stIvtStructivtHrBcpMapper.getIvtPor();
|
||||
break;
|
||||
|
||||
case StorUtil.STOR_BJ :
|
||||
result = emBiStructivtMapper.getIvtPor();
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -33,4 +33,6 @@ public interface StIvtStructivtCpMapper extends BaseMapper<StIvtStructivtCp> {
|
||||
|
||||
List<Map> getStructAll(@Param("chanList") List<String> list);
|
||||
|
||||
List<JSONObject> getIvtPor();
|
||||
|
||||
}
|
||||
|
||||
@@ -236,4 +236,20 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getIvtPor" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
mater.material_spec,
|
||||
MAX(unit.unit_name) AS unit_name,
|
||||
SUM(ivt.canuse_qty) AS canuse_qty,
|
||||
ROUND(SUM(ivt.canuse_qty) / (SELECT SUM(canuse_qty) FROM st_ivt_structivt_cp) * 100,2) AS pro
|
||||
FROM
|
||||
st_ivt_structivt_cp ivt
|
||||
LEFT JOIN md_me_materialbase mater ON ivt.material_id = mater.material_id
|
||||
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = ivt.qty_unit_id
|
||||
|
||||
GROUP BY ivt.material_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.storage_manage.rawmanage.service.structIvt.dao.mapper;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.common.domain.query.PageQuery;
|
||||
import org.nl.wms.pcs_manage.service.purchase.dto.PurchaseOrderQuery;
|
||||
@@ -29,4 +30,6 @@ public interface StIvtStructivtYlMapper extends BaseMapper<StIvtStructivtYl> {
|
||||
List<Map> getSemiProductIvt(@Param("query") StructIvtYLQuery query);
|
||||
|
||||
List<Map> getStructIvt(@Param("query") StructIvtYLQuery query);
|
||||
|
||||
List<JSONObject> getIvtPor();
|
||||
}
|
||||
|
||||
@@ -192,4 +192,20 @@
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getIvtPor" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
mater.material_spec,
|
||||
MAX(unit.unit_name) AS unit_name,
|
||||
SUM(ivt.canuse_qty) AS canuse_qty,
|
||||
ROUND(SUM(ivt.canuse_qty) / (SELECT SUM(canuse_qty) FROM st_ivt_structivt_yl) * 100,2) AS pro
|
||||
FROM
|
||||
st_ivt_structivt_yl ivt
|
||||
LEFT JOIN md_me_materialbase mater ON ivt.material_id = mater.material_id
|
||||
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = ivt.qty_unit_id
|
||||
|
||||
GROUP BY ivt.material_id
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -38,4 +38,6 @@ public interface StIvtStructivtBcpMapper extends BaseMapper<StIvtStructivtBcp> {
|
||||
List<Map> getPdaBcpMaterialIvt(JSONObject jo);
|
||||
|
||||
StIvtStructivtBcp queryIvtOutOne(JSONObject json);
|
||||
|
||||
List<JSONObject> getIvtPor();
|
||||
}
|
||||
|
||||
@@ -271,4 +271,20 @@
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="getIvtPor" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
mater.material_spec,
|
||||
MAX(unit.unit_name) AS unit_name,
|
||||
SUM(ivt.canuse_qty) AS canuse_qty,
|
||||
ROUND(SUM(ivt.canuse_qty) / (SELECT SUM(canuse_qty) FROM st_ivt_structivt_bcp) * 100,2) AS pro
|
||||
FROM
|
||||
st_ivt_structivt_bcp ivt
|
||||
LEFT JOIN md_me_materialbase mater ON ivt.material_id = mater.material_id
|
||||
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = ivt.qty_unit_id
|
||||
|
||||
GROUP BY ivt.material_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -39,4 +39,7 @@ public interface StIvtStructivtHrBcpMapper extends BaseMapper<StIvtStructivtHrBc
|
||||
StIvtStructivtBcp queryIvtOutOne(JSONObject json);
|
||||
|
||||
List<Map> getBcpMoveIvt(@Param("query") StructIvtYLQuery query);
|
||||
|
||||
List<JSONObject> getIvtPor();
|
||||
|
||||
}
|
||||
|
||||
@@ -282,4 +282,20 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getIvtPor" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
mater.material_code,
|
||||
mater.material_name,
|
||||
mater.material_spec,
|
||||
MAX(unit.unit_name) AS unit_name,
|
||||
SUM(ivt.canuse_qty) AS canuse_qty,
|
||||
ROUND(SUM(ivt.canuse_qty) / (SELECT SUM(canuse_qty) FROM st_ivt_structivt_hr_bcp) * 100,2) AS pro
|
||||
FROM
|
||||
st_ivt_structivt_hr_bcp ivt
|
||||
LEFT JOIN md_me_materialbase mater ON ivt.material_id = mater.material_id
|
||||
LEFT JOIN md_pb_measureunit unit ON unit.measure_unit_id = ivt.qty_unit_id
|
||||
|
||||
GROUP BY ivt.material_id
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -2,7 +2,7 @@ spring:
|
||||
freemarker:
|
||||
check-template-location: false
|
||||
profiles:
|
||||
active: dev3
|
||||
active: prod
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
data:
|
||||
|
||||
@@ -148,6 +148,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
<springProfile name="dev3">
|
||||
<root level="debug">
|
||||
<appender-ref ref="CONSOLE"/>
|
||||
<appender-ref ref="esLogAppender"/>
|
||||
</root>
|
||||
|
||||
<logger name="jdbc.audit" level="ERROR" additivity="false">
|
||||
|
||||
Reference in New Issue
Block a user