parent
ddc67786f9
commit
4c8f653b13
|
|
@ -199,7 +199,7 @@ public class PBomApi extends BaseApi {
|
|||
@PostMapping("getAllocationFactoryBom")
|
||||
@ApiOperation("分工厂-获取BOM树")
|
||||
public ResultVO<List<BomNewPbomParentVO> > getAllocationFactoryBom(@Valid @RequestBody AllocationFactoryBomQuery param ) throws ExecutionException, InterruptedException {
|
||||
return ResultVO.success(bomNewPbomParentService.getAllocationFactoryBom(param));
|
||||
return ResultVO.success(bomNewPbomParentService.getAllocationFactoryBomTree(param));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,4 +63,8 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
|
|||
void delBatch(@Param("rowIds") List<Long> rowIds);
|
||||
|
||||
void updateStateBatchByRowIds(@Param("status") Integer status, @Param("list") List<Long> list );
|
||||
|
||||
Integer checkIsRoot(@Param("materialNo") String materialNo);
|
||||
|
||||
Integer checkIsUserRoot(@Param("materialNo")String materialNo, @Param("jobNo")String jobNo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
for (Long bomRowId : bomRowIds) {
|
||||
List<BomNewEbomParentVO> data = getBomTree(bomRowId);
|
||||
BomNewEbomParentVO parent = Convert.convert(BomNewEbomParentVO.class, this.getById(bomRowId));
|
||||
LogRecordContext.putVariable("bom",parent);
|
||||
LogRecordContext.putVariable("bom", parent);
|
||||
//初始化物料信息
|
||||
materialMainService.intiMaterialInfo(data);
|
||||
productTypeInitDo(parent, data);
|
||||
|
|
@ -641,9 +641,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
|
||||
|
||||
BomNewEbomParentEntity root = this.getById(paramDto.getBomRowId());
|
||||
LogRecordContext.putVariable("bom",root);
|
||||
LogRecordContext.putVariable("bom", root);
|
||||
//初始化虚拟包-判断枚举(不是手工生成虚拟包的情况)
|
||||
checkAndInitVirtualPackageEnum(paramDto,root);
|
||||
checkAndInitVirtualPackageEnum(paramDto, root);
|
||||
Boolean flag = true;
|
||||
for (Integer f : paramDto.getVirtualPackageValue()) {
|
||||
flag = flag & ((root.getVirtrualPackageEnum() & f) == f);
|
||||
|
|
@ -704,6 +704,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
if (CollUtil.isNotEmpty(eBomToPBom.getPBomChildResult())) {
|
||||
pBomChildService.saveOrUpdateBatch(eBomToPBom.getPBomChildResult());
|
||||
}
|
||||
//标记跟节点
|
||||
upRootMark(parent);
|
||||
if (CollUtil.isNotEmpty(eBomToPBom.getVirtualPackageCompositionResult())) {
|
||||
//先删除
|
||||
Set<String> delSet = eBomToPBom.getVirtualPackageCompositionResult().stream().map(u -> StrUtil.join("-", u.getVirtualPackageMaterialNo(), u.getParentMaterialNo())).collect(Collectors.toSet());
|
||||
|
|
@ -738,14 +740,14 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
this.getBaseMapper().updateStateBatchByRowIds(EBomStatusEnum.PUBLISHED.getValue(), bomRowIds);
|
||||
}
|
||||
//子级记录-bom版本
|
||||
List<BomNewEbomChildEntity> bomChildren=new ArrayList<>();
|
||||
bomTree.forEach(k->{
|
||||
BomNewEbomChildEntity entChild=new BomNewEbomChildEntity();
|
||||
List<BomNewEbomChildEntity> bomChildren = new ArrayList<>();
|
||||
bomTree.forEach(k -> {
|
||||
BomNewEbomChildEntity entChild = new BomNewEbomChildEntity();
|
||||
entChild.setRowId(k.getRowId());
|
||||
entChild.setBomVersionRowId(k.getBomRowId());
|
||||
bomChildren.add(entChild);
|
||||
});
|
||||
if(CollUtil.isNotEmpty(bomChildren)) {
|
||||
if (CollUtil.isNotEmpty(bomChildren)) {
|
||||
ebomChildService.updateBatchById(bomChildren);
|
||||
}
|
||||
|
||||
|
|
@ -754,6 +756,18 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
}
|
||||
}
|
||||
|
||||
private void upRootMark(BomNewEbomParentVO parent){
|
||||
Integer rootIs = this.getBaseMapper().checkIsRoot(parent.getMaterialNo());
|
||||
Integer userRootIs=this.getBaseMapper().checkIsUserRoot(parent.getMaterialNo(),parent.getCreatedBy());
|
||||
BomNewEbomParentEntity ebomParent=new BomNewEbomParentEntity();
|
||||
ebomParent.setRowId(parent.getRowId());
|
||||
ebomParent.setRootIs(rootIs>0?0:1);
|
||||
ebomParent.setUserRootIs(userRootIs>0?0:1);
|
||||
this.updateById(ebomParent);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起变更
|
||||
*
|
||||
|
|
@ -764,15 +778,19 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
List<BomNewEbomParentEntity> list = this.lambdaQuery().in(BomNewEbomParentEntity::getRowId, paramDTO.getBomRowIds()).list();
|
||||
List<String> notConvertToPbom = list.stream().filter(u -> u.getStatus() < EBomStatusEnum.PUBLISHED.getValue()).map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(notConvertToPbom)).throwMessage(StrUtil.join(",", notConvertToPbom) + "未转PBom,不能发起变更");
|
||||
//检查是否存在发布前的版本,有则不能发起变更
|
||||
List<String> materialNos = list.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
List<BomNewEbomParentEntity> existEnt = this.lambdaQuery().in(BomNewEbomParentEntity::getMaterialNo, materialNos).lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).list();
|
||||
Set<String> existMaterialNos = existEnt.stream().map(u -> u.getMaterialNo()).collect(Collectors.toSet());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(existMaterialNos)).throwMessage(StrUtil.join(",", existMaterialNos, "存在发布前版本。"));
|
||||
|
||||
List<BomNewEbomParentEntity> parentResult = new ArrayList<>();
|
||||
List<BomNewEbomChildEntity> childResult = new ArrayList<>();
|
||||
for (Long bomRowId : paramDTO.getBomRowIds()) {
|
||||
BomNewEbomParentEntity parent = this.getById(bomRowId);
|
||||
LogRecordContext.putVariable("bom",parent);
|
||||
List<BomNewEbomParentEntity> existEnt = this.lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, parent.getMaterialNo()).lt(BomNewEbomParentEntity::getStatus, EBomStatusEnum.PUBLISHED.getValue()).list();
|
||||
//含发布前版本则无需升级
|
||||
if (CollUtil.isEmpty(existEnt)) {
|
||||
LogRecordContext.putVariable("bom", parent);
|
||||
|
||||
|
||||
List<BomNewEbomChildEntity> child = ebomChildService.lambdaQuery().eq(BomNewEbomChildEntity::getParentRowId, bomRowId).list();
|
||||
BomNewEbomParentEntity newParent = new BomNewEbomParentEntity();
|
||||
BeanUtil.copyProperties(parent, newParent);
|
||||
|
|
@ -783,6 +801,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
newParent.setChangeDesc(paramDTO.getChangeDesc());
|
||||
newParent.setNoticeNums(paramDTO.getNoticeNums());
|
||||
newParent.setStatus(EBomStatusEnum.WAIT_CHECK.getValue());
|
||||
newParent.setRootIs(1);
|
||||
newParent.setUserRootIs(1);
|
||||
parent.setLastVersionIs(0);
|
||||
parentResult.add(newParent);
|
||||
parentResult.add(parent);
|
||||
|
|
@ -793,7 +813,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
newChild.setParentRowId(newParent.getRowId());
|
||||
childResult.add(newChild);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (CollUtil.isNotEmpty(parentResult)) {
|
||||
|
|
@ -1047,7 +1067,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
VUtils.isTure(true).throwMessage("下级BOM无法进行退回");
|
||||
}
|
||||
Set<String> materialNoAndVersion = bomNewEbomParentEntityList.stream().map(u -> StrUtil.join("-", u.getMaterialNo(), u.getCurrentVersion())).collect(Collectors.toSet());
|
||||
LogRecordContext.putVariable("log",materialNoAndVersion);
|
||||
LogRecordContext.putVariable("log", materialNoAndVersion);
|
||||
|
||||
if (rowIds.size() != bomNewEbomParentEntityList.size()) {
|
||||
|
||||
|
|
@ -1154,7 +1174,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
VUtils.isTure(true).throwMessage("下级BOM无法进行复核");
|
||||
}
|
||||
Set<String> materialNoAndVersion = bomNewEbomParentEntityList.stream().map(u -> StrUtil.join("-", u.getMaterialNo(), u.getCurrentVersion())).collect(Collectors.toSet());
|
||||
LogRecordContext.putVariable("log",materialNoAndVersion);
|
||||
LogRecordContext.putVariable("log", materialNoAndVersion);
|
||||
|
||||
if (rowIds.size() != bomNewEbomParentEntityList.size()) {
|
||||
VUtils.isTure(true).throwMessage("数据中包含有下级BOM无法进行复核");
|
||||
|
|
@ -1274,7 +1294,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
BomNewEbomParentVO parentVO = Convert.convert(BomNewEbomParentVO.class, parent);
|
||||
|
||||
|
||||
|
||||
parentVO.setBomRowId(parentVO.getRowId());
|
||||
parentVO.setParentRowId(0l);
|
||||
parentVO.setProjectType(projectType);
|
||||
|
|
@ -1282,8 +1301,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
materialMainService.intiMaterialInfo(ImmutableList.of(parentVO), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT2);
|
||||
|
||||
|
||||
|
||||
|
||||
// materialMainService.intiMaterialInfo(ImmutableList.of(parentVO));
|
||||
|
||||
|
||||
|
|
@ -1405,7 +1422,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
public Boolean deleteBom(Long bomRowId) throws ExecutionException, InterruptedException {
|
||||
|
||||
BomNewEbomParentEntity parentEntity = this.getBaseMapper().selectById(bomRowId);
|
||||
LogRecordContext.putVariable("bom",parentEntity);
|
||||
LogRecordContext.putVariable("bom", parentEntity);
|
||||
|
||||
VUtils.isTure(Objects.isNull(parentEntity)).throwMessage("该节点不存在,请检查参数是否正确");
|
||||
|
||||
|
|
@ -1443,24 +1460,25 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
/**
|
||||
* 2. 只有含有BOM的物料才可以打“超级物料的”标签,如果不存在下级BOM时,不可以打标。
|
||||
* 3. 需求:编辑页面需要添加一个是否为超级物料的选项,属于一个打标签的功能
|
||||
*
|
||||
* @param datas
|
||||
*/
|
||||
private void superMaterialStatus( List<BomNewEbomParentVO> datas){
|
||||
private void superMaterialStatus(List<BomNewEbomParentVO> datas) {
|
||||
|
||||
List<BomNewEbomParentVO> superTagList=datas.stream().filter(item-> item.getSuperMaterialStatus()!=null
|
||||
List<BomNewEbomParentVO> superTagList = datas.stream().filter(item -> item.getSuperMaterialStatus() != null
|
||||
// && item.getSuperMaterialStatus().equals(EBomSuperMaterialStatusEnum.SUPER_MATERIAL_1.getValue())
|
||||
&& item.getBomRowId()!=null && item.getBomRowId().longValue()>0
|
||||
&& item.getBomRowId() != null && item.getBomRowId().longValue() > 0
|
||||
).collect(Collectors.toList());
|
||||
|
||||
List<BomNewEbomParentEntity> updateList=new ArrayList<>();
|
||||
for (BomNewEbomParentVO vo:superTagList){
|
||||
BomNewEbomParentEntity entity=new BomNewEbomParentEntity();
|
||||
List<BomNewEbomParentEntity> updateList = new ArrayList<>();
|
||||
for (BomNewEbomParentVO vo : superTagList) {
|
||||
BomNewEbomParentEntity entity = new BomNewEbomParentEntity();
|
||||
entity.setRowId(vo.getBomRowId());
|
||||
entity.setSuperMaterialStatus(vo.getSuperMaterialStatus());
|
||||
updateList.add(entity);
|
||||
}
|
||||
|
||||
if(CollectionUtil.isNotEmpty(updateList)){
|
||||
if (CollectionUtil.isNotEmpty(updateList)) {
|
||||
this.updateBatchById(updateList);
|
||||
}
|
||||
|
||||
|
|
@ -1748,11 +1766,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
}
|
||||
|
||||
|
||||
public void createOrder(){
|
||||
BomNewEbomParentEntity ent=new BomNewEbomParentEntity();
|
||||
public void createOrder() {
|
||||
BomNewEbomParentEntity ent = new BomNewEbomParentEntity();
|
||||
ent.setDrawingNo("testDrawingNo");
|
||||
ent.setCurrentVersion("V001");
|
||||
LogRecordContext.putVariable("bom",ent);
|
||||
LogRecordContext.putVariable("bom", ent);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -592,10 +592,16 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
return CTreePBomUtils.toTree(bomRowId, allBom, BomNewPbomParentVO::getParentRowId, BomNewPbomParentVO::getBomRowId);
|
||||
}
|
||||
|
||||
public List<BomNewPbomParentVO> getAllocationFactoryBomTree(AllocationFactoryBomQuery param) throws ExecutionException, InterruptedException {
|
||||
List<BomNewPbomParentVO> allBom = getAllBom(param.getBomRowId(), 0);
|
||||
materialMainService.intiMaterialInfo(allBom, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
return CTreePBomUtils.toTree(param.getBomRowId(), allBom, BomNewPbomParentVO::getParentRowId, BomNewPbomParentVO::getBomRowId);
|
||||
}
|
||||
|
||||
public List<BomNewPbomParentVO> getAllocationFactoryBom(AllocationFactoryBomQuery param) throws ExecutionException, InterruptedException {
|
||||
List<BomNewPbomParentVO> allBom = getAllBom(param.getBomRowId(), 1);
|
||||
materialMainService.intiMaterialInfo(allBom, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
return CTreePBomUtils.toTree(param.getBomRowId(), allBom, BomNewPbomParentVO::getParentRowId, BomNewPbomParentVO::getBomRowId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -621,7 +627,10 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
}else {
|
||||
params.getData().forEach(k->{
|
||||
try {
|
||||
List<BomNewPbomParentVO> allBom = this.getAllBomTree(k.getBomRowId());
|
||||
AllocationFactoryBomQuery query=new AllocationFactoryBomQuery();
|
||||
query.setBomRowId(k.getBomRowId());
|
||||
|
||||
List<BomNewPbomParentVO> allBom = this.getAllocationFactoryBom(query);
|
||||
List<Long> rowIds =new ArrayList<>();
|
||||
rowIds.add(k.getRowId());
|
||||
rowIds.addAll(allBom.stream().map(u -> u.getRowId()).collect(Collectors.toList()));
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@
|
|||
<!--物料编码搜索-父级-->
|
||||
<select id="getParentForMaterialNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
|
||||
SELECT created_by as bomCreatedBy , row_id as bomRowId, row_id as childBomRowId, a.*
|
||||
FROM t_bom_new_ebom_parent a where a.last_version_is=1 and material_no in
|
||||
FROM t_bom_new_ebom_parent a where a.last_version_is=1 and a.status < 4 and material_no in
|
||||
<foreach collection="materialNoList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
|
@ -108,7 +108,7 @@
|
|||
from t_bom_new_ebom_parent a
|
||||
join t_bom_new_ebom_child b on a.row_id =b.parent_row_id
|
||||
left join t_bom_new_ebom_parent c on b.material_no=c.material_no and c.last_version_is=1
|
||||
where a.last_version_is=1 and ( b.material_no in
|
||||
where a.last_version_is=1 and a.status < 4 and ( b.material_no in
|
||||
<foreach collection="materialNoList" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
|
|
@ -215,4 +215,17 @@
|
|||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
<!--检查是否已发布数据的跟节点-->
|
||||
<select id="checkIsRoot" resultType="java.lang.Integer">
|
||||
select COUNT(1) from t_bom_new_ebom_parent a join t_bom_new_ebom_child b on a.row_id=b.parent_row_id and a.`status`=4 and a.last_version_is=1
|
||||
and b.material_no=#{materialNo}
|
||||
</select>
|
||||
|
||||
<!--检查是否已发布数据的用户跟节点-->
|
||||
<select id="checkIsUserRoot" resultType="java.lang.Integer">
|
||||
select COUNT(1) from t_bom_new_ebom_parent a join t_bom_new_ebom_child b on a.row_id=b.parent_row_id and a.`status`=4 and a.last_version_is=1
|
||||
and b.material_no=#{materialNo} and b.created_by=#{jobNo}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue