|
|
|
@ -5,10 +5,13 @@ import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesEquipment;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesEquipmentSpotCheck;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentRepository;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
@ -17,6 +20,8 @@ import java.util.List;
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class MesEquipmentSpotCheckService extends BaseMesService<MesEquipmentSpotCheck> implements IMesEquipmentSpotCheckService {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesEquipmentRepository equipmentRepository;
|
|
|
|
|
|
|
|
|
|
protected void setPackQueryBean(MesEquipmentSpotCheck bean, DdlPackBean packBean) {
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getSpotCheckCode(), "spotCheckCode", packBean);
|
|
|
|
@ -84,6 +89,18 @@ public class MesEquipmentSpotCheckService extends BaseMesService<MesEquipmentSpo
|
|
|
|
|
.setErrorDetail("【%s】点检项目代码已经存在,请检查数据", item.getSpotCheckCode())
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
DdlPackBean ddlPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getEquipName(),"equipmentName", ddlPackBean);
|
|
|
|
|
|
|
|
|
|
MesEquipment mesEquipment = equipmentRepository.getByProperty(ddlPackBean);
|
|
|
|
|
if (mesEquipment == null) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("【%s】设备名称不存在,请检查数据", item.getEquipName())
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
item.setEquipCode(mesEquipment.getEquipmentCode());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|