|
|
|
@ -1,13 +1,20 @@
|
|
|
|
|
package cn.estsh.i3plus.ext.mes.apiservice.serviceimpl.base;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.api.base.IMesBomService;
|
|
|
|
|
import cn.estsh.i3plus.ext.mes.pojo.model.MesBomTreeModel;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.util.MesConstWords;
|
|
|
|
|
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.MesBom;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesCustomer;
|
|
|
|
|
import cn.estsh.i3plus.pojo.mes.bean.MesPart;
|
|
|
|
|
import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
|
import cn.estsh.impp.framework.boot.util.ValidatorBean;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
|
@Slf4j
|
|
|
|
@ -17,4 +24,75 @@ public class MesBomService extends BaseMesService<MesBom> implements IMesBomServ
|
|
|
|
|
DdlPreparedPack.getStringEqualPack(bean.getBomVersion(), "bomVersion", packBean);
|
|
|
|
|
DdlPreparedPack.getStringLikerPack(bean.getPartNo(), "partNo", packBean);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public List queryMesDataTreeByFirstFloor(MesBom bom) {
|
|
|
|
|
|
|
|
|
|
List resultList = new ArrayList();
|
|
|
|
|
ValidatorBean.checkNotNull(bom.getPartNo(), "零件号不能为空");
|
|
|
|
|
MesBomTreeModel organize = new MesBomTreeModel();
|
|
|
|
|
|
|
|
|
|
organize.setParentId(CommonEnumUtil.PARENT.DEFAULT.getValue());
|
|
|
|
|
organize.setName("LML");
|
|
|
|
|
// organize.setName(AuthUtil.getOrganize().getName());
|
|
|
|
|
|
|
|
|
|
List<MesBom> bomList = baseRDao.findByProperty(new String[]{MesConstWords.IS_VALID, MesConstWords.IS_DELETED, MesConstWords.ORGANIZE_CODE, "partNo"},
|
|
|
|
|
new Object[]{CommonEnumUtil.IS_VAILD.VAILD.getValue(), CommonEnumUtil.IS_DEAL.NO.getValue(), bom.getOrganizeCode(), bom.getPartNo()});
|
|
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(bomList)) {
|
|
|
|
|
organize.setChildTreeList(bomList);
|
|
|
|
|
resultList.add(organize);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return resultList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 根据零件号查询所有
|
|
|
|
|
*
|
|
|
|
|
* @param bom 组织代码
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public List queryMesDataTree(MesBom bom) {
|
|
|
|
|
List resultList = new ArrayList();
|
|
|
|
|
ValidatorBean.checkNotNull(bom.getPartNo(), "零件号不能为空");
|
|
|
|
|
MesBomTreeModel organize = new MesBomTreeModel();
|
|
|
|
|
|
|
|
|
|
organize.setParentId(CommonEnumUtil.PARENT.DEFAULT.getValue());
|
|
|
|
|
// organize.setName("LML");
|
|
|
|
|
organize.setName(AuthUtil.getOrganize().getName());
|
|
|
|
|
|
|
|
|
|
List<MesBom> bomList = baseRDao.findByProperty(new String[]{MesConstWords.IS_VALID, MesConstWords.IS_DELETED, MesConstWords.ORGANIZE_CODE, "partNo"},
|
|
|
|
|
new Object[]{CommonEnumUtil.IS_VAILD.VAILD.getValue(), CommonEnumUtil.IS_DEAL.NO.getValue(), bom.getOrganizeCode(), bom.getPartNo()});
|
|
|
|
|
|
|
|
|
|
recursionBomList(bomList);
|
|
|
|
|
organize.setChildTreeList(bomList);
|
|
|
|
|
resultList.add(organize);
|
|
|
|
|
|
|
|
|
|
return resultList;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 递归查询bom
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
private List<MesBom> recursionBomList(List<MesBom> bomList) {
|
|
|
|
|
if (!CollectionUtils.isEmpty(bomList)) {
|
|
|
|
|
for (MesBom bom : bomList) {
|
|
|
|
|
if (bom.getItemPartNo().equals(bom.getPartNo())) continue;
|
|
|
|
|
List<MesBom> resultList = baseRDao.findByProperty(new String[]{MesConstWords.IS_VALID, MesConstWords.IS_DELETED, MesConstWords.ORGANIZE_CODE, "partNo"},
|
|
|
|
|
new Object[]{CommonEnumUtil.IS_VAILD.VAILD.getValue(), CommonEnumUtil.IS_DEAL.NO.getValue(), bom.getOrganizeCode(), bom.getItemPartNo()});
|
|
|
|
|
|
|
|
|
|
recursionBomList(resultList);
|
|
|
|
|
bom.setChildTreeList(resultList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return bomList;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|