1、pbom-升级及未发布列表不显示问题

This commit is contained in:
大米 2024-04-18 17:28:13 +08:00
parent a762b57fe2
commit 8d26ce919a
5 changed files with 52 additions and 4 deletions

View File

@ -9,7 +9,10 @@ import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
import com.nflg.product.bomnew.pojo.vo.BomNewPbomWorkExcelVO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Set;
/**
* t_bom_new_pbom_parent 表数据库访问层
@ -53,4 +56,8 @@ public interface BomNewPbomParentMapper extends BaseMapper<BomNewPbomParentEntit
List<BomNewPbomWorkExcelVO> exportExcel(List<Long> bomRowIds);
void resetBomExist(Long rowId);
void updateWaitPublicRootState(@Param("materialNoList") Collection<String> materialNoList);
}

View File

@ -857,6 +857,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if (CollUtil.isNotEmpty(eBomToPBom.getPBomChildResult())) {
pBomChildService.saveOrUpdateBatch(eBomToPBom.getPBomChildResult());
}
//标记PBom未发布跟节点
Set<String> materialNos = bomTree.stream().map(u -> u.getMaterialNo()).collect(Collectors.toSet());
if(CollUtil.isNotEmpty(materialNos)){
pBomParentService.getBaseMapper().updateWaitPublicRootState(materialNos);
}
//标记跟节点
upRootMark(parent);
if (CollUtil.isNotEmpty(eBomToPBom.getVirtualPackageCompositionResult())) {

View File

@ -74,6 +74,12 @@ public class PBomUpgrade {
}
private void buildParent(BomNewPbomParentVO parentVO, boolean rootIs) {
//判断有无未发布版本-有则直接跳过
List<BomNewPbomParentEntity> waitPublishBomList = SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery().eq(BomNewPbomParentEntity::getMaterialNo, parentVO.getMaterialNo())
.eq(BomNewPbomParentEntity::getStatus, PBomStatusEnum.WAIT_PUBLISH.getValue()).list();
if(CollUtil.isNotEmpty(waitPublishBomList)){
return;
}
BomNewPbomParentEntity pbomParent = new BomNewPbomParentEntity();
BeanUtil.copyProperties(parentVO, pbomParent);
pbomParent.setRowId(IdWorker.getId());

View File

@ -306,13 +306,13 @@
<!--检查是否已发布数据的跟节点-->
<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
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 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
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 b.material_no=#{materialNo} and b.created_by=#{jobNo}
</select>

View File

@ -78,7 +78,7 @@
<!--获取工作列表-->
<select id="workDetailsListByPage" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
select * , row_id as bomRowId
from t_bom_new_pbom_parent where root_is=1 and status &lt; 4
from t_bom_new_pbom_parent where (root_is=1 or root_state=1 ) and status &lt; 4
<if test="userFac!=null and userFac!=''">
and fac_code=#{userFac}
</if>
@ -99,7 +99,18 @@
<!--获取已发布列表-->
<select id="releaseListByPage" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
select * , row_id as bomRowId
from t_bom_new_pbom_parent where status &gt;= 4 and last_version_is=1
from t_bom_new_pbom_parent a join
(select material_no, max(current_version) current_version from t_bom_new_pbom_parent where status &gt;= 4
<if test="query.materialNo!= null and query.materialNo!=''">
and material_no = #{query.materialNo}
</if>
<if test="query.drawingNo!= null and query.drawingNo!=''">
and drawing_no = #{query.drawingNo}
</if>
group by material_no
) b
on a.material_no=b.material_no and a.current_version=b.current_version
where status &gt;= 4
<if test=" (query.materialNo== null || query.materialNo=='' ) and (query.drawingNo== null || query.drawingNo=='')">
and root_is=1
</if>
@ -231,4 +242,23 @@
SET p.bom_exist = (IF(EXISTS (SELECT 1 FROM t_bom_new_pbom_child WHERE parent_row_id = p.row_id), 1, 0))
WHERE p.row_id = #{rowId};
</select>
<sql id="upRootStateWhr">
<foreach collection="materialNoList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</sql>
<!--更新待发布根节点状态-->
<update id="updateWaitPublicRootState">
update t_bom_new_pbom_parent a left join (
select b.material_no , a.fac_code from t_bom_new_pbom_parent a join t_bom_new_pbom_child b on a.row_id=b.parent_row_id and a.`status` &lt; 4 and a.last_version_is=1
and b.material_no in <include refid="upRootStateWhr"/>
) b on a.material_no=b.material_no and a.fac_code =b.fac_code
set a.root_state=1
where a.`status` &lt; 4 and last_version_is=1 and b.material_no is null
and a.material_no in <include refid="upRootStateWhr"/>
</update>
</mapper>