rev:大屏改造成mybatis以及代码优化
This commit is contained in:
@@ -3,28 +3,39 @@ package org.nl.wms.ext_manage.bigScreen.service.impl;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.wms.ext_manage.bigScreen.SwitchOnOff;
|
||||
import org.nl.wms.ext_manage.bigScreen.WordOrderUtils;
|
||||
import org.nl.wms.ext_manage.bigScreen.service.ProductService;
|
||||
|
||||
import org.nl.wms.product_manage.service.produceshiftorder.dao.MpsBdProduceshiftorder;
|
||||
import org.nl.wms.product_manage.service.produceshiftorder.dao.mapper.MpsBdProduceshiftorderMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class ProductServiceImpl implements ProductService {
|
||||
|
||||
@Autowired
|
||||
private MpsBdProduceshiftorderMapper mpsBdProduceshiftorderMapper;
|
||||
|
||||
@Override
|
||||
public Map<String, Object> planReached(Map<String, String> param) {
|
||||
if (SwitchOnOff.type == 1){
|
||||
/* if (SwitchOnOff.type == 1){
|
||||
return WordOrderUtils.planReached();
|
||||
}
|
||||
String today = DateUtil.today();
|
||||
@@ -60,6 +71,61 @@ public class ProductServiceImpl implements ProductService {
|
||||
monthResult.put("joo1", joo1);
|
||||
monthResult.put("joo2", joo2);
|
||||
monthResult.put("joo3", joo3);
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("dayResult", dayResult);
|
||||
returnjo.put("monthResult", monthResult);
|
||||
return returnjo;*/
|
||||
|
||||
/*
|
||||
* mybatis 优化
|
||||
*/
|
||||
if (SwitchOnOff.type == 1){
|
||||
return WordOrderUtils.planReached();
|
||||
}
|
||||
String today = DateUtil.today();
|
||||
//1.计算当天的计划达成
|
||||
//01-弯头工段、02-综合工段、03-成品工段
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("produce_date", today);
|
||||
|
||||
map.put("worksection_type_scode", "01");
|
||||
JSONObject jo1 = mpsBdProduceshiftorderMapper.countTodayPlan(map);
|
||||
|
||||
map.put("worksection_type_scode", "02");
|
||||
JSONObject jo2 = mpsBdProduceshiftorderMapper.countTodayPlan(map);
|
||||
|
||||
|
||||
map.put("worksection_type_scode", "03");
|
||||
JSONObject jo3 = mpsBdProduceshiftorderMapper.countTodayPlan(map);
|
||||
|
||||
JSONObject dayResult = new JSONObject();
|
||||
dayResult.put("jo1", jo1);
|
||||
dayResult.put("jo2", jo2);
|
||||
dayResult.put("jo3", jo3);
|
||||
|
||||
//2.计算一个月的计划达成
|
||||
String beginOfMonth = DateUtil.formatTime(DateUtil.beginOfMonth(DateUtil.parseDate(today)));
|
||||
JSONObject monthResult = new JSONObject();
|
||||
map.put("end_produce_date", today);
|
||||
map.put("begin_produce_date", beginOfMonth);
|
||||
|
||||
map.put("worksection_type_scode", "01");
|
||||
JSONObject joo1 = mpsBdProduceshiftorderMapper.countMoonPlan(map);
|
||||
|
||||
map.put("worksection_type_scode", "02");
|
||||
JSONObject joo2 = mpsBdProduceshiftorderMapper.countMoonPlan(map);
|
||||
|
||||
|
||||
map.put("worksection_type_scode", "03");
|
||||
JSONObject joo3 = mpsBdProduceshiftorderMapper.countMoonPlan(map);
|
||||
|
||||
|
||||
monthResult.put("joo1", joo1);
|
||||
monthResult.put("joo2", joo2);
|
||||
monthResult.put("joo3", joo3);
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
@@ -70,7 +136,7 @@ public class ProductServiceImpl implements ProductService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> productSchedule(Map<String, String> param) {
|
||||
if (SwitchOnOff.type == 1){
|
||||
/* if (SwitchOnOff.type == 1){
|
||||
return WordOrderUtils.productSchedule();
|
||||
}
|
||||
String today = DateUtil.today();
|
||||
@@ -79,6 +145,25 @@ public class ProductServiceImpl implements ProductService {
|
||||
map.put("flag", "2");
|
||||
map.put("produce_date", today);
|
||||
JSONArray result = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().getResultJSONArray(0);
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("result", result);
|
||||
return returnjo;*/
|
||||
|
||||
/*
|
||||
* mybatis 优化
|
||||
*/
|
||||
if (SwitchOnOff.type == 1){
|
||||
return WordOrderUtils.productSchedule();
|
||||
}
|
||||
String today = DateUtil.today();
|
||||
//今日排产生产进度跟踪
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("produce_date", today);
|
||||
|
||||
List<Map> result = mpsBdProduceshiftorderMapper.productSchedule(map);
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
@@ -88,7 +173,7 @@ public class ProductServiceImpl implements ProductService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> output(Map<String, String> param) {
|
||||
if (SwitchOnOff.type == 1){
|
||||
/* if (SwitchOnOff.type == 1){
|
||||
return WordOrderUtils.output();
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
@@ -119,6 +204,58 @@ public class ProductServiceImpl implements ProductService {
|
||||
result.put("delayed_qty", delayed_qty);
|
||||
result.put("normal_qty", sum_qty - delayed_qty);
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("result", result);
|
||||
return returnjo;*/
|
||||
|
||||
|
||||
/*
|
||||
* mybatis 优化
|
||||
*/
|
||||
if (SwitchOnOff.type == 1){
|
||||
return WordOrderUtils.output();
|
||||
}
|
||||
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
String today = DateUtil.today();
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("produce_date", today);
|
||||
//统计产量方式一: 1 计算工单物料 2 计算每个物料清洗前一个工序 3拿着工序+物料 关联工单表 统计总数
|
||||
//1激光下料——推弯——清洗
|
||||
//2旋压-清洗
|
||||
//3盘管无屑下料-三通拉伸-镗孔-清洗
|
||||
//4直管无屑下料-镗孔-清洗
|
||||
//统计产量方式二: 只需要统计 推弯,旋压。镗孔 3个工序工单的数量 ('07','06','02')
|
||||
JSONObject joo = mpsBdProduceshiftorderMapper.countProduct(map);
|
||||
result.put("real_qty", joo.getString("real_qty"));
|
||||
result.put("plan_qty", joo.getString("plan_qty"));
|
||||
result.put("finish_rate", joo.getString("finish_rate"));
|
||||
|
||||
//统计工单个数
|
||||
int sum_qty = mpsBdProduceshiftorderMapper.selectCount(
|
||||
new QueryWrapper<MpsBdProduceshiftorder>().lambda()
|
||||
.eq(MpsBdProduceshiftorder::getIs_delete, "0")
|
||||
.eq(MpsBdProduceshiftorder::getProduce_date, today)
|
||||
.ne(MpsBdProduceshiftorder::getOrder_status, "00")
|
||||
);
|
||||
|
||||
//统计延时工单
|
||||
map.put("product_date", today);
|
||||
map.put("flag", "5");
|
||||
int delayed_qty = mpsBdProduceshiftorderMapper.selectCount(
|
||||
new QueryWrapper<MpsBdProduceshiftorder>().lambda()
|
||||
.eq(MpsBdProduceshiftorder::getProduce_date, today)
|
||||
.ne(MpsBdProduceshiftorder::getOrder_status, "00")
|
||||
.apply("realproduceend_date > planproduceend_date")
|
||||
);
|
||||
|
||||
result.put("sum_qty", sum_qty);
|
||||
result.put("delayed_qty", delayed_qty);
|
||||
result.put("normal_qty", sum_qty - delayed_qty);
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
@@ -126,10 +263,9 @@ public class ProductServiceImpl implements ProductService {
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> worksectionHarvest(Map<String, String> param) {
|
||||
if (SwitchOnOff.type == 1){
|
||||
/* if (SwitchOnOff.type == 1){
|
||||
return WordOrderUtils.worksectionHarvest();
|
||||
}
|
||||
//近一周工段产量
|
||||
@@ -141,6 +277,7 @@ public class ProductServiceImpl implements ProductService {
|
||||
DateTime dateTime = DateUtil.offsetDay(DateUtil.parse(DateUtil.now()), -i);
|
||||
dataArr.add(dateTime.toString().substring(0, 10));
|
||||
}
|
||||
|
||||
for (int i = 0; i < dataArr.size(); i++) {
|
||||
JSONObject jo = new JSONObject();
|
||||
String date = dataArr.get((dataArr.size() - i - 1)).toString();
|
||||
@@ -161,6 +298,77 @@ public class ProductServiceImpl implements ProductService {
|
||||
jo.put("date", date.substring(5, date.length()));
|
||||
results.add(jo);
|
||||
}
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("result", results);
|
||||
return returnjo;*/
|
||||
|
||||
|
||||
/*
|
||||
* mybatis 优化
|
||||
*/
|
||||
if (SwitchOnOff.type == 1){
|
||||
return WordOrderUtils.worksectionHarvest();
|
||||
}
|
||||
|
||||
//近一周工段产量
|
||||
//获取一周的日期
|
||||
JSONArray dataArr = new JSONArray();
|
||||
JSONArray results = new JSONArray();
|
||||
|
||||
for (int i = 0; i < 7; i++) {
|
||||
DateTime dateTime = DateUtil.offsetDay(DateUtil.parse(DateUtil.now()), -i);
|
||||
dataArr.add(dateTime.toString().substring(0, 10));
|
||||
}
|
||||
|
||||
// 7天日期集合
|
||||
List<String> strList = JSONArray.parseArray(JSON.toJSONString(dataArr), String.class);
|
||||
|
||||
// 查询所有工段7天的产量
|
||||
List<JSONObject> allList = mpsBdProduceshiftorderMapper.workSectionHarvest(strList);
|
||||
|
||||
// 处理每天的数据
|
||||
for (int i = 0; i < dataArr.size(); i++) {
|
||||
JSONObject jo = new JSONObject();
|
||||
String date = dataArr.get((dataArr.size() - i - 1)).toString();
|
||||
|
||||
// 根据工段分组
|
||||
Map<String, List<JSONObject>> mapList = allList.stream()
|
||||
.collect(Collectors.groupingBy(row -> row.getString("worksection_type_scode")));
|
||||
|
||||
// 定义数据
|
||||
double elbow_qty = 0; // 弯头工段
|
||||
double comprehensive_qty = 0; // 综合工段
|
||||
double end_product_qty = 0; // 成品工段
|
||||
|
||||
// 处理数据
|
||||
for (String worksection_type_scode : mapList.keySet()) {
|
||||
List<JSONObject> groupList = mapList.get(worksection_type_scode);
|
||||
|
||||
double real_qty = groupList.stream()
|
||||
.filter(row -> date.equals(row.getString("produce_date")))
|
||||
.map(row -> row.getBigDecimal("real_qty"))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add)
|
||||
.doubleValue();
|
||||
|
||||
if ("01".equals(worksection_type_scode)) {
|
||||
elbow_qty = real_qty;
|
||||
} else if ("02".equals(worksection_type_scode)) {
|
||||
comprehensive_qty = real_qty;
|
||||
} else {
|
||||
end_product_qty = real_qty;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
jo.put("elbow_qty",elbow_qty);
|
||||
jo.put("comprehensive_qty",comprehensive_qty);
|
||||
jo.put("end_product_qty",end_product_qty);
|
||||
jo.put("date", date.substring(5, date.length()));
|
||||
results.add(jo);
|
||||
}
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
@@ -170,7 +378,7 @@ public class ProductServiceImpl implements ProductService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> topHarvest(Map<String, String> param) {
|
||||
if (SwitchOnOff.type == 1){
|
||||
/* if (SwitchOnOff.type == 1){
|
||||
return WordOrderUtils.topHarvest();
|
||||
}
|
||||
String today = DateUtil.today();
|
||||
@@ -179,6 +387,27 @@ public class ProductServiceImpl implements ProductService {
|
||||
map.put("flag", "10");
|
||||
map.put("produce_date", today);
|
||||
JSONArray results = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().getResultJSONArray(0);
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("result", results);
|
||||
return returnjo;*/
|
||||
|
||||
/*
|
||||
* mybatis 优化
|
||||
*/
|
||||
if (SwitchOnOff.type == 1){
|
||||
return WordOrderUtils.topHarvest();
|
||||
}
|
||||
|
||||
//今日Top10产量
|
||||
String today = DateUtil.today();
|
||||
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("produce_date", today);
|
||||
|
||||
List<Map> results = mpsBdProduceshiftorderMapper.topHarvest(map);
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
@@ -188,7 +417,7 @@ public class ProductServiceImpl implements ProductService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> monthHarvest(Map<String, String> param) {
|
||||
if (SwitchOnOff.type == 1){
|
||||
/* if (SwitchOnOff.type == 1){
|
||||
return WordOrderUtils.monthHarvest();
|
||||
}
|
||||
//30天产量走势
|
||||
@@ -215,6 +444,49 @@ public class ProductServiceImpl implements ProductService {
|
||||
jo.put("date", date.substring(5, date.length()));
|
||||
results.add(jo);
|
||||
}
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("result", results);
|
||||
return returnjo;*/
|
||||
|
||||
/*
|
||||
* mybatis 优化
|
||||
*/
|
||||
if (SwitchOnOff.type == 1){
|
||||
return WordOrderUtils.monthHarvest();
|
||||
}
|
||||
|
||||
//30天产量走势
|
||||
JSONArray dataArr = new JSONArray();
|
||||
JSONArray results = new JSONArray();
|
||||
for (int i = 0; i < 30; i++) {
|
||||
DateTime dateTime = DateUtil.offsetDay(DateUtil.parse(DateUtil.now()), -i);
|
||||
dataArr.add(dateTime.toString().substring(0, 10));
|
||||
}
|
||||
|
||||
// 30天日期list数据
|
||||
List<String> strList = JSONArray.parseArray(JSON.toJSONString(dataArr), String.class);
|
||||
|
||||
// 30内所有数据
|
||||
List<JSONObject> allList = mpsBdProduceshiftorderMapper.monthHarvest(strList);
|
||||
|
||||
// 处理数据
|
||||
for (int i = 0; i < dataArr.size(); i++) {
|
||||
String date = dataArr.get(dataArr.size() - i - 1).toString();
|
||||
|
||||
// 处理每一天数据
|
||||
BigDecimal real_qty = allList.stream()
|
||||
.filter(row -> date.equals(row.getString("produce_date")))
|
||||
.map(row -> row.getBigDecimal("real_qty"))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("real_qty", real_qty);
|
||||
jo.put("date", date.substring(5, date.length()));
|
||||
results.add(jo);
|
||||
}
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
@@ -224,7 +496,7 @@ public class ProductServiceImpl implements ProductService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> unfinishOrder(Map<String, String> param) {
|
||||
if (SwitchOnOff.type == 1){
|
||||
/* if (SwitchOnOff.type == 1){
|
||||
return WordOrderUtils.unfinishOrder();
|
||||
}
|
||||
String today = DateUtil.today();
|
||||
@@ -232,6 +504,26 @@ public class ProductServiceImpl implements ProductService {
|
||||
map.put("flag", "11");
|
||||
map.put("produce_date", today);
|
||||
JSONArray results = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().getResultJSONArray(0);
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("result", results);
|
||||
return returnjo;*/
|
||||
|
||||
/*
|
||||
* mybatis 优化
|
||||
*/
|
||||
if (SwitchOnOff.type == 1){
|
||||
return WordOrderUtils.unfinishOrder();
|
||||
}
|
||||
|
||||
String today = DateUtil.today();
|
||||
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("produce_date_today", today);
|
||||
|
||||
List<JSONObject> results = mpsBdProduceshiftorderMapper.unfinishOrder(map);
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
@@ -241,7 +533,7 @@ public class ProductServiceImpl implements ProductService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> monthOrder(Map<String, String> param) {
|
||||
if (SwitchOnOff.type == 1){
|
||||
/* if (SwitchOnOff.type == 1){
|
||||
return WordOrderUtils.monthOrder();
|
||||
}
|
||||
//计算前9种物料产能
|
||||
@@ -273,6 +565,50 @@ public class ProductServiceImpl implements ProductService {
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("result", results);
|
||||
return returnjo;*/
|
||||
|
||||
/*
|
||||
* mybatis 优化
|
||||
*/
|
||||
if (SwitchOnOff.type == 1){
|
||||
return WordOrderUtils.monthOrder();
|
||||
}
|
||||
|
||||
//计算前9种物料产能
|
||||
String today = DateUtil.today();
|
||||
String beginOfMonth = DateUtil.formatTime(DateUtil.beginOfMonth(DateUtil.parseDate(today)));
|
||||
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("produce_date", today);
|
||||
map.put("end_produce_date", today);
|
||||
map.put("begin_produce_date", beginOfMonth);
|
||||
|
||||
List<JSONObject> results = mpsBdProduceshiftorderMapper.topNineProduct(map);
|
||||
|
||||
//计算所有的产能
|
||||
int sum_count = mpsBdProduceshiftorderMapper.allProduct(map).getIntValue("real_qty");
|
||||
|
||||
// 前9种物料之和
|
||||
int count_num_flag = results.stream()
|
||||
.map(row -> row.getBigDecimal("real_qty"))
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add)
|
||||
.intValue();
|
||||
|
||||
//如果有9种物料则需要计算其他
|
||||
if (results.size() == 9) {
|
||||
if (count_num_flag < sum_count) {
|
||||
JSONObject joo = new JSONObject();
|
||||
joo.put("material_name", "其他");
|
||||
joo.put("material_spec", "其他");
|
||||
joo.put("real_qty", sum_count - count_num_flag);
|
||||
results.add(joo);
|
||||
}
|
||||
}
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.nl.wms.product_manage.controller.produceshiftorder;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.product_manage.service.produceshiftorder.IMpsBdProduceshiftorderService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生产班次工单表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-08-22
|
||||
*/
|
||||
@RestController
|
||||
@Api(tags = "工单")
|
||||
@RequestMapping("api/mpsBdProduceshiftorder")
|
||||
@Slf4j
|
||||
public class MpsBdProduceshiftorderController {
|
||||
|
||||
@Autowired
|
||||
private IMpsBdProduceshiftorderService iMpsBdProduceshiftorderService;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.nl.wms.product_manage.service.produceshiftorder;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.nl.wms.product_manage.service.produceshiftorder.dao.MpsBdProduceshiftorder;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生产班次工单表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-08-22
|
||||
*/
|
||||
public interface IMpsBdProduceshiftorderService extends IService<MpsBdProduceshiftorder> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
package org.nl.wms.product_manage.service.produceshiftorder.dao;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生产班次工单表
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-08-22
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("mps_bd_produceshiftorder")
|
||||
public class MpsBdProduceshiftorder implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 生产班次工单标识
|
||||
*/
|
||||
private String produceorder_id;
|
||||
|
||||
/**
|
||||
* 生产班次工单编号
|
||||
*/
|
||||
private String produceorder_code;
|
||||
|
||||
/**
|
||||
* 机台工单号
|
||||
*/
|
||||
private String producedeviceorder_code;
|
||||
|
||||
/**
|
||||
* 班次类型
|
||||
*/
|
||||
private String shift_type_scode;
|
||||
|
||||
/**
|
||||
* 工序标识
|
||||
*/
|
||||
private String workprocedure_id;
|
||||
|
||||
/**
|
||||
* 生产日期
|
||||
*/
|
||||
private String produce_date;
|
||||
|
||||
/**
|
||||
* 计划数量
|
||||
*/
|
||||
private BigDecimal plan_qty;
|
||||
|
||||
/**
|
||||
* 实际数量
|
||||
*/
|
||||
private BigDecimal real_qty;
|
||||
|
||||
/**
|
||||
* 报工数量
|
||||
*/
|
||||
private BigDecimal report_qty;
|
||||
|
||||
/**
|
||||
* 物料标识
|
||||
*/
|
||||
private String material_id;
|
||||
|
||||
/**
|
||||
* 物料单重
|
||||
*/
|
||||
private BigDecimal material_weight;
|
||||
|
||||
/**
|
||||
* 计划生产开始时间
|
||||
*/
|
||||
private String planproducestart_date;
|
||||
|
||||
/**
|
||||
* 计划生产结束时间
|
||||
*/
|
||||
private String planproduceend_date;
|
||||
|
||||
/**
|
||||
* 实际生产开始时间
|
||||
*/
|
||||
private String realproducestart_date;
|
||||
|
||||
/**
|
||||
* 实际生产结束时间
|
||||
*/
|
||||
private String realproduceend_date;
|
||||
|
||||
/**
|
||||
* 工单状态
|
||||
*/
|
||||
private String order_status;
|
||||
|
||||
/**
|
||||
* 是否搬运
|
||||
*/
|
||||
private String is_needmove;
|
||||
|
||||
/**
|
||||
* 工单类型
|
||||
*/
|
||||
private String order_type_scode;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String create_id;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String create_name;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String create_time;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String update_optid;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String update_optname;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String update_time;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
private String sysdeptid;
|
||||
|
||||
/**
|
||||
* 公司ID
|
||||
*/
|
||||
private String syscompanyid;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
private String is_delete;
|
||||
|
||||
/**
|
||||
* 生产设备标识
|
||||
*/
|
||||
private String device_id;
|
||||
|
||||
/**
|
||||
* 是否允许操作工修改报工数量
|
||||
*/
|
||||
private String is_canupdate_update;
|
||||
|
||||
/**
|
||||
* 销售单标识
|
||||
*/
|
||||
private String sale_id;
|
||||
|
||||
private String jockey_id;
|
||||
|
||||
private String is_error;
|
||||
|
||||
private String error_info;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package org.nl.wms.product_manage.service.produceshiftorder.dao.mapper;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.nl.wms.product_manage.service.produceshiftorder.dao.MpsBdProduceshiftorder;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生产班次工单表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-08-22
|
||||
*/
|
||||
public interface MpsBdProduceshiftorderMapper extends BaseMapper<MpsBdProduceshiftorder> {
|
||||
|
||||
/**
|
||||
* 大屏数据 - 计划达成 - 计算当天计划达成
|
||||
* @param json /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject countTodayPlan(JSONObject json);
|
||||
|
||||
/**
|
||||
* 大屏数据 - 计划达成 - 计算一个月计划达成
|
||||
* @param json /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject countMoonPlan(JSONObject json);
|
||||
|
||||
/**
|
||||
* 大屏数据 - 今日排产生产进度跟踪
|
||||
* @param json /
|
||||
* @return /
|
||||
*/
|
||||
List<Map> productSchedule(JSONObject json);
|
||||
|
||||
/**
|
||||
* 大屏数据 - 今日产量 - 统计产量
|
||||
* @param json /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject countProduct(JSONObject json);
|
||||
|
||||
/**
|
||||
* 大屏数据 - 近一周工段产量
|
||||
* @param list /
|
||||
* @return /
|
||||
*/
|
||||
List<JSONObject> workSectionHarvest(@Param("chanList") List<String> list);
|
||||
|
||||
/**
|
||||
* 大屏数据 - 今日Top10产量
|
||||
* @param json /
|
||||
* @return /
|
||||
*/
|
||||
List<Map> topHarvest(JSONObject json);
|
||||
|
||||
/**
|
||||
* 大屏数据 - 30天产量走势
|
||||
* @param list /
|
||||
* @return /
|
||||
*/
|
||||
List<JSONObject> monthHarvest(@Param("chanList") List<String> list);
|
||||
|
||||
/**
|
||||
* 大屏数据 - 今日未完成订单
|
||||
* @param json /
|
||||
* @return /
|
||||
*/
|
||||
List<JSONObject> unfinishOrder(JSONObject json);
|
||||
|
||||
/**
|
||||
* 大屏数据 - 30天生产订单分布 - 前9产能
|
||||
* @param json /
|
||||
* @return /
|
||||
*/
|
||||
List<JSONObject> topNineProduct(JSONObject json);
|
||||
|
||||
/**
|
||||
* 大屏数据 - 30天生产订单分布 - 计算所有产能
|
||||
* @param json /
|
||||
* @return /
|
||||
*/
|
||||
JSONObject allProduct(JSONObject json);
|
||||
}
|
||||
@@ -0,0 +1,257 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.nl.wms.product_manage.service.produceshiftorder.dao.mapper.MpsBdProduceshiftorderMapper">
|
||||
|
||||
<select id="countTodayPlan" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
IFNULL(sum( shiftorder.real_qty ),0) AS real_qty,
|
||||
IFNULL(sum( shiftorder.plan_qty ),0) AS plan_qty,
|
||||
IFNULL(convert(sum( shiftorder.real_qty )/sum( shiftorder.plan_qty ),DECIMAL(10,2))*100,0) AS finish_rate
|
||||
FROM
|
||||
mps_bd_produceshiftorder shiftorder
|
||||
LEFT JOIN pdm_bi_workprocedure workprocedure ON shiftorder.workprocedure_id = workprocedure.workprocedure_id
|
||||
LEFT JOIN sys_dict_detail sys ON sys.VALUE= workprocedure.worksection_type_scode AND sys.dict_id = '87'
|
||||
<where>
|
||||
shiftorder.is_delete='0'
|
||||
and shiftorder.order_status != '00'
|
||||
|
||||
<if test="worksection_type_scode != null and worksection_type_scode != ''">
|
||||
and workprocedure.worksection_type_scode = #{worksection_type_scode}
|
||||
</if>
|
||||
|
||||
<if test="produce_date != null and produce_date != ''">
|
||||
and shiftorder.produce_date = #{produce_date}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="countMoonPlan" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
IFNULL(sum( shiftorder.real_qty ),0) AS real_qty,
|
||||
IFNULL(sum( shiftorder.plan_qty ),0) AS plan_qty,
|
||||
IFNULL(convert(sum( shiftorder.real_qty )/sum( shiftorder.plan_qty ),DECIMAL(10,2))*100,0) AS finish_rate
|
||||
FROM
|
||||
mps_bd_produceshiftorder shiftorder
|
||||
LEFT JOIN pdm_bi_workprocedure workprocedure ON shiftorder.workprocedure_id = workprocedure.workprocedure_id
|
||||
LEFT JOIN sys_dict_detail sys ON sys.VALUE= workprocedure.worksection_type_scode AND sys.dict_id = '87'
|
||||
<where>
|
||||
shiftorder.is_delete='0'
|
||||
|
||||
<if test="worksection_type_scode != null and worksection_type_scode != ''">
|
||||
and workprocedure.worksection_type_scode = #{worksection_type_scode}
|
||||
</if>
|
||||
|
||||
<if test="end_produce_date != null and end_produce_date != ''">
|
||||
and shiftorder.produce_date <= #{end_produce_date}
|
||||
</if>
|
||||
|
||||
<if test="begin_produce_date != null and begin_produce_date != ''">
|
||||
and shiftorder.produce_date >= #{begin_produce_date}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="productSchedule" resultType="java.util.Map">
|
||||
SELECT
|
||||
shiftorder.produceorder_code,
|
||||
shiftorder.plan_qty,
|
||||
shiftorder.real_qty,
|
||||
(shiftorder.plan_qty - shiftorder.real_qty) AS gap_qty,
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
material.material_spec,
|
||||
CONVERT ( ( shiftorder.real_qty / shiftorder.plan_qty ), DECIMAL ( 10, 3 ) ) * 100 AS finish_rate
|
||||
FROM
|
||||
mps_bd_produceshiftorder shiftorder
|
||||
LEFT join md_me_materialbase material on material.material_id =shiftorder.material_id
|
||||
<where>
|
||||
shiftorder.is_delete='0'
|
||||
|
||||
<if test="produce_date != null and produce_date != ''">
|
||||
and shiftorder.produce_date = #{produce_date}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="countProduct" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
IFNULL(sum( real_qty ),0) AS real_qty,
|
||||
IFNULL(sum( plan_qty ),0) AS plan_qty,
|
||||
IFNULL(CONVERT ( sum( shiftorder.real_qty ) / sum( shiftorder.plan_qty ), DECIMAL ( 10, 3 ) ) * 100,0) AS finish_rate
|
||||
FROM
|
||||
mps_bd_produceshiftorder shiftorder
|
||||
LEFT JOIN pdm_bi_workprocedure workprocedure ON workprocedure.workprocedure_id = shiftorder.workprocedure_id
|
||||
<where>
|
||||
shiftorder.is_delete='0'
|
||||
and shiftorder.order_status != '00'
|
||||
and workprocedure.workprocedure_code IN ( '07', '06', '02' )
|
||||
|
||||
<if test="produce_date != null and produce_date != ''">
|
||||
and shiftorder.produce_date = #{produce_date}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="workSectionHarvest" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
IFNULL(sum( real_qty ),0) AS real_qty,
|
||||
IFNULL(sum( plan_qty ),0) AS plan_qty,
|
||||
IFNULL(CONVERT ( sum( shiftorder.real_qty ) / sum( shiftorder.plan_qty ), DECIMAL ( 10, 3 ) ) * 100,0) AS finish_rate,
|
||||
shiftorder.produce_date,
|
||||
workprocedure.worksection_type_scode
|
||||
FROM
|
||||
mps_bd_produceshiftorder shiftorder
|
||||
LEFT JOIN pdm_bi_workprocedure workprocedure ON shiftorder.workprocedure_id = workprocedure.workprocedure_id
|
||||
LEFT JOIN sys_dict_detail sys ON sys.VALUE= workprocedure.worksection_type_scode AND sys.dict_id = '87'
|
||||
<where>
|
||||
shiftorder.is_delete='0'
|
||||
and workprocedure.worksection_type_scode in ('01','02','03')
|
||||
and shiftorder.produce_date IN
|
||||
<foreach collection="chanList" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
GROUP BY shiftorder.produce_date,workprocedure.worksection_type_scode
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="topHarvest" resultType="java.util.Map">
|
||||
SELECT
|
||||
shiftorder.material_id,
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
material.material_spec,
|
||||
sum( real_qty ) AS real_qty
|
||||
FROM
|
||||
mps_bd_produceshiftorder shiftorder
|
||||
LEFT JOIN pdm_bi_workprocedure workprocedure ON shiftorder.workprocedure_id = workprocedure.workprocedure_id
|
||||
LEFT JOIN md_me_materialbase material on material.material_id =shiftorder.material_id
|
||||
<where>
|
||||
shiftorder.is_delete='0'
|
||||
|
||||
<if test="produce_date != null and produce_date != ''">
|
||||
and shiftorder.produce_date= #{produce_date}
|
||||
</if>
|
||||
|
||||
GROUP BY
|
||||
shiftorder.material_id,
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
material.material_spec
|
||||
ORDER BY
|
||||
real_qty desc
|
||||
LIMIT 0,10
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="monthHarvest" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
IFNULL(sum( real_qty ),0) AS real_qty,
|
||||
shiftorder.produce_date
|
||||
FROM
|
||||
mps_bd_produceshiftorder shiftorder
|
||||
LEFT JOIN pdm_bi_workprocedure workprocedure ON shiftorder.workprocedure_id = workprocedure.workprocedure_id
|
||||
LEFT JOIN sys_dict_detail sys ON sys.VALUE= workprocedure.worksection_type_scode AND sys.dict_id = '87'
|
||||
<where>
|
||||
shiftorder.is_delete='0'
|
||||
and workprocedure.workprocedure_code IN ( '07', '06', '02' )
|
||||
and shiftorder.produce_date in
|
||||
<foreach collection="chanList" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
||||
GROUP BY worksection_type_scode,shiftorder.produce_date
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="unfinishOrder" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
shiftorder.produceorder_code,
|
||||
shiftorder.material_id,
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
material.material_spec,
|
||||
shiftorder. real_qty,
|
||||
shiftorder.plan_qty,
|
||||
shiftorder.plan_qty -shiftorder. real_qty as gap_qty,
|
||||
shiftorder.produce_date as date
|
||||
FROM
|
||||
mps_bd_produceshiftorder shiftorder
|
||||
LEFT JOIN pdm_bi_workprocedure workprocedure ON shiftorder.workprocedure_id = workprocedure.workprocedure_id
|
||||
LEFT JOIN sys_dict_detail sys ON sys.VALUE= workprocedure.worksection_type_scode AND sys.dict_id = '87'
|
||||
LEFT JOIN md_me_materialbase material on material.material_id =shiftorder.material_id
|
||||
<where>
|
||||
shiftorder.is_delete='0'
|
||||
and shiftorder.order_status != '00'
|
||||
and workprocedure.workprocedure_code IN ( '07', '06', '02' )
|
||||
and shiftorder. real_qty < shiftorder.plan_qty
|
||||
|
||||
<if test="produce_date_today != null and produce_date_today != ''">
|
||||
and shiftorder.produce_date = #{produce_date_today}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="topNineProduct" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
shiftorder.material_id,
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
material.material_spec,
|
||||
sum( real_qty ) AS real_qty
|
||||
FROM
|
||||
mps_bd_produceshiftorder shiftorder
|
||||
LEFT JOIN pdm_bi_workprocedure workprocedure ON shiftorder.workprocedure_id = workprocedure.workprocedure_id
|
||||
LEFT JOIN md_me_materialbase material on material.material_id =shiftorder.material_id
|
||||
<where>
|
||||
shiftorder.is_delete='0'
|
||||
|
||||
<if test="end_produce_date != null and end_produce_date != ''">
|
||||
and shiftorder.produce_date <= #{end_produce_date}
|
||||
</if>
|
||||
|
||||
<if test="begin_produce_date != null and begin_produce_date != ''">
|
||||
and shiftorder.produce_date >= #{begin_produce_date}
|
||||
</if>
|
||||
|
||||
GROUP BY
|
||||
shiftorder.material_id,
|
||||
material.material_code,
|
||||
material.material_spec,
|
||||
material.material_name
|
||||
ORDER BY real_qty desc
|
||||
LIMIT 0,9
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="allProduct" resultType="com.alibaba.fastjson.JSONObject">
|
||||
SELECT
|
||||
IFNULL(sum( real_qty ),0) AS real_qty
|
||||
FROM
|
||||
mps_bd_produceshiftorder shiftorder
|
||||
LEFT JOIN pdm_bi_workprocedure workprocedure ON shiftorder.workprocedure_id = workprocedure.workprocedure_id
|
||||
LEFT JOIN md_me_materialbase material on material.material_id =shiftorder.material_id
|
||||
<where>
|
||||
shiftorder.is_delete='0'
|
||||
|
||||
<if test="end_produce_date != null and end_produce_date != ''">
|
||||
and shiftorder.produce_date <= #{end_produce_date}
|
||||
</if>
|
||||
|
||||
<if test="begin_produce_date != null and begin_produce_date != ''">
|
||||
and shiftorder.produce_date >= #{begin_produce_date}
|
||||
</if>
|
||||
|
||||
</where>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.nl.wms.product_manage.service.produceshiftorder.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.nl.wms.product_manage.service.produceshiftorder.IMpsBdProduceshiftorderService;
|
||||
import org.nl.wms.product_manage.service.produceshiftorder.dao.MpsBdProduceshiftorder;
|
||||
import org.nl.wms.product_manage.service.produceshiftorder.dao.mapper.MpsBdProduceshiftorderMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 生产班次工单表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author generator
|
||||
* @since 2023-08-22
|
||||
*/
|
||||
@Service
|
||||
public class MpsBdProduceshiftorderServiceImpl extends ServiceImpl<MpsBdProduceshiftorderMapper, MpsBdProduceshiftorder> implements IMpsBdProduceshiftorderService {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user