|
|
|
@ -4,15 +4,20 @@ import cn.estsh.i3plus.ext.mes.api.base.IMesWorkCellExtendCfgService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.apiservice.unit.exception.MesException;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.util.StringUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesWorkCell;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesWorkCellExtendCfg;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.MesWorkCellRepository;
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class MesWorkCellExtendCfgService extends BaseMesService<MesWorkCellExtendCfg> implements IMesWorkCellExtendCfgService {
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesWorkCellRepository workCellRepository;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void setPackQueryBean(MesWorkCellExtendCfg bean, DdlPackBean packBean) {
|
|
|
|
@ -36,16 +41,18 @@ public class MesWorkCellExtendCfgService extends BaseMesService<MesWorkCellExten
|
|
|
|
|
MesException.throwMesBusiException("主子关系时产线【%s】与子产线【%s】需一致,请检查数据",
|
|
|
|
|
item.getWorkCenterCode(),item.getWorkCenterCodeBak());
|
|
|
|
|
}
|
|
|
|
|
//2.主工位和子工位各自唯一
|
|
|
|
|
DdlPackBean mainPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getWorkCenterCode(), "workCenterCode", mainPackBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getWorkCellCode(), "workCellCode", mainPackBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getWorkCenterCodeBak(), "workCenterCodeBak", mainPackBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getWorkCellCodeBak(), "workCellCodeBak", mainPackBean);
|
|
|
|
|
if (baseRDao.isExitByHql(mainPackBean)) {
|
|
|
|
|
MesException.throwMesBusiException("工作中心【%s】子工位【%s】数据界已经存在,请检查数据",
|
|
|
|
|
item.getWorkCenterCode(),item.getWorkCellCode(),item.getWorkCellCodeBak());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//1.子产线 子工位表里面唯一(无论类型)
|
|
|
|
|
DdlPackBean mainPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getWorkCenterCode(), "workCenterCode", mainPackBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getWorkCellCode(), "workCellCode", mainPackBean);
|
|
|
|
|
if (baseRDao.isExitByHql(mainPackBean)) {
|
|
|
|
|
MesException.throwMesBusiException("工作中心【%s】主工位【%s】数据已经存在,请检查数据",
|
|
|
|
|
item.getWorkCenterCode(),item.getWorkCellCode(),item.getWorkCellCodeBak());
|
|
|
|
|
}
|
|
|
|
|
//2.主工位和子工位各自唯一
|
|
|
|
|
DdlPackBean partPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getWorkCenterCodeBak(), "workCenterCodeBak", partPackBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getWorkCellCodeBak(), "workCellCodeBak", partPackBean);
|
|
|
|
@ -53,8 +60,20 @@ public class MesWorkCellExtendCfgService extends BaseMesService<MesWorkCellExten
|
|
|
|
|
MesException.throwMesBusiException("工作中心【%s】子工位【%s】数据界已经存在,请检查数据",
|
|
|
|
|
item.getWorkCenterCode(),item.getWorkCellCode(),item.getWorkCellCodeBak());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//3.子工位 是 30 工位 在 父子里面 都全局唯一
|
|
|
|
|
DdlPackBean wcPackBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getWorkCenterCodeBak(), "workCenterCodeBak", wcPackBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getWorkCellCodeBak(), "workCellCodeBak", wcPackBean);
|
|
|
|
|
MesWorkCell mesWorkCell = workCellRepository.getByProperty(wcPackBean);
|
|
|
|
|
if(!StringUtil.isEmpty(mesWorkCell)&&mesWorkCell.getGrade()==30){
|
|
|
|
|
DdlPackBean cellBean = DdlPackBean.getDdlPackBean(item.getOrganizeCode());
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getWorkCenterCode(), "workCenterCode", cellBean);
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(item.getWorkCellCode(), "workCellCode", cellBean);
|
|
|
|
|
if (baseRDao.isExitByHql(cellBean)) {
|
|
|
|
|
MesException.throwMesBusiException("工作中心【%s】子工位是30【%s】工位全局唯一,请检查数据",
|
|
|
|
|
item.getWorkCenterCode(),item.getWorkCellCode(),item.getWorkCellCodeBak());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void onUpdateBean(MesWorkCellExtendCfg item) {
|
|
|
|
|