|
|
|
@ -1,16 +1,21 @@
|
|
|
|
|
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesEquipmentVariableService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.apiservice.schedulejob.MesWorkOrderProcessCcscTaskToSapJob;
|
|
|
|
|
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.MesEquipmentVariable;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesErpWorkCenter;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.util.StringUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.*;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentRepository;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesEquipmentVariableRepository;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
@ -26,6 +31,12 @@ import java.util.List;
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class MesEquipmentVariableService extends BaseMesService<MesEquipmentVariable> implements IMesEquipmentVariableService {
|
|
|
|
|
|
|
|
|
|
public static final Logger LOGGER = LoggerFactory.getLogger(MesEquipmentVariableService.class);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesEquipmentRepository equipmentRepository;
|
|
|
|
|
|
|
|
|
|
protected void setPackQueryBean(MesEquipmentVariable bean, DdlPackBean packBean) {
|
|
|
|
|
DdlPreparedPack.getStringLikerPack(bean.getEquipmentCode(), "equipmentCode", packBean);
|
|
|
|
|
DdlPreparedPack.getStringLikerPack(bean.getCode(), "code", packBean);
|
|
|
|
@ -48,4 +59,33 @@ public class MesEquipmentVariableService extends BaseMesService<MesEquipmentVari
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public List<MesEquipmentVariable> validateReturnImport(List<MesEquipmentVariable> beanList) {
|
|
|
|
|
|
|
|
|
|
int i = 1;
|
|
|
|
|
for (MesEquipmentVariable item : beanList) {
|
|
|
|
|
// 数据校验
|
|
|
|
|
if(StringUtil.isEmpty(item.getEquipmentCode())){
|
|
|
|
|
LOGGER.info("第{}行,设备代码不能为空", i);
|
|
|
|
|
i++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
ValidatorBean.checkNotNull(item.getEquipmentCode(), "设备代码不能为空");
|
|
|
|
|
|
|
|
|
|
DdlPackBean seriesPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getEquipmentCode(), "equipmentCode", seriesPackBean);
|
|
|
|
|
MesEquipment itemFlg = equipmentRepository.getByProperty(seriesPackBean);
|
|
|
|
|
if (StringUtil.isEmpty(itemFlg)) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
|
|
|
|
|
.setErrorDetail("【%s】设备代码不存在,请检查数据", item.getEquipmentCode())
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
item.setEquipId(itemFlg.getEquipId());
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
return beanList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|