Merge branch 'feature/DM/nflg-bom' of http://112.74.186.154:3000/nflj/nflg_project into feature/DM/nflg-bom

This commit is contained in:
jing's 2023-12-26 20:33:08 +08:00
commit 45df2e2b14
8 changed files with 52 additions and 26 deletions

View File

@ -28,9 +28,9 @@ public interface BomNewOriginalParentMapper extends BaseMapper<BomNewOriginalPar
void delBatch(@Param("rowIds") List<Long> rowIds);
void updateBomState(@Param("status") Integer status ,@Param("rowIds") List<Long> rowIds);
void updateBomState(@Param("editStatus") Integer editStatus, @Param("status") Integer status ,@Param("rowIds") List<Long> rowIds);
void updateRevertBom(@Param("status") Integer status ,@Param("editStatus") Integer editStatus ,@Param("rowIds") List<Long> rowIds);
void updateRevertBom( @Param("status") Integer status ,@Param("editStatus") Integer editStatus ,@Param("rowIds") List<Long> rowIds);

View File

@ -116,12 +116,16 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (CollUtil.isNotEmpty(parentMaterialByMaterialNo)) {
List<BomNewEbomParentVO> parents = this.getBaseMapper().getParentForMaterialNoSeach(parentMaterialByMaterialNo);
List<BomNewEbomParentVO> childs = this.getBaseMapper().getChildForMaterialNoSeach(parentMaterialByMaterialNo, materialNo);
List<BomNewEbomParentVO> data=new ArrayList<>();
data.addAll(parents);
data.addAll(childs);
materialMainService.intiMaterialInfo(data , "material","materialTexture","projectType");
returnResult = handSeachToTree(parents, childs);
}
}
} else {
Page<BomNewEbomParentVO> result = this.getBaseMapper().getEBomListPage(new Page<>(query.getPage(), query.getPageSize()), query, userRoleService.getUserJob(), SessionUtil.getUserCode());
materialMainService.intiMaterialInfo(result.getRecords() , "material","materialTexture","projectType");
returnResult = result;
}
return returnResult;
@ -534,7 +538,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
newParent.setRowId(IdWorker.getId());
newParent.setLastVersionIs(1);
newParent.setCurrentVersion(VersionUtil.getNextVersionForSmallVersion(parent.getCurrentVersion()));
newParent.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_11.getValue());
parent.setLastVersionIs(0);
parentResult.add(newParent);
parentResult.add(parent);

View File

@ -403,7 +403,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
}
//将原始BOM及子级转为已处理
if (CollUtil.isNotEmpty(convert.getHasHandlerParentIds())) {
this.getBaseMapper().updateBomState(OriginalStatusEnum.OVER_CONVERT.getValue(), convert.getHasHandlerParentIds());
this.getBaseMapper().updateBomState(OriginalEditStatusEnum.HANDLER_FINISHED.getValue(), OriginalStatusEnum.OVER_CONVERT.getValue(), convert.getHasHandlerParentIds());
}
}

View File

@ -79,9 +79,9 @@ public class CheckEBomException {
public void checkException(){
for (BomNewEbomParentVO vo : allBomDetail) {
if(Objects.isNull(vo.getExceptionStatus())) {
// if(Objects.isNull(vo.getExceptionStatus())) {
vo.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
}
// }
if (StrUtil.isNotBlank(vo.getMaterialNo())
&& (MaterialGetEnum.MaterialStateEnum.STATE_NO_4.equalsValue(vo.getMaterialState())
|| MaterialGetEnum.MaterialStateEnum.STATE_NO_5.equalsValue(vo.getMaterialState()))) {
@ -96,8 +96,8 @@ public class CheckEBomException {
} else if (StrUtil.isBlank(vo.getProjectType())) {
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue());
}
else if (StrUtil.isBlank(vo.getNoticeNums())){
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_11.getValue());
else if (StrUtil.isNotBlank(vo.getNoticeNums()) && EBomExceptionStatusEnum.EXCEPT_NO_11.equals(vo.getExceptionStatus())){
vo.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
}
}

View File

@ -81,7 +81,7 @@ public class EBomToPBom {
*/
public void convert() {
//效验数据是否OK
// check();
check();
//bom 提层
liftingLayer();
List<BomNewEbomParentVO> parentList = result.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList());

View File

@ -134,7 +134,7 @@ public class EbomInitProjectType {
sResult = sameLevelChild.stream().filter(u -> u.getMaterialCategoryCode().startsWith("2005") || u.getMaterialCategoryCode().startsWith("2006")).collect(Collectors.toList());
if (CollUtil.isNotEmpty(sResult)) {
List<String> projectType = sResult.stream().filter(u->StrUtil.isNotBlank(u.getProjectType())).map(u -> u.getProjectType()).distinct().collect(Collectors.toList());
if (projectType.size() == 1 && projectType.get(0).equals("Q")) {
if (projectType.size() == 1 && projectType.get(0).equals("Q") && !ProjectTypeInputTypeEnum.MANUAL_INPUT.equalsValue(child.getProjectTypeInputType())) {
child.setProjectType("Q");
}
}
@ -161,7 +161,7 @@ public class EbomInitProjectType {
for (BomNewEbomParentVO v : sResultProjectL) {
lResult = lResult & projectTypeEquals(getChilds(v.getBomRowId()), Sets.newHashSet("F", "Q"));
}
if ((resultNo1004 & lResult) == 1) {
if ((resultNo1004 & lResult) == 1 && !ProjectTypeInputTypeEnum.MANUAL_INPUT.equalsValue(child.getProjectTypeInputType())) {
child.setProjectType("F");
}

View File

@ -111,7 +111,8 @@ public class OriginalBomToEBomConvert extends BaseConvert {
//合并相同编码的物料
// List<BomOriginalListVO> mergeResult = mergeBOM(parentChild);
Long parentRowId = buildEBomParent(parentEnt);
buildEBomChild(parentChild, parentRowId);
// buildEBomChild(parentChild, parentRowId);
handlerChild(parentEnt,parentChild);
} else { //无子级
MaterialMateVO materialByRel = getMaterialByRel(parent.getMaterialName(), parent.getMaterialTexture());
@ -132,7 +133,8 @@ public class OriginalBomToEBomConvert extends BaseConvert {
List<BomOriginalListVO> mergeResult = mergeBOM(parentChild);
Long parentRowId = buildEBomParent(parentEnt);
buildEBomChild(mergeResult, parentRowId);
// buildEBomChild(mergeResult, parentRowId);
handlerChild(parentEnt,mergeResult);
} else { //无子级
//一板零部件
@ -177,13 +179,13 @@ public class OriginalBomToEBomConvert extends BaseConvert {
* 处理子级
*
* @param parentEntity
* @param originalSourceEnum
* @param
*/
private void handlerChild(BomOriginalListVO parentEntity, List<BomOriginalListVO> parentChild, OriginalSourceEnum originalSourceEnum) {
private void handlerChild(BomOriginalListVO parentEntity, List<BomOriginalListVO> parentChild) {
for (BomOriginalListVO childVo : parentChild) {
//一般零部件
if (com.github.xiaoymin.knife4j.core.util.StrUtil.isNotBlank(childVo.getMaterialCategoryCode()) && childVo.getMaterialCategoryCode().equals(OriginalConstant.COMMON_MATERIAL_CATEGORY_CODE)) {
if (StrUtil.isNotBlank(childVo.getMaterialCategoryCode()) && childVo.getMaterialCategoryCode().equals(OriginalConstant.COMMON_MATERIAL_CATEGORY_CODE)) {
MaterialMateVO materialByRel = getMaterialByRel(childVo);
//找到对应物料
if (Objects.nonNull(materialByRel)) {
@ -200,13 +202,15 @@ public class OriginalBomToEBomConvert extends BaseConvert {
newChild.setParentRowId(parentRowId);
this.eBomChildResult.add(newChild);
}
} else {
Long parentRowId = buildEBomParent(childVo);
buildEBomChild(childVo, parentRowId);
}
continue;
}
}
}
buildEBomChild(childVo,parentEntity.getRowId());
}
}
@ -232,11 +236,10 @@ public class OriginalBomToEBomConvert extends BaseConvert {
* 构建EBom父级
*/
private Long buildEBomParent(BomOriginalListVO parentEnt) {
BomNewEbomParentEntity ebom = SpringUtil.getBean(BomNewEbomParentService.class).lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, parentEnt.getMaterialNo())
.eq(BomNewEbomParentEntity::getLastVersionIs, 1).one();
BomNewEbomParentEntity ebom = SpringUtil.getBean(BomNewEbomParentService.class).lambdaQuery().eq(BomNewEbomParentEntity::getMaterialNo, parentEnt.getMaterialNo()).eq(BomNewEbomParentEntity::getLastVersionIs, 1).one();
BomNewEbomParentEntity eBomParent = new BomNewEbomParentEntity();
BeanUtil.copyProperties(parentEnt, eBomParent, "materialGetType");
eBomParent.setRowId(parentEnt.getEBomRowId()>0?parentEnt.getEBomRowId(): IdWorker.getId());
eBomParent.setRowId(parentEnt.getEBomRowId() > 0 ? parentEnt.getEBomRowId() : IdWorker.getId());
eBomParent.setSource(EBomSourceEnum.FROM_BOM.getValue());
eBomParent.setCurrentVersion(Objects.isNull(ebom) ? "" : VersionUtil.getNextVersion(ebom.getCurrentVersion()));
eBomParent.setConvertToEbomTime(LocalDateTime.now());
@ -245,6 +248,12 @@ public class OriginalBomToEBomConvert extends BaseConvert {
eBomParent.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
eBomParent.setModifyTime(LocalDateTime.now());
eBomParent.setBomExist(parentEnt.getBomRowId() > 0 ? 1 : 0);
eBomParent.setDeviseName(SessionUtil.getRealName());
eBomParent.setDeptName(SessionUtil.getDepartName());
eBomParent.setDeviseUserCode(SessionUtil.getUserCode());
if (Objects.isNull(ebom)) {
eBomParent.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_11.getValue());
}
//工艺岗直接到已复核
eBomParent.setStatus(SpringUtil.getBean(UserRoleService.class).technician() ? EBomStatusEnum.CHECKED.getValue() : EBomStatusEnum.WAIT_CHECK.getValue());
eBomParent.setCreatedJob(SpringUtil.getBean(UserRoleService.class).technician() ? UserJobEnum.ENGINEER.getValue() : UserJobEnum.DESIGNER.getValue());
@ -272,11 +281,24 @@ public class OriginalBomToEBomConvert extends BaseConvert {
childEntity.setIdentityNo(StrUtil.join("_", parentRowId.toString(), childEntity.getRowId()));
childEntity.setModifyTime(LocalDateTime.now());
this.eBomChildResult.add(childEntity);
}
}
private void buildEBomChild(BomOriginalListVO child, Long parentRowId) {
BomNewEbomChildEntity childEntity = new BomNewEbomChildEntity();
BeanUtil.copyProperties(child, childEntity, "materialGetType");
childEntity.setRowId(IdWorker.getId());
childEntity.setParentRowId(parentRowId);
childEntity.setIdentityNo(StrUtil.join("_", parentRowId.toString(), childEntity.getRowId()));
childEntity.setModifyTime(LocalDateTime.now());
this.eBomChildResult.add(childEntity);
}
/**
* 合并相同物料
*/

View File

@ -131,13 +131,13 @@
<update id="updateBomState">
update t_bom_new_original_parent set status = #{status},convert_to_ebom_time=now() where
update t_bom_new_original_parent set status = #{status},edit_status=#{editStatus}, convert_to_ebom_time=now() where
row_id in
<foreach collection="rowIds" item="rowId" open="(" separator="," close=")">
#{rowId}
</foreach>;
update t_bom_new_original_child set status = #{status} where
update t_bom_new_original_child set status = #{status} ,edit_status=#{editStatus} where
parent_row_id in
<foreach collection="rowIds" item="rowId" open="(" separator="," close=")">
#{rowId}