|
|
@ -1,5 +1,6 @@
|
|
|
|
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.report;
|
|
|
|
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.report;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesConfigService;
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesProduceSnService;
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesProduceSnService;
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesProductionRecordService;
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesProductionRecordService;
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.file.IMesFileService;
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.file.IMesFileService;
|
|
|
@ -90,6 +91,9 @@ public class MesYfReportServiceImpl implements IMesYfReportService {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private MesEquipmentRepository mesEquipmentRepository;
|
|
|
|
private MesEquipmentRepository mesEquipmentRepository;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private IMesConfigService mesConfigService;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public ListPager<MesDeviceDataQueryReportResultModel> queryMesDeviceDataByPager(MesDeviceDataQueryReportConditionModel queryReportModel, Pager pager) {
|
|
|
|
public ListPager<MesDeviceDataQueryReportResultModel> queryMesDeviceDataByPager(MesDeviceDataQueryReportConditionModel queryReportModel, Pager pager) {
|
|
|
|
ListPager<MesDeviceDataQueryReportResultModel> mesDeviceDataQueryReportResultModelListPager =
|
|
|
|
ListPager<MesDeviceDataQueryReportResultModel> mesDeviceDataQueryReportResultModelListPager =
|
|
|
@ -157,7 +161,7 @@ public class MesYfReportServiceImpl implements IMesYfReportService {
|
|
|
|
List<MesProductionAssembly> productionAssemblyList = mesProductionAssemblyRepository.findByHqlWhere(packBean);
|
|
|
|
List<MesProductionAssembly> productionAssemblyList = mesProductionAssemblyRepository.findByHqlWhere(packBean);
|
|
|
|
Map<String, List<MesProductionAssembly>> productionAssemblyMap = CollectionUtils.isEmpty(productionAssemblyList) ? null : productionAssemblyList.stream().collect(Collectors.groupingBy(t -> new StringJoiner(MesExtConstWords.COMMA).add(t.getWorkCenterCode()).add(t.getWorkCellCode()).add(t.getEquipmentCode()).toString()));
|
|
|
|
Map<String, List<MesProductionAssembly>> productionAssemblyMap = CollectionUtils.isEmpty(productionAssemblyList) ? null : productionAssemblyList.stream().collect(Collectors.groupingBy(t -> new StringJoiner(MesExtConstWords.COMMA).add(t.getWorkCenterCode()).add(t.getWorkCellCode()).add(t.getEquipmentCode()).toString()));
|
|
|
|
//根据设备代码查询设备id
|
|
|
|
//根据设备代码查询设备id
|
|
|
|
Map<String, List<MesEquipmentLogDetail>> mesEquipmentLogDetailMap = getMesEquipmentLogDetailMap(mesProduceSn, productionRecordList);
|
|
|
|
Map<String, List<MesEquipmentLogDetail>> mesEquipmentLogDetailMap = getMesEquipmentLogDetailMap(mesProduceSn.getOrganizeCode(), productionRecordList);
|
|
|
|
//查询工序名称
|
|
|
|
//查询工序名称
|
|
|
|
Map<String, MesProcess> processMap = getMesProcessMap(mesProduceSn, processCodeList);
|
|
|
|
Map<String, MesProcess> processMap = getMesProcessMap(mesProduceSn, processCodeList);
|
|
|
|
//数据组装
|
|
|
|
//数据组装
|
|
|
@ -220,29 +224,29 @@ public class MesYfReportServiceImpl implements IMesYfReportService {
|
|
|
|
return mesTraceabilityReportModelList;
|
|
|
|
return mesTraceabilityReportModelList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, List<MesEquipmentLogDetail>> getMesEquipmentLogDetailMap(MesProduceSn mesProduceSn, List<MesProductionRecord> productionRecordList) {
|
|
|
|
private Map<String, List<MesEquipmentLogDetail>> getMesEquipmentLogDetailMap(String organizeCode, List<MesProductionRecord> productionRecordList) {
|
|
|
|
List<String> organizeCodeEquipList = getEquipList(mesProduceSn, productionRecordList);
|
|
|
|
List<String> organizeCodeEquipList = getEquipList(organizeCode, productionRecordList);
|
|
|
|
//工艺加工参数
|
|
|
|
//工艺加工参数
|
|
|
|
if(CollectionUtils.isEmpty(organizeCodeEquipList)) return null;
|
|
|
|
if(CollectionUtils.isEmpty(organizeCodeEquipList)) return null;
|
|
|
|
return getMesEquipmentLogDetailMap(mesProduceSn, productionRecordList, organizeCodeEquipList);
|
|
|
|
return getMesEquipmentLogDetailMap(organizeCode, productionRecordList, organizeCodeEquipList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Map<String, List<MesEquipmentLogDetail>> getMesEquipmentLogDetailMap(MesProduceSn mesProduceSn, List<MesProductionRecord> productionRecordList, List<String> organizeCodeEquipList) {
|
|
|
|
private Map<String, List<MesEquipmentLogDetail>> getMesEquipmentLogDetailMap(String organizeCode, List<MesProductionRecord> productionRecordList, List<String> organizeCodeEquipList) {
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(mesProduceSn.getOrganizeCode());
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
DdlPreparedPack.getInPackList(organizeCodeEquipList, MesExtConstWords.ORG_EQUIP_ID, packBean);
|
|
|
|
DdlPreparedPack.getInPackList(organizeCodeEquipList, MesExtConstWords.ORG_EQUIP_ID, packBean);
|
|
|
|
DdlPreparedPack.getInPackList(productionRecordList.stream().map(MesProductionRecord::getMouldRecordId).collect(Collectors.toList()), "mouldRecordId", packBean);
|
|
|
|
DdlPreparedPack.getInPackList(productionRecordList.stream().map(MesProductionRecord::getMouldRecordId).distinct().collect(Collectors.toList()), "mouldRecordId", packBean);
|
|
|
|
DdlPreparedPack.getInPackArray(new Object[]{MesExtEnumUtil.EQUIP_VARIABLE_TYPE.PROCESS_FINISH.getValue(), MesExtEnumUtil.EQUIP_VARIABLE_TYPE.PROCESS.getValue()}, "variableType", packBean);
|
|
|
|
DdlPreparedPack.getInPackArray(new Object[]{MesExtEnumUtil.EQUIP_VARIABLE_TYPE.PROCESS_FINISH.getValue(), MesExtEnumUtil.EQUIP_VARIABLE_TYPE.PROCESS.getValue()}, "variableType", packBean);
|
|
|
|
List<MesEquipmentLogDetail> mesEquipmentLogDetailList = mesEquipmentLogDetailRepository.findByHqlWhere(packBean);
|
|
|
|
List<MesEquipmentLogDetail> mesEquipmentLogDetailList = mesEquipmentLogDetailRepository.findByHqlWhere(packBean);
|
|
|
|
if (CollectionUtils.isEmpty(mesEquipmentLogDetailList)) return null;
|
|
|
|
if (CollectionUtils.isEmpty(mesEquipmentLogDetailList)) return null;
|
|
|
|
return mesEquipmentLogDetailList.stream().collect(Collectors.groupingBy(t -> new StringJoiner(MesExtConstWords.COMMA).add(t.getMouldRecordId().toString()).add(t.getWorkCenterCode()).add(t.getWorkCellCode()).add(t.getEquipmentCode()).toString()));
|
|
|
|
return mesEquipmentLogDetailList.stream().collect(Collectors.groupingBy(t -> new StringJoiner(MesExtConstWords.COMMA).add(t.getMouldRecordId().toString()).add(t.getWorkCenterCode()).add(t.getWorkCellCode()).add(t.getEquipmentCode()).toString()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<String> getEquipList(MesProduceSn mesProduceSn, List<MesProductionRecord> productionRecordList) {
|
|
|
|
private List<String> getEquipList(String organizeCode, List<MesProductionRecord> productionRecordList) {
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(mesProduceSn.getOrganizeCode());
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(organizeCode);
|
|
|
|
DdlPreparedPack.getInPackList(productionRecordList.stream().map(MesProductionRecord::getEquipmentCode).collect(Collectors.toList()), "equipmentCode", packBean);
|
|
|
|
DdlPreparedPack.getInPackList(productionRecordList.stream().map(MesProductionRecord::getEquipmentCode).distinct().collect(Collectors.toList()), "equipmentCode", packBean);
|
|
|
|
List<MesEquipment> mesEquipmentList = mesEquipmentRepository.findByHqlWhere(packBean);
|
|
|
|
List<MesEquipment> mesEquipmentList = mesEquipmentRepository.findByHqlWhere(packBean);
|
|
|
|
if (CollectionUtils.isEmpty(mesEquipmentList)) return null;
|
|
|
|
if (CollectionUtils.isEmpty(mesEquipmentList)) return null;
|
|
|
|
return mesEquipmentList.stream().map(t -> new StringJoiner(MesExtConstWords.E_UNDERLINE).add(t.getOrganizeCode()).add(t.getEquipId().toString()).toString()).collect(Collectors.toList());
|
|
|
|
return mesConfigService.findShardingTablesObjectCfg(organizeCode,MesEquipmentLogDetail.class.getSimpleName(),mesEquipmentList.stream().map(t -> new StringJoiner(MesExtConstWords.E_UNDERLINE).add(t.getOrganizeCode()).add(t.getEquipId().toString()).toString()).distinct().collect(Collectors.toList()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private MesWorkCenter getWorkCenter(MesProduceSn produceSn) {
|
|
|
|
private MesWorkCenter getWorkCenter(MesProduceSn produceSn) {
|
|
|
|