|
|
@ -5,10 +5,15 @@ import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
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.base.util.StringUtil;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentSpotCheck;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentSpotCheckDetail;
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentSpotCheckDetail;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentSpotCheckPart;
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentSpotCheckRepository;
|
|
|
|
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 lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
@ -17,6 +22,8 @@ import java.util.List;
|
|
|
|
@Slf4j
|
|
|
|
@Slf4j
|
|
|
|
public class MesEquipmentSpotCheckDetailService extends BaseMesService<MesEquipmentSpotCheckDetail> implements IMesEquipmentSpotCheckDetailService {
|
|
|
|
public class MesEquipmentSpotCheckDetailService extends BaseMesService<MesEquipmentSpotCheckDetail> implements IMesEquipmentSpotCheckDetailService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private MesEquipmentSpotCheckRepository equipmentSpotCheckRepository;
|
|
|
|
protected void setPackQueryBean(MesEquipmentSpotCheckDetail bean, DdlPackBean packBean) {
|
|
|
|
protected void setPackQueryBean(MesEquipmentSpotCheckDetail bean, DdlPackBean packBean) {
|
|
|
|
DdlPreparedPack.getNumEqualPack(bean.getPid(), "pid", packBean);
|
|
|
|
DdlPreparedPack.getNumEqualPack(bean.getPid(), "pid", packBean);
|
|
|
|
DdlPreparedPack.getStringLikerPack(bean.getSpotCheckItemCode(), "spotCheckItemCode", packBean);
|
|
|
|
DdlPreparedPack.getStringLikerPack(bean.getSpotCheckItemCode(), "spotCheckItemCode", packBean);
|
|
|
@ -82,5 +89,41 @@ public class MesEquipmentSpotCheckDetailService extends BaseMesService<MesEquipm
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public List<MesEquipmentSpotCheckDetail> validateReturnImport(List<MesEquipmentSpotCheckDetail> beanList) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (MesEquipmentSpotCheckDetail item : beanList) {
|
|
|
|
|
|
|
|
// 数据校验
|
|
|
|
|
|
|
|
if(StringUtil.isEmpty(item.getPid())){
|
|
|
|
|
|
|
|
ValidatorBean.checkNotNull(item.getSpotCheckCode(), "点检项目代码不能为空");
|
|
|
|
|
|
|
|
ValidatorBean.checkNotNull(item.getSpotCheckItemCode(), "点检内容代码不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean seriesPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getSpotCheckCode(), "spotCheckCode", seriesPackBean);
|
|
|
|
|
|
|
|
MesEquipmentSpotCheck itemFlg = equipmentSpotCheckRepository.getByProperty(seriesPackBean);
|
|
|
|
|
|
|
|
if (StringUtil.isEmpty(itemFlg)) {
|
|
|
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
|
|
|
.setErrorDetail("【%s】点检项目代码不存在,请检查数据", item.getSpotCheckCode())
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
item.setPid(itemFlg.getId());
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
ValidatorBean.checkNotNull(item.getId(), "点检项目id不能为空");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlPackBean seriesPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
|
|
|
DdlPreparedPack.getNumNOEqualPack(item.getId(), "id", seriesPackBean);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!baseRDao.isExitByHql(seriesPackBean)) {
|
|
|
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
|
|
|
.setErrorDetail("【%s】点检项目id不存在,请检查数据", item.getPid())
|
|
|
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return beanList;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|