jx mes BI

tags/yfai-mes-ext-v1.0
王杰 1 year ago
parent a1c62ab5a6
commit 22f0600776

@ -49,7 +49,7 @@ public class JxCenterWorkingBoardCenterOneService implements IJxCenterWorkingBoa
@Override
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
dataMap = proxyService0.queryCenterWorkingBoardData(dataMap);
proxyService0.queryCenterWorkingBoardData(dataMap);
MesWorkCenterExt workCenterExtDb = (MesWorkCenterExt) dataMap.get(MesWorkCenterExt.class.getSimpleName());
@ -57,7 +57,7 @@ public class JxCenterWorkingBoardCenterOneService implements IJxCenterWorkingBoa
packProxyCondition(dataMap, workCenterExtDb, curTime);
dataMap = proxyService.queryCenterWorkingBoardData(dataMap);
proxyService.queryCenterWorkingBoardData(dataMap);
List<MesShiftProdCenterRecord> shiftProdCenterRecordList = (List<MesShiftProdCenterRecord>) dataMap.get(MesShiftProdCenterRecord.class.getSimpleName());

@ -71,15 +71,15 @@ public class JxCenterWorkingBoardCenterThreeService extends JxCenterWorkingBoard
@Override
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
dataMap = proxyService0.queryCenterWorkingBoardData(dataMap);
proxyService0.queryCenterWorkingBoardData(dataMap);
dataMap = proxyService1.queryCenterWorkingBoardData(dataMap);
proxyService1.queryCenterWorkingBoardData(dataMap);
MesWorkCenterExt workCenterExtDb = (MesWorkCenterExt) dataMap.get(MesWorkCenterExt.class.getSimpleName());
packProxyCondition(dataMap, workCenterExtDb);
dataMap = proxyService.queryCenterWorkingBoardData(dataMap);
proxyService.queryCenterWorkingBoardData(dataMap);
List<MesWorkOrder> workOrderList = (List<MesWorkOrder>) dataMap.get(MesWorkOrder.class.getSimpleName());
@ -111,6 +111,7 @@ public class JxCenterWorkingBoardCenterThreeService extends JxCenterWorkingBoard
dataMap.remove(MesWorkCenterExt.class.getSimpleName());
dataMap.remove(MesWorkOrder.class.getSimpleName());
dataMap.remove(MesOutPutStatistics.class.getSimpleName());
dataMap.remove(MesOutPutStatisticsTimeSegment.class.getSimpleName());
dataMap.remove(MesExtConstWords.COMPLET_QTY);
dataMap.remove(MesExtConstWords.START_TIME);
dataMap.remove(MesExtConstWords.END_TIME);

@ -51,15 +51,15 @@ public class JxCenterWorkingBoardCenterTwoService extends JxCenterWorkingBoardCo
@Override
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
dataMap = proxyService0.queryCenterWorkingBoardData(dataMap);
proxyService0.queryCenterWorkingBoardData(dataMap);
dataMap = proxyService1.queryCenterWorkingBoardData(dataMap);
proxyService1.queryCenterWorkingBoardData(dataMap);
MesWorkCenterExt workCenterExtDb = (MesWorkCenterExt) dataMap.get(MesWorkCenterExt.class.getSimpleName());
packProxyCondition(dataMap, workCenterExtDb);
dataMap = proxyService.queryCenterWorkingBoardData(dataMap);
proxyService.queryCenterWorkingBoardData(dataMap);
List<MesWorkOrder> workOrderList = (List<MesWorkOrder>) dataMap.get(MesWorkOrder.class.getSimpleName());
@ -73,7 +73,7 @@ public class JxCenterWorkingBoardCenterTwoService extends JxCenterWorkingBoardCo
dataMap.put("点检作业", getOrderJobStatistics(workCenterExtDb));
dataMap.put("当日计划台数", getTodayOrderPlanQty(workOrderList, workCenterExtDb, dataMap));
dataMap.put("当日计划台数", getTodayOrderPlanQty(workOrderList, workCenterExtDb.getWorkTime(), dataMap));
dataMap.put("当日实绩台数", getWorkTimeQty(outPutStatisticsList, dataMap));
@ -99,6 +99,7 @@ public class JxCenterWorkingBoardCenterTwoService extends JxCenterWorkingBoardCo
dataMap.remove(MesWorkCenterExt.class.getSimpleName());
dataMap.remove(MesShiftProdCenterRecord.class.getSimpleName());
dataMap.remove(MesWorkOrder.class.getSimpleName());
dataMap.remove(MesRepairTask.class.getSimpleName());
dataMap.remove(MesOutPutStatistics.class.getSimpleName());
dataMap.remove(MesExtConstWords.QTY);
dataMap.remove(MesExtConstWords.COMPLET_QTY);
@ -154,8 +155,8 @@ public class JxCenterWorkingBoardCenterTwoService extends JxCenterWorkingBoardCo
return new StringJoiner(MesExtConstWords.SINGLE_SLASH).add(getListSizeStr(orderJobList4Complete)).add(getListSizeStr(orderJobList)).toString();
}
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();
private String getTodayOrderPlanQty(List<MesWorkOrder> workOrderList, String workTime, Map<String, Object> dataMap) {
Double qty = statisticsOrderPlanQty(workOrderList, workTime);
dataMap.put(MesExtConstWords.QTY, qty);
return getQtyStr(qty);
}

@ -2,9 +2,11 @@ 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.MesOutPutStatistics;
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.util.MesExtConstWords;
import cn.estsh.i3plus.platform.common.tool.MathOperation;
import cn.estsh.i3plus.platform.common.tool.TimeTool;
import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder;
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
import lombok.extern.slf4j.Slf4j;
@ -12,6 +14,7 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.text.ParseException;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
@ -63,6 +66,19 @@ public class JxCenterWorkingBoardCommonService implements IJxCenterWorkingBoardS
return CollectionUtils.isEmpty(outPutStatisticsList) ? null : outPutStatisticsList.stream().filter(o -> null != o).sorted(Comparator.comparing(MesOutPutStatistics::getModifyDatetime).reversed()).collect(Collectors.toList());
}
public Double statisticsOrderPlanQty(List<MesWorkOrder> workOrderList, String workTime) {
return CollectionUtils.isEmpty(workOrderList) ? new Double(0) : workOrderList.stream().filter(o -> (null != o && o.getStartTime().contains(workTime))).mapToDouble(MesWorkOrder::getQty).sum();
}
public Double getStatisticsTime(MesShiftProdCenterRecord shiftProdCenterRecord, String curTime) {
try {
String endTime = shiftProdCenterRecord.getEndTime().compareTo(curTime) <= 0 ? shiftProdCenterRecord.getEndTime() : curTime;
return MathOperation.mul(new Double(TimeTool.getSecoundsBetweenTime(2, shiftProdCenterRecord.getStartTime(), endTime)), shiftProdCenterRecord.getWorkerQty());
} catch (ParseException e) {
return new Double(0);
}
}
public String getQtyStr(Double qty) { return qty.intValue() + "台"; }
public String getListSizeStr(List list) { return CollectionUtils.isEmpty(list) ? MesExtConstWords.ZERO_STR : String.valueOf(list.size()); }

@ -48,10 +48,16 @@ public class JxCenterWorkingBoardDispatchService implements IJxCenterWorkingBoar
case "monitor01":
return new JxCenterWorkingBoardWatchService(new JxCenterWorkingBoardMonitorOneService(
new JxCenterWorkingBoardProxyAllCenterService(), new JxCenterWorkingBoardProxyStandardWorkService(), new JxCenterWorkingBoardProxyWorkingStatusService(), new JxCenterWorkingBoardProxyEnergyRateService(),
new JxCenterWorkingBoardProxyAllCenterService(), new JxCenterWorkingBoardProxyStandardWorkService(), new JxCenterWorkingBoardProxyProductionScheduleService(), new JxCenterWorkingBoardProxyEnergyRateService(), new JxCenterWorkingBoardProxyWorkingStatusService(),
new JxCenterWorkingBoardProxyOrderService(new JxCenterWorkingBoardProxyOutPutService(new JxCenterWorkingBoardProxyRepairService(new JxCenterWorkingBoardProxySpcrService())))
)).queryCenterWorkingBoardData(dataMap);
case "mobile01":
return new JxCenterWorkingBoardWatchService(new JxCenterWorkingBoardMobileOneService(
new JxCenterWorkingBoardProxyAllCenterService(), new JxCenterWorkingBoardProxyStandardWorkService(), new JxCenterWorkingBoardProxyProductionScheduleService(), new JxCenterWorkingBoardProxyEnergyRateService(),
new JxCenterWorkingBoardProxyOrderService(new JxCenterWorkingBoardProxyOutPutService(new JxCenterWorkingBoardProxySpcrService()))
)).queryCenterWorkingBoardData(dataMap);
default:
return dataMap;
}

@ -0,0 +1,196 @@
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.busi.jx;
import cn.estsh.i3plus.ext.mes.api.base.bu.IBusiConfigService;
import cn.estsh.i3plus.ext.mes.api.busi.jx.IJxCenterWorkingBoardService;
import cn.estsh.i3plus.ext.mes.pojo.bean.MesBusiConfig;
import cn.estsh.i3plus.ext.mes.pojo.bean.MesOutPutStatistics;
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.model.jx.JxCenterWorkingBoardBusiModel;
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.impp.framework.boot.util.SpringContextsUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author : wangjie
* @CreateDate : 2022-02-15
* @Modify:
**/
@Slf4j
public class JxCenterWorkingBoardMobileOneService extends JxCenterWorkingBoardCommonService implements IJxCenterWorkingBoardService {
private IJxCenterWorkingBoardService proxyService0;
private IJxCenterWorkingBoardService proxyService1;
private IJxCenterWorkingBoardService proxyService2;
private IJxCenterWorkingBoardService proxyService3;
private IJxCenterWorkingBoardService proxyService;
private IBusiConfigService busiConfigService;
public JxCenterWorkingBoardMobileOneService(IJxCenterWorkingBoardService proxyService0, IJxCenterWorkingBoardService proxyService1, IJxCenterWorkingBoardService proxyService2, IJxCenterWorkingBoardService proxyService3, IJxCenterWorkingBoardService proxyService) {
this.proxyService0 = proxyService0;
this.proxyService1 = proxyService1;
this.proxyService2 = proxyService2;
this.proxyService3 = proxyService3;
this.proxyService = proxyService;
this.busiConfigService = (IBusiConfigService) SpringContextsUtil.getBean("busiConfigService");
}
@Override
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
proxyService0.queryCenterWorkingBoardData(dataMap);
proxyService1.queryCenterWorkingBoardData(dataMap);
List<MesWorkCenterExt> workCenterExtDbList = (List<MesWorkCenterExt>) dataMap.get(MesWorkCenterExt.class.getSimpleName());
packProxyCondition(dataMap, workCenterExtDbList);
proxyService.queryCenterWorkingBoardData(dataMap);
proxyService2.queryCenterWorkingBoardData(dataMap);
calcOntologyLineData(workCenterExtDbList, dataMap);
return clearUselessData(dataMap);
}
@Override
public Map<String, Object> clearUselessData(Map<String, Object> dataMap) {
dataMap.remove(MesWorkCenterExt.class.getSimpleName());
dataMap.remove(MesWorkOrder.class.getSimpleName());
dataMap.remove(MesOutPutStatistics.class.getSimpleName());
dataMap.remove(MesShiftProdCenterRecord.class.getSimpleName());
dataMap.remove(MesExtConstWords.START_TIME);
dataMap.remove(MesExtConstWords.END_TIME);
dataMap.remove(MesExtConstWords.WORK_TIME);
dataMap.remove(MesExtConstWords.WORK_CENTER_CODE);
dataMap.remove(MesExtConstWords.STANDARD_WORK);
dataMap.remove("serviceTime");
dataMap.remove("standardTime");
dataMap.remove("curTime");
return dataMap;
}
private void packProxyCondition(Map<String, Object> dataMap, List<MesWorkCenterExt> workCenterExtDbList) {
List<String> workTimeList = workCenterExtDbList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getWorkTime()) && !StringUtils.isEmpty(o.getShiftCode()))).map(MesWorkCenterExt::getWorkTime).collect(Collectors.toList());
if (CollectionUtils.isEmpty(workTimeList)) return;
Collections.sort(workTimeList);
dataMap.put(MesExtConstWords.START_TIME, workTimeList.get(0));
dataMap.put(MesExtConstWords.END_TIME, workTimeList.get(workTimeList.size() - 1));
dataMap.put("curTime", TimeTool.getNowTime(true));
dataMap.put("onlyCalcRate", CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr());
}
private List<MesBusiConfig> execConfigListSortSeq(String organizeCode) {
List<MesBusiConfig> busiConfigList = busiConfigService.getConfigListSortSeq(organizeCode, MesExtConstWords.BOARD_WORK_SHOW_FLAG);
if (!CollectionUtils.isEmpty(busiConfigList)) execCachedCenterWorkingBoardData(organizeCode, CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr(), MesExtConstWords.BOARD_WORK_SHOW_FLAG, JSONObject.toJSONString(busiConfigList));
return busiConfigList;
}
private Map<String, Object> calcOntologyLineData(List<MesWorkCenterExt> workCenterExtDbList, Map<String, Object> dataMap) {
String organizeCode = (String) dataMap.get(MesExtConstWords.ORGANIZE_CODE);
String curTime = (String) dataMap.get("curTime");
JxCenterWorkingBoardBusiModel psData1 = new JxCenterWorkingBoardBusiModel().title("本体能率");
JxCenterWorkingBoardBusiModel psData2 = new JxCenterWorkingBoardBusiModel().title("项目");
String busiConfigList4Cached = (String) execCachedCenterWorkingBoardData(organizeCode, MesExtConstWords.ZERO_STR, MesExtConstWords.BOARD_WORK_SHOW_FLAG, null);
List<MesBusiConfig> busiConfigList = !StringUtils.isEmpty(busiConfigList4Cached) ? JSONObject.parseArray(busiConfigList4Cached, MesBusiConfig.class) : execConfigListSortSeq(organizeCode);
if (CollectionUtils.isEmpty(busiConfigList)) return packOntologyLineData(dataMap, psData1, psData2);
Map<String, MesWorkCenterExt> workCenterExtDbMap = workCenterExtDbList.stream().filter(o -> null != o).collect(Collectors.toMap(MesWorkCenterExt::getWorkCenterCode, o -> o));
Map<String, List<MesWorkOrder>> centerMap4OrderFilter = (Map<String, List<MesWorkOrder>>) dataMap.get(MesWorkOrder.class.getSimpleName());
Map<String, List<MesOutPutStatistics>> centerMap4OutPutFilter = (Map<String, List<MesOutPutStatistics>>) dataMap.get(MesOutPutStatistics.class.getSimpleName());
List<MesShiftProdCenterRecord> shiftProdCenterRecordList = (List<MesShiftProdCenterRecord>) dataMap.get(MesShiftProdCenterRecord.class.getSimpleName());
Double planQtyAmount = new Double(0);
Double qtyAmount = new Double(0);
for (MesBusiConfig busiConfig : busiConfigList) {
if (null == busiConfig || !workCenterExtDbMap.containsKey(busiConfig.getCfgValue())) continue;
MesWorkCenterExt workCenterExtDb = workCenterExtDbMap.get(busiConfig.getCfgValue());
if (StringUtils.isEmpty(workCenterExtDb.getLineType()) || !workCenterExtDb.getLineType().equals(MesExtEnumUtil.LINE_TYPE.ONTOLOGY_LINE.getValueStr())) continue;
dataMap.put(MesExtConstWords.WORK_TIME, workCenterExtDb.getWorkTime());
dataMap.put(MesExtConstWords.WORK_CENTER_CODE, workCenterExtDb.getWorkCenterCode());
List<MesWorkOrder> workOrderList = CollectionUtils.isEmpty(centerMap4OrderFilter) ? null : centerMap4OrderFilter.get(workCenterExtDb.getWorkCenterCode());
List<MesOutPutStatistics> outPutStatisticsListFilter = CollectionUtils.isEmpty(centerMap4OutPutFilter) ? null : centerMap4OutPutFilter.get(workCenterExtDb.getWorkCenterCode());
dataMap.put(MesOutPutStatistics.class.getSimpleName(), outPutStatisticsListFilter);
proxyService3.queryCenterWorkingBoardData(dataMap);
Double planQty = statisticsOrderPlanQty(workOrderList, workCenterExtDb.getWorkTime());
Double qty = getOutPutStatisticsList2AmountQty(outPutStatisticsListFilter);
planQtyAmount = MathOperation.add(planQtyAmount, planQty);
qtyAmount = MathOperation.add(qtyAmount, qty);
psData1.addChartData(workCenterExtDb.getWorkCenterCode(), planQty, qty,
getBigDecimalPercent(divThenMul100Format1RoundHalfUp((Double) dataMap.get("standardTime"), (Double) dataMap.get("serviceTime"))),
getBigDecimalPercent(divThenMul100Format1RoundHalfUp(qty, planQty)));
psData2.addChartData(workCenterExtDb.getWorkCenterCode(),
getRealWorkQty(shiftProdCenterRecordList, workCenterExtDb),
getNonWorkingTime(shiftProdCenterRecordList, workCenterExtDb, curTime));
}
psData1.obj(getStandardRateCfg(organizeCode));
psData2.obj(new StringJoiner(MesExtConstWords.COMMA).add(String.valueOf(planQtyAmount.intValue())).add(String.valueOf(qtyAmount.intValue())).toString());
return packOntologyLineData(dataMap, psData1, psData2);
}
private String getStandardRateCfg(String organizeCode) {
String busiConfig4Cached = (String) execCachedCenterWorkingBoardData(organizeCode, MesExtConstWords.ZERO_STR, MesExtConstWords.SX_STANDARD_RATE_CFG, null);
MesBusiConfig busiConfig = !StringUtils.isEmpty(busiConfig4Cached) ? JSONObject.parseObject(busiConfig4Cached, MesBusiConfig.class) : execStandardRateCfg(organizeCode);
return null == busiConfig ? getBigDecimalPercent(format1RounHalfUp(new Double(0))) : busiConfig.getCfgValue();
}
private MesBusiConfig execStandardRateCfg(String organizeCode) {
MesBusiConfig busiConfig = busiConfigService.getBusiConfigByCfgCode(organizeCode, MesExtConstWords.SX_STANDARD_RATE_CFG);
if (null != busiConfig) execCachedCenterWorkingBoardData(organizeCode, CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr(), MesExtConstWords.SX_STANDARD_RATE_CFG, JSONObject.toJSONString(busiConfig));
return busiConfig;
}
private Double getRealWorkQty(List<MesShiftProdCenterRecord> shiftProdCenterRecordList, MesWorkCenterExt workCenterExtDb) {
Optional<MesShiftProdCenterRecord> optional = CollectionUtils.isEmpty(shiftProdCenterRecordList) ? null :
shiftProdCenterRecordList.stream().filter(o -> (null != o && MesExtEnumUtil.SHIFT_PROD_TYPE.START_OR_END_SHIFT_TIME.getValue() == o.getProdType() &&
o.getWorkCenterCode().equals(workCenterExtDb.getWorkCenterCode()) && o.getWorkTime().equals(workCenterExtDb.getWorkTime()) && o.getShiftCode().equals(workCenterExtDb.getWorkTime()))).findFirst();
return (null == optional || !optional.isPresent()) ? new Double(0) : optional.get().getWorkerQty();
}
private Object getNonWorkingTime(List<MesShiftProdCenterRecord> shiftProdCenterRecordList, MesWorkCenterExt workCenterExtDb, String curTime) {
List<MesShiftProdCenterRecord> stopList = CollectionUtils.isEmpty(shiftProdCenterRecordList) ? null :
shiftProdCenterRecordList.stream().filter(o -> (null != o && MesExtEnumUtil.SHIFT_PROD_TYPE.UNNORMAL_STOP_CENTER.getValue() == o.getProdType() &&
o.getWorkCenterCode().equals(workCenterExtDb.getWorkCenterCode()) && o.getWorkTime().equals(workCenterExtDb.getWorkTime()) && o.getShiftCode().equals(workCenterExtDb.getWorkTime()) && o.getStartTime().compareTo(curTime) <= 0)).collect(Collectors.toList());
return CollectionUtils.isEmpty(stopList) ? new Double(0) : stopList.stream().filter(o -> null != o).mapToDouble(o -> getStatisticsTime(o, curTime)).sum();
}
private Map<String, Object> packOntologyLineData(Map<String, Object> dataMap, JxCenterWorkingBoardBusiModel psData1, JxCenterWorkingBoardBusiModel psData2) {
dataMap.put("本体能率", psData1);
dataMap.put("项目", psData2);
return dataMap;
}
}

@ -43,6 +43,8 @@ public class JxCenterWorkingBoardMonitorOneService extends JxCenterWorkingBoardC
private IJxCenterWorkingBoardService proxyService3;
private IJxCenterWorkingBoardService proxyService4;
private IJxCenterWorkingBoardService proxyService;
private MesPlantInfoRepository plantInfoRepository;
@ -55,11 +57,12 @@ public class JxCenterWorkingBoardMonitorOneService extends JxCenterWorkingBoardC
private MesOutPutStatisticsRepository outPutStatisticsRepository;
public JxCenterWorkingBoardMonitorOneService(IJxCenterWorkingBoardService proxyService0, IJxCenterWorkingBoardService proxyService1, IJxCenterWorkingBoardService proxyService2, IJxCenterWorkingBoardService proxyService3, IJxCenterWorkingBoardService proxyService) {
public JxCenterWorkingBoardMonitorOneService(IJxCenterWorkingBoardService proxyService0, IJxCenterWorkingBoardService proxyService1, IJxCenterWorkingBoardService proxyService2, IJxCenterWorkingBoardService proxyService3, IJxCenterWorkingBoardService proxyService4, IJxCenterWorkingBoardService proxyService) {
this.proxyService0 = proxyService0;
this.proxyService1 = proxyService1;
this.proxyService2 = proxyService2;
this.proxyService3 = proxyService3;
this.proxyService4 = proxyService4;
this.proxyService = proxyService;
this.plantInfoRepository = (MesPlantInfoRepository) SpringContextsUtil.getBean("mesPlantInfoRepository");
this.numberOfSafeOperationDaysService = (IMesNumberOfSafeOperationDaysService) SpringContextsUtil.getBean("mesNumberOfSafeOperationDaysService");
@ -71,15 +74,15 @@ public class JxCenterWorkingBoardMonitorOneService extends JxCenterWorkingBoardC
@Override
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
dataMap = proxyService0.queryCenterWorkingBoardData(dataMap);
proxyService0.queryCenterWorkingBoardData(dataMap);
dataMap = proxyService1.queryCenterWorkingBoardData(dataMap);
proxyService1.queryCenterWorkingBoardData(dataMap);
List<MesWorkCenterExt> workCenterExtDbList = (List<MesWorkCenterExt>) dataMap.get(MesWorkCenterExt.class.getSimpleName());
packProxyCondition(dataMap, workCenterExtDbList);
dataMap = proxyService.queryCenterWorkingBoardData(dataMap);
proxyService.queryCenterWorkingBoardData(dataMap);
String organizeCode = (String) dataMap.get(MesExtConstWords.ORGANIZE_CODE);
@ -93,7 +96,7 @@ public class JxCenterWorkingBoardMonitorOneService extends JxCenterWorkingBoardC
dataMap.put("当年累计总事故数", getCurYearAmountAccident(organizeCode));
dataMap.put("生产进度", getProductionSchedule(organizeCode, workCenterExtDbList, dataMap));
proxyService2.queryCenterWorkingBoardData(dataMap);
calcOntologyLineData(organizeCode, workCenterExtDbList, dataMap);
@ -105,6 +108,8 @@ public class JxCenterWorkingBoardMonitorOneService extends JxCenterWorkingBoardC
dataMap.remove(MesWorkCenterExt.class.getSimpleName());
dataMap.remove(MesWorkOrder.class.getSimpleName());
dataMap.remove(MesOutPutStatistics.class.getSimpleName());
dataMap.remove(MesRepairTask.class.getSimpleName());
dataMap.remove(MesShiftProdCenterRecord.class.getSimpleName());
dataMap.remove(MesExtConstWords.START_TIME);
dataMap.remove(MesExtConstWords.END_TIME);
dataMap.remove(MesExtConstWords.WORK_TIME);
@ -143,71 +148,6 @@ public class JxCenterWorkingBoardMonitorOneService extends JxCenterWorkingBoardC
return accidentDateService.queryBuAccidentDaysBoard(organizeCode);
}
private Map<String, List<MesWorkOrder>> getCenterMap4Order(List<MesWorkOrder> workOrderList) {
return CollectionUtils.isEmpty(workOrderList) ? null : workOrderList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesWorkOrder::getWorkCenterCode));
}
private Map<String, List<MesOutPutStatistics>> getCenterMap4OutPut(List<MesOutPutStatistics> outPutStatisticsList) {
return CollectionUtils.isEmpty(outPutStatisticsList) ? null : outPutStatisticsList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesOutPutStatistics::getWorkCenterCode));
}
private JxCenterWorkingBoardBusiModel getProductionSchedule(String organizeCode, List<MesWorkCenterExt> workCenterExtDbList, Map<String, Object> dataMap) {
JxCenterWorkingBoardBusiModel psData = new JxCenterWorkingBoardBusiModel().title("生产进度");
List<MesWorkOrder> workOrderList = (List<MesWorkOrder>) dataMap.get(MesWorkOrder.class.getSimpleName());
List<MesOutPutStatistics> outPutStatisticsList = (List<MesOutPutStatistics>) dataMap.get(MesOutPutStatistics.class.getSimpleName());
if (CollectionUtils.isEmpty(workOrderList) && CollectionUtils.isEmpty(outPutStatisticsList)) return psData;
String categoryCodeCfg4Cached = (String) execCachedCenterWorkingBoardData(organizeCode, MesExtConstWords.ZERO_STR, MesExtConstWords.SX_CATEGORY_CFG, null);
MesBusiConfig categoryCodeCfg = !StringUtils.isEmpty(categoryCodeCfg4Cached) ? JSONObject.parseObject(categoryCodeCfg4Cached, MesBusiConfig.class) : execCatagoryCodeCfg(organizeCode);
if (null == categoryCodeCfg || StringUtils.isEmpty(categoryCodeCfg.getCfgValue()) || StringUtils.isEmpty(categoryCodeCfg.getCfgValueSeq())) return psData;
String[] categoryCodeArr = categoryCodeCfg.getCfgValueSeq().split(MesExtConstWords.COMMA);
String[] categoryNameArr = categoryCodeCfg.getCfgValue().split(MesExtConstWords.COMMA);
if (categoryCodeArr.length != categoryNameArr.length) return psData;
Map<String, List<MesOutPutStatistics>> centerMap4OutPutFilter = new HashMap<>();
Map<String, List<MesWorkOrder>> centerMap4Order = getCenterMap4Order(workOrderList);
Map<String, List<MesOutPutStatistics>> centerMap4OutPut = getCenterMap4OutPut(outPutStatisticsList);
Map<String, List<MesWorkOrder>> categoryCodeMap4Order = new HashMap<>();
Map<String, List<MesOutPutStatistics>> categoryCodeMap4OutPut = new HashMap<>();
for (MesWorkCenterExt workCenterExtDb : workCenterExtDbList) {
if (null == workCenterExtDb) continue;
if (StringUtils.isEmpty(workCenterExtDb.getCategoryCode()) || StringUtils.isEmpty(workCenterExtDb.getWorkTime()) || StringUtils.isEmpty(workCenterExtDb.getShiftCode())) continue;
List<MesWorkOrder> workOrderList4Center = CollectionUtils.isEmpty(centerMap4Order) ? null : getWorkOrderListByWorkTime(centerMap4Order.get(workCenterExtDb.getWorkCenterCode()), workCenterExtDb.getWorkTime());
List<MesOutPutStatistics> outPutStatisticsList4Center = CollectionUtils.isEmpty(centerMap4OutPut) ? null : getOutPutStatisticsListByWorkTime(centerMap4OutPut.get(workCenterExtDb.getWorkCenterCode()), workCenterExtDb.getWorkTime());
List<MesWorkOrder> categoryCodeList4Order = (!CollectionUtils.isEmpty(categoryCodeMap4Order) && categoryCodeMap4Order.containsKey(workCenterExtDb.getCategoryCode())) ? categoryCodeMap4Order.get(workCenterExtDb.getCategoryCode()) : new ArrayList<>();
List<MesOutPutStatistics> categoryCodeList4OutPut = (!CollectionUtils.isEmpty(categoryCodeMap4OutPut) && categoryCodeMap4OutPut.containsKey(workCenterExtDb.getCategoryCode())) ? categoryCodeMap4OutPut.get(workCenterExtDb.getCategoryCode()) : new ArrayList<>();
if (!CollectionUtils.isEmpty(workOrderList4Center)) categoryCodeList4Order.addAll(workOrderList4Center);
if (!CollectionUtils.isEmpty(outPutStatisticsList4Center)) categoryCodeList4OutPut.addAll(outPutStatisticsList4Center);
categoryCodeMap4Order.put(workCenterExtDb.getCategoryCode(), categoryCodeList4Order);
categoryCodeMap4OutPut.put(workCenterExtDb.getCategoryCode(), categoryCodeList4OutPut);
if (!CollectionUtils.isEmpty(outPutStatisticsList4Center)) centerMap4OutPutFilter.put(workCenterExtDb.getWorkCenterCode(), sortOutPutStatisticsList(outPutStatisticsList4Center));
}
for (int i = 0; i < categoryCodeArr.length; i ++) {
List<MesWorkOrder> workOrderList4Category = CollectionUtils.isEmpty(categoryCodeMap4Order) ? null : categoryCodeMap4Order.get(categoryCodeArr[i]);
List<MesOutPutStatistics> outPutStatisticsList4Category = CollectionUtils.isEmpty(categoryCodeMap4OutPut) ? null : categoryCodeMap4OutPut.get(categoryCodeArr[i]);
Double planQtyAmount = getWorkOrderList2AmountQty(workOrderList4Category);
Double completeQtyAmount = getOutPutStatisticsList2AmountQty(outPutStatisticsList4Category);
psData.addChartData(categoryNameArr[i], completeQtyAmount, planQtyAmount, getBigDecimalPercent(divThenMul100Format1RoundHalfUp(completeQtyAmount, planQtyAmount)));
}
dataMap.put(MesOutPutStatistics.class.getSimpleName(), centerMap4OutPutFilter);
return psData;
}
private Map<String, Object> calcOntologyLineData(String organizeCode, List<MesWorkCenterExt> workCenterExtDbList, Map<String, Object> dataMap) {
JxCenterWorkingBoardBusiModel psData1 = new JxCenterWorkingBoardBusiModel().title("本体产线状态");
@ -236,7 +176,7 @@ public class JxCenterWorkingBoardMonitorOneService extends JxCenterWorkingBoardC
MesOutPutStatistics outPutStatistics = !CollectionUtils.isEmpty(outPutStatisticsListFilter) ? outPutStatisticsListFilter.get(0) : getOutPutStatisticsByCenter(organizeCode, workCenterExtDb.getWorkCenterCode());
List<MesOutPutStatistics> outPutStatisticsList2Order = (null == outPutStatistics || CollectionUtils.isEmpty(outPutStatisticsListFilter)) ? null : outPutStatisticsListFilter.stream().filter(o -> (null != o && o.getWorkOrderNo().equals(outPutStatistics.getWorkOrderNo()))).collect(Collectors.toList());
psData1.addChartData(workCenterExtDb.getWorkCenterCode(), null == outPutStatistics ? null : outPutStatistics.getPartNo(), getRepairRate(outPutStatisticsList2Order, repairTaskList, workCenterExtDb), proxyService2.queryCenterWorkingBoardData(dataMap).get(MesExtConstWords.STATUS));
psData1.addChartData(workCenterExtDb.getWorkCenterCode(), null == outPutStatistics ? null : outPutStatistics.getPartNo(), getRepairRate(outPutStatisticsList2Order, repairTaskList, workCenterExtDb), proxyService4.queryCenterWorkingBoardData(dataMap).get(MesExtConstWords.STATUS));
proxyService3.queryCenterWorkingBoardData(dataMap);
@ -250,12 +190,6 @@ public class JxCenterWorkingBoardMonitorOneService extends JxCenterWorkingBoardC
return packOntologyLineWorkingStatusAndEnergyRate(dataMap, psData1, psData2);
}
private MesBusiConfig execCatagoryCodeCfg(String organizeCode) {
MesBusiConfig catagoryCodeCfg = busiConfigService.getBusiConfigByCfgCode(organizeCode, MesExtConstWords.SX_CATEGORY_CFG);
if (null != catagoryCodeCfg) execCachedCenterWorkingBoardData(organizeCode, CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr(), MesExtConstWords.SX_CATEGORY_CFG, JSONObject.toJSONString(catagoryCodeCfg));
return catagoryCodeCfg;
}
private List<MesBusiConfig> execConfigListSortSeq(String organizeCode) {
List<MesBusiConfig> busiConfigList = busiConfigService.getConfigListSortSeq(organizeCode, MesExtConstWords.BOARD_WORK_SHOW_FLAG);
if (!CollectionUtils.isEmpty(busiConfigList)) execCachedCenterWorkingBoardData(organizeCode, CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr(), MesExtConstWords.BOARD_WORK_SHOW_FLAG, JSONObject.toJSONString(busiConfigList));

@ -9,6 +9,7 @@ import cn.estsh.i3plus.platform.common.tool.MathOperation;
import cn.estsh.i3plus.platform.common.tool.TimeTool;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.text.ParseException;
import java.util.List;
@ -21,7 +22,7 @@ import java.util.stream.Collectors;
* @Modify:
**/
@Slf4j
public class JxCenterWorkingBoardProxyEnergyRateService implements IJxCenterWorkingBoardService {
public class JxCenterWorkingBoardProxyEnergyRateService extends JxCenterWorkingBoardCommonService implements IJxCenterWorkingBoardService {
private IJxCenterWorkingBoardService proxyService;
@ -45,22 +46,25 @@ public class JxCenterWorkingBoardProxyEnergyRateService implements IJxCenterWork
Map<String, String> partStandardWorkMap = (Map<String, String>) dataMap.get(MesExtConstWords.STANDARD_WORK);
List<MesOutPutStatistics> filterList2OutPut = CollectionUtils.isEmpty(outPutStatisticsList) ? null :
outPutStatisticsList.stream().filter(o -> (null != o && o.getWorkCenterCode().equals(workCenterCode) && o.getWorkTime().equals(workTime) && o.getShiftCode().equals(shiftCode))).collect(Collectors.toList());
outPutStatisticsList.stream().filter(o -> (null != o && o.getWorkCenterCode().equals(workCenterCode) && o.getWorkTime().equals(workTime) && (StringUtils.isEmpty(shiftCode) || o.getShiftCode().equals(shiftCode)))).collect(Collectors.toList());
List<MesShiftProdCenterRecord> filterList2ShiftProd = CollectionUtils.isEmpty(shiftProdCenterRecordList) ? null :
shiftProdCenterRecordList.stream().filter(o -> (null != o && o.getWorkCenterCode().equals(workCenterCode) && o.getWorkTime().equals(workTime) && o.getShiftCode().equals(shiftCode) && o.getStartTime().compareTo(curTime) <= 0)).collect(Collectors.toList());
shiftProdCenterRecordList.stream().filter(o -> (null != o && o.getWorkCenterCode().equals(workCenterCode) && o.getWorkTime().equals(workTime) && (StringUtils.isEmpty(shiftCode) || o.getShiftCode().equals(shiftCode)) && o.getStartTime().compareTo(curTime) <= 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, curTime)).sum();
Double nonWorkingTime = CollectionUtils.isEmpty(stopList) ? new Double(0) : stopList.stream().filter(o -> null != o).mapToDouble(o -> getStatisticsTime(o, curTime)).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);
Double standardTime = CollectionUtils.isEmpty(filterList2OutPut) ? new Double(0) : filterList2OutPut.stream().filter(o -> null != o).mapToDouble(o -> getStatisticsTime(o, partStandardWorkMap)).sum();
dataMap.put("standardTime", standardTime);
dataMap.put("workingTime", workingTime);
if (!dataMap.containsKey("onlyCalcRate")) {
List<MesShiftProdCenterRecord> stopList = getShiftProdDataListByFlag(filterList2ShiftProd, false);
Double nonWorkingTime = CollectionUtils.isEmpty(stopList) ? new Double(0) : stopList.stream().filter(o -> null != o).mapToDouble(o -> getStatisticsTime(o, curTime)).sum();
dataMap.put("nonWorkingTime", nonWorkingTime);
Double workingTime = MathOperation.sub(serviceTime, nonWorkingTime);
dataMap.put("workingTime", workingTime);
}
return dataMap;
}
@ -71,15 +75,6 @@ public class JxCenterWorkingBoardProxyEnergyRateService implements IJxCenterWork
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 Double getStatisticsTime(MesShiftProdCenterRecord shiftProdCenterRecord, String curTime) {
try {
String endTime = shiftProdCenterRecord.getEndTime().compareTo(curTime) <= 0 ? shiftProdCenterRecord.getEndTime() : curTime;
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, String> partStandardWorkMap) {
return MathOperation.mul(outPutStatistics.getQty(), ((!CollectionUtils.isEmpty(partStandardWorkMap) && partStandardWorkMap.containsKey(outPutStatistics.getPartNo())) ? Double.parseDouble(partStandardWorkMap.get(outPutStatistics.getPartNo())) : new Double(0)));
}

@ -36,16 +36,16 @@ public class JxCenterWorkingBoardProxyOrderService implements IJxCenterWorkingBo
@Override
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
if (null != proxyService) dataMap = proxyService.queryCenterWorkingBoardData(dataMap);
if (null != proxyService) proxyService.queryCenterWorkingBoardData(dataMap);
String orgainzeCode = (String) dataMap.get(MesExtConstWords.ORGANIZE_CODE);
String organizeCode = (String) dataMap.get(MesExtConstWords.ORGANIZE_CODE);
String workCenterCode = (String) dataMap.get(MesExtConstWords.WORK_CENTER_CODE);
String startTime = (String) dataMap.get(MesExtConstWords.START_TIME);
String endTime = (String) dataMap.get(MesExtConstWords.END_TIME);
if (StringUtils.isEmpty(startTime) || StringUtils.isEmpty(endTime)) return dataMap;
DdlPackBean packBean = DdlPackBean.getDdlPackBean(orgainzeCode);
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(workCenterCode, MesExtConstWords.WORK_CENTER_CODE, packBean);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.WORK_ORDER_TYPE.STANDARD_ORDER.getValue(), MesExtConstWords.WORK_ORDER_TYPE, packBean);
DdlPreparedPack.timeBuilder(startTime + MesExtConstWords.APPEND_ZERO_HMS, endTime + MesExtConstWords.APPEND_24_HMS, MesExtConstWords.START_TIME, true, true, packBean);

@ -36,9 +36,9 @@ public class JxCenterWorkingBoardProxyOutPutService implements IJxCenterWorkingB
@Override
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
if (null != proxyService) dataMap = proxyService.queryCenterWorkingBoardData(dataMap);
if (null != proxyService) proxyService.queryCenterWorkingBoardData(dataMap);
String orgainzeCode = (String) dataMap.get(MesExtConstWords.ORGANIZE_CODE);
String organizeCode = (String) dataMap.get(MesExtConstWords.ORGANIZE_CODE);
String workCenterCode = (String) dataMap.get(MesExtConstWords.WORK_CENTER_CODE);
String workTime = (String) dataMap.get(MesExtConstWords.WORK_TIME);
String startTime = (String) dataMap.get(MesExtConstWords.START_TIME);
@ -48,10 +48,10 @@ public class JxCenterWorkingBoardProxyOutPutService implements IJxCenterWorkingB
if (!StringUtils.isEmpty(workCenterCode) && !StringUtils.isEmpty(workTime))
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[]{orgainzeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterCode, workTime, MesExtEnumUtil.WORK_ORDER_TYPE.STANDARD_ORDER.getValue()},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterCode, workTime, MesExtEnumUtil.WORK_ORDER_TYPE.STANDARD_ORDER.getValue()},
" order by modifyDatetime desc ");
else if (!StringUtils.isEmpty(startTime) && !StringUtils.isEmpty(endTime)) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(orgainzeCode);
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.WORK_ORDER_TYPE.STANDARD_ORDER.getValue(), MesExtConstWords.WORK_ORDER_TYPE, packBean);
DdlPreparedPack.timeBuilder(startTime, endTime, MesExtConstWords.WORK_TIME, true, true, packBean);
outPutStatisticsList = outPutStatisticsRepository.findByHqlWhere(packBean);

@ -0,0 +1,124 @@
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.busi.jx;
import cn.estsh.i3plus.ext.mes.api.base.bu.IBusiConfigService;
import cn.estsh.i3plus.ext.mes.api.busi.jx.IJxCenterWorkingBoardService;
import cn.estsh.i3plus.ext.mes.pojo.bean.MesBusiConfig;
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.model.jx.JxCenterWorkingBoardBusiModel;
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder;
import cn.estsh.impp.framework.boot.util.SpringContextsUtil;
import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Author : wangjie
* @CreateDate : 2022-02-15
* @Modify:
**/
@Slf4j
public class JxCenterWorkingBoardProxyProductionScheduleService extends JxCenterWorkingBoardCommonService implements IJxCenterWorkingBoardService {
private IBusiConfigService busiConfigService;
public JxCenterWorkingBoardProxyProductionScheduleService() {
this.busiConfigService = (IBusiConfigService) SpringContextsUtil.getBean("busiConfigService");
}
@Override
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
String organizeCode = (String) dataMap.get(MesExtConstWords.ORGANIZE_CODE);
List<MesWorkCenterExt> workCenterExtDbList = (List<MesWorkCenterExt>) dataMap.get(MesWorkCenterExt.class.getSimpleName());
dataMap.put("生产进度", getProductionSchedule(organizeCode, workCenterExtDbList, dataMap));
return dataMap;
}
private JxCenterWorkingBoardBusiModel getProductionSchedule(String organizeCode, List<MesWorkCenterExt> workCenterExtDbList, Map<String, Object> dataMap) {
JxCenterWorkingBoardBusiModel psData = new JxCenterWorkingBoardBusiModel().title("生产进度");
List<MesWorkOrder> workOrderList = (List<MesWorkOrder>) dataMap.get(MesWorkOrder.class.getSimpleName());
List<MesOutPutStatistics> outPutStatisticsList = (List<MesOutPutStatistics>) dataMap.get(MesOutPutStatistics.class.getSimpleName());
if (CollectionUtils.isEmpty(workOrderList) && CollectionUtils.isEmpty(outPutStatisticsList)) return psData;
String categoryCodeCfg4Cached = (String) execCachedCenterWorkingBoardData(organizeCode, MesExtConstWords.ZERO_STR, MesExtConstWords.SX_CATEGORY_CFG, null);
MesBusiConfig categoryCodeCfg = !StringUtils.isEmpty(categoryCodeCfg4Cached) ? JSONObject.parseObject(categoryCodeCfg4Cached, MesBusiConfig.class) : execCatagoryCodeCfg(organizeCode);
if (null == categoryCodeCfg || StringUtils.isEmpty(categoryCodeCfg.getCfgValue()) || StringUtils.isEmpty(categoryCodeCfg.getCfgValueSeq())) return psData;
String[] categoryCodeArr = categoryCodeCfg.getCfgValueSeq().split(MesExtConstWords.COMMA);
String[] categoryNameArr = categoryCodeCfg.getCfgValue().split(MesExtConstWords.COMMA);
if (categoryCodeArr.length != categoryNameArr.length) return psData;
Map<String, List<MesWorkOrder>> centerMap4OrderFilter = new HashMap<>();
Map<String, List<MesOutPutStatistics>> centerMap4OutPutFilter = new HashMap<>();
Map<String, List<MesWorkOrder>> centerMap4Order = getCenterMap4Order(workOrderList);
Map<String, List<MesOutPutStatistics>> centerMap4OutPut = getCenterMap4OutPut(outPutStatisticsList);
Map<String, List<MesWorkOrder>> categoryCodeMap4Order = new HashMap<>();
Map<String, List<MesOutPutStatistics>> categoryCodeMap4OutPut = new HashMap<>();
for (MesWorkCenterExt workCenterExtDb : workCenterExtDbList) {
if (null == workCenterExtDb) continue;
if (StringUtils.isEmpty(workCenterExtDb.getCategoryCode()) || StringUtils.isEmpty(workCenterExtDb.getWorkTime()) || StringUtils.isEmpty(workCenterExtDb.getShiftCode())) continue;
List<MesWorkOrder> workOrderList4Center = CollectionUtils.isEmpty(centerMap4Order) ? null : getWorkOrderListByWorkTime(centerMap4Order.get(workCenterExtDb.getWorkCenterCode()), workCenterExtDb.getWorkTime());
List<MesOutPutStatistics> outPutStatisticsList4Center = CollectionUtils.isEmpty(centerMap4OutPut) ? null : getOutPutStatisticsListByWorkTime(centerMap4OutPut.get(workCenterExtDb.getWorkCenterCode()), workCenterExtDb.getWorkTime());
List<MesWorkOrder> categoryCodeList4Order = (!CollectionUtils.isEmpty(categoryCodeMap4Order) && categoryCodeMap4Order.containsKey(workCenterExtDb.getCategoryCode())) ? categoryCodeMap4Order.get(workCenterExtDb.getCategoryCode()) : new ArrayList<>();
List<MesOutPutStatistics> categoryCodeList4OutPut = (!CollectionUtils.isEmpty(categoryCodeMap4OutPut) && categoryCodeMap4OutPut.containsKey(workCenterExtDb.getCategoryCode())) ? categoryCodeMap4OutPut.get(workCenterExtDb.getCategoryCode()) : new ArrayList<>();
if (!CollectionUtils.isEmpty(workOrderList4Center)) categoryCodeList4Order.addAll(workOrderList4Center);
if (!CollectionUtils.isEmpty(outPutStatisticsList4Center)) categoryCodeList4OutPut.addAll(outPutStatisticsList4Center);
categoryCodeMap4Order.put(workCenterExtDb.getCategoryCode(), categoryCodeList4Order);
categoryCodeMap4OutPut.put(workCenterExtDb.getCategoryCode(), categoryCodeList4OutPut);
if (!CollectionUtils.isEmpty(workOrderList4Center)) centerMap4OrderFilter.put(workCenterExtDb.getWorkCenterCode(), workOrderList4Center);
if (!CollectionUtils.isEmpty(outPutStatisticsList4Center)) centerMap4OutPutFilter.put(workCenterExtDb.getWorkCenterCode(), sortOutPutStatisticsList(outPutStatisticsList4Center));
}
for (int i = 0; i < categoryCodeArr.length; i ++) {
List<MesWorkOrder> workOrderList4Category = CollectionUtils.isEmpty(categoryCodeMap4Order) ? null : categoryCodeMap4Order.get(categoryCodeArr[i]);
List<MesOutPutStatistics> outPutStatisticsList4Category = CollectionUtils.isEmpty(categoryCodeMap4OutPut) ? null : categoryCodeMap4OutPut.get(categoryCodeArr[i]);
Double planQtyAmount = getWorkOrderList2AmountQty(workOrderList4Category);
Double completeQtyAmount = getOutPutStatisticsList2AmountQty(outPutStatisticsList4Category);
psData.addChartData(categoryNameArr[i], completeQtyAmount, planQtyAmount, getBigDecimalPercent(divThenMul100Format1RoundHalfUp(completeQtyAmount, planQtyAmount)));
}
dataMap.put(MesWorkOrder.class.getSimpleName(), centerMap4OrderFilter);
dataMap.put(MesOutPutStatistics.class.getSimpleName(), centerMap4OutPutFilter);
return psData;
}
private MesBusiConfig execCatagoryCodeCfg(String organizeCode) {
MesBusiConfig catagoryCodeCfg = busiConfigService.getBusiConfigByCfgCode(organizeCode, MesExtConstWords.SX_CATEGORY_CFG);
if (null != catagoryCodeCfg) execCachedCenterWorkingBoardData(organizeCode, CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr(), MesExtConstWords.SX_CATEGORY_CFG, JSONObject.toJSONString(catagoryCodeCfg));
return catagoryCodeCfg;
}
private Map<String, List<MesWorkOrder>> getCenterMap4Order(List<MesWorkOrder> workOrderList) {
return CollectionUtils.isEmpty(workOrderList) ? null : workOrderList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesWorkOrder::getWorkCenterCode));
}
private Map<String, List<MesOutPutStatistics>> getCenterMap4OutPut(List<MesOutPutStatistics> outPutStatisticsList) {
return CollectionUtils.isEmpty(outPutStatisticsList) ? null : outPutStatisticsList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesOutPutStatistics::getWorkCenterCode));
}
}

@ -37,7 +37,7 @@ public class JxCenterWorkingBoardProxyRepairService implements IJxCenterWorkingB
if (null != proxyService) proxyService.queryCenterWorkingBoardData(dataMap);
String orgainzeCode = (String) dataMap.get(MesExtConstWords.ORGANIZE_CODE);
String organizeCode = (String) dataMap.get(MesExtConstWords.ORGANIZE_CODE);
String workCenterCode = (String) dataMap.get(MesExtConstWords.WORK_CENTER_CODE);
String workTime = (String) dataMap.get(MesExtConstWords.WORK_TIME);
String startTime = (String) dataMap.get(MesExtConstWords.START_TIME);
@ -47,9 +47,9 @@ public class JxCenterWorkingBoardProxyRepairService implements IJxCenterWorkingB
if (!StringUtils.isEmpty(workCenterCode) && !StringUtils.isEmpty(workTime))
repairTaskDbList = repairTaskRepository.findByProperty(
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.IS_VALID, MesExtConstWords.WORK_CENTER_CODE, MesExtConstWords.WORK_TIME},
new Object[]{orgainzeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterCode, workTime});
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterCode, workTime});
else if (!StringUtils.isEmpty(startTime) && !StringUtils.isEmpty(endTime)) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(orgainzeCode);
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.timeBuilder(startTime, endTime, MesExtConstWords.WORK_TIME, true, true, packBean);
repairTaskDbList = repairTaskRepository.findByHqlWhere(packBean);
}

@ -32,7 +32,7 @@ public class JxCenterWorkingBoardProxySpcrService implements IJxCenterWorkingBoa
@Override
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
String orgainzeCode = (String) dataMap.get(MesExtConstWords.ORGANIZE_CODE);
String organizeCode = (String) dataMap.get(MesExtConstWords.ORGANIZE_CODE);
String workCenterCode = (String) dataMap.get(MesExtConstWords.WORK_CENTER_CODE);
String workTime = (String) dataMap.get(MesExtConstWords.WORK_TIME);
String shiftCode = (String) dataMap.get(MesExtConstWords.SHIFT_CODE);
@ -43,9 +43,9 @@ public class JxCenterWorkingBoardProxySpcrService implements IJxCenterWorkingBoa
if (!StringUtils.isEmpty(workCenterCode) && !StringUtils.isEmpty(workTime) && !StringUtils.isEmpty(shiftCode))
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[]{orgainzeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterCode, workTime, shiftCode});
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterCode, workTime, shiftCode});
else if (!StringUtils.isEmpty(startTime) && !StringUtils.isEmpty(endTime)) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(orgainzeCode);
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.timeBuilder(startTime, endTime, MesExtConstWords.WORK_TIME, true, true, packBean);
shiftProdCenterRecordList = shiftProdCenterRecordRepository.findByHqlWhere(packBean);
}

@ -31,7 +31,7 @@ public class JxCenterWorkingBoardProxyTimeSegmentService implements IJxCenterWor
@Override
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
String orgainzeCode = (String) dataMap.get(MesExtConstWords.ORGANIZE_CODE);
String organizeCode = (String) dataMap.get(MesExtConstWords.ORGANIZE_CODE);
String workCenterCode = (String) dataMap.get(MesExtConstWords.WORK_CENTER_CODE);
String workTime = (String) dataMap.get(MesExtConstWords.WORK_TIME);
String shiftCode = (String) dataMap.get(MesExtConstWords.SHIFT_CODE);
@ -40,7 +40,7 @@ public class JxCenterWorkingBoardProxyTimeSegmentService implements IJxCenterWor
List<MesOutPutStatisticsTimeSegment> outPutStatisticsTimeSegmentList = outPutStatisticsTimeSegmentRepository.findByProperty(
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.IS_VALID, MesExtConstWords.WORK_CENTER_CODE, MesExtConstWords.WORK_TIME, MesExtConstWords.SHIFT_CODE, MesExtConstWords.WORK_ORDER_TYPE},
new Object[]{orgainzeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterCode, workTime, shiftCode, MesExtEnumUtil.WORK_ORDER_TYPE.STANDARD_ORDER.getValue()});
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterCode, workTime, shiftCode, MesExtEnumUtil.WORK_ORDER_TYPE.STANDARD_ORDER.getValue()});
if (CollectionUtils.isEmpty(outPutStatisticsTimeSegmentList)) return dataMap;

@ -29,11 +29,19 @@ public class JxCenterWorkingBoardBusiModel extends JxEChartsReportCommonDataMode
@ApiParam("标题")
private String title;
@ApiParam("数据")
private Object obj;
public JxCenterWorkingBoardBusiModel title(String title) {
this.title = title;
return this;
}
public JxCenterWorkingBoardBusiModel obj(Object obj) {
this.obj = obj;
return this;
}
public JxCenterWorkingBoardBusiModel addChartData2ChartDataLists(Integer size, String key, Object value, Object value2, Object value3) {
if (CollectionUtils.isEmpty(this.chartDataLists)) this.chartDataLists = new LinkedList<>();
List<SxDataModel> chartDataList = (CollectionUtils.isEmpty(this.chartDataLists) || this.chartDataLists.get(this.chartDataLists.size() - 1).size() == size) ? new LinkedList<>() : this.chartDataLists.get(this.chartDataLists.size() - 1);
@ -42,6 +50,12 @@ public class JxCenterWorkingBoardBusiModel extends JxEChartsReportCommonDataMode
return this;
}
public JxCenterWorkingBoardBusiModel addChartData(String key, Object value, Object value2, Object value3, Object value4) {
if (CollectionUtils.isEmpty(this.chartDataList)) this.chartDataList = new LinkedList<>();
this.chartDataList.add(new JxEChartsReportCommonDataModel.SxDataModel(key, value, value2, value3, value4));
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));

@ -951,4 +951,7 @@ public class MesExtConstWords {
//流水号截至位置
public static final String SEQNO_END_INDEX = "SEQNO_END_INDEX";
//标准综合能率配置
public static final String SX_STANDARD_RATE_CFG = "SX_STANDARD_RATE_CFG";
}

Loading…
Cancel
Save