forked from I3-YF/i3plus-mes-yfai
jx 生产线运行看板
parent
6e5b385fac
commit
5bcbb31f3c
@ -0,0 +1,22 @@
|
||||
package cn.estsh.i3plus.ext.mes.api.busi.jx;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: wangjie
|
||||
* @CreateDate: 2021/01/19 15:06 下午
|
||||
* @Description: 嘉兴产线运行看板
|
||||
**/
|
||||
public interface IJxCenterWorkingBoardService {
|
||||
|
||||
/**
|
||||
* 嘉兴产线运行看板
|
||||
* @param dataMap 参数数据
|
||||
* @return 产线运行看板数据
|
||||
*/
|
||||
@ApiOperation(value = "嘉兴产线运行看板", notes = "嘉兴产线运行看板")
|
||||
Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap);
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package cn.estsh.i3plus.ext.mes.apiservice.controller.busi.jx;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.api.busi.jx.IJxCenterWorkingBoardService;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
|
||||
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
||||
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
||||
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
|
||||
import cn.estsh.impp.framework.base.controller.MesBaseController;
|
||||
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
||||
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
|
||||
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
||||
import cn.estsh.impp.framework.boot.util.ResultBean;
|
||||
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author: wangjie
|
||||
* @CreateDate: 2021/01/19 15:37
|
||||
* @Description:
|
||||
**/
|
||||
@RestController
|
||||
@RequestMapping(CommonConstWords.BASE_URL_MES)
|
||||
@Api(tags = "嘉兴产线运行看板")
|
||||
public class JxCenterWorkingBoardController extends MesBaseController {
|
||||
|
||||
@Autowired
|
||||
private IJxCenterWorkingBoardService centerWorkingBoardService;
|
||||
|
||||
@PostMapping(value = "/ext/jx/center-working-board/query")
|
||||
@ApiOperation(value = "嘉兴产线运行看板")
|
||||
public ResultBean queryCenterWorkingBoardData(@RequestBody Map<String, Object> dataMap) {
|
||||
try {
|
||||
if (!dataMap.containsKey(MesExtConstWords.FLAG))
|
||||
throw ImppExceptionBuilder.newInstance()
|
||||
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
||||
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
||||
.setErrorDetail("参数缺失业务标志[flag]!")
|
||||
.build();
|
||||
dataMap.put(MesExtConstWords.ORGANIZE_CODE, AuthUtil.getOrganize().getOrganizeCode());
|
||||
dataMap.put(MesExtConstWords.START_TIME, TimeTool.getNowTime(true));
|
||||
return ResultBean.success("查询成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultMap(centerWorkingBoardService.queryCenterWorkingBoardData(dataMap));
|
||||
} catch (ImppBusiException busExcep) {
|
||||
return ResultBean.fail(busExcep);
|
||||
} catch (Exception e) {
|
||||
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,151 @@
|
||||
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.busi.jx;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.api.busi.jx.IJxCenterWorkingBoardService;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.bean.MesFourMDetail;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.bean.MesShiftProdCenterRecord;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.bean.MesWorkCenterExt;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.bean.MesWorkCenterNotificationBar;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.repository.MesFourMDetailRepository;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.repository.MesWorkCenterNotificationBarRepository;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
||||
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringJoiner;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author : wangjie
|
||||
* @CreateDate : 2022-02-15
|
||||
* @Modify:
|
||||
**/
|
||||
@Slf4j
|
||||
public class JxCenterWorkingBoardBusiOneService implements IJxCenterWorkingBoardService {
|
||||
|
||||
private IJxCenterWorkingBoardService proxyService;
|
||||
|
||||
private MesFourMDetailRepository fourMDetailRepository;
|
||||
|
||||
private MesWorkCenterNotificationBarRepository workCenterNotificationBarRepository;
|
||||
|
||||
public JxCenterWorkingBoardBusiOneService(IJxCenterWorkingBoardService proxyService) {
|
||||
|
||||
this.proxyService = proxyService;
|
||||
|
||||
this.fourMDetailRepository = (MesFourMDetailRepository) SpringContextsUtil.getBean("mesFourMDetailRepository");
|
||||
|
||||
this.workCenterNotificationBarRepository = (MesWorkCenterNotificationBarRepository) SpringContextsUtil.getBean("mesWorkCenterNotificationBarRepository");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
|
||||
|
||||
dataMap = proxyService.queryCenterWorkingBoardData(dataMap);
|
||||
|
||||
MesWorkCenterExt workCenterExtDb = (MesWorkCenterExt) dataMap.get(MesWorkCenterExt.class.getSimpleName());
|
||||
|
||||
String startTime = (String) dataMap.get(MesExtConstWords.START_TIME);
|
||||
|
||||
List<MesShiftProdCenterRecord> shiftProdCenterRecordList = (List<MesShiftProdCenterRecord>) dataMap.get(MesShiftProdCenterRecord.class.getSimpleName());
|
||||
|
||||
dataMap.put("生产状态", getWorkingStatusData(shiftProdCenterRecordList, startTime));
|
||||
|
||||
dataMap.put("异常停工时间", getUnnormalStopCenterData(shiftProdCenterRecordList, startTime));
|
||||
|
||||
dataMap.put("4M变更信息", getFourMChangeData(workCenterExtDb, startTime));
|
||||
|
||||
dataMap.put("公告信息", getWorkCenterNotificationBarData(workCenterExtDb));
|
||||
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
private String getWorkingStatusData(List<MesShiftProdCenterRecord> shiftProdCenterRecordList, String startTime) {
|
||||
|
||||
List<MesShiftProdCenterRecord> filterList = CollectionUtils.isEmpty(shiftProdCenterRecordList) ? null :
|
||||
shiftProdCenterRecordList.stream().filter(o -> (null != o && MesExtEnumUtil.SHIFT_PROD_TYPE.UNNORMAL_PROD.getValue() >= o.getProdType() && o.getStartTime().compareTo(startTime) <= 0 && o.getEndTime().compareTo(startTime) >= 0)).collect(Collectors.toList());
|
||||
MesShiftProdCenterRecord filterData = CollectionUtils.isEmpty(filterList) ? null :
|
||||
filterList.stream().filter(o -> null != o).sorted(Comparator.comparing(MesShiftProdCenterRecord::getModifyDatetime).reversed()).collect(Collectors.toList()).get(0);
|
||||
|
||||
SHIFT_PROD_TYPE_COLOR enumItem;
|
||||
if (null == filterData) enumItem = SHIFT_PROD_TYPE_COLOR.NO_WORKING;
|
||||
else enumItem = SHIFT_PROD_TYPE_COLOR.getByValue(filterData.getProdType());
|
||||
return new StringJoiner(MesExtConstWords.COMMA).add(enumItem.workingStatusName).add(enumItem.color).toString();
|
||||
}
|
||||
|
||||
private List<MesShiftProdCenterRecord> getUnnormalStopCenterData(List<MesShiftProdCenterRecord> shiftProdCenterRecordList, String startTime) {
|
||||
return CollectionUtils.isEmpty(shiftProdCenterRecordList) ? null :
|
||||
shiftProdCenterRecordList.stream().filter(o -> (null != o && MesExtEnumUtil.SHIFT_PROD_TYPE.UNNORMAL_STOP_CENTER.getValue() == o.getProdType() && o.getStartTime().compareTo(startTime) <= 0)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<MesFourMDetail> getFourMChangeData(MesWorkCenterExt workCenterExtDb, String startTime) {
|
||||
DdlPackBean packBean = DdlPackBean.getDdlPackBean(workCenterExtDb.getOrganizeCode());
|
||||
DdlPreparedPack.getStringEqualPack(workCenterExtDb.getWorkCenterCode(), MesExtConstWords.WORK_CENTER_CODE, packBean);
|
||||
DdlPreparedPack.getStringRightLikerPack(startTime.substring(0, 10), MesExtConstWords.CREATE_DATE_TIME, packBean);
|
||||
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{MesExtConstWords.CREATE_DATE_TIME}, packBean);
|
||||
packBean.setHqlAppend(" limit 3 ");
|
||||
List<MesFourMDetail> fourMDetailList = fourMDetailRepository.findByHqlWhere(packBean);
|
||||
fourMDetailList.forEach(a -> {
|
||||
a.setManageTypeName(MesExtEnumUtil.MANAGE_TYPE.valueOfDescription(a.getManageType()));
|
||||
});
|
||||
return fourMDetailList;
|
||||
}
|
||||
|
||||
private String getWorkCenterNotificationBarData(MesWorkCenterExt workCenterExtDb) {
|
||||
DdlPackBean packBean = DdlPackBean.getDdlPackBean(workCenterExtDb.getOrganizeCode());
|
||||
DdlPreparedPack.getStringEqualPack(workCenterExtDb.getWorkCenterCode(), MesExtConstWords.WORK_CENTER_CODE, packBean);
|
||||
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{MesExtConstWords.MODIFY_DATE_TIME}, packBean);
|
||||
MesWorkCenterNotificationBar workCenterNotificationBar = workCenterNotificationBarRepository.getByProperty(packBean);
|
||||
return null == workCenterNotificationBar ? "暂无公告" : workCenterNotificationBar.getContent();
|
||||
}
|
||||
|
||||
enum SHIFT_PROD_TYPE_COLOR {
|
||||
|
||||
NO_WORKING(0, "无生产", "无生产", "#808080", "gray"),
|
||||
NORMAL_STOP_CENTER(10, "常规停机", "常规停机", "#808080", "gray"),
|
||||
UNNORMAL_STOP_CENTER(20, "非常规停机", "异常停机", "#ff0000", "red"),
|
||||
NORMAL_PROD(30, "常规生产", "正常生产", "#00ff00", "green"),
|
||||
UNNORMAL_PROD(40, "非常规生产", "加班生产", "#ff0000", "red");
|
||||
|
||||
private int value;
|
||||
private String description;
|
||||
private String workingStatusName;
|
||||
private String color;
|
||||
private String colorName;
|
||||
|
||||
SHIFT_PROD_TYPE_COLOR(int value, String description, String workingStatusName, String color, String colorName) {
|
||||
this.value = value;
|
||||
this.description = description;
|
||||
this.workingStatusName = workingStatusName;
|
||||
this.color = color;
|
||||
this.colorName = colorName;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static SHIFT_PROD_TYPE_COLOR getByValue(int value) {
|
||||
for (SHIFT_PROD_TYPE_COLOR matchType : values()) {
|
||||
if (matchType.getValue() == value) {
|
||||
return matchType;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(String.format("#%02x%02x%02x", Color.white.getRed(), Color.white.getGreen(), Color.white.getBlue()));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.busi.jx;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.api.busi.jx.IJxCenterWorkingBoardService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author : wangjie
|
||||
* @CreateDate : 2022-02-15
|
||||
* @Modify:
|
||||
**/
|
||||
@Slf4j
|
||||
public class JxCenterWorkingBoardBusiThreeService implements IJxCenterWorkingBoardService {
|
||||
|
||||
private IJxCenterWorkingBoardService proxyService;
|
||||
|
||||
public JxCenterWorkingBoardBusiThreeService(IJxCenterWorkingBoardService proxyService) {
|
||||
this.proxyService = proxyService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,257 @@
|
||||
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.busi.jx;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.api.busi.jx.IJxCenterWorkingBoardService;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.bean.*;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.model.jx.JxCenterWorkingBoardBusiModel;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.repository.MesOrderJobRepository;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.repository.MesRepairTaskRepository;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtEnumUtil;
|
||||
import cn.estsh.i3plus.platform.common.tool.MathOperation;
|
||||
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesShiftRepository;
|
||||
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.text.ParseException;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author : wangjie
|
||||
* @CreateDate : 2022-02-15
|
||||
* @Modify:
|
||||
**/
|
||||
@Slf4j
|
||||
public class JxCenterWorkingBoardBusiTwoService implements IJxCenterWorkingBoardService {
|
||||
|
||||
private IJxCenterWorkingBoardService proxyService;
|
||||
|
||||
private MesShiftRepository shiftRepository;
|
||||
|
||||
private MesOrderJobRepository orderJobRepository;
|
||||
|
||||
private MesRepairTaskRepository repairTaskRepository;
|
||||
|
||||
public JxCenterWorkingBoardBusiTwoService(IJxCenterWorkingBoardService proxyService) {
|
||||
|
||||
this.proxyService = proxyService;
|
||||
|
||||
this.shiftRepository = (MesShiftRepository) SpringContextsUtil.getBean("mesShiftRepository");
|
||||
|
||||
this.orderJobRepository = (MesOrderJobRepository) SpringContextsUtil.getBean("mesOrderJobRepository");
|
||||
|
||||
this.repairTaskRepository = (MesRepairTaskRepository) SpringContextsUtil.getBean("mesRepairTaskRepository");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
|
||||
|
||||
dataMap = proxyService.queryCenterWorkingBoardData(dataMap);
|
||||
|
||||
String startTime = (String) dataMap.get(MesExtConstWords.START_TIME);
|
||||
|
||||
MesWorkCenterExt workCenterExtDb = (MesWorkCenterExt) dataMap.get(MesWorkCenterExt.class.getSimpleName());
|
||||
|
||||
List<MesWorkOrder> workOrderList = (List<MesWorkOrder>) dataMap.get(MesWorkOrder.class.getSimpleName());
|
||||
|
||||
List<MesShiftProdCenterRecord> shiftProdCenterRecordList = (List<MesShiftProdCenterRecord>) dataMap.get(MesShiftProdCenterRecord.class.getSimpleName());
|
||||
|
||||
List<MesOutPutStatistics> outPutStatisticsList = (List<MesOutPutStatistics>) dataMap.get(MesOutPutStatistics.class.getSimpleName());
|
||||
|
||||
Map<String, Double> partStandardWorkMap = (Map<String, Double>) dataMap.get(MesExtConstWords.STANDARD_WORK);
|
||||
|
||||
List<MesRepairTask> repairTaskList = getRepairTaskList(workCenterExtDb);
|
||||
|
||||
statisticsData(shiftProdCenterRecordList, outPutStatisticsList, partStandardWorkMap, workCenterExtDb, startTime, dataMap);
|
||||
|
||||
dataMap.put("当前班次", getShiftName(workCenterExtDb));
|
||||
|
||||
dataMap.put("出勤人数", workCenterExtDb.getWorkerQty());
|
||||
|
||||
dataMap.put("点检作业", getOrderJobStatistics(workCenterExtDb));
|
||||
|
||||
dataMap.put("当日计划台数", getTodayOrderPlanQty(workOrderList, workCenterExtDb, dataMap));
|
||||
|
||||
dataMap.put("当日实绩台数", getWorkTimeQty(outPutStatisticsList, dataMap));
|
||||
|
||||
dataMap.put("当日生产进度", getBigDecimalPercent(divThenMul100Format1RoundHalfUp((Double) dataMap.get(MesExtConstWords.COMPLET_QTY), (Double) dataMap.get(MesExtConstWords.QTY))));
|
||||
|
||||
dataMap.put("当班作业稼动率", getBigDecimalPercent(divThenMul100Format1RoundHalfUp((Double) dataMap.get("workingTime"), (Double) dataMap.get("serviceTime"))));
|
||||
|
||||
dataMap.put("当班作业能率", getBigDecimalPercent(divThenMul100Format1RoundHalfUp((Double) dataMap.get("standardTime"), (Double) dataMap.get("workingTime"))));
|
||||
|
||||
dataMap.put("当前产品直通率", getBigDecimalPercent(getCurProdPassthroughRate(outPutStatisticsList, repairTaskList)));
|
||||
|
||||
dataMap.put("当班产品直通率", getBigDecimalPercent(getShiftProdPassthroughRate(outPutStatisticsList, repairTaskList, workCenterExtDb)));
|
||||
|
||||
dataMap.put("综合能率", getBigDecimalPercent(divThenMul100Format1RoundHalfUp((Double) dataMap.get("standardTime"), (Double) dataMap.get("serviceTime"))));
|
||||
|
||||
dataMap.put("生产计划进度", getProductionSchedule(workOrderList, outPutStatisticsList, workCenterExtDb));
|
||||
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
private List<MesRepairTask> getRepairTaskList(MesWorkCenterExt workCenterExtDb) {
|
||||
return repairTaskRepository.findByProperty(
|
||||
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.IS_VALID, MesExtConstWords.WORK_CENTER_CODE, MesExtConstWords.WORK_TIME},
|
||||
new Object[]{workCenterExtDb.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterExtDb.getWorkCenterCode(), workCenterExtDb.getWorkTime()});
|
||||
}
|
||||
|
||||
private void statisticsData(List<MesShiftProdCenterRecord> shiftProdCenterRecordList, List<MesOutPutStatistics> outPutStatisticsList,
|
||||
Map<String, Double> partStandardWorkMap, MesWorkCenterExt workCenterExtDb, String startTime, Map<String, Object> dataMap) {
|
||||
|
||||
List<MesOutPutStatistics> filterList2OutPut = CollectionUtils.isEmpty(outPutStatisticsList) ? null :
|
||||
outPutStatisticsList.stream().filter(o -> (null != o && o.getShiftCode().equals(workCenterExtDb.getShiftCode()))).collect(Collectors.toList());
|
||||
List<MesShiftProdCenterRecord> filterList2ShiftProd = CollectionUtils.isEmpty(shiftProdCenterRecordList) ? null :
|
||||
shiftProdCenterRecordList.stream().filter(o -> (null != o && o.getShiftCode().equals(workCenterExtDb.getShiftCode()) && o.getStartTime().compareTo(startTime) <= 0)).collect(Collectors.toList());
|
||||
List<MesShiftProdCenterRecord> stopList = getShiftProdDataListByFlag(filterList2ShiftProd, false);
|
||||
List<MesShiftProdCenterRecord> prodList = getShiftProdDataListByFlag(filterList2ShiftProd, true);
|
||||
|
||||
Double serviceTime = CollectionUtils.isEmpty(prodList) ? new Double(0) : prodList.stream().filter(o -> null != o).mapToDouble(o -> getStatisticsTime(o, startTime)).sum();
|
||||
Double nonWorkingTime = CollectionUtils.isEmpty(stopList) ? new Double(0) : stopList.stream().filter(o -> null != o).mapToDouble(o -> getStatisticsTime(o, startTime)).sum();
|
||||
Double standardTime = CollectionUtils.isEmpty(filterList2OutPut) ? new Double(0) : filterList2OutPut.stream().filter(o -> null != o).mapToDouble(o -> getStatisticsTime(o, partStandardWorkMap)).sum();
|
||||
Double workingTime = MathOperation.sub(serviceTime, nonWorkingTime);
|
||||
|
||||
dataMap.put("serviceTime", serviceTime);
|
||||
dataMap.put("nonWorkingTime", nonWorkingTime);
|
||||
dataMap.put("standardTime", standardTime);
|
||||
dataMap.put("workingTime", workingTime);
|
||||
|
||||
}
|
||||
|
||||
private Double getStatisticsTime(MesShiftProdCenterRecord shiftProdCenterRecord, String startTime) {
|
||||
try {
|
||||
String endTime = shiftProdCenterRecord.getEndTime().compareTo(startTime) <= 0 ? shiftProdCenterRecord.getEndTime() : startTime;
|
||||
return MathOperation.mul(new Double(TimeTool.getSecoundsBetweenTime(2, shiftProdCenterRecord.getStartTime(), endTime)), shiftProdCenterRecord.getWorkerQty());
|
||||
} catch (ParseException e) {
|
||||
return new Double(0);
|
||||
}
|
||||
}
|
||||
|
||||
private Double getStatisticsTime(MesOutPutStatistics outPutStatistics, Map<String, Double> partStandardWorkMap) {
|
||||
return MathOperation.mul(outPutStatistics.getQty(), ((!CollectionUtils.isEmpty(partStandardWorkMap) && partStandardWorkMap.containsKey(outPutStatistics.getPartNo())) ? partStandardWorkMap.get(outPutStatistics.getPartNo()) : new Double(0)));
|
||||
}
|
||||
|
||||
private List<MesShiftProdCenterRecord> getShiftProdDataListByFlag(List<MesShiftProdCenterRecord> shiftProdCenterRecordList, Boolean flag) {
|
||||
if (CollectionUtils.isEmpty(shiftProdCenterRecordList)) return null;
|
||||
if (!flag) return shiftProdCenterRecordList.stream().filter(o -> (null != o && (MesExtEnumUtil.SHIFT_PROD_TYPE.NORMAL_STOP_CENTER.getValue() == o.getProdType() || MesExtEnumUtil.SHIFT_PROD_TYPE.UNNORMAL_STOP_CENTER.getValue() == o.getProdType()))).collect(Collectors.toList());
|
||||
else return shiftProdCenterRecordList.stream().filter(o -> (null != o && (MesExtEnumUtil.SHIFT_PROD_TYPE.NORMAL_PROD.getValue() == o.getProdType() || MesExtEnumUtil.SHIFT_PROD_TYPE.UNNORMAL_PROD.getValue() == o.getProdType()))).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private String getShiftName(MesWorkCenterExt workCenterExtDb) {
|
||||
return shiftRepository.getByProperty(
|
||||
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.IS_VALID, MesExtConstWords.WORK_CENTER_CODE, MesExtConstWords.SHIFT_CODE},
|
||||
new Object[]{workCenterExtDb.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterExtDb.getWorkCenterCode(), workCenterExtDb.getShiftCode()}).getShiftName();
|
||||
}
|
||||
|
||||
private String getOrderJobStatistics(MesWorkCenterExt workCenterExtDb) {
|
||||
List<MesOrderJob> orderJobList = orderJobRepository.findByProperty(
|
||||
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.IS_VALID, MesExtConstWords.WORK_CENTER_CODE, MesExtConstWords.WORK_TIME, MesExtConstWords.SHIFT_CODE},
|
||||
new Object[]{workCenterExtDb.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterExtDb.getWorkCenterCode(), workCenterExtDb.getWorkTime(), workCenterExtDb.getShiftCode()});
|
||||
orderJobList = CollectionUtils.isEmpty(orderJobList)? null :
|
||||
orderJobList.stream().filter(o -> (null != o && MesExtEnumUtil.MES_ORJ_ORDER_STATUS.CLOSE.getValue() != o.getOrderStatus())).collect(Collectors.toList());
|
||||
List<MesOrderJob> orderJobList4Complete = CollectionUtils.isEmpty(orderJobList)? null :
|
||||
orderJobList.stream().filter(o -> (null != o && MesExtEnumUtil.MES_ORJ_ORDER_STATUS.CHECK_COMPLETE.getValue() == o.getOrderStatus())).collect(Collectors.toList());
|
||||
return new StringJoiner(MesExtConstWords.SINGLE_SLASH).add(getListSizeStr(orderJobList4Complete)).add(getListSizeStr(orderJobList)).toString();
|
||||
}
|
||||
|
||||
private String getListSizeStr(List list) { return CollectionUtils.isEmpty(list) ? "0" : String.valueOf(list.size());
|
||||
}
|
||||
private Double getListSizeD(List list) { return new Double(CollectionUtils.isEmpty(list) ? MesExtConstWords.ZERO : list.size()); }
|
||||
|
||||
private String getTodayOrderPlanQty(List<MesWorkOrder> workOrderList, MesWorkCenterExt workCenterExtDb, Map<String, Object> dataMap) {
|
||||
Double qty = CollectionUtils.isEmpty(workOrderList) ? new Double(0) : workOrderList.stream().filter(o -> (null != o && o.getStartTime().contains(workCenterExtDb.getWorkTime()))).mapToDouble(MesWorkOrder::getQty).sum();
|
||||
dataMap.put(MesExtConstWords.QTY, qty);
|
||||
return getQtyStr(qty);
|
||||
}
|
||||
|
||||
private String getWorkTimeQty(List<MesOutPutStatistics> outPutStatisticsList, Map<String, Object> dataMap) {
|
||||
Double completeQty = getOutPutStatisticsList2AmountQty(outPutStatisticsList);
|
||||
dataMap.put(MesExtConstWords.COMPLET_QTY, completeQty);
|
||||
return getQtyStr(completeQty);
|
||||
}
|
||||
|
||||
private String getQtyStr(Double qty) { return qty.intValue() + "台"; }
|
||||
|
||||
private BigDecimal getCurProdPassthroughRate(List<MesOutPutStatistics> outPutStatisticsList, List<MesRepairTask> repairTaskList) {
|
||||
if (CollectionUtils.isEmpty(outPutStatisticsList)) return new BigDecimal(0);
|
||||
List<MesOutPutStatistics> filterList = outPutStatisticsList.stream().filter(o -> (null != o && o.getWorkOrderNo().equals(outPutStatisticsList.get(0).getWorkOrderNo()))).collect(Collectors.toList());
|
||||
Double repairQty = CollectionUtils.isEmpty(repairTaskList) ? new Double(0) : getListSizeD(repairTaskList.stream().filter(o -> (null != o && o.getWorkOrderNo().equals(outPutStatisticsList.get(0).getWorkOrderNo()))).collect(Collectors.toList()));
|
||||
Double qty = getOutPutStatisticsList2AmountQty(filterList);
|
||||
return divThenMul100Format1RoundHalfUp(qty, MathOperation.add(qty, repairQty));
|
||||
}
|
||||
|
||||
private BigDecimal getShiftProdPassthroughRate(List<MesOutPutStatistics> outPutStatisticsList, List<MesRepairTask> repairTaskList, MesWorkCenterExt workCenterExtDb) {
|
||||
List<MesOutPutStatistics> filterList = CollectionUtils.isEmpty(outPutStatisticsList) ? null : outPutStatisticsList.stream().filter(o -> (null != o && o.getShiftCode().equals(workCenterExtDb.getShiftCode()))).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(filterList)) return new BigDecimal(0);
|
||||
Double repairQty = CollectionUtils.isEmpty(repairTaskList) ? new Double(0) : getListSizeD(repairTaskList.stream().filter(o -> (null != o && o.getShiftCode().equals(workCenterExtDb.getShiftCode()))).collect(Collectors.toList()));
|
||||
Double qty = getOutPutStatisticsList2AmountQty(filterList);
|
||||
return divThenMul100Format1RoundHalfUp(qty, MathOperation.add(qty, repairQty));
|
||||
}
|
||||
|
||||
private Double getOutPutStatisticsList2AmountQty(List<MesOutPutStatistics> outPutStatisticsList) {
|
||||
return CollectionUtils.isEmpty(outPutStatisticsList) ? new Double(0) : outPutStatisticsList.stream().filter(o -> null != o).mapToDouble(MesOutPutStatistics::getQty).sum();
|
||||
}
|
||||
|
||||
private JxCenterWorkingBoardBusiModel getProductionSchedule(List<MesWorkOrder> workOrderList, List<MesOutPutStatistics> outPutStatisticsList, MesWorkCenterExt workCenterExtDb) {
|
||||
JxCenterWorkingBoardBusiModel psData = new JxCenterWorkingBoardBusiModel().title("生产计划进度");
|
||||
List<MesWorkOrder> workOrderList2Sort = CollectionUtils.isEmpty(workOrderList) ? null :
|
||||
workOrderList.stream().filter(o -> (null != o && (o.getStartTime().contains(workCenterExtDb.getWorkTime()) || MesExtEnumUtil.WORK_ORDER_STATUS.CLOSE.getValue() != o.getWorkOrderStatus()))).sorted(Comparator.comparing(MesWorkOrder::getSeq)).collect(Collectors.toList());
|
||||
Set<String> partNoList = new TreeSet<>();
|
||||
if (!CollectionUtils.isEmpty(outPutStatisticsList)) partNoList.add(outPutStatisticsList.get(0).getPartNo());
|
||||
if (!CollectionUtils.isEmpty(workOrderList2Sort)) workOrderList2Sort.stream().filter(o -> null != o).forEach(o -> partNoList.add(o.getPartNo()));
|
||||
if (!CollectionUtils.isEmpty(outPutStatisticsList)) outPutStatisticsList.stream().filter(o -> null != o).forEach(o -> partNoList.add(o.getPartNo()));
|
||||
if (CollectionUtils.isEmpty(partNoList)) return psData;
|
||||
|
||||
Map<String, List<MesWorkOrder>> orderMap = CollectionUtils.isEmpty(workOrderList) ? null : workOrderList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesWorkOrder::getPartNo));
|
||||
Map<String, List<MesOutPutStatistics>> outPutMap = CollectionUtils.isEmpty(outPutStatisticsList) ? null : outPutStatisticsList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesOutPutStatistics::getPartNo));
|
||||
|
||||
for (String partNo : partNoList) {
|
||||
if (StringUtils.isEmpty(partNo)) continue;
|
||||
|
||||
List<MesWorkOrder> orderList = CollectionUtils.isEmpty(orderMap) ? null : orderMap.get(partNo);
|
||||
List<MesOutPutStatistics> outPutList = CollectionUtils.isEmpty(outPutMap) ? null : outPutMap.get(partNo);
|
||||
|
||||
Map<String, List<MesOutPutStatistics>> itemMap2OutPut = CollectionUtils.isEmpty(outPutList) ? null : outPutList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesOutPutStatistics::getWorkOrderNo));
|
||||
|
||||
psData.addChartData(partNo, statisticsPlanQty(orderList, itemMap2OutPut), getOutPutStatisticsList2AmountQty(outPutList), !CollectionUtils.isEmpty(psData.getChartDataList()) ? "#ffffff" : "#00ff00");
|
||||
|
||||
}
|
||||
return psData;
|
||||
}
|
||||
|
||||
private Double statisticsPlanQty(List<MesWorkOrder> orderList, Map<String, List<MesOutPutStatistics>> itemMap2OutPut) {
|
||||
return CollectionUtils.isEmpty(orderList) ? new Double(0) :
|
||||
orderList.stream().filter(o -> null != o).mapToDouble(o -> MathOperation.add(MathOperation.sub(o.getQty(), o.getCompleteQty()), getOutPutQty(o.getOrderNo(), itemMap2OutPut))).sum();
|
||||
}
|
||||
|
||||
private Double getOutPutQty(String workOrderNo, Map<String, List<MesOutPutStatistics>> itemMap2OutPut) {
|
||||
List<MesOutPutStatistics> outPutStatisticsList = CollectionUtils.isEmpty(itemMap2OutPut) ? null : itemMap2OutPut.get(workOrderNo);
|
||||
return getOutPutStatisticsList2AmountQty(outPutStatisticsList);
|
||||
}
|
||||
|
||||
private String getBigDecimalPercent(BigDecimal b) {
|
||||
return b + MesExtConstWords.PERCENT;
|
||||
}
|
||||
|
||||
private BigDecimal divThenMul100Format1RoundHalfUp(Double d1, Double d2) {
|
||||
Double d = (MathOperation.compareTo(d1, new Double(0)) == 0 || MathOperation.compareTo(d2, new Double(0)) == 0)
|
||||
? null : MathOperation.mul(MathOperation.div(d1, d2), new Double(100));
|
||||
return format1RounHalfUp(d);
|
||||
}
|
||||
|
||||
private BigDecimal format1RounHalfUp(Double d) {
|
||||
if (StringUtils.isEmpty(d)) d = new Double(0);
|
||||
BigDecimal bd = new BigDecimal(d);
|
||||
bd = bd.setScale(1, BigDecimal.ROUND_HALF_UP);
|
||||
return bd;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.busi.jx;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.api.base.IProdOrgExtService;
|
||||
import cn.estsh.i3plus.ext.mes.api.busi.jx.IJxCenterWorkingBoardService;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.bean.MesWorkCenterExt;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
|
||||
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author : wangjie
|
||||
* @CreateDate : 2022-02-15
|
||||
* @Modify:
|
||||
**/
|
||||
@Slf4j
|
||||
public class JxCenterWorkingBoardProxyCenterService implements IJxCenterWorkingBoardService {
|
||||
|
||||
private IProdOrgExtService prodOrgExtService;
|
||||
|
||||
public JxCenterWorkingBoardProxyCenterService() {
|
||||
|
||||
this.prodOrgExtService = (IProdOrgExtService) SpringContextsUtil.getBean("prodOrgExtService");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
|
||||
MesWorkCenterExt workCenterExtDb = prodOrgExtService.getWorkCenterExt((String) dataMap.get(MesExtConstWords.ORGANIZE_CODE), (String) dataMap.get(MesExtConstWords.WORK_CENTER_CODE));
|
||||
dataMap.put(MesWorkCenterExt.class.getSimpleName(), workCenterExtDb);
|
||||
dataMap.put("BOARD_NAME", workCenterExtDb.getWorkCenterName() + "产线运行状态看板");
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.busi.jx;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.api.busi.jx.IJxCenterWorkingBoardService;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.bean.MesWorkCenterExt;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtEnumUtil;
|
||||
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
||||
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
||||
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
||||
import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder;
|
||||
import cn.estsh.i3plus.pojo.mes.repository.MesWorkOrderRepository;
|
||||
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author : wangjie
|
||||
* @CreateDate : 2022-02-15
|
||||
* @Modify:
|
||||
**/
|
||||
@Slf4j
|
||||
public class JxCenterWorkingBoardProxyOrderService implements IJxCenterWorkingBoardService {
|
||||
|
||||
private IJxCenterWorkingBoardService proxyService;
|
||||
|
||||
private MesWorkOrderRepository workOrderRepository;
|
||||
|
||||
public JxCenterWorkingBoardProxyOrderService(IJxCenterWorkingBoardService proxyService) {
|
||||
|
||||
this.proxyService = proxyService;
|
||||
|
||||
this.workOrderRepository = (MesWorkOrderRepository) SpringContextsUtil.getBean("mesWorkOrderRepository");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
|
||||
|
||||
dataMap = proxyService.queryCenterWorkingBoardData(dataMap);
|
||||
|
||||
MesWorkCenterExt workCenterExtDb = (MesWorkCenterExt) dataMap.get(MesWorkCenterExt.class.getSimpleName());
|
||||
if (StringUtils.isEmpty(workCenterExtDb.getWorkTime()) || StringUtils.isEmpty(workCenterExtDb.getShiftCode())) return dataMap;
|
||||
|
||||
DdlPackBean packBean = DdlPackBean.getDdlPackBean(workCenterExtDb.getOrganizeCode());
|
||||
DdlPreparedPack.getStringEqualPack(workCenterExtDb.getWorkCenterCode(), MesExtConstWords.WORK_CENTER_CODE, packBean);
|
||||
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.WORK_ORDER_TYPE.STANDARD_ORDER.getValue(), MesExtConstWords.WORK_ORDER_TYPE, packBean);
|
||||
DdlPreparedPack.timeBuilder(getStatrtTimeByFlag(dataMap, workCenterExtDb.getWorkTime()) + MesExtConstWords.APPEND_ZERO_HMS, workCenterExtDb.getWorkTime() + MesExtConstWords.APPEND_24_HMS, MesExtConstWords.START_TIME, true, true, packBean);
|
||||
List<MesWorkOrder> workOrderList = workOrderRepository.findByHqlWhere(packBean);
|
||||
workOrderList = CollectionUtils.isEmpty(workOrderList) ? null : workOrderList.stream().filter(o -> (null != o && MesExtEnumUtil.WORK_ORDER_STATUS.CREATE.getValue() != o.getWorkOrderStatus() && MesExtEnumUtil.WORK_ORDER_STATUS.REMOVE.getValue() != o.getWorkOrderStatus())).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(workOrderList)) return dataMap;
|
||||
|
||||
dataMap.put(MesWorkOrder.class.getSimpleName(), workOrderList);
|
||||
|
||||
return dataMap;
|
||||
|
||||
}
|
||||
|
||||
private String getStatrtTimeByFlag(Map<String, Object> dataMap, String startTime) {
|
||||
if (!dataMap.get(MesExtConstWords.FLAG).equals("2")) return startTime;
|
||||
return TimeTool.timeCalc(TimeTool.stringParseToDate(startTime, MesExtConstWords.DATE_FORMAT), Calendar.DATE, -1, MesExtConstWords.DATE_FORMAT);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.busi.jx;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.api.busi.jx.IJxCenterWorkingBoardService;
|
||||
import cn.estsh.i3plus.ext.mes.apiservice.dao.IPartExtDao;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.bean.MesOutPutStatistics;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.bean.MesWorkCenterExt;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.repository.MesOutPutStatisticsRepository;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtEnumUtil;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author : wangjie
|
||||
* @CreateDate : 2022-02-15
|
||||
* @Modify:
|
||||
**/
|
||||
@Slf4j
|
||||
public class JxCenterWorkingBoardProxyOutPutService implements IJxCenterWorkingBoardService {
|
||||
|
||||
private IJxCenterWorkingBoardService proxyService;
|
||||
|
||||
private MesOutPutStatisticsRepository outPutStatisticsRepository;
|
||||
|
||||
private IPartExtDao partExtDao;
|
||||
|
||||
public JxCenterWorkingBoardProxyOutPutService(IJxCenterWorkingBoardService proxyService) {
|
||||
|
||||
this.proxyService = proxyService;
|
||||
|
||||
this.outPutStatisticsRepository = (MesOutPutStatisticsRepository) SpringContextsUtil.getBean("mesOutPutStatisticsRepository");
|
||||
|
||||
this.partExtDao = (IPartExtDao) SpringContextsUtil.getBean("partExtDao");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
|
||||
|
||||
dataMap = proxyService.queryCenterWorkingBoardData(dataMap);
|
||||
|
||||
MesWorkCenterExt workCenterExtDb = (MesWorkCenterExt) dataMap.get(MesWorkCenterExt.class.getSimpleName());
|
||||
if (StringUtils.isEmpty(workCenterExtDb.getWorkTime()) || StringUtils.isEmpty(workCenterExtDb.getShiftCode())) return dataMap;
|
||||
|
||||
List<MesOutPutStatistics> outPutStatisticsList = outPutStatisticsRepository.findByProperty(
|
||||
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.IS_VALID, MesExtConstWords.WORK_CENTER_CODE, MesExtConstWords.WORK_TIME, MesExtConstWords.WORK_ORDER_TYPE},
|
||||
new Object[]{workCenterExtDb.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterExtDb.getWorkCenterCode(), workCenterExtDb.getWorkTime(), MesExtEnumUtil.WORK_ORDER_TYPE.STANDARD_ORDER.getValue()},
|
||||
" order by modifyDatetime desc ");
|
||||
|
||||
if (CollectionUtils.isEmpty(outPutStatisticsList)) return dataMap;
|
||||
|
||||
dataMap.put(MesOutPutStatistics.class.getSimpleName(), outPutStatisticsList);
|
||||
|
||||
Map<String, Double> partStandardWorkMap = partExtDao.queryPartExtStandardWorkMap(workCenterExtDb.getOrganizeCode());
|
||||
|
||||
dataMap.put(MesExtConstWords.STANDARD_WORK, partStandardWorkMap);
|
||||
|
||||
return dataMap;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.busi.jx;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.api.busi.jx.IJxCenterWorkingBoardService;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.bean.MesShiftProdCenterRecord;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.bean.MesWorkCenterExt;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.repository.MesShiftProdCenterRecordRepository;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
|
||||
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
||||
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author : wangjie
|
||||
* @CreateDate : 2022-02-15
|
||||
* @Modify:
|
||||
**/
|
||||
@Slf4j
|
||||
public class JxCenterWorkingBoardProxySpcrService implements IJxCenterWorkingBoardService {
|
||||
|
||||
private IJxCenterWorkingBoardService proxyService;
|
||||
|
||||
private MesShiftProdCenterRecordRepository shiftProdCenterRecordRepository;
|
||||
|
||||
public JxCenterWorkingBoardProxySpcrService(IJxCenterWorkingBoardService proxyService) {
|
||||
|
||||
this.proxyService = proxyService;
|
||||
|
||||
this.shiftProdCenterRecordRepository = (MesShiftProdCenterRecordRepository) SpringContextsUtil.getBean("mesShiftProdCenterRecordRepository");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
|
||||
|
||||
dataMap = proxyService.queryCenterWorkingBoardData(dataMap);
|
||||
|
||||
MesWorkCenterExt workCenterExtDb = (MesWorkCenterExt) dataMap.get(MesWorkCenterExt.class.getSimpleName());
|
||||
if (StringUtils.isEmpty(workCenterExtDb.getWorkTime()) || StringUtils.isEmpty(workCenterExtDb.getShiftCode())) return dataMap;
|
||||
|
||||
List<MesShiftProdCenterRecord> shiftProdCenterRecordList = shiftProdCenterRecordRepository.findByProperty(
|
||||
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.IS_VALID, MesExtConstWords.WORK_CENTER_CODE, MesExtConstWords.WORK_TIME, MesExtConstWords.SHIFT_CODE},
|
||||
new Object[]{workCenterExtDb.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterExtDb.getWorkCenterCode(), workCenterExtDb.getWorkTime(), workCenterExtDb.getShiftCode()});
|
||||
if (CollectionUtils.isEmpty(shiftProdCenterRecordList)) return dataMap;
|
||||
|
||||
dataMap.put(MesShiftProdCenterRecord.class.getSimpleName(), shiftProdCenterRecordList);
|
||||
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.busi.jx;
|
||||
|
||||
import cn.estsh.i3plus.ext.mes.api.busi.jx.IJxCenterWorkingBoardService;
|
||||
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Author : wangjie
|
||||
* @CreateDate : 2022-02-15
|
||||
* @Modify:
|
||||
**/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class JxCenterWorkingBoardService implements IJxCenterWorkingBoardService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
|
||||
|
||||
switch ((String) dataMap.get(MesExtConstWords.FLAG)) {
|
||||
case "1":
|
||||
return new JxCenterWorkingBoardBusiOneService(new JxCenterWorkingBoardProxySpcrService(new JxCenterWorkingBoardProxyCenterService())).queryCenterWorkingBoardData(dataMap);
|
||||
case "2":
|
||||
return new JxCenterWorkingBoardBusiTwoService(new JxCenterWorkingBoardProxyOutPutService(new JxCenterWorkingBoardProxyOrderService(new JxCenterWorkingBoardProxySpcrService(new JxCenterWorkingBoardProxyCenterService())))).queryCenterWorkingBoardData(dataMap);
|
||||
case "3":
|
||||
default:
|
||||
return dataMap;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package cn.estsh.i3plus.ext.mes.pojo.model.jx;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.Data;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @DESCRIPTION:
|
||||
* @USER: wangjie
|
||||
* @DATE: 2022-11-01 15:54
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("嘉兴产线运行看板图表数据MODEL")
|
||||
public class JxCenterWorkingBoardBusiModel extends JxEChartsReportCommonDataModel implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -3290431005501985429L;
|
||||
|
||||
@ApiParam("图表数据")
|
||||
private List<SxDataModel> chartDataList;
|
||||
|
||||
@ApiParam("标题")
|
||||
private String title;
|
||||
|
||||
public JxCenterWorkingBoardBusiModel title(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public JxCenterWorkingBoardBusiModel addChartData(String key, Object value, Object value2, Object value3) {
|
||||
if (CollectionUtils.isEmpty(this.chartDataList)) this.chartDataList = new LinkedList<>();
|
||||
this.chartDataList.add(new JxEChartsReportCommonDataModel.SxDataModel(key, value, value2, value3));
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,134 @@
|
||||
package cn.estsh.i3plus.ext.mes.pojo.model.jx;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.Data;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @DESCRIPTION:
|
||||
* @USER: wangjie
|
||||
* @DATE: 2022-11-01 15:54
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("分析报表数据MODEL")
|
||||
public class JxEChartsReportCommonDataModel implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 3523485024274298341L;
|
||||
|
||||
@ApiParam("组织代码")
|
||||
public String organizeCode;
|
||||
|
||||
@ApiParam("时间维度")
|
||||
public Integer dimension;
|
||||
|
||||
@ApiParam("查询时间")
|
||||
public String workTimeStart;
|
||||
|
||||
@ApiParam("查询时间")
|
||||
public String workTimeEnd;
|
||||
|
||||
@ApiParam("年份")
|
||||
public Integer year;
|
||||
|
||||
@ApiParam("松下年标志")
|
||||
public Boolean sxYearFlag = false;
|
||||
|
||||
@ApiParam("事业别")
|
||||
public String careerCode;
|
||||
|
||||
@ApiParam("产品别")
|
||||
public String categoryCode;
|
||||
|
||||
@ApiParam("班次代码")
|
||||
public String shiftCode;
|
||||
|
||||
@ApiParam("系别")
|
||||
public String isDont;
|
||||
|
||||
@ApiParam("班别")
|
||||
public String dontClass;
|
||||
|
||||
@ApiParam("生产线代码")
|
||||
public String workCenterCode;
|
||||
|
||||
@ApiParam("作业时间")
|
||||
public String ymdStart;
|
||||
@ApiParam("作业时间")
|
||||
public String ymdEnd;
|
||||
|
||||
@ApiParam("作业时间")
|
||||
public String statisticsYmStart;
|
||||
@ApiParam("作业时间")
|
||||
public String statisticsYmEnd;
|
||||
|
||||
@ApiParam("作业时间")
|
||||
public String statisticsYmdStart;
|
||||
@ApiParam("作业时间")
|
||||
public String statisticsYmdEnd;
|
||||
|
||||
@ApiParam("作业时间")
|
||||
public String workTimeYmdStart;
|
||||
@ApiParam("作业时间")
|
||||
public String workTimeYmdEnd;
|
||||
|
||||
@ApiParam("作业时间")
|
||||
public String workTimeYmStart;
|
||||
@ApiParam("作业时间")
|
||||
public String workTimeYmEnd;
|
||||
|
||||
@Data
|
||||
class SxDataModel implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -4097136832957368713L;
|
||||
|
||||
public String key;
|
||||
public Object value;
|
||||
public Object value2;
|
||||
public Object value3;
|
||||
public Object value4;
|
||||
|
||||
public Double valueToSort;
|
||||
|
||||
public SxDataModel(String key, Object value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public SxDataModel(String key, Object value, Object value2) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
this.value2 = value2;
|
||||
}
|
||||
|
||||
public SxDataModel(String key, Object value, Object value2, Object value3) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
this.value2 = value2;
|
||||
this.value3 = value3;
|
||||
}
|
||||
|
||||
public SxDataModel(String key, Object value, Object value2, Object value3, Object value4) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
this.value2 = value2;
|
||||
this.value3 = value3;
|
||||
this.value4 = value4;
|
||||
}
|
||||
|
||||
public SxDataModel valueToSort(Double valueToSort) {
|
||||
this.valueToSort = valueToSort;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public List<SxDataModel> sortReversedValue(List<SxDataModel> dataList) {
|
||||
return CollectionUtils.isEmpty(dataList) ? null : dataList.stream().filter(o -> null != o).sorted(Comparator.comparing(SxDataModel::getValueToSort).reversed()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue