1、BUG修复

This commit is contained in:
大米 2024-04-13 15:34:52 +08:00
parent dc097a96cb
commit a5e5dd1827
7 changed files with 204 additions and 166 deletions

View File

@ -7,7 +7,9 @@ import com.nflg.product.bomnew.pojo.query.OriginalBomQuery;
import com.nflg.product.bomnew.pojo.vo.BomOriginalListVO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
import java.util.Set;
/**
* t_bom_new_original_parent 表数据库访问层
@ -59,7 +61,14 @@ public interface BomNewOriginalParentMapper extends BaseMapper<BomNewOriginalPar
*/
List<BomOriginalListVO> getParentForDrawingNoSeach(@Param("drawingNos") List<String> drawingNos ,@Param("state") Integer state);
List<BomOriginalListVO> getChildForDrawingNoSeach(@Param("drawingNos") List<String> drawingNos,@Param("state") Integer state);
List<BomOriginalListVO> getChildForDrawingNoSeach(@Param("drawingNos") List<String> drawingNos,@Param("bomRowIds") Collection<Long> bomRowIds);
/**
* 获取父级图号
* @param drawingNos
* @return
*/
Set<String> getMaterialParent(@Param("drawingNos") Collection<String> drawingNos);

View File

@ -225,6 +225,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
/**
* 获取父级物料 (包含查询物料本身)
*
* @param materialNoList
* @param bomType
* @return
@ -402,6 +403,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
/**
* 生成虚拟包时-获取子级
*
* @param rowId
* @return
*/
@ -769,21 +771,23 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
public void generateVirtualPackage(VirtualPackageParamDto paramDto) throws IOException {
BomNewEbomParentEntity root = this.getById(paramDto.getBomRowId());
VUtils.isTure(Objects.isNull(root)).throwMessage("Bom不存在");
//
// VUtils.isTure(root.getVirtrualPackageEnum()>0).throwMessage("已生成过虚拟包不能2次生成");
//初始化虚拟包-判断枚举不是手工生成虚拟包的情况
checkAndInitVirtualPackageEnum(paramDto, root);
VUtils.isTure(root.getVirtrualPackageEnum() > 0).throwMessage("已生成过虚拟包不能2次生成");
VUtils.isTure(!Objects.equals(root.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue()))
.throwMessage("异常状态下不允许生成虚拟包");
LogRecordContext.putVariable("gvbom", root);
//初始化虚拟包-判断枚举不是手工生成虚拟包的情况
checkAndInitVirtualPackageEnum(paramDto, root);
Boolean flag = true;
for (Integer f : paramDto.getVirtualPackageValue()) {
flag = flag & ((root.getVirtrualPackageEnum() & f) == f);
}
VUtils.isTure(flag).throwMessage("已生成虚拟包,无需重复生成");
// Boolean flag = true;
// for (Integer f : paramDto.getVirtualPackageValue()) {
// flag = flag & ((root.getVirtrualPackageEnum() & f) == f);
// }
// VUtils.isTure(flag).throwMessage("已生成虚拟包,无需重复生成");
BomNewEbomParentVO parent = Convert.convert(BomNewEbomParentVO.class, root);
materialMainService.intiMaterialInfo(ImmutableList.of(parent), BomNewEbomParentVO::getMaterialNo);
@ -1213,7 +1217,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
* 退回设计,不用判断角色 工艺岗才能看见已复核数据
* 1.已发布不能退
* 2.被工艺岗位添加的物料不可以退回但是可以被删除只能是当前工艺岗位的用户创建的物料
*
*/
@Transactional(rollbackFor = Exception.class)
public void revertDesign(BomNewEBomRevertDTO dto) throws ExecutionException, InterruptedException {
@ -1261,7 +1264,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
.map(BomNewEbomParentVO::getBomRowId).collect(Collectors.toList()));
if (CollectionUtil.isNotEmpty(revertList)) {
//parent表状态
UpdateWrapper<BomNewEbomParentEntity> updateWrapper = new UpdateWrapper<>();
@ -1291,8 +1293,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
}
/**
@ -1403,13 +1403,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
public Boolean updateProjectType(BomNewEbomProjectTypeDTO dto) {
List<Long> rowIdList = dto.getRowIdList().stream().map(BomNewEbomProjectTypeDTO.BomNewEbomChangeProjectType::getRowId).collect(Collectors.toList());
List<Long> bomRowIdList = dto.getRowIdList().stream().filter(u -> u.getBomRowId() > 0).map(BomNewEbomProjectTypeDTO.BomNewEbomChangeProjectType::getBomRowId).collect(Collectors.toList());
// if (CollectionUtil.isNotEmpty(bomRowIdList)) {
// UpdateWrapper<BomNewEbomParentEntity> parentUpdate = new UpdateWrapper<>();
// parentUpdate.lambda()
@ -1505,7 +1502,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
BomNewEbomChildEntity childEntity = null;
@ -1529,9 +1525,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
//编辑数据 新增或物料编码已变化
BomNewEbomParentEntity bomParent = null;
if (query.getBomRowId() != null && query.getBomRowId().longValue() != 0) {
@ -1568,7 +1561,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
if (StrUtil.isNotBlank(baseMaterialVO.getMaterialNo())
&& (MaterialGetEnum.MaterialStateEnum.STATE_NO_4.equalsValue(baseMaterialVO.getMaterialState())
|| MaterialGetEnum.MaterialStateEnum.STATE_NO_5.equalsValue(baseMaterialVO.getMaterialState()))) {
@ -1665,7 +1657,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
if (CollectionUtil.isNotEmpty(eBomDel.getDelEBom())) {
//ThreadUtil.execAsync(() -> computeLevelNumAndRootState());
@ -1717,9 +1708,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
/**
* 暂存
* <p>
@ -1733,7 +1721,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
checkUserRoleAuth(dto.getParent().getCreatedBy());
//暂存数据为空后面不处理
if (CollUtil.isEmpty(dto.getDatas())) {
return dto.getParent();
@ -1745,8 +1732,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
eBomEdit.handleBom(dto);
if (eBomEdit.getParentEntity() != null) {
eBomEdit.nextVersion();
@ -1771,8 +1756,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
BomNewEbomParentVO retParentVO = Convert.convert(BomNewEbomParentVO.class, eBomEdit.getParentEntity());
retParentVO.setBomRowId(retParentVO.getRowId());
@ -1789,7 +1772,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
checkUserRoleAuth(dto.getParent().getCreatedBy());
//无提交数据后面不处理
if (CollUtil.isEmpty(dto.getDatas())) {
return true;
@ -1879,7 +1861,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
// }
//原始bom不正常
List<BomNewEbomChildEntity> s1List = delChildList.stream().filter(u -> Objects.equals(EBomSourceEnum.FROM_BOM.getValue(), u.getSource())
&& !Objects.equals(u.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())).collect(Collectors.toList());

View File

@ -114,6 +114,30 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
return result;
}
/**
* 获取父级图号包含查询的图号
* @param drawingNos
* @return
*/
public List<String> getParentMaterialByDrawingNo(List<String> drawingNos) {
Set<String> result = new HashSet<>();
result.addAll(drawingNos);
Set<String> useMaterialSku = this.getBaseMapper().getMaterialParent(drawingNos);
while (CollUtil.isNotEmpty(useMaterialSku)) {
//防止数据错误循环依赖-死循环
Set<String> difference = Sets.difference(useMaterialSku, result);
if (CollUtil.isNotEmpty(difference)) {
useMaterialSku = this.getBaseMapper().getMaterialParent(difference);
result.addAll(difference);
} else {
break;
}
}
return new ArrayList<>(result);
}
private Page<BomOriginalListVO> handSeachToTree(List<BomOriginalListVO> parents, List<BomOriginalListVO> childs) {
Page<BomOriginalListVO> resutlData = new Page<>();
Set<String> parentSet = parents.stream().map(u -> u.getDrawingNo()).collect(Collectors.toSet());
@ -162,12 +186,12 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
// if(query.getStatus().equals(1) && CollUtil.isEmpty(materialBoms)){
// return result;
// }
List<String> parentDrawingNos = new ArrayList<>(getParentDrawingNoByMaterialNo(queryDrawingNos));
parentDrawingNos.addAll(queryDrawingNos);
List<String> parentDrawingNos = new ArrayList<>(getParentMaterialByDrawingNo(queryDrawingNos));
// parentDrawingNos.addAll(queryDrawingNos);
if (CollUtil.isNotEmpty(parentDrawingNos)) {
List<BomOriginalListVO> parents = this.getBaseMapper().getParentForDrawingNoSeach(parentDrawingNos, query.getStatus());
materialMainService.intiMaterialInfo(parents, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
List<BomOriginalListVO> childs = this.getBaseMapper().getChildForDrawingNoSeach(parentDrawingNos,query.getStatus());
List<BomOriginalListVO> childs = this.getBaseMapper().getChildForDrawingNoSeach(parentDrawingNos,parents.stream().map(u->u.getRowId()).collect(Collectors.toSet()));
materialMainService.intiMaterialInfo(childs, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
childs.stream().filter(f -> StrUtil.isBlank(f.getCurrentVersion())).forEach(f -> {
if (MaterialshouldBomExistUtil.checkShouldBomExist(f.getMaterialCategoryCode(), f.getMaterialGetType())) {
@ -499,6 +523,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
*
* @return
*/
@Transactional(rollbackFor = Exception.class)
public List<ImportOriginalBomVO> convertToEBom(List<Long> bomRowIds) throws ExecutionException, InterruptedException {
List<BomNewOriginalParentEntity> bomNewOriginalParentEntities = this.getBaseMapper().selectBatchIds(bomRowIds);
@ -522,13 +547,13 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
try {
convertToEBomDo(parent, ebomRowId);
} catch (Exception e) {
importOriginalBomVOList.add(new ImportOriginalBomVO(parent.getDrawingNo(), "操作失败:" + e.getMessage()));
throw e;
}
//更新并保存异常信息
ebomParentService.checkAndSaveEBomException(ebomRowId);
} catch (Exception e) {
importOriginalBomVOList.add(new ImportOriginalBomVO(parent.getDrawingNo(), "操作失败:" + e.getMessage()));
}
}
return importOriginalBomVOList;
}

View File

@ -39,7 +39,7 @@ public class VirtualPackageFor21 extends VirtualPackageBase {
BomNewEbomParentEntity parent = getParentByRowId(bomRowId);
BomNewEbomParentVO vo= Convert.convert(BomNewEbomParentVO.class,parent );
if(virtualPackageValue.contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) && (parent.getVirtrualPackageEnum()| VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue())!=VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()){
if(virtualPackageValue.contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) && (parent.getVirtrualPackageEnum()&VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue())!= VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()){
generateVMNoF21(parent.getDrawingNo(), ImmutableList.of(vo),VirtualPackageTypeEnum.MAKING_PACKAGE, VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE,VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
}
else {
@ -58,7 +58,7 @@ public class VirtualPackageFor21 extends VirtualPackageBase {
buildChild(directDeliveryPackage, bomRowId, "002", VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE,parent.getMaterialNo());
}
if(virtualPackageValue.contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) && (parent.getVirtrualPackageEnum()| VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue())!=VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) {
if(virtualPackageValue.contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) && (parent.getVirtrualPackageEnum()& VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue())!=VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) {
//构建构建发货前装配包
if(Objects.isNull(makingPackage)){
makingPackage=getParentZhiZuo(parent.getDrawingNo());

View File

@ -226,8 +226,9 @@
</update>
<!--更新-待复核根节点-->
<update id="updateRootForWaitReview">
update t_bom_new_ebom_parent set root_is_for_wait_review=0 ;
update t_bom_new_ebom_parent a left join (
select b.row_id, b.material_no,a.`status` 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` =2
select b.row_id, b.material_no,a.`status` 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` in(1,3) and last_version_is=1
) b on a.material_no=b.material_no
set a.root_is_for_wait_review=1
where a.`status` in (1,3) and last_version_is=1 and b.row_id is null ;

View File

@ -192,40 +192,60 @@
<!--物料编码搜索-父级-->
<select id="getParentForDrawingNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomOriginalListVO">
SELECT if(#{state}=1 and status=2,3,status) as status, created_by as bomCreatedBy , row_id as bomRowId, row_id as childBomRowId, a.*
FROM t_bom_new_original_parent a where 1=1
<!-- <if test="state==1">-->
<!-- and a.last_version_is=1-->
<!-- <if test="InHasConvertBomIs">-->
<!-- and a.status=1-->
<!-- </if>-->
<!-- </if>-->
<if test="state==2">
and current_version in ( select current_version from t_bom_new_original_parent where status &gt;1 and drawing_no in
<foreach collection="drawingNos" item="item" open="(" separator="," close=")">
#{item}
</foreach>
)
</if>
SELECT status , created_by as bomCreatedBy , row_id as bomRowId, row_id as childBomRowId, a.*
FROM t_bom_new_original_parent a
join (select drawing_no,max(current_version) current_version from t_bom_new_original_parent where status=#{state}
and drawing_no in
<foreach collection="drawingNos" item="item" open="(" separator="," close=")">
#{item}
</foreach>
group by drawing_no ) b on a.drawing_no=b.drawing_no and a.current_version=b.current_version
order by created_time desc
</select>
<!--物料编码搜索-子级-->
<select id="getChildForDrawingNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomOriginalListVO">
select if(#{state}=1 and c.status=2,3,c.status) as status ,c.current_version , c.created_by as bomCreatedBy
,IFNULL(c.devise_name,a.devise_name) as devise_name,IFNULL(c.devise_user_code,a.devise_user_code) AS devise_user_code
,IFNULL(c.dept_name,a.dept_name) AS dept_name,IFNULL(c.source,a.source) AS source,IFNULL(c.row_id,"0") as bomRowId
,IFNULL(c.row_id,"0") as childBomRowId, b.*
from t_bom_new_original_parent a
join t_bom_new_original_child b on a.row_id =b.parent_row_id
left join t_bom_new_original_parent c on b.drawing_no=c.drawing_no and c.last_version_is=1
where a.last_version_is=1 and b.drawing_no in
select a.status ,a.current_version , a.created_by as bomCreatedBy,
a.devise_name ,a.devise_user_code
,a.dept_name,a.source,ifnull( a.row_id,0) as bomRowId
,ifnull( a.row_id,0) as childBomRowId, b.* from t_bom_new_original_child b
left join t_bom_new_original_parent a on a.drawing_no=b.drawing_no and a.row_id in
<foreach collection="bomRowIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
where b.parent_row_id in
<foreach collection="bomRowIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and b.drawing_no in
<foreach collection="drawingNos" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<!-- &lt;!&ndash;物料编码搜索-子级&ndash;&gt;-->
<!-- <select id="getChildForDrawingNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomOriginalListVO">-->
<!-- select c.status ,c.current_version , c.created_by as bomCreatedBy-->
<!-- ,IFNULL(c.devise_name,a.devise_name) as devise_name,IFNULL(c.devise_user_code,a.devise_user_code) AS devise_user_code-->
<!-- ,IFNULL(c.dept_name,a.dept_name) AS dept_name,IFNULL(c.source,a.source) AS source,IFNULL(c.row_id,"0") as bomRowId-->
<!-- ,IFNULL(c.row_id,"0") as childBomRowId, b.*-->
<!-- from t_bom_new_original_parent a-->
<!-- join t_bom_new_original_child b on a.row_id =b.parent_row_id-->
<!-- left join t_bom_new_original_parent c on b.drawing_no=c.drawing_no and c.last_version_is=1-->
<!-- where a.last_version_is=1 and b.drawing_no in-->
<!-- <foreach collection="drawingNos" item="item" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </select>-->
<!--获取父级图号-->
<select id="getMaterialParent" resultType="java.lang.String">
select a.drawing_no from t_bom_new_original_parent a join t_bom_new_original_child b on a.row_id=b.parent_row_id
where a.last_version_is=1
and b.drawing_no in
<foreach collection="drawingNos" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
</mapper>

View File

@ -1,6 +1,7 @@
package nflg.product.common.dto;
import lombok.Data;
import lombok.experimental.Accessors;
//import org.omg.CORBA.PRIVATE_MEMBER;
import java.util.List;
@ -11,6 +12,7 @@ import java.util.List;
* @Date 2022/7/14 10:38
**/
@Data
@Accessors(chain = true)
public class LoginUserInfoDTO {
private Long rowId;