jx pmc 看板

tags/yfai-mes-ext-v1.0
王杰 1 year ago
parent f5eb7928c8
commit 76d68b5860

@ -5,6 +5,7 @@ import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import java.util.Map;
/**
@ -69,4 +70,13 @@ public interface IBusiConfigService {
@ApiOperation(value = "获取配置信息MAP", notes = "获取配置信息MAP")
Map<String, String> getConfigMap(String organizeCode, String cfgCode);
/**
*
* @param organizeCode
* @param cfgCode
* @return
*/
@ApiOperation(value = "获取配置信息集合", notes = "获取配置信息集合")
List<MesBusiConfig> getConfigListSortSeq(String organizeCode, String cfgCode);
}

@ -47,8 +47,7 @@ public class JxCenterWorkingBoardController extends MesBaseController {
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
.setErrorDetail("参数缺失业务标志[flag]!")
.build();
dataMap.put(MesExtConstWords.ORGANIZE_CODE, AuthUtil.getOrganize().getOrganizeCode());
dataMap.put(MesExtConstWords.START_TIME, TimeTool.getNowTime(true));
if (!dataMap.containsKey(MesExtConstWords.ORGANIZE_CODE)) dataMap.put(MesExtConstWords.ORGANIZE_CODE, AuthUtil.getOrganize().getOrganizeCode());
return ResultBean.success("查询成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultMap(centerWorkingBoardService.queryCenterWorkingBoardData(dataMap));
} catch (ImppBusiException busExcep) {
return ResultBean.fail(busExcep);

@ -203,4 +203,13 @@ public class BusiConfigService implements IBusiConfigService {
busiConfigList.stream().filter(o -> null != o).collect(Collectors.toMap(MesBusiConfig::getCfgValueSeq, MesBusiConfig::getCfgValue));
}
@Override
public List<MesBusiConfig> getConfigListSortSeq(String organizeCode, String cfgCode) {
List<MesBusiConfig> busiConfigList = busiConfigRepository.findByProperty(
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.IS_VALID, MesExtConstWords.CFG_CODE},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), cfgCode});
return CollectionUtils.isEmpty(busiConfigList) ? null :
busiConfigList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getCfgValueSeq()) && !StringUtils.isEmpty(o.getCfgValue()))).sorted(Comparator.comparing(MesBusiConfig::getCfgValueSeq)).collect(Collectors.toList());
}
}

@ -62,8 +62,6 @@ public class ProjectBadRateService implements IProjectBadRateService {
//看板生产计划达成率标志
public static final String MAIN_BOARD_PRODUCT_PLAN_RATE = "MAIN_BOARD_PRODUCT_PLAN_RATE";
//PMC主看板产线是否显示标志
public static final String BOARD_WORK_SHOW_FLAG = "BOARD_WORK_SHOW_FLAG";
@Override
public List<ProjectBadRateModel> queryProjectBadRate(String organizeCode) throws ParseException {
@ -988,7 +986,7 @@ public class ProjectBadRateService implements IProjectBadRateService {
private List<MesBusiConfig> getBusiConfigWorkCenterList(String organizeCode) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(BOARD_WORK_SHOW_FLAG, MesExtConstWords.CFG_CODE, packBean);
DdlPreparedPack.getStringEqualPack(MesExtConstWords.BOARD_WORK_SHOW_FLAG, MesExtConstWords.CFG_CODE, packBean);
packBean.setOrderByStr(" order by cfgValueSeq asc ");
return busiConfigRepository.findByHqlWhere(packBean);
}

@ -21,7 +21,10 @@ import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -60,9 +63,6 @@ public class EpWorkCenterRunningStateService implements IEpWorkCenterRunningStat
@Autowired
private IProjectBadRateService projectBadRateService;
//PMC主看板产线是否显示标志
public static final String BOARD_WORK_SHOW_FLAG = "BOARD_WORK_SHOW_FLAG";
@Override
public List<EpWorkCenterStateModel> getWorkCenterState(String organizeCode) {
@ -201,7 +201,7 @@ public class EpWorkCenterRunningStateService implements IEpWorkCenterRunningStat
private List<MesBusiConfig> getBusiConfigWorkCenterList(String organizeCode) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getStringEqualPack(BOARD_WORK_SHOW_FLAG, MesExtConstWords.CFG_CODE, packBean);
DdlPreparedPack.getStringEqualPack(MesExtConstWords.BOARD_WORK_SHOW_FLAG, MesExtConstWords.CFG_CODE, packBean);
packBean.setOrderByStr(" order by cfgValueSeq asc ");
return busiConfigRepository.findByHqlWhere(packBean);
}

@ -9,17 +9,17 @@ 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.platform.common.tool.TimeTool;
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 org.springframework.util.StringUtils;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.StringJoiner;
import java.util.stream.Collectors;
/**
@ -28,7 +28,9 @@ import java.util.stream.Collectors;
* @Modify:
**/
@Slf4j
public class JxCenterWorkingBoardBusiOneService implements IJxCenterWorkingBoardService {
public class JxCenterWorkingBoardCenterOneService implements IJxCenterWorkingBoardService {
private IJxCenterWorkingBoardService proxyService0;
private IJxCenterWorkingBoardService proxyService;
@ -36,7 +38,8 @@ public class JxCenterWorkingBoardBusiOneService implements IJxCenterWorkingBoard
private MesWorkCenterNotificationBarRepository workCenterNotificationBarRepository;
public JxCenterWorkingBoardBusiOneService(IJxCenterWorkingBoardService proxyService) {
public JxCenterWorkingBoardCenterOneService(IJxCenterWorkingBoardService proxyService0, IJxCenterWorkingBoardService proxyService) {
this.proxyService0 = proxyService0;
this.proxyService = proxyService;
this.fourMDetailRepository = (MesFourMDetailRepository) SpringContextsUtil.getBean("mesFourMDetailRepository");
this.workCenterNotificationBarRepository = (MesWorkCenterNotificationBarRepository) SpringContextsUtil.getBean("mesWorkCenterNotificationBarRepository");
@ -45,19 +48,25 @@ public class JxCenterWorkingBoardBusiOneService implements IJxCenterWorkingBoard
@Override
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
dataMap = proxyService.queryCenterWorkingBoardData(dataMap);
dataMap = proxyService0.queryCenterWorkingBoardData(dataMap);
MesWorkCenterExt workCenterExtDb = (MesWorkCenterExt) dataMap.get(MesWorkCenterExt.class.getSimpleName());
String startTime = (String) dataMap.get(MesExtConstWords.START_TIME);
String curTime = TimeTool.getNowTime(true);
packProxyCondition(dataMap, workCenterExtDb, curTime);
dataMap = proxyService.queryCenterWorkingBoardData(dataMap);
List<MesShiftProdCenterRecord> shiftProdCenterRecordList = (List<MesShiftProdCenterRecord>) dataMap.get(MesShiftProdCenterRecord.class.getSimpleName());
dataMap.put("生产状态", getWorkingStatusData(shiftProdCenterRecordList, startTime));
dataMap.put("BOARD_TITLE", workCenterExtDb.getWorkCenterName() + "产线运行状态看板");
dataMap.put("异常停工时间", getUnnormalStopCenterData(shiftProdCenterRecordList, startTime));
dataMap.put("BOARD_BOTTOM", "PKATJX·松下厨电科技嘉兴有限公司");
dataMap.put("4M变更信息", getFourMChangeData(workCenterExtDb, startTime));
dataMap.put("异常停工时间", getUnnormalStopCenterData(shiftProdCenterRecordList, curTime));
dataMap.put("4M变更信息", getFourMChangeData(workCenterExtDb, curTime));
dataMap.put("公告信息", getWorkCenterNotificationBarData(workCenterExtDb));
@ -68,31 +77,30 @@ public class JxCenterWorkingBoardBusiOneService implements IJxCenterWorkingBoard
public Map<String, Object> clearUselessData(Map<String, Object> dataMap) {
dataMap.remove(MesWorkCenterExt.class.getSimpleName());
dataMap.remove(MesShiftProdCenterRecord.class.getSimpleName());
dataMap.remove(MesExtConstWords.WORK_TIME);
dataMap.remove(MesExtConstWords.SHIFT_CODE);
dataMap.remove(MesExtConstWords.WORK_CENTER_CODE);
dataMap.remove("curTime");
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 void packProxyCondition(Map<String, Object> dataMap, MesWorkCenterExt workCenterExtDb, String curTime) {
if (StringUtils.isEmpty(workCenterExtDb.getWorkTime()) || StringUtils.isEmpty(workCenterExtDb.getShiftCode())) return;
dataMap.put(MesExtConstWords.WORK_TIME, workCenterExtDb.getWorkTime());
dataMap.put(MesExtConstWords.SHIFT_CODE, workCenterExtDb.getShiftCode());
dataMap.put(MesExtConstWords.WORK_CENTER_CODE, workCenterExtDb.getWorkCenterCode());
dataMap.put("curTime", curTime);
}
private List<MesShiftProdCenterRecord> getUnnormalStopCenterData(List<MesShiftProdCenterRecord> shiftProdCenterRecordList, String startTime) {
private List<MesShiftProdCenterRecord> getUnnormalStopCenterData(List<MesShiftProdCenterRecord> shiftProdCenterRecordList, String curTime) {
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());
shiftProdCenterRecordList.stream().filter(o -> (null != o && MesExtEnumUtil.SHIFT_PROD_TYPE.UNNORMAL_STOP_CENTER.getValue() == o.getProdType() && o.getStartTime().compareTo(curTime) <= 0)).collect(Collectors.toList());
}
private List<MesFourMDetail> getFourMChangeData(MesWorkCenterExt workCenterExtDb, String startTime) {
private List<MesFourMDetail> getFourMChangeData(MesWorkCenterExt workCenterExtDb, String curTime) {
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.getStringRightLikerPack(curTime.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);
@ -110,40 +118,4 @@ public class JxCenterWorkingBoardBusiOneService implements IJxCenterWorkingBoard
return null == workCenterNotificationBar ? "暂无公告" : workCenterNotificationBar.getContent();
}
enum SHIFT_PROD_TYPE_COLOR {
//System.out.println(String.format("#%02x%02x%02x", Color.white.getRed(), Color.white.getGreen(), Color.white.getBlue()));
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;
}
}
}

@ -5,11 +5,13 @@ 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.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 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.Optional;
@ -21,21 +23,28 @@ import java.util.stream.Collectors;
* @Modify:
**/
@Slf4j
public class JxCenterWorkingBoardBusiThreeService extends JxCenterWorkingBoardCommonService implements IJxCenterWorkingBoardService {
public class JxCenterWorkingBoardCenterThreeService extends JxCenterWorkingBoardCommonService implements IJxCenterWorkingBoardService {
private IJxCenterWorkingBoardService proxyService0;
private IJxCenterWorkingBoardService proxyService;
public JxCenterWorkingBoardBusiThreeService(IJxCenterWorkingBoardService proxyService) {
public JxCenterWorkingBoardCenterThreeService(IJxCenterWorkingBoardService proxyService0, IJxCenterWorkingBoardService proxyService) {
this.proxyService0 = proxyService0;
this.proxyService = proxyService;
}
@Override
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
dataMap = proxyService.queryCenterWorkingBoardData(dataMap);
dataMap = proxyService0.queryCenterWorkingBoardData(dataMap);
MesWorkCenterExt workCenterExtDb = (MesWorkCenterExt) dataMap.get(MesWorkCenterExt.class.getSimpleName());
packProxyCondition(dataMap, workCenterExtDb);
dataMap = proxyService.queryCenterWorkingBoardData(dataMap);
List<MesWorkOrder> workOrderList = (List<MesWorkOrder>) dataMap.get(MesWorkOrder.class.getSimpleName());
List<MesOutPutStatistics> outPutStatisticsList = (List<MesOutPutStatistics>) dataMap.get(MesOutPutStatistics.class.getSimpleName());
@ -59,9 +68,23 @@ public class JxCenterWorkingBoardBusiThreeService extends JxCenterWorkingBoardCo
dataMap.remove(MesWorkOrder.class.getSimpleName());
dataMap.remove(MesOutPutStatistics.class.getSimpleName());
dataMap.remove(MesExtConstWords.COMPLET_QTY);
dataMap.remove(MesExtConstWords.START_TIME);
dataMap.remove(MesExtConstWords.END_TIME);
dataMap.remove(MesExtConstWords.WORK_TIME);
dataMap.remove(MesExtConstWords.SHIFT_CODE);
dataMap.remove(MesExtConstWords.WORK_CENTER_CODE);
return dataMap;
}
private void packProxyCondition(Map<String, Object> dataMap, MesWorkCenterExt workCenterExtDb) {
if (StringUtils.isEmpty(workCenterExtDb.getWorkTime()) || StringUtils.isEmpty(workCenterExtDb.getShiftCode())) return;
dataMap.put(MesExtConstWords.START_TIME, TimeTool.timeCalc(TimeTool.stringParseToDate(workCenterExtDb.getWorkTime(), MesExtConstWords.DATE_FORMAT), Calendar.DATE, -1, MesExtConstWords.DATE_FORMAT));
dataMap.put(MesExtConstWords.END_TIME, workCenterExtDb.getWorkTime());
dataMap.put(MesExtConstWords.WORK_TIME, workCenterExtDb.getWorkTime());
dataMap.put(MesExtConstWords.SHIFT_CODE, workCenterExtDb.getShiftCode());
dataMap.put(MesExtConstWords.WORK_CENTER_CODE, workCenterExtDb.getWorkCenterCode());
}
private Optional<MesWorkOrder> getFirstWorkOrder(List<MesWorkOrder> workOrderList, List<MesOutPutStatistics> outPutStatisticsList, MesWorkCenterExt workCenterExtDb) {
if (!CollectionUtils.isEmpty(outPutStatisticsList)) return CollectionUtils.isEmpty(workOrderList) ? null : workOrderList.stream().filter(o -> (null != o && o.getOrderNo().equals(outPutStatisticsList.get(0).getWorkOrderNo()))).findFirst();

@ -1,10 +1,10 @@
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.*;
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;
@ -28,7 +28,9 @@ import java.util.stream.Collectors;
* @Modify:
**/
@Slf4j
public class JxCenterWorkingBoardBusiTwoService extends JxCenterWorkingBoardCommonService implements IJxCenterWorkingBoardService {
public class JxCenterWorkingBoardCenterTwoService extends JxCenterWorkingBoardCommonService implements IJxCenterWorkingBoardService {
private IJxCenterWorkingBoardService proxyService0;
private IJxCenterWorkingBoardService proxyService;
@ -36,35 +38,40 @@ public class JxCenterWorkingBoardBusiTwoService extends JxCenterWorkingBoardComm
private MesOrderJobRepository orderJobRepository;
private MesRepairTaskRepository repairTaskRepository;
private IPartExtDao partExtDao;
public JxCenterWorkingBoardBusiTwoService(IJxCenterWorkingBoardService proxyService) {
public JxCenterWorkingBoardCenterTwoService(IJxCenterWorkingBoardService proxyService0, IJxCenterWorkingBoardService proxyService) {
this.proxyService0 = proxyService0;
this.proxyService = proxyService;
this.shiftRepository = (MesShiftRepository) SpringContextsUtil.getBean("mesShiftRepository");
this.orderJobRepository = (MesOrderJobRepository) SpringContextsUtil.getBean("mesOrderJobRepository");
this.repairTaskRepository = (MesRepairTaskRepository) SpringContextsUtil.getBean("mesRepairTaskRepository");
this.partExtDao = (IPartExtDao) SpringContextsUtil.getBean("partExtDao");
}
@Override
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
dataMap = proxyService.queryCenterWorkingBoardData(dataMap);
String startTime = (String) dataMap.get(MesExtConstWords.START_TIME);
dataMap = proxyService0.queryCenterWorkingBoardData(dataMap);
MesWorkCenterExt workCenterExtDb = (MesWorkCenterExt) dataMap.get(MesWorkCenterExt.class.getSimpleName());
List<MesWorkOrder> workOrderList = (List<MesWorkOrder>) dataMap.get(MesWorkOrder.class.getSimpleName());
packProxyCondition(dataMap, workCenterExtDb);
dataMap = proxyService.queryCenterWorkingBoardData(dataMap);
String curTime = TimeTool.getNowTime(true);
List<MesShiftProdCenterRecord> shiftProdCenterRecordList = (List<MesShiftProdCenterRecord>) dataMap.get(MesShiftProdCenterRecord.class.getSimpleName());
List<MesWorkOrder> workOrderList = (List<MesWorkOrder>) dataMap.get(MesWorkOrder.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 = (List<MesRepairTask>) dataMap.get(MesRepairTask.class.getSimpleName());
List<MesRepairTask> repairTaskList = getRepairTaskList(workCenterExtDb);
Map<String, Double> partStandardWorkMap = partExtDao.queryPartExtStandardWorkMap(workCenterExtDb.getOrganizeCode());
statisticsData(shiftProdCenterRecordList, outPutStatisticsList, partStandardWorkMap, workCenterExtDb, startTime, dataMap);
statisticsData(shiftProdCenterRecordList, outPutStatisticsList, partStandardWorkMap, workCenterExtDb, curTime, dataMap);
dataMap.put("当前班次", getShiftName(workCenterExtDb));
@ -99,9 +106,13 @@ public class JxCenterWorkingBoardBusiTwoService extends JxCenterWorkingBoardComm
dataMap.remove(MesShiftProdCenterRecord.class.getSimpleName());
dataMap.remove(MesWorkOrder.class.getSimpleName());
dataMap.remove(MesOutPutStatistics.class.getSimpleName());
dataMap.remove(MesExtConstWords.STANDARD_WORK);
dataMap.remove(MesExtConstWords.QTY);
dataMap.remove(MesExtConstWords.COMPLET_QTY);
dataMap.remove(MesExtConstWords.START_TIME);
dataMap.remove(MesExtConstWords.END_TIME);
dataMap.remove(MesExtConstWords.WORK_TIME);
dataMap.remove(MesExtConstWords.SHIFT_CODE);
dataMap.remove(MesExtConstWords.WORK_CENTER_CODE);
dataMap.remove("serviceTime");
dataMap.remove("nonWorkingTime");
dataMap.remove("standardTime");
@ -109,25 +120,27 @@ public class JxCenterWorkingBoardBusiTwoService extends JxCenterWorkingBoardComm
return dataMap;
}
private List<MesRepairTask> getRepairTaskList(MesWorkCenterExt workCenterExtDb) {
return StringUtils.isEmpty(workCenterExtDb.getWorkTime()) ? null :
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 packProxyCondition(Map<String, Object> dataMap, MesWorkCenterExt workCenterExtDb) {
if (StringUtils.isEmpty(workCenterExtDb.getWorkTime()) || StringUtils.isEmpty(workCenterExtDb.getShiftCode())) return;
dataMap.put(MesExtConstWords.START_TIME, TimeTool.timeCalc(TimeTool.stringParseToDate(workCenterExtDb.getWorkTime(), MesExtConstWords.DATE_FORMAT), Calendar.DATE, -1, MesExtConstWords.DATE_FORMAT));
dataMap.put(MesExtConstWords.END_TIME, workCenterExtDb.getWorkTime());
dataMap.put(MesExtConstWords.WORK_TIME, workCenterExtDb.getWorkTime());
dataMap.put(MesExtConstWords.SHIFT_CODE, workCenterExtDb.getShiftCode());
dataMap.put(MesExtConstWords.WORK_CENTER_CODE, workCenterExtDb.getWorkCenterCode());
}
private void statisticsData(List<MesShiftProdCenterRecord> shiftProdCenterRecordList, List<MesOutPutStatistics> outPutStatisticsList,
Map<String, Double> partStandardWorkMap, MesWorkCenterExt workCenterExtDb, String startTime, Map<String, Object> dataMap) {
Map<String, Double> partStandardWorkMap, MesWorkCenterExt workCenterExtDb, String curTime, 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());
shiftProdCenterRecordList.stream().filter(o -> (null != o && o.getShiftCode().equals(workCenterExtDb.getShiftCode()) && 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, startTime)).sum();
Double nonWorkingTime = CollectionUtils.isEmpty(stopList) ? new Double(0) : stopList.stream().filter(o -> null != o).mapToDouble(o -> getStatisticsTime(o, startTime)).sum();
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);
@ -138,9 +151,9 @@ public class JxCenterWorkingBoardBusiTwoService extends JxCenterWorkingBoardComm
}
private Double getStatisticsTime(MesShiftProdCenterRecord shiftProdCenterRecord, String startTime) {
private Double getStatisticsTime(MesShiftProdCenterRecord shiftProdCenterRecord, String curTime) {
try {
String endTime = shiftProdCenterRecord.getEndTime().compareTo(startTime) <= 0 ? shiftProdCenterRecord.getEndTime() : startTime;
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);
@ -176,10 +189,6 @@ public class JxCenterWorkingBoardBusiTwoService extends JxCenterWorkingBoardComm
return new StringJoiner(MesExtConstWords.SINGLE_SLASH).add(getListSizeStr(orderJobList4Complete)).add(getListSizeStr(orderJobList)).toString();
}
private String getListSizeStr(List list) { return CollectionUtils.isEmpty(list) ? MesExtConstWords.ZERO_STR : 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);
@ -229,7 +238,7 @@ public class JxCenterWorkingBoardBusiTwoService extends JxCenterWorkingBoardComm
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));
Map<String, List<MesOutPutStatistics>> itemMap2OutPut = getOutPutStatisticsMapByOrderNo(outPutList);
psData.addChartData2ChartDataLists(5, partNo, statisticsPlanQty(orderList, itemMap2OutPut, workCenterExtDb), getOutPutStatisticsList2AmountQty(outPutList), !CollectionUtils.isEmpty(psData.getChartDataList()) ? "#ffffff" : "#00ff00");
@ -249,21 +258,4 @@ public class JxCenterWorkingBoardBusiTwoService extends JxCenterWorkingBoardComm
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;
}
}

@ -2,13 +2,17 @@ package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.busi.jx;
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.util.MesExtConstWords;
import cn.estsh.i3plus.platform.common.tool.MathOperation;
import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -27,10 +31,51 @@ public class JxCenterWorkingBoardCommonService {
))).sorted(Comparator.comparing(MesWorkOrder::getSeq)).collect(Collectors.toList());
}
public List<MesWorkOrder> getWorkOrderListByWorkTime(List<MesWorkOrder> workOrderList, String workTime) {
return CollectionUtils.isEmpty(workOrderList) ? null : workOrderList.stream().filter(o -> (null != o && o.getStartTime().contains(workTime))).collect(Collectors.toList());
}
public List<MesOutPutStatistics> getOutPutStatisticsListByWorkTime(List<MesOutPutStatistics> outPutStatisticsList, String workTime) {
return CollectionUtils.isEmpty(outPutStatisticsList) ? null : outPutStatisticsList.stream().filter(o -> (null != o && o.getWorkTime().equals(workTime))).collect(Collectors.toList());
}
public Double getWorkOrderList2AmountQty(List<MesWorkOrder> workOrderList) {
return CollectionUtils.isEmpty(workOrderList) ? new Double(0) : workOrderList.stream().filter(o -> null != o).mapToDouble(MesWorkOrder::getQty).sum();
}
public Double getOutPutStatisticsList2AmountQty(List<MesOutPutStatistics> outPutStatisticsList) {
return CollectionUtils.isEmpty(outPutStatisticsList) ? new Double(0) : outPutStatisticsList.stream().filter(o -> null != o).mapToDouble(MesOutPutStatistics::getQty).sum();
}
public Map<String, List<MesOutPutStatistics>> getOutPutStatisticsMapByOrderNo(List<MesOutPutStatistics> outPutStatisticsList) {
return CollectionUtils.isEmpty(outPutStatisticsList) ? null : outPutStatisticsList.stream().filter(o -> null != o).collect(Collectors.groupingBy(MesOutPutStatistics::getWorkOrderNo));
}
public List<MesOutPutStatistics> sortOutPutStatisticsList(List<MesOutPutStatistics> outPutStatisticsList) {
return CollectionUtils.isEmpty(outPutStatisticsList) ? null : outPutStatisticsList.stream().filter(o -> null != o).sorted(Comparator.comparing(MesOutPutStatistics::getModifyDatetime).reversed()).collect(Collectors.toList());
}
public String getQtyStr(Double qty) { return qty.intValue() + "台"; }
public String getListSizeStr(List list) { return CollectionUtils.isEmpty(list) ? MesExtConstWords.ZERO_STR : String.valueOf(list.size()); }
public Double getListSizeD(List list) { return new Double(CollectionUtils.isEmpty(list) ? MesExtConstWords.ZERO : list.size()); }
public String getBigDecimalPercent(BigDecimal b) {
return b + MesExtConstWords.PERCENT;
}
public 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);
}
public 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;
}
}

@ -20,12 +20,21 @@ public class JxCenterWorkingBoardDispatchService implements IJxCenterWorkingBoar
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":
return new JxCenterWorkingBoardBusiThreeService(new JxCenterWorkingBoardProxyOutPutService(new JxCenterWorkingBoardProxyOrderService(new JxCenterWorkingBoardProxyCenterService()))).queryCenterWorkingBoardData(dataMap);
case "center01":
return new JxCenterWorkingBoardCenterOneService(new JxCenterWorkingBoardProxyCenterService(), new JxCenterWorkingBoardProxyWorkingStatusService(new JxCenterWorkingBoardProxySpcrService())).queryCenterWorkingBoardData(dataMap);
case "center02":
return new JxCenterWorkingBoardCenterTwoService(new JxCenterWorkingBoardProxyCenterService(),
new JxCenterWorkingBoardProxyOrderService(new JxCenterWorkingBoardProxyOutPutService(new JxCenterWorkingBoardProxyRepairService(new JxCenterWorkingBoardProxySpcrService())))).queryCenterWorkingBoardData(dataMap);
case "center03":
return new JxCenterWorkingBoardCenterThreeService(new JxCenterWorkingBoardProxyCenterService(), new JxCenterWorkingBoardProxyOrderService(new JxCenterWorkingBoardProxyOutPutService())).queryCenterWorkingBoardData(dataMap);
case "monitor01":
return new JxCenterWorkingBoardMonitorOneService(new JxCenterWorkingBoardProxyAllCenterService(), new JxCenterWorkingBoardProxyWorkingStatusService(),
new JxCenterWorkingBoardProxyOrderService(new JxCenterWorkingBoardProxyOutPutService(new JxCenterWorkingBoardProxyRepairService(new JxCenterWorkingBoardProxySpcrService())))).queryCenterWorkingBoardData(dataMap);
default:
return dataMap;

@ -0,0 +1,241 @@
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.busi.jx;
import cn.estsh.i3plus.ext.mes.api.base.IMesAccidentDateService;
import cn.estsh.i3plus.ext.mes.api.base.IMesNumberOfSafeOperationDaysService;
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.*;
import cn.estsh.i3plus.ext.mes.pojo.model.MesAccidentDateModel;
import cn.estsh.i3plus.ext.mes.pojo.model.jx.JxCenterWorkingBoardBusiModel;
import cn.estsh.i3plus.ext.mes.pojo.repository.MesOutPutStatisticsRepository;
import cn.estsh.i3plus.ext.mes.pojo.repository.MesPlantInfoRepository;
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.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.mes.bean.MesWorkOrder;
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.*;
import java.util.stream.Collectors;
/**
* @Author : wangjie
* @CreateDate : 2022-02-15
* @Modify:
**/
@Slf4j
public class JxCenterWorkingBoardMonitorOneService extends JxCenterWorkingBoardCommonService implements IJxCenterWorkingBoardService {
private IJxCenterWorkingBoardService proxyService0;
private IJxCenterWorkingBoardService proxyService1;
private IJxCenterWorkingBoardService proxyService;
private MesPlantInfoRepository plantInfoRepository;
private IMesNumberOfSafeOperationDaysService numberOfSafeOperationDaysService;
private IMesAccidentDateService accidentDateService;
private IBusiConfigService busiConfigService;
private MesOutPutStatisticsRepository outPutStatisticsRepository;
public JxCenterWorkingBoardMonitorOneService(IJxCenterWorkingBoardService proxyService0, IJxCenterWorkingBoardService proxyService1, IJxCenterWorkingBoardService proxyService) {
this.proxyService0 = proxyService0;
this.proxyService1 = proxyService1;
this.proxyService = proxyService;
this.plantInfoRepository = (MesPlantInfoRepository) SpringContextsUtil.getBean("mesPlantInfoRepository");
this.numberOfSafeOperationDaysService = (IMesNumberOfSafeOperationDaysService) SpringContextsUtil.getBean("mesNumberOfSafeOperationDaysService");
this.accidentDateService = (IMesAccidentDateService) SpringContextsUtil.getBean("mesAccidentDateService");
this.busiConfigService = (IBusiConfigService) SpringContextsUtil.getBean("busiConfigService");
this.outPutStatisticsRepository = (MesOutPutStatisticsRepository) SpringContextsUtil.getBean("mesOutPutStatisticsRepository");
}
@Override
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
dataMap = proxyService0.queryCenterWorkingBoardData(dataMap);
List<MesWorkCenterExt> workCenterExtDbList = (List<MesWorkCenterExt>) dataMap.get(MesWorkCenterExt.class.getSimpleName());
packProxyCondition(dataMap, workCenterExtDbList);
dataMap = proxyService.queryCenterWorkingBoardData(dataMap);
String organizeCode = (String) dataMap.get(MesExtConstWords.ORGANIZE_CODE);
dataMap.put("BOARD_TITLE", "PKATJX智能工场监控中心");
dataMap.put("BOARD_BOTTOM", "PKATJX·松下厨电科技嘉兴有限公司");
dataMap.put("工厂信息总览", getOrganizeInfo(organizeCode));
dataMap.put("累计安全运行天数", getAmountSafeRunningDays(organizeCode));
dataMap.put("当年累计总事故数", getCurYearAmountAccident(organizeCode));
dataMap.put("生产进度", getProductionSchedule(organizeCode, workCenterExtDbList, dataMap));
dataMap.put("本体产线状态", getOntologyLineWorkingStatus(organizeCode, workCenterExtDbList, dataMap));
dataMap.put("本体能率", "");
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(MesExtConstWords.START_TIME);
dataMap.remove(MesExtConstWords.END_TIME);
dataMap.remove(MesExtConstWords.WORK_TIME);
dataMap.remove(MesExtConstWords.SHIFT_CODE);
dataMap.remove(MesExtConstWords.WORK_CENTER_CODE);
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));
}
private MesPlantInfo getOrganizeInfo(String organizeCode) {
return plantInfoRepository.getByProperty(
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.IS_VALID},
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue()});
}
private MesNumberOfSafeOperationDays getAmountSafeRunningDays(String organizeCode) {
return numberOfSafeOperationDaysService.queryNumberOfSafeOperationDays(organizeCode);
}
private MesAccidentDateModel getCurYearAmountAccident(String organizeCode) {
return accidentDateService.queryAccidentDaysBoard(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;
MesBusiConfig catagoryCodeCfg = busiConfigService.getBusiConfigByCfgCode(organizeCode, MesExtConstWords.SX_CATEGORY_CFG);
if (null == catagoryCodeCfg || StringUtils.isEmpty(catagoryCodeCfg.getCfgValue()) || StringUtils.isEmpty(catagoryCodeCfg.getCfgValueSeq())) return psData;
String[] categoryCodeArr = catagoryCodeCfg.getCfgValueSeq().split(MesExtConstWords.COMMA);
String[] categoryNameArr = catagoryCodeCfg.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 JxCenterWorkingBoardBusiModel getOntologyLineWorkingStatus(String organizeCode, List<MesWorkCenterExt> workCenterExtDbList, Map<String, Object> dataMap) {
JxCenterWorkingBoardBusiModel psData = new JxCenterWorkingBoardBusiModel().title("本体产线状态");
List<MesBusiConfig> busiConfigList = busiConfigService.getConfigListSortSeq(organizeCode, MesExtConstWords.BOARD_WORK_SHOW_FLAG);
if (CollectionUtils.isEmpty(busiConfigList)) return psData;
Map<String, MesWorkCenterExt> workCenterExtDbMap = workCenterExtDbList.stream().filter(o -> null != o).collect(Collectors.toMap(MesWorkCenterExt::getWorkCenterCode, o -> o));
Map<String, List<MesOutPutStatistics>> centerMap4OutPutFilter = (Map<String, List<MesOutPutStatistics>>) dataMap.get(MesOutPutStatistics.class.getSimpleName());
List<MesRepairTask> repairTaskList = (List<MesRepairTask>) dataMap.get(MesRepairTask.class.getSimpleName());
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.SHIFT_CODE, workCenterExtDb.getShiftCode());
dataMap.put(MesExtConstWords.WORK_CENTER_CODE, workCenterExtDb.getWorkCenterCode());
MesOutPutStatistics outPutStatistics = (!CollectionUtils.isEmpty(centerMap4OutPutFilter) && centerMap4OutPutFilter.containsKey(workCenterExtDb.getWorkCenterCode())) ? centerMap4OutPutFilter.get(workCenterExtDb.getWorkCenterCode()).get(0) : getOutPutStatisticsByCenter(organizeCode, workCenterExtDb.getWorkCenterCode());
List<MesOutPutStatistics> outPutStatisticsListFilter = (null == outPutStatistics || CollectionUtils.isEmpty(centerMap4OutPutFilter)) ? null : centerMap4OutPutFilter.get(workCenterExtDb.getWorkCenterCode());
outPutStatisticsListFilter = CollectionUtils.isEmpty(outPutStatisticsListFilter) ? null : outPutStatisticsListFilter.stream().filter(o -> (null != o && o.getWorkOrderNo().equals(outPutStatistics.getWorkOrderNo()))).collect(Collectors.toList());
psData.addChartData(workCenterExtDb.getWorkCenterCode(), null == outPutStatistics ? null : outPutStatistics.getPartNo(), getRepairRate(outPutStatisticsListFilter, repairTaskList, workCenterExtDb), proxyService1.queryCenterWorkingBoardData(dataMap).get("生产状态"));
}
return psData;
}
private String getRepairRate(List<MesOutPutStatistics> outPutStatisticsList, List<MesRepairTask> repairTaskList, MesWorkCenterExt workCenterExtDb) {
return (CollectionUtils.isEmpty(outPutStatisticsList) || StringUtils.isEmpty(workCenterExtDb.getWorkTime())) ? getBigDecimalPercent(format1RounHalfUp(new Double(0))) : calcRepairRate(outPutStatisticsList, repairTaskList, workCenterExtDb);
}
private String calcRepairRate(List<MesOutPutStatistics> outPutStatisticsList, List<MesRepairTask> repairTaskList, MesWorkCenterExt workCenterExtDb) {
Double repairQty = CollectionUtils.isEmpty(repairTaskList) ? new Double(0) : getListSizeD(repairTaskList.stream().filter(o -> (null != o && o.getWorkOrderNo().equals(outPutStatisticsList.get(0).getWorkOrderNo()) && o.getWorkTime().equals(workCenterExtDb.getWorkTime()))).collect(Collectors.toList()));
Double qty = getOutPutStatisticsList2AmountQty(outPutStatisticsList);
return getBigDecimalPercent(format1RounHalfUp(MathOperation.sub(new Double(100), MathOperation.div(qty, MathOperation.add(qty, repairQty)))));
}
private MesOutPutStatistics getOutPutStatisticsByCenter(String organizeCode, String workCenterCode) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
DdlPreparedPack.getNumEqualPack(workCenterCode, MesExtConstWords.WORK_CENTER_CODE, packBean);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.WORK_ORDER_TYPE.STANDARD_ORDER.getValue(), MesExtConstWords.WORK_ORDER_TYPE, packBean);
DdlPreparedPack.getOrderByPack(new Object[]{CommonEnumUtil.ASC_OR_DESC.DESC.getValue()}, new String[]{MesExtConstWords.MODIFY_DATE_TIME}, packBean);
return outPutStatisticsRepository.getByProperty(packBean);
}
}

@ -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 org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Map;
/**
* @Author : wangjie
* @CreateDate : 2022-02-15
* @Modify:
**/
@Slf4j
public class JxCenterWorkingBoardProxyAllCenterService implements IJxCenterWorkingBoardService {
private IProdOrgExtService prodOrgExtService;
public JxCenterWorkingBoardProxyAllCenterService() {
this.prodOrgExtService = (IProdOrgExtService) SpringContextsUtil.getBean("prodOrgExtService");
}
@Override
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
List<MesWorkCenterExt> workCenterExtDbList = prodOrgExtService.queryWorkCenterExtList((String) dataMap.get(MesExtConstWords.ORGANIZE_CODE));
if (CollectionUtils.isEmpty(workCenterExtDbList)) return dataMap;
dataMap.put(MesWorkCenterExt.class.getSimpleName(), workCenterExtDbList);
return dataMap;
}
}

@ -27,7 +27,6 @@ public class JxCenterWorkingBoardProxyCenterService implements IJxCenterWorkingB
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;
}

@ -1,10 +1,8 @@
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;
@ -14,7 +12,6 @@ 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;
@ -39,18 +36,19 @@ public class JxCenterWorkingBoardProxyOrderService implements IJxCenterWorkingBo
@Override
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
dataMap = proxyService.queryCenterWorkingBoardData(dataMap);
if (null != proxyService) dataMap = proxyService.queryCenterWorkingBoardData(dataMap);
MesWorkCenterExt workCenterExtDb = (MesWorkCenterExt) dataMap.get(MesWorkCenterExt.class.getSimpleName());
if (StringUtils.isEmpty(workCenterExtDb.getWorkTime()) || StringUtils.isEmpty(workCenterExtDb.getShiftCode())) return dataMap;
String orgainzeCode = (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);
DdlPackBean packBean = DdlPackBean.getDdlPackBean(workCenterExtDb.getOrganizeCode());
DdlPreparedPack.getStringEqualPack(workCenterExtDb.getWorkCenterCode(), MesExtConstWords.WORK_CENTER_CODE, packBean);
if (!StringUtils.isEmpty(startTime) && !StringUtils.isEmpty(endTime)) return dataMap;
DdlPackBean packBean = DdlPackBean.getDdlPackBean(orgainzeCode);
DdlPreparedPack.getStringEqualPack(workCenterCode, MesExtConstWords.WORK_CENTER_CODE, packBean);
DdlPreparedPack.getNumEqualPack(MesExtEnumUtil.WORK_ORDER_TYPE.STANDARD_ORDER.getValue(), MesExtConstWords.WORK_ORDER_TYPE, packBean);
DdlPreparedPack.timeBuilder(
TimeTool.timeCalc(TimeTool.stringParseToDate(workCenterExtDb.getWorkTime(), MesExtConstWords.DATE_FORMAT), Calendar.DATE, -1, MesExtConstWords.DATE_FORMAT) + MesExtConstWords.APPEND_ZERO_HMS,
workCenterExtDb.getWorkTime() + MesExtConstWords.APPEND_24_HMS, MesExtConstWords.START_TIME, true, true, packBean
);
DdlPreparedPack.timeBuilder(startTime + MesExtConstWords.APPEND_ZERO_HMS, endTime + 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;

@ -1,13 +1,13 @@
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.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;
@ -28,35 +28,43 @@ public class JxCenterWorkingBoardProxyOutPutService implements IJxCenterWorkingB
private MesOutPutStatisticsRepository outPutStatisticsRepository;
private IPartExtDao partExtDao;
public JxCenterWorkingBoardProxyOutPutService() {
this.outPutStatisticsRepository = (MesOutPutStatisticsRepository) SpringContextsUtil.getBean("mesOutPutStatisticsRepository");
}
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);
if (null != proxyService) dataMap = proxyService.queryCenterWorkingBoardData(dataMap);
MesWorkCenterExt workCenterExtDb = (MesWorkCenterExt) dataMap.get(MesWorkCenterExt.class.getSimpleName());
if (StringUtils.isEmpty(workCenterExtDb.getWorkTime()) || StringUtils.isEmpty(workCenterExtDb.getShiftCode())) return dataMap;
String orgainzeCode = (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);
String endTime = (String) dataMap.get(MesExtConstWords.END_TIME);
List<MesOutPutStatistics> outPutStatisticsList = outPutStatisticsRepository.findByProperty(
List<MesOutPutStatistics> outPutStatisticsList = null;
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[]{workCenterExtDb.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterExtDb.getWorkCenterCode(), workCenterExtDb.getWorkTime(), MesExtEnumUtil.WORK_ORDER_TYPE.STANDARD_ORDER.getValue()},
new Object[]{orgainzeCode, 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);
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);
}
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,62 @@
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.MesRepairTask;
import cn.estsh.i3plus.ext.mes.pojo.repository.MesRepairTaskRepository;
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
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 org.springframework.util.StringUtils;
import java.util.List;
import java.util.Map;
/**
* @Author : wangjie
* @CreateDate : 2022-02-15
* @Modify:
**/
@Slf4j
public class JxCenterWorkingBoardProxyRepairService implements IJxCenterWorkingBoardService {
private IJxCenterWorkingBoardService proxyService;
private MesRepairTaskRepository repairTaskRepository;
public JxCenterWorkingBoardProxyRepairService(IJxCenterWorkingBoardService proxyService) {
this.proxyService = proxyService;
this.repairTaskRepository = (MesRepairTaskRepository) SpringContextsUtil.getBean("mesRepairTaskRepository");
}
@Override
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
String orgainzeCode = (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);
String endTime = (String) dataMap.get(MesExtConstWords.END_TIME);
List<MesRepairTask> repairTaskDbList = null;
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});
else if (!StringUtils.isEmpty(startTime) && !StringUtils.isEmpty(endTime)) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean(orgainzeCode);
DdlPreparedPack.timeBuilder(startTime, endTime, MesExtConstWords.WORK_TIME, true, true, packBean);
repairTaskDbList = repairTaskRepository.findByHqlWhere(packBean);
}
if (CollectionUtils.isEmpty(repairTaskDbList)) return dataMap;
dataMap.put(MesRepairTask.class.getSimpleName(), repairTaskDbList);
return dataMap;
}
}

@ -2,10 +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.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.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;
@ -22,26 +23,33 @@ import java.util.Map;
@Slf4j
public class JxCenterWorkingBoardProxySpcrService implements IJxCenterWorkingBoardService {
private IJxCenterWorkingBoardService proxyService;
private MesShiftProdCenterRecordRepository shiftProdCenterRecordRepository;
public JxCenterWorkingBoardProxySpcrService(IJxCenterWorkingBoardService proxyService) {
this.proxyService = proxyService;
public JxCenterWorkingBoardProxySpcrService() {
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;
String orgainzeCode = (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);
String startTime = (String) dataMap.get(MesExtConstWords.START_TIME);
String endTime = (String) dataMap.get(MesExtConstWords.END_TIME);
List<MesShiftProdCenterRecord> shiftProdCenterRecordList = shiftProdCenterRecordRepository.findByProperty(
List<MesShiftProdCenterRecord> shiftProdCenterRecordList = null;
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[]{workCenterExtDb.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCenterExtDb.getWorkCenterCode(), workCenterExtDb.getWorkTime(), workCenterExtDb.getShiftCode()});
new Object[]{orgainzeCode, 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);
DdlPreparedPack.timeBuilder(startTime, endTime, MesExtConstWords.WORK_TIME, true, true, packBean);
shiftProdCenterRecordList = shiftProdCenterRecordRepository.findByHqlWhere(packBean);
}
if (CollectionUtils.isEmpty(shiftProdCenterRecordList)) return dataMap;
dataMap.put(MesShiftProdCenterRecord.class.getSimpleName(), shiftProdCenterRecordList);

@ -0,0 +1,95 @@
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.util.MesExtConstWords;
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtEnumUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
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 JxCenterWorkingBoardProxyWorkingStatusService implements IJxCenterWorkingBoardService {
private IJxCenterWorkingBoardService proxyService;
public JxCenterWorkingBoardProxyWorkingStatusService() {}
public JxCenterWorkingBoardProxyWorkingStatusService(IJxCenterWorkingBoardService proxyService) {
this.proxyService = proxyService;
}
@Override
public Map<String, Object> queryCenterWorkingBoardData(Map<String, Object> dataMap) {
if (null != proxyService) proxyService.queryCenterWorkingBoardData(dataMap);
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);
String curTime = (String) dataMap.get("curTime");
List<MesShiftProdCenterRecord> shiftProdCenterRecordList = (List<MesShiftProdCenterRecord>) dataMap.get(MesShiftProdCenterRecord.class.getSimpleName());
List<MesShiftProdCenterRecord> filterList = (CollectionUtils.isEmpty(shiftProdCenterRecordList) || StringUtils.isEmpty(workTime) || StringUtils.isEmpty(shiftCode)) ? null :
shiftProdCenterRecordList.stream().filter(o -> (null != o && o.getWorkCenterCode().equals(workCenterCode) && o.getWorkTime().equals(workTime) && o.getShiftCode().equals(shiftCode) &&
MesExtEnumUtil.SHIFT_PROD_TYPE.UNNORMAL_PROD.getValue() >= o.getProdType() && o.getStartTime().compareTo(curTime) <= 0 && o.getEndTime().compareTo(curTime) >= 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());
dataMap.put("生产状态", new StringJoiner(MesExtConstWords.COMMA).add(enumItem.workingStatusName).add(enumItem.color).toString());
return dataMap;
}
enum SHIFT_PROD_TYPE_COLOR {
//System.out.println(String.format("#%02x%02x%02x", Color.white.getRed(), Color.white.getGreen(), Color.white.getBlue()));
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;
}
}
}

@ -747,6 +747,8 @@ public class MesExtConstWords {
public static final String VALIDITY_DATE = "validityDate";
//事业别配置
public static final String SX_CATEGORY_CFG = "SX_CATEGORY_CFG";
//事业别配置
public static final String SX_CAREER_CFG = "SX_CAREER_CFG";
//仕损明细记录类型明细配置
@ -895,4 +897,6 @@ public class MesExtConstWords {
//总不良率
public static final String AMOUNT_BAD_RATE = "amountBadRate";
public static final String BOARD_WORK_SHOW_FLAG = "BOARD_WORK_SHOW_FLAG";
}

@ -2292,6 +2292,10 @@ public class MesExtEnumUtil {
return value;
}
public String getValueStr() {
return value + "";
}
public String getDescription() {
return description;
}

Loading…
Cancel
Save