|
|
@ -1,5 +1,7 @@
|
|
|
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
|
|
|
|
package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.base.IMesProdOrgExtService;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProduceSnExtService;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionRecordService;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.IMesProductionRecordService;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.util.MesPcnExtConstWords;
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
@ -7,11 +9,11 @@ import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
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.mes.bean.*;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesProduceSn;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.MesProductionRecordModel;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesProductionRecord;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.*;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.*;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import cn.estsh.impp.framework.boot.util.ResultBean;
|
|
|
|
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.CollectionUtils;
|
|
|
@ -31,6 +33,12 @@ import java.util.stream.Collectors;
|
|
|
|
public class MesProductionRecordService implements IMesProductionRecordService {
|
|
|
|
public class MesProductionRecordService implements IMesProductionRecordService {
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private IMesProduceSnExtService produceSnExtService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private IMesProdOrgExtService prodOrgExtService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
private MesTimeEfficientCfgRepository timeEfficientCfgRepository;
|
|
|
|
private MesTimeEfficientCfgRepository timeEfficientCfgRepository;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
@ -59,6 +67,14 @@ public class MesProductionRecordService implements IMesProductionRecordService {
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), productSn});
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), productSn});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询加工记录, 根据完成时间倒序
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public List<MesProductionRecord> findProductionRecordListCompleteDateTimeDesc(String organizeCode, String productSn) {
|
|
|
|
|
|
|
|
List<MesProductionRecord> productionRecordList = findProductionRecordList(organizeCode, productSn);
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(productionRecordList)) return productionRecordList;
|
|
|
|
|
|
|
|
return productionRecordList.stream().filter(o -> null != o).sorted(Comparator.comparing(MesProductionRecord::getCompleteDateTime).reversed()).collect(Collectors.toList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<MesProductionRecord> findProductionRecordList(String organizeCode, String productSn, String partNo) {
|
|
|
|
public List<MesProductionRecord> findProductionRecordList(String organizeCode, String productSn, String partNo) {
|
|
|
|
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(productSn) || StringUtils.isEmpty(partNo)) return null;
|
|
|
|
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(productSn) || StringUtils.isEmpty(partNo)) return null;
|
|
|
@ -114,30 +130,113 @@ public class MesProductionRecordService implements IMesProductionRecordService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<MesProductionRecordModel> findMesProductionRecordList(String organizeCode, String productSn) {
|
|
|
|
public ResultBean queryMesProductionRecordReport(String organizeCode, String productSn) {
|
|
|
|
List<MesProductionRecord> productionRecordList = findProductionRecord(organizeCode, productSn);
|
|
|
|
|
|
|
|
List<MesProductionRecordModel> mesProductionRecordModelList = new ArrayList<>();
|
|
|
|
//查询条码信息, 根据创建时间倒序
|
|
|
|
if (!CollectionUtils.isEmpty(productionRecordList)) {
|
|
|
|
List<MesProduceSn> produceSnList = produceSnExtService.getProduceSnListCreateDatetimeDesc(organizeCode, productSn);
|
|
|
|
//数据查询
|
|
|
|
|
|
|
|
Map<String, MesCraft> craftMap = getStringMesCraftMap(organizeCode, productionRecordList.stream().map(MesProductionRecord::getCraftCode).distinct().collect(Collectors.toList()));
|
|
|
|
if (CollectionUtils.isEmpty(produceSnList)) return ResultBean.fail(String.format("零件条码[%s]信息不存在!", productSn));
|
|
|
|
Map<String, MesProduceSn> produceSnMap = getStringMesProduceSnMap(organizeCode, productSn);
|
|
|
|
|
|
|
|
Map<String, MesWorkCenter> mesWorkCenterMap = getStringMesWorkCenterMap(organizeCode, productionRecordList.stream().map(MesProductionRecord::getWorkCenterCode).distinct().collect(Collectors.toList()));
|
|
|
|
MesProduceSn produceSnDb = produceSnList.get(0);
|
|
|
|
Map<String, MesWorkCell> workCellMap = getStringMesWorkCellMap(organizeCode, productionRecordList.stream().map(MesProductionRecord::getWorkCellCode).distinct().collect(Collectors.toList()));
|
|
|
|
|
|
|
|
//数据组装
|
|
|
|
//查询加工记录, 根据完成时间倒序
|
|
|
|
MesProductionRecordModel mesProductionRecordModel = null;
|
|
|
|
List<MesProductionRecord> productionRecordList = findProductionRecordListCompleteDateTimeDesc(organizeCode, productSn);
|
|
|
|
for (MesProductionRecord mesProductionRecord : productionRecordList) {
|
|
|
|
|
|
|
|
mesProductionRecordModel = new MesProductionRecordModel();
|
|
|
|
//查询生产线名称
|
|
|
|
BeanUtils.copyProperties(mesProductionRecord, mesProductionRecordModel);
|
|
|
|
Map<String, String> workCenterCodeMap = getProductionRecordReportCenterMap(organizeCode, produceSnDb.getWorkCenterCode(), productionRecordList);
|
|
|
|
mesProductionRecordModel.setCraftName(Objects.isNull(craftMap) || Objects.isNull(craftMap.get(mesProductionRecord.getCraftCode())) || StringUtils.isEmpty(mesProductionRecord.getCraftCode()) ? "" : craftMap.get(mesProductionRecord.getCraftCode()).getCraftName());
|
|
|
|
//查询工位名称
|
|
|
|
mesProductionRecordModel.setSnStatus(Objects.isNull(produceSnMap.get(mesProductionRecord.getSerialNumber())) || StringUtils.isEmpty(mesProductionRecord.getSerialNumber()) ? 0 : produceSnMap.get(mesProductionRecord.getSerialNumber()).getSnStatus());
|
|
|
|
Map<String, String> workCellCodeMap = getProductionRecordReportCellMap(organizeCode, produceSnDb.getWorkCellCode(), productionRecordList);
|
|
|
|
mesProductionRecordModel.setSnStatusDesc(0 == mesProductionRecordModel.getSnStatus() ?"" : MesExtEnumUtil.PRODUCE_SN_STATUS.valueOfDescription(mesProductionRecordModel.getSnStatus()));
|
|
|
|
//查询工艺名称
|
|
|
|
mesProductionRecordModel.setReportStatusDesc(MesExtEnumUtil.REPORT_STATUS.valueOfDescription(mesProductionRecordModel.getReportStatus()));
|
|
|
|
Map<String, String> craftCodeMap = getProductionRecordReportCraftMap(organizeCode, produceSnDb.getCraftCode(), productionRecordList);
|
|
|
|
mesProductionRecordModel.setWorkCenterName(Objects.isNull(mesWorkCenterMap.get(mesProductionRecord.getWorkCenterCode())) || StringUtils.isEmpty(mesProductionRecord.getWorkCenterCode()) ? "" : mesWorkCenterMap.get(mesProductionRecord.getWorkCenterCode()).getWorkCenterName());
|
|
|
|
|
|
|
|
mesProductionRecordModel.setWorkCellName(Objects.isNull(workCellMap.get(mesProductionRecord.getWorkCellCode())) || StringUtils.isEmpty(mesProductionRecord.getWorkCellCode()) ? "" : workCellMap.get(mesProductionRecord.getWorkCellCode()).getWorkCellName());
|
|
|
|
Map<String, Object> produceSnMap = new HashMap<>();
|
|
|
|
mesProductionRecordModelList.add(mesProductionRecordModel);
|
|
|
|
produceSnMap.put(MesPcnExtConstWords.PRODUCT_SN, productSn);
|
|
|
|
|
|
|
|
produceSnMap.put(MesPcnExtConstWords.PART_NO, produceSnDb.getPartNo());
|
|
|
|
|
|
|
|
produceSnMap.put(MesPcnExtConstWords.PART_NAME, produceSnDb.getPartName());
|
|
|
|
|
|
|
|
produceSnMap.put(MesPcnExtConstWords.WORK_CENTER_CODE, produceSnDb.getWorkCenterCode());
|
|
|
|
|
|
|
|
produceSnMap.put(MesPcnExtConstWords.WORK_CELL_CODE, produceSnDb.getWorkCellCode());
|
|
|
|
|
|
|
|
produceSnMap.put(MesPcnExtConstWords.CRAFT_CODE, produceSnDb.getCraftCode());
|
|
|
|
|
|
|
|
produceSnMap.put(MesPcnExtConstWords.WORK_CENTER_NAME, getMap2Value(workCenterCodeMap, produceSnDb.getWorkCenterCode()));
|
|
|
|
|
|
|
|
produceSnMap.put(MesPcnExtConstWords.WORK_CELL_NAME, getMap2Value(workCellCodeMap, getCellCodeSuffix(produceSnDb.getWorkCenterCode(), produceSnDb.getWorkCellCode())));
|
|
|
|
|
|
|
|
produceSnMap.put(MesPcnExtConstWords.CRAFT_NAME, getMap2Value(craftCodeMap, produceSnDb.getCraftCode()));
|
|
|
|
|
|
|
|
produceSnMap.put(MesPcnExtConstWords.SN_STATUS, produceSnDb.getSnStatus());
|
|
|
|
|
|
|
|
produceSnMap.put(MesPcnExtConstWords.QC_STATUS, produceSnDb.getQcStatus());
|
|
|
|
|
|
|
|
produceSnMap.put(MesPcnExtConstWords.SN_STATUS_NAME, MesExtEnumUtil.PRODUCE_SN_STATUS.valueOfDescription(produceSnDb.getSnStatus()));
|
|
|
|
|
|
|
|
produceSnMap.put(MesPcnExtConstWords.QC_STATUS_NAME, MesExtEnumUtil.PRODUCE_QC_STATUS.valueOfDescription(produceSnDb.getQcStatus()));
|
|
|
|
|
|
|
|
produceSnMap.put(MesPcnExtConstWords.MODIFY_USER, produceSnDb.getModifyUser());
|
|
|
|
|
|
|
|
produceSnMap.put(MesPcnExtConstWords.MODIFY_DATE_TIME, produceSnDb.getModifyDatetime());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ResultBean resultBean = ResultBean.success("查询成功!").setResultObject(produceSnMap);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(productionRecordList)) return resultBean;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, List<MesProduceSn>> produceSnMap2Part = produceSnList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getPartNo()))).collect(Collectors.groupingBy(MesProduceSn::getPartNo));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> productionRecordMapList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MesProduceSn produceSnItem;
|
|
|
|
|
|
|
|
for (MesProductionRecord productionRecord : productionRecordList) {
|
|
|
|
|
|
|
|
if (null == productionRecord) continue;
|
|
|
|
|
|
|
|
Map<String, Object> productionRecordMap = new HashMap<>();
|
|
|
|
|
|
|
|
productionRecordMap.put(MesPcnExtConstWords.PRODUCT_SN, productSn);
|
|
|
|
|
|
|
|
productionRecordMap.put(MesPcnExtConstWords.PART_NO, productionRecord.getPartNo());
|
|
|
|
|
|
|
|
productionRecordMap.put(MesPcnExtConstWords.PART_NAME, productionRecord.getPartName());
|
|
|
|
|
|
|
|
productionRecordMap.put(MesPcnExtConstWords.WORK_CENTER_CODE, productionRecord.getWorkCenterCode());
|
|
|
|
|
|
|
|
productionRecordMap.put(MesPcnExtConstWords.WORK_CELL_CODE, productionRecord.getWorkCellCode());
|
|
|
|
|
|
|
|
productionRecordMap.put(MesPcnExtConstWords.CRAFT_CODE, productionRecord.getCraftCode());
|
|
|
|
|
|
|
|
productionRecordMap.put(MesPcnExtConstWords.WORK_CENTER_NAME, getMap2Value(workCenterCodeMap, productionRecord.getWorkCenterCode()));
|
|
|
|
|
|
|
|
productionRecordMap.put(MesPcnExtConstWords.WORK_CELL_NAME, getMap2Value(workCellCodeMap, getCellCodeSuffix(productionRecord.getWorkCenterCode(), productionRecord.getWorkCellCode())));
|
|
|
|
|
|
|
|
productionRecordMap.put(MesPcnExtConstWords.CRAFT_NAME, getMap2Value(craftCodeMap, productionRecord.getCraftCode()));
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(produceSnMap2Part) && !StringUtils.isEmpty(productionRecord.getPartNo()) && produceSnMap2Part.containsKey(productionRecord.getPartNo())) {
|
|
|
|
|
|
|
|
produceSnItem = produceSnMap2Part.get(productionRecord.getPartNo()).get(0);
|
|
|
|
|
|
|
|
productionRecordMap.put(MesPcnExtConstWords.SN_STATUS, produceSnItem.getSnStatus());
|
|
|
|
|
|
|
|
productionRecordMap.put(MesPcnExtConstWords.QC_STATUS, produceSnItem.getQcStatus());
|
|
|
|
|
|
|
|
productionRecordMap.put(MesPcnExtConstWords.SN_STATUS_NAME, !StringUtils.isEmpty(produceSnItem.getSnStatus()) ? MesExtEnumUtil.PRODUCE_SN_STATUS.valueOfDescription(produceSnItem.getSnStatus()) : MesPcnExtConstWords.EMPTY);
|
|
|
|
|
|
|
|
productionRecordMap.put(MesPcnExtConstWords.QC_STATUS_NAME, !StringUtils.isEmpty(produceSnItem.getQcStatus()) ? MesExtEnumUtil.PRODUCE_QC_STATUS.valueOfDescription(produceSnItem.getQcStatus()) : MesPcnExtConstWords.EMPTY);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
productionRecordMap.put(MesPcnExtConstWords.COMPLETE_DATE_TIME, productionRecord.getCompleteDateTime());
|
|
|
|
|
|
|
|
productionRecordMap.put(MesPcnExtConstWords.CREATE_USER, productionRecord.getCreateUser());
|
|
|
|
|
|
|
|
productionRecordMap.put(MesPcnExtConstWords.REPORT_STATUS, productionRecord.getReportStatus());
|
|
|
|
|
|
|
|
productionRecordMap.put(MesPcnExtConstWords.REPORT_STATUS_NAME, !StringUtils.isEmpty(productionRecord.getReportStatus()) ? MesExtEnumUtil.REPORT_STATUS.valueOfDescription(productionRecord.getReportStatus()) : MesPcnExtConstWords.EMPTY);
|
|
|
|
|
|
|
|
productionRecordMapList.add(productionRecordMap);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return mesProductionRecordModelList;
|
|
|
|
|
|
|
|
|
|
|
|
return resultBean.setResultList(productionRecordMapList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String getCellCodeSuffix(String workCenterCode, String workCellCode) {
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(workCenterCode) || StringUtils.isEmpty(workCellCode)) return null;
|
|
|
|
|
|
|
|
return new StringJoiner(MesPcnExtConstWords.AND).add(workCenterCode).add(workCellCode).toString();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String getMap2Value(Map<String, String> map, String key) {
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(key)) return MesPcnExtConstWords.EMPTY;
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(map) || !map.containsKey(key)) return MesPcnExtConstWords.EMPTY;
|
|
|
|
|
|
|
|
return map.get(key);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, String> getProductionRecordReportCenterMap(String organizeCode, String workCenterCode, List<MesProductionRecord> productionRecordList) {
|
|
|
|
|
|
|
|
List<String> workCenterCodeList = CollectionUtils.isEmpty(productionRecordList) ? null :
|
|
|
|
|
|
|
|
productionRecordList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getWorkCenterCode()))).map(MesProductionRecord::getWorkCenterCode).collect(Collectors.toList());
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(workCenterCodeList) && !StringUtils.isEmpty(workCenterCode)) workCenterCodeList = new ArrayList<>();
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(workCenterCode)) workCenterCodeList.add(workCenterCode);
|
|
|
|
|
|
|
|
return prodOrgExtService.getWorkCenterCodeMap(organizeCode, workCenterCodeList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, String> getProductionRecordReportCellMap(String organizeCode, String workCellCode, List<MesProductionRecord> productionRecordList) {
|
|
|
|
|
|
|
|
List<String> workCellCodeList = CollectionUtils.isEmpty(productionRecordList) ? null :
|
|
|
|
|
|
|
|
productionRecordList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getWorkCellCode()))).map(MesProductionRecord::getWorkCellCode).collect(Collectors.toList());
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(workCellCodeList) && !StringUtils.isEmpty(workCellCode)) workCellCodeList = new ArrayList<>();
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(workCellCode)) workCellCodeList.add(workCellCode);
|
|
|
|
|
|
|
|
return prodOrgExtService.getWorkCellCodeMap(organizeCode, workCellCodeList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, String> getProductionRecordReportCraftMap(String organizeCode, String craftCode, List<MesProductionRecord> productionRecordList) {
|
|
|
|
|
|
|
|
List<String> craftCodeList = CollectionUtils.isEmpty(productionRecordList) ? null :
|
|
|
|
|
|
|
|
productionRecordList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getCraftCode()))).map(MesProductionRecord::getCraftCode).collect(Collectors.toList());
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(craftCodeList) && !StringUtils.isEmpty(craftCode)) craftCodeList = new ArrayList<>();
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(craftCode)) craftCodeList.add(craftCode);
|
|
|
|
|
|
|
|
return prodOrgExtService.getCraftCodeMap(organizeCode, craftCodeList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -152,68 +251,4 @@ public class MesProductionRecordService implements IMesProductionRecordService {
|
|
|
|
productionRecordRepository.saveAll(recordList);
|
|
|
|
productionRecordRepository.saveAll(recordList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, MesCraft> getStringMesCraftMap(String organizeCode, List<String> craftCodeList) {
|
|
|
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
|
|
|
DdlPreparedPack.getInPackList(craftCodeList, MesPcnExtConstWords.CRAFT_CODE,packBean);
|
|
|
|
|
|
|
|
List<MesCraft> craftList = mesCraftRepository.findByHqlWhere(packBean);
|
|
|
|
|
|
|
|
Map<String, MesCraft> craftMap = null;
|
|
|
|
|
|
|
|
if(!CollectionUtils.isEmpty(craftList)){
|
|
|
|
|
|
|
|
craftMap = craftList.stream().collect(Collectors.toMap(MesCraft::getCraftCode, t -> t));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return craftMap;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, MesProduceSn> getStringMesProduceSnMap(String organizeCode, String productSn) {
|
|
|
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(productSn, MesPcnExtConstWords.PRODUCT_SN,packBean);
|
|
|
|
|
|
|
|
List<MesProduceSn> mesProduceSns = mesProduceSnRepository.findByHqlWhere(packBean);
|
|
|
|
|
|
|
|
Map<String, MesProduceSn> mesProduceSnMap = new HashMap<>();
|
|
|
|
|
|
|
|
if(!CollectionUtils.isEmpty(mesProduceSns)){
|
|
|
|
|
|
|
|
for (MesProduceSn mesProduceSn : mesProduceSns) {
|
|
|
|
|
|
|
|
if(!mesProduceSnMap.containsKey(mesProduceSn.getSerialNumber())){
|
|
|
|
|
|
|
|
mesProduceSnMap.put(mesProduceSn.getSerialNumber(),mesProduceSn);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return mesProduceSnMap;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, MesWorkCenter> getStringMesWorkCenterMap(String organizeCode, List<String> workCenterNoList) {
|
|
|
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
|
|
|
DdlPreparedPack.getInPackList(workCenterNoList, MesPcnExtConstWords.WORK_CENTER_CODE,packBean);
|
|
|
|
|
|
|
|
List<MesWorkCenter> mesWorkCenterList = mesWorkCenterRepository.findByHqlWhere(packBean);
|
|
|
|
|
|
|
|
Map<String, MesWorkCenter> mesWorkCenterMap = new HashMap<>();
|
|
|
|
|
|
|
|
if(!CollectionUtils.isEmpty(mesWorkCenterList)){
|
|
|
|
|
|
|
|
for (MesWorkCenter workCenter : mesWorkCenterList) {
|
|
|
|
|
|
|
|
if(!mesWorkCenterMap.containsKey(workCenter.getWorkCenterCode())){
|
|
|
|
|
|
|
|
mesWorkCenterMap.put(workCenter.getWorkCenterCode(),workCenter);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return mesWorkCenterMap;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, MesWorkCell> getStringMesWorkCellMap(String organizeCode, List<String> workCenterNoList) {
|
|
|
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
|
|
|
DdlPreparedPack.getInPackList(workCenterNoList, MesPcnExtConstWords.WORK_CELL_CODE,packBean);
|
|
|
|
|
|
|
|
List<MesWorkCell> mesWorkCellList = mesWorkCellRepository.findByHqlWhere(packBean);
|
|
|
|
|
|
|
|
Map<String, MesWorkCell> mesProduceSnMap = new HashMap<>();
|
|
|
|
|
|
|
|
if(!CollectionUtils.isEmpty(mesWorkCellList)){
|
|
|
|
|
|
|
|
for (MesWorkCell mesWorkCell : mesWorkCellList) {
|
|
|
|
|
|
|
|
if(!mesProduceSnMap.containsKey(mesWorkCell.getWorkCellCode())){
|
|
|
|
|
|
|
|
mesProduceSnMap.put(mesWorkCell.getWorkCellCode(),mesWorkCell);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return mesProduceSnMap;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<MesProductionRecord> findProductionRecord(String organizeCode, String productSn) {
|
|
|
|
|
|
|
|
if (StringUtils.isEmpty(organizeCode) || StringUtils.isEmpty(productSn)) return null;
|
|
|
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(productSn,MesPcnExtConstWords.PRODUCT_SN,packBean);
|
|
|
|
|
|
|
|
DdlPreparedPack.getOrderBy(MesPcnExtConstWords.CREATE_DATE_TIME,CommonEnumUtil.ASC_OR_DESC.DESC.getValue(),packBean);
|
|
|
|
|
|
|
|
return productionRecordRepository.findByHqlWhere(packBean);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|