|
|
@ -2,31 +2,38 @@ package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesConfigService;
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesConfigService;
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesDowntimeRecordService;
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesDowntimeRecordService;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.apiservice.utils.BeanUtil;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
|
|
|
import cn.estsh.i3plus.platform.common.util.MesConstWords;
|
|
|
|
import cn.estsh.i3plus.platform.common.util.MesConstWords;
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.PagerHelper;
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
import cn.estsh.i3plus.pojo.base.util.StringUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.base.util.StringUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.*;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.*;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesDowntimeRecordRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.report.MesDowntimeRecordResModel;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesProductionRecordRepository;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.*;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesWcEquipmentRepository;
|
|
|
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
|
|
|
|
import cn.hutool.core.stream.CollectorUtil;
|
|
|
|
|
|
|
|
import com.codepoetics.protonpack.collectors.CollectorUtils;
|
|
|
|
|
|
|
|
import com.xxl.job.core.util.DateUtil;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
import java.util.Calendar;
|
|
|
|
import java.util.*;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -46,10 +53,26 @@ public class MesDowntimeRecordServiceImpl extends BaseMesService<MesDowntimeReco
|
|
|
|
private MesDowntimeRecordRepository mesDowntimeRecordRDao;
|
|
|
|
private MesDowntimeRecordRepository mesDowntimeRecordRDao;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private IMesConfigService mesConfigService;
|
|
|
|
private IMesBasDowntimeReasonRepository downtimeReasonRepository;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private IMesBasDowntimeReasonTypeRepository downtimeReasonTypeRepository;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private MesWcEquipmentRepository wcEquipmentRepository;
|
|
|
|
private MesWcEquipmentRepository wcEquipmentRepository;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private MesEquipmentRepository equipmentRepository;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private IMesConfigService mesConfigService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private MesWorkCenterRepository workCenterRepository;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private MesWorkCellRepository workCellRepository;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
protected void setPackQueryBean(MesDowntimeRecord bean, DdlPackBean packBean) {
|
|
|
|
protected void setPackQueryBean(MesDowntimeRecord bean, DdlPackBean packBean) {
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getWorkCenterCode(), "workCenterCode", packBean);
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getWorkCenterCode(), "workCenterCode", packBean);
|
|
|
@ -117,10 +140,12 @@ public class MesDowntimeRecordServiceImpl extends BaseMesService<MesDowntimeReco
|
|
|
|
if(!StringUtil.isEmpty(type)){
|
|
|
|
if(!StringUtil.isEmpty(type)){
|
|
|
|
DdlPreparedPack.getStringEqualPack(type, "reasonTypeCode", ddlPackBeanDowntime);
|
|
|
|
DdlPreparedPack.getStringEqualPack(type, "reasonTypeCode", ddlPackBeanDowntime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
MesDowntimeRecord mesDowntimeRecordDao = mesDowntimeRecordRDao.getByProperty(ddlPackBeanDowntime);
|
|
|
|
DdlPreparedPack.getOrderBy("createDatetime", CommonEnumUtil.ASC_OR_DESC.DESC.getValue(), ddlPackBeanDowntime);
|
|
|
|
if (StringUtil.isEmpty(mesDowntimeRecordDao)) {
|
|
|
|
|
|
|
|
|
|
|
|
List<MesDowntimeRecord> mesDowntimeRecordDaoList = mesDowntimeRecordRDao.findByHqlTopWhere(ddlPackBeanDowntime, 1);
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(mesDowntimeRecordDaoList)) {
|
|
|
|
MesWcEquipment wcEquipmentDbList = wcEquipmentRepository.getByProperty(
|
|
|
|
MesWcEquipment wcEquipmentDbList = wcEquipmentRepository.getByProperty(
|
|
|
|
new String[]{MesConstWords.ORGANIZE_CODE, MesConstWords.IS_DELETED, MesConstWords.IS_VALID,""},
|
|
|
|
new String[]{MesConstWords.ORGANIZE_CODE, MesConstWords.IS_DELETED, MesConstWords.IS_VALID,"equipmentCode"},
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(),
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(),
|
|
|
|
mesEquipment.getEquipmentCode()});
|
|
|
|
mesEquipment.getEquipmentCode()});
|
|
|
|
//新增设备停机记录
|
|
|
|
//新增设备停机记录
|
|
|
@ -134,6 +159,8 @@ public class MesDowntimeRecordServiceImpl extends BaseMesService<MesDowntimeReco
|
|
|
|
mesDowntimeRecord.setReasonCode(StringUtil.isEmpty(reason)?"21":reason);
|
|
|
|
mesDowntimeRecord.setReasonCode(StringUtil.isEmpty(reason)?"21":reason);
|
|
|
|
mesDowntimeRecord.setReasonTypeCode(StringUtil.isEmpty(type)?"6":type);
|
|
|
|
mesDowntimeRecord.setReasonTypeCode(StringUtil.isEmpty(type)?"6":type);
|
|
|
|
ConvertBean.serviceModelInitialize(mesDowntimeRecord, "MesDowntimeRecordJob");
|
|
|
|
ConvertBean.serviceModelInitialize(mesDowntimeRecord, "MesDowntimeRecordJob");
|
|
|
|
|
|
|
|
mesDowntimeRecord.setSystemSyncStatus(2);
|
|
|
|
|
|
|
|
mesDowntimeRecord.setModifyDatetime(null);
|
|
|
|
//将当前新增数据的create_date_time时间些到上一条记录的modify_date_time字段
|
|
|
|
//将当前新增数据的create_date_time时间些到上一条记录的modify_date_time字段
|
|
|
|
DdlPackBean ddlPackBeanOt = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
DdlPackBean ddlPackBeanOt = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
DdlPreparedPack.getStringEqualPack(mesEquipment.getEquipmentCode(), "equipmentCode", ddlPackBeanOt);
|
|
|
|
DdlPreparedPack.getStringEqualPack(mesEquipment.getEquipmentCode(), "equipmentCode", ddlPackBeanOt);
|
|
|
@ -147,12 +174,178 @@ public class MesDowntimeRecordServiceImpl extends BaseMesService<MesDowntimeReco
|
|
|
|
mesDowntimeRecordRDao.insert(mesDowntimeRecord);
|
|
|
|
mesDowntimeRecordRDao.insert(mesDowntimeRecord);
|
|
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
}else {
|
|
|
|
ConvertBean.serviceModelUpdate(mesDowntimeRecordDao, "MesDowntimeRecordJob");
|
|
|
|
// 如果上一次停机还未结束,则不需要再生成一条新的记录
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(mesDowntimeRecordDaoList.get(0).getModifyDatetime())) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ConvertBean.serviceModelUpdate(mesDowntimeRecordDaoList.get(0), "MesDowntimeRecordJob");
|
|
|
|
|
|
|
|
mesDowntimeRecordDaoList.get(0).setSystemSyncStatus(2);
|
|
|
|
|
|
|
|
mesDowntimeRecordRDao.update(mesDowntimeRecordDaoList.get(0));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
DdlPackBean ddlPackBeanDowntime = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(mesEquipment.getEquipmentCode(), "equipmentCode", ddlPackBeanDowntime);
|
|
|
|
|
|
|
|
if(!StringUtil.isEmpty(reason)){
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(reason, "reasonCode", ddlPackBeanDowntime);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!StringUtil.isEmpty(type)){
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(type, "reasonTypeCode", ddlPackBeanDowntime);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
DdlPreparedPack.getOrderBy("createDatetime", CommonEnumUtil.ASC_OR_DESC.DESC.getValue(), ddlPackBeanDowntime);
|
|
|
|
|
|
|
|
MesDowntimeRecord mesDowntimeRecordDao = mesDowntimeRecordRDao.getByProperty(ddlPackBeanDowntime);
|
|
|
|
|
|
|
|
if (mesDowntimeRecordDao != null) {
|
|
|
|
|
|
|
|
mesDowntimeRecordDao.setModifyDatetime(mesProductionRecord.getCompleteDateTime());
|
|
|
|
mesDowntimeRecordRDao.update(mesDowntimeRecordDao);
|
|
|
|
mesDowntimeRecordRDao.update(mesDowntimeRecordDao);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public ListPager<MesDowntimeRecordResModel> queryRecordList(MesDowntimeRecord downtimeRecord, Pager pager) {
|
|
|
|
|
|
|
|
ListPager pagerList = new ListPager();
|
|
|
|
|
|
|
|
List<MesDowntimeRecordResModel> list = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(downtimeRecord.getEquipmentCode())) {
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(downtimeRecord.getEquipmentCode(), "equipmentCode", ddlPackBean);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(downtimeRecord.getWorkCenterCode())) {
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(downtimeRecord.getWorkCenterCode(), "workCenterCode", ddlPackBean);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(downtimeRecord.getWorkCellCode())) {
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(downtimeRecord.getWorkCellCode(), "workCellCode", ddlPackBean);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(downtimeRecord.getReasonTypeCode(),"reasonTypeCode", ddlPackBean);
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(downtimeRecord.getCreateDatetime())) {
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringBiggerPack(downtimeRecord.getCreateDatetime(), "createDatetime", ddlPackBean);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(downtimeRecord.getModifyDatetime())) {
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringSmallerPack(downtimeRecord.getModifyDatetime(), "modifyDatetime", ddlPackBean);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pager = PagerHelper.getPager(pager, mesDowntimeRecordRDao.findByHqlWhereCount(ddlPackBean));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<MesDowntimeRecord> recordList = mesDowntimeRecordRDao.findByHqlWherePage(ddlPackBean, pager);
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(recordList)) {
|
|
|
|
|
|
|
|
List<String> reasonCodeList = recordList.stream().map(MesDowntimeRecord::getReasonCode).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
List<String> reasonTypeCodeList = recordList.stream().map(MesDowntimeRecord::getReasonTypeCode).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
List<String> equipmentInfoList = recordList.stream().map(MesDowntimeRecord::getEquipmentCode).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
List<String> workCellList = recordList.stream().map(MesDowntimeRecord::getWorkCellCode).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
List<String> workCenterList = recordList.stream().map(MesDowntimeRecord::getWorkCenterCode).distinct().collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, List<MesDowntimeReason>> reasonMap = getReason(reasonCodeList);
|
|
|
|
|
|
|
|
Map<String, MesEquipment> equipmentMap = getEquipment(equipmentInfoList);
|
|
|
|
|
|
|
|
Map<String, MesWorkCenter> workCenterMap = getWorkCenter(workCenterList);
|
|
|
|
|
|
|
|
Map<String, MesWorkCell> workCellMap = getWorkCell(workCellList);
|
|
|
|
|
|
|
|
Map<String, List<MesDowntimeReasonType>> reasonTypeMap = getReasonType(reasonTypeCodeList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
recordList.stream().forEach(record -> {
|
|
|
|
|
|
|
|
MesDowntimeRecordResModel mesDowntimeRecordResModel = new MesDowntimeRecordResModel();
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(record, mesDowntimeRecordResModel);
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(record.getReasonCode())) {
|
|
|
|
|
|
|
|
if (reasonMap.get(record.getReasonCode()) != null) {
|
|
|
|
|
|
|
|
mesDowntimeRecordResModel.setReasonName(reasonMap.get(record.getReasonCode()).get(0).getReasonName());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(record.getReasonTypeCode())) {
|
|
|
|
|
|
|
|
if (reasonTypeMap.get(record.getReasonTypeCode()) != null) {
|
|
|
|
|
|
|
|
mesDowntimeRecordResModel.setReasonTypeName(reasonTypeMap.get(record.getReasonTypeCode()).get(0).getReasonTypeName());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(record.getEquipmentCode())) {
|
|
|
|
|
|
|
|
mesDowntimeRecordResModel.setEquipmentName(equipmentMap.get(record.getEquipmentCode()).getEquipmentName());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(record.getWorkCenterCode())) {
|
|
|
|
|
|
|
|
mesDowntimeRecordResModel.setWorkCenterName(workCenterMap.get(record.getWorkCenterCode()).getWorkCenterName());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(record.getWorkCellCode())) {
|
|
|
|
|
|
|
|
mesDowntimeRecordResModel.setWorkCellName(workCellMap.get(record.getWorkCellCode()).getWorkCellName());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 如果停机结束时间还在,则需要补充动态停机时间,否则需要有停机时间
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(mesDowntimeRecordResModel.getModifyDatetime())) {
|
|
|
|
|
|
|
|
Date startTime = DateUtil.parseDateTime(mesDowntimeRecordResModel.getCreateDatetime());
|
|
|
|
|
|
|
|
Date currentTime = new Date();
|
|
|
|
|
|
|
|
Long time = (currentTime.getTime() - startTime.getTime())/(1000 * 60);
|
|
|
|
|
|
|
|
mesDowntimeRecordResModel.setCurrentDownTime(time.intValue());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Date startTime = DateUtil.parseDateTime(mesDowntimeRecordResModel.getCreateDatetime());
|
|
|
|
|
|
|
|
Date endTime = DateUtil.parseDateTime(mesDowntimeRecordResModel.getModifyDatetime());
|
|
|
|
|
|
|
|
Long time = (endTime.getTime() - startTime.getTime())/(1000 * 60);
|
|
|
|
|
|
|
|
mesDowntimeRecordResModel.setDownTime(time.intValue());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
list.add(mesDowntimeRecordResModel);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pagerList.setObjectList(list);
|
|
|
|
|
|
|
|
pagerList.setObjectPager(pager);
|
|
|
|
|
|
|
|
return pagerList;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, List<MesDowntimeReason>> getReason(List<String> reasonCodeList) {
|
|
|
|
|
|
|
|
Map<String, List<MesDowntimeReason>> reasonMap = new HashedMap();
|
|
|
|
|
|
|
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
|
|
|
|
|
|
|
|
DdlPreparedPack.getInPackList(reasonCodeList, "reasonCode", ddlPackBean);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<MesDowntimeReason> downtimeReasons = downtimeReasonRepository.findByHqlWhere(ddlPackBean);
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(downtimeReasons)) {
|
|
|
|
|
|
|
|
reasonMap = downtimeReasons.stream().distinct().collect(Collectors.groupingBy(MesDowntimeReason::getReasonCode));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return reasonMap;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, List<MesDowntimeReasonType>> getReasonType(List<String> reasonTypeCodeList) {
|
|
|
|
|
|
|
|
Map<String, List<MesDowntimeReasonType>> reasonMap = new HashedMap();
|
|
|
|
|
|
|
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
|
|
|
|
|
|
|
|
DdlPreparedPack.getInPackList(reasonTypeCodeList, "reasonTypeCode", ddlPackBean);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<MesDowntimeReasonType> downtimeReasonTypes = downtimeReasonTypeRepository.findByHqlWhere(ddlPackBean);
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(downtimeReasonTypes)) {
|
|
|
|
|
|
|
|
reasonMap = downtimeReasonTypes.stream().collect(Collectors.groupingBy(MesDowntimeReasonType::getReasonTypeCode));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return reasonMap;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, MesEquipment> getEquipment(List<String> equipmentList) {
|
|
|
|
|
|
|
|
Map<String, MesEquipment> equipmentMap = new HashedMap();
|
|
|
|
|
|
|
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
|
|
|
|
|
|
|
|
DdlPreparedPack.getInPackList(equipmentList, "equipmentCode", ddlPackBean);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<MesEquipment> equipments = equipmentRepository.findByHqlWhere(ddlPackBean);
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(equipments)) {
|
|
|
|
|
|
|
|
equipmentMap = equipments.stream().collect(Collectors.toMap(MesEquipment::getEquipmentCode, m -> m));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return equipmentMap;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, MesWorkCenter> getWorkCenter(List<String> workCenterList) {
|
|
|
|
|
|
|
|
Map<String, MesWorkCenter> workCenterMap = new HashedMap();
|
|
|
|
|
|
|
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
|
|
|
|
|
|
|
|
DdlPreparedPack.getInPackList(workCenterList, "workCenterCode", ddlPackBean);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<MesWorkCenter> workCenters = workCenterRepository.findByHqlWhere(ddlPackBean);
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(workCenters)) {
|
|
|
|
|
|
|
|
workCenterMap = workCenters.stream().collect(Collectors.toMap(MesWorkCenter::getWorkCenterCode, m -> m));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return workCenterMap;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, MesWorkCell> getWorkCell(List<String> equipmentList) {
|
|
|
|
|
|
|
|
Map<String, MesWorkCell> workCellMap = new HashedMap();
|
|
|
|
|
|
|
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean();
|
|
|
|
|
|
|
|
DdlPreparedPack.getInPackList(equipmentList, "workCellCode", ddlPackBean);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<MesWorkCell> workCells = workCellRepository.findByHqlWhere(ddlPackBean);
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(workCells)) {
|
|
|
|
|
|
|
|
workCellMap = workCells.stream().collect(Collectors.toMap(MesWorkCell::getWorkCellCode, m -> m));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return workCellMap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|