|
|
|
@ -2,6 +2,7 @@ package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.busi;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.busi.IProdExtOrgService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.apiservice.dao.IEquipmentExtDao;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.util.MesExtConstWords;
|
|
|
|
|
import cn.estsh.i3plus.mes.api.iservice.base.IEnumService;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
|
|
|
|
@ -21,6 +22,7 @@ import cn.estsh.i3plus.pojo.mes.model.ProdOrgModel;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.model.SysOrganizeModel;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.repository.*;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.sqlpack.MesHqlPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.util.MesExtEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.SysUserInfo;
|
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
@ -62,6 +64,10 @@ public class ProdExtOrgService implements IProdExtOrgService {
|
|
|
|
|
private MesWorkCellParamRepository workCellParamRepository;
|
|
|
|
|
@Autowired
|
|
|
|
|
private IEnumService enumService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesWorkModuleRepository workModuleRepository;
|
|
|
|
|
@Autowired
|
|
|
|
|
private MesWorkCellModuleRepository workCellModuleRepository;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List queryMesDataTree(String organizeCode) {
|
|
|
|
@ -172,7 +178,6 @@ public class ProdExtOrgService implements IProdExtOrgService {
|
|
|
|
|
if (MesEnumUtil.PROD_ORG_LEVEL.LEVEL_THREE.getValue() == prodOrgModel.getLevel()) {
|
|
|
|
|
MesWorkCell workCell = new MesWorkCell();
|
|
|
|
|
BeanUtils.copyProperties(prodOrgModel, workCell);
|
|
|
|
|
//checkWorkCell(workCell);
|
|
|
|
|
//唯一性校验
|
|
|
|
|
MesWorkCell mesWorkCell = workCellRepository.getByProperty(new String[]{MesConstWords.ORGANIZE_CODE, MesConstWords.IS_DELETED, "workCellCode", "workCenterCode"},
|
|
|
|
|
new Object[]{workCell.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), workCell.getWorkCellCode(), workCell.getWorkCenterCode()});
|
|
|
|
@ -186,12 +191,12 @@ public class ProdExtOrgService implements IProdExtOrgService {
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
workCell.setGrade(prodOrgModel.getGrade());
|
|
|
|
|
insertWorkCellModule(workCell);
|
|
|
|
|
return workCellRepository.insert(workCell);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public ListPager<MesArea> queryMesAreaByPager(MesArea mesArea, Pager pager) {
|
|
|
|
|
|
|
|
|
@ -395,23 +400,12 @@ public class ProdExtOrgService implements IProdExtOrgService {
|
|
|
|
|
workCell.getAreaCode(), workCell.getWorkCenterCode(), workCell.getWorkCellCode())
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
/*if (MesEnumUtil.MES_WORK_CELL_TYPE.REWORK.getValue() == workCell.getWorkCellType()) {
|
|
|
|
|
MesWorkCell mesWorkCell = workCellRepository.getByProperty(new String[]{MesConstWords.ORGANIZE_CODE, MesConstWords.IS_DELETED, MesConstWords.IS_VALID, "workCenterCode", "workCellType"},
|
|
|
|
|
new Object[]{workCell.getOrganizeCode(), CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), workCell.getWorkCenterCode(), workCell.getWorkCellType()});
|
|
|
|
|
if (mesWorkCell != null && !mesWorkCell.getId().equals(workCellDb.getId())) {
|
|
|
|
|
throw ImppExceptionBuilder.newInstance()
|
|
|
|
|
.setSystemID(CommonEnumUtil.SOFT_TYPE.MES.getCode())
|
|
|
|
|
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
|
|
|
|
|
.setErrorDetail("工位代码为【%s】,工位类型为【%s】的记录已存在", mesWorkCell.getWorkCellCode(), MesEnumUtil.MES_WORK_CELL_TYPE.valueOfDescription(workCell.getWorkCellType()))
|
|
|
|
|
.build();
|
|
|
|
|
}
|
|
|
|
|
}*/
|
|
|
|
|
workCellDb.setSeq(workCell.getSeq());
|
|
|
|
|
workCellDb.setWorkCellName(workCell.getWorkCellName());
|
|
|
|
|
workCellDb.setGrade(workCell.getGrade());
|
|
|
|
|
ConvertBean.serviceModelUpdate(workCellDb, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
|
|
|
|
|
return workCellRepository.save(workCellDb);
|
|
|
|
|
ConvertBean.serviceModelUpdate(workCell, AuthUtil.getSessionUser().getUserName());
|
|
|
|
|
|
|
|
|
|
insertWorkCellModule(workCell);
|
|
|
|
|
|
|
|
|
|
return workCellRepository.save(workCell);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -598,4 +592,31 @@ public class ProdExtOrgService implements IProdExtOrgService {
|
|
|
|
|
new Object[]{status, userName, TimeTool.getNowTime(true)});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void insertWorkCellModule(MesWorkCell workCell) {
|
|
|
|
|
if (StringUtils.isEmpty(workCell.getGrade()) || workCell.getGrade().compareTo(MesExtEnumUtil.WORK_CELL_GRADE.SCAN.getValue()) != 0) return;
|
|
|
|
|
List<MesWorkCellModule> workCellModuleList = getWorkCellModuleButtonList(workCell.getOrganizeCode(), workCell.getWorkCenterCode(), workCell.getWorkCellCode());
|
|
|
|
|
if (!CollectionUtils.isEmpty(workCellModuleList)) return;
|
|
|
|
|
List<MesWorkModule> workModuleList = getWorkModuleButtonList(workCell.getOrganizeCode());
|
|
|
|
|
if (CollectionUtils.isEmpty(workModuleList)) return;
|
|
|
|
|
for (MesWorkModule workModule : workModuleList) {
|
|
|
|
|
if (null == workModule) continue;
|
|
|
|
|
MesWorkCellModule workCellModule = new MesWorkCellModule();
|
|
|
|
|
BeanUtils.copyProperties(workCell, workCellModule, MesExtConstWords.ID);
|
|
|
|
|
workCellModule.setModuleCode(workModule.getModuleCode());
|
|
|
|
|
workCellModuleRepository.insert(workCellModule);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<MesWorkCellModule> getWorkCellModuleButtonList(String organizeCode, String workCenterCode, String workCellCode) {
|
|
|
|
|
return workCellModuleRepository.findByProperty(
|
|
|
|
|
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.WORK_CENTER_CODE, MesExtConstWords.WORK_CELL_CODE},
|
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), workCenterCode, workCellCode});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<MesWorkModule> getWorkModuleButtonList(String organizeCode) {
|
|
|
|
|
return workModuleRepository.findByProperty(
|
|
|
|
|
new String[]{MesExtConstWords.ORGANIZE_CODE, MesExtConstWords.IS_DELETED, MesExtConstWords.IS_VALID, MesExtConstWords.MODULE_TYPE},
|
|
|
|
|
new Object[]{organizeCode, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), CommonEnumUtil.IS_VAILD.VAILD.getValue(), MesEnumUtil.WORK_MODULE_TYPE.BUTTON_MODULE.getValue()});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|