|
|
|
@ -2,6 +2,7 @@ package cn.estsh.i3plus.ext.mes.pcn.apiservice.serviceimpl.busi;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.api.busi.spot.IMesSpotCheckOrderService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.constant.MesCommonConstant;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesEquipmentSpotCheckModel;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pcn.pojo.model.MesSpotCheckOrderModel;
|
|
|
|
|
import cn.estsh.i3plus.icloud.core.sdk.ICoreUtilCloud;
|
|
|
|
|
import cn.estsh.i3plus.mes.pcn.api.iservice.busi.ISyncFuncService;
|
|
|
|
@ -32,10 +33,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.LinkedHashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -89,6 +87,30 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<MesEquipmentSpotCheckModel> findEquipmentSpotCheck(MesEquipmentSpotCheck spotCheckOrder) {
|
|
|
|
|
List<MesEquipmentSpotCheck> mesEquipmentSpotCheckList = queryEquipmentSpotCheck(spotCheckOrder);
|
|
|
|
|
if(CollectionUtils.isEmpty(mesEquipmentSpotCheckList)){
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
Map<String, List<MesEquipmentSpotCheck>> mesEquipmentSpotCheckMap = mesEquipmentSpotCheckList.stream().collect(Collectors.groupingBy(MesEquipmentSpotCheck::getEquipCode));
|
|
|
|
|
List<MesEquipmentSpotCheckModel> mesEquipmentSpotCheckModelList = new ArrayList<>();
|
|
|
|
|
for (Map.Entry<String, List<MesEquipmentSpotCheck>> mesEquipmentSpotCheckEntry : mesEquipmentSpotCheckMap.entrySet()) {
|
|
|
|
|
MesEquipmentSpotCheck next = mesEquipmentSpotCheckEntry.getValue().iterator().next();
|
|
|
|
|
MesEquipmentSpotCheckModel mesEquipmentSpotCheckModel = new MesEquipmentSpotCheckModel();
|
|
|
|
|
BeanUtils.copyProperties(next,mesEquipmentSpotCheckModel);
|
|
|
|
|
Map<Integer, List<MesEquipmentSpotCheck>> listMap = mesEquipmentSpotCheckEntry.getValue().stream().collect(Collectors.groupingBy(MesEquipmentSpotCheck::getSpotCheckOrderType));
|
|
|
|
|
for (Map.Entry<Integer, List<MesEquipmentSpotCheck>> entry : listMap.entrySet()) {
|
|
|
|
|
MesEquipmentSpotCheckModel.MesEquipmentSpotCheckDataModel mesEquipmentSpotCheckDataModel = new MesEquipmentSpotCheckModel.MesEquipmentSpotCheckDataModel();
|
|
|
|
|
mesEquipmentSpotCheckDataModel.setSpotCheckOrderType(entry.getKey());
|
|
|
|
|
mesEquipmentSpotCheckDataModel.setSpotCheckList(entry.getValue());
|
|
|
|
|
mesEquipmentSpotCheckModel.getSpotCheckDataModelList().add(mesEquipmentSpotCheckDataModel);
|
|
|
|
|
}
|
|
|
|
|
mesEquipmentSpotCheckModelList.add(mesEquipmentSpotCheckModel);
|
|
|
|
|
}
|
|
|
|
|
return mesEquipmentSpotCheckModelList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List<MesEquipmentSpotCheck> queryEquipmentSpotCheck(MesEquipmentSpotCheck bean) {
|
|
|
|
|
|
|
|
|
|
DdlPackBean packBean = DdlPackBean.getDdlPackBean(bean.getOrganizeCode(), bean.getIsValid());
|
|
|
|
@ -97,7 +119,8 @@ public class MesSpotCheckOrderService implements IMesSpotCheckOrderService {
|
|
|
|
|
DdlPreparedPack.getStringLikerPack(bean.getSpotCheckName(), "spotCheckName", packBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getWorkCenterCode(), "workCenterCode", packBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getWorkCellCode(), "workCellCode", packBean);
|
|
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getEquipCode(), "equipCode", packBean);
|
|
|
|
|
DdlPreparedPack.getNumEqualPack(bean.getSpotCheckOrderType(), "spotCheckOrderType", packBean);
|
|
|
|
|
|
|
|
|
|
return equipmentSpotCheckRepository.findByHqlWhere(packBean);
|
|
|
|
|
}
|
|
|
|
|