|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesEquitmentService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesPartSapService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesProdRuleNosortCfgService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.apiservice.dao.IMesProdRuleNosortCfgDao;
|
|
|
|
@ -8,6 +9,7 @@ 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.MesPartSap;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesProdRuleNosortCfg;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
@ -19,6 +21,8 @@ import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
@Slf4j
|
|
|
|
@ -30,6 +34,10 @@ public class MesProdRuleNosortCfgService extends BaseMesService<MesProdRuleNosor
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesPartSapService partSapService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IMesEquitmentService equitmentService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void setPackQueryBean(MesProdRuleNosortCfg bean, DdlPackBean packBean) {
|
|
|
|
|
DdlPreparedPack.getStringLikerPack(bean.getInPartNo(), "inPartNo", packBean);
|
|
|
|
|
DdlPreparedPack.getStringLikerPack(bean.getInPartNoRule(), "inPartNoRule", packBean);
|
|
|
|
@ -39,6 +47,18 @@ public class MesProdRuleNosortCfgService extends BaseMesService<MesProdRuleNosor
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void setBeanModel(List<MesProdRuleNosortCfg> prodRuleNosortCfgList) {
|
|
|
|
|
if (CollectionUtils.isEmpty(prodRuleNosortCfgList)) return;
|
|
|
|
|
List<MesEquipment> equipmentList = equitmentService.findAll(DdlPackBean.getDdlPackBean(prodRuleNosortCfgList.get(0).getOrganizeCode()));
|
|
|
|
|
Map<String, List<MesEquipment>> equipmentCodeMap = CollectionUtils.isEmpty(equipmentList) ? null :
|
|
|
|
|
equipmentList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getEquipmentCode()))).collect(Collectors.groupingBy(MesEquipment::getEquipmentCode));
|
|
|
|
|
if (CollectionUtils.isEmpty(equipmentCodeMap)) return;
|
|
|
|
|
prodRuleNosortCfgList.stream().filter(o -> (null != o && !StringUtils.isEmpty(o.getEquipmentCode()))).forEach(o -> {
|
|
|
|
|
if (equipmentCodeMap.containsKey(o.getEquipmentCode())) o.setEquipmentName(equipmentCodeMap.get(o.getEquipmentCode()).get(0).getEquipmentName());
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public MesProdRuleNosortCfg insert(MesProdRuleNosortCfg bean) {
|
|
|
|
|
//插入前构造并校验数据
|
|
|
|
|
onInsertBean(bean);
|
|
|
|
|