1、变更影响及同步formal表优化

This commit is contained in:
大米 2024-06-29 12:11:23 +08:00
parent cce1aef1d7
commit 51febf0ef7
2 changed files with 123 additions and 106 deletions

View File

@ -2530,9 +2530,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
if(CollUtil.isNotEmpty(addRowIds)) {
this.getBaseMapper().insertEBomFormalParent(addRowIds);
this.getBaseMapper().insertEBomFormalChild(addRowIds);
}
if(CollUtil.isNotEmpty(delRowIds)){
//转移后删除
this.getBaseMapper().delEBomHistory(delRowIds);
}
}
}

View File

@ -55,7 +55,6 @@
<result column="notice_nums" property="noticeNums" jdbcType="VARCHAR"/>
<result column="modify_time" property="modifyTime" jdbcType="TIMESTAMP"/>
<result column="root_is_for_wait_review" property="rootIsForWaitReview" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
@ -87,13 +86,16 @@
<!--Ebom工作列表-->
<select id="getEBomListPage" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
<if test="job==0">
select * ,row_id as bomRowId from t_bom_new_ebom_parent where created_by=#{createdBy} and (user_root_is=1 or root_is_for_wait_review=1) and
select * ,row_id as bomRowId from t_bom_new_ebom_parent where created_by=#{createdBy} and (user_root_is=1 or
root_is_for_wait_review=1) and
(status=1 or status=3)
<include refid="whr"/>
order by created_time desc
</if>
<if test="job==1">
select * ,row_id as bomRowId from t_bom_new_ebom_parent where ((((user_root_is=1 and created_by=#{createdBy}) or root_is=1) and status=2) or (created_by=#{createdBy} and user_root_is=1 and (status=1 or status=3)))
select * ,row_id as bomRowId from t_bom_new_ebom_parent where ((((user_root_is=1 and
created_by=#{createdBy}) or root_is=1) and status=2) or (created_by=#{createdBy} and user_root_is=1 and
(status=1 or status=3)))
<include refid="whr"/>
order by created_time desc
</if>
@ -114,14 +116,12 @@
<if test="technicianIs==1 ">
(created_by=#{createdBy} or status=2 )
</if>
</if>
and material_no in
<foreach collection="materialNoList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
group by material_no ) b on a.material_no=b.material_no and a.current_version=b.current_version
</select>
<!-- &lt;!&ndash;物料编码搜索-父级&ndash;&gt;-->
@ -183,11 +183,9 @@
<if test="createdBy!=null and createdBy!=''">
and b.created_by=#{createdBy}
</if>
</select>
<!--BOM-正式工作表-->
<select id="formalWorksheet" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
select * , row_id as bomRowId
@ -263,8 +261,10 @@
<update id="updateRootState">
update t_bom_new_ebom_parent
set root_is=0, user_root_is=0
where last_version_is = 1 AND `status` &lt; 4;
set root_is=0,
user_root_is=0
where last_version_is = 1
AND `status` &lt; 4;
update t_bom_new_ebom_parent a left join (
@ -282,18 +282,20 @@
) b
on a.material_no=b.material_no and a.created_by=b.created_by
set a.user_root_is=1
where a.`status` &lt; 4
where a.`status`
&lt; 4
and b.row_id is null
and a.last_version_is = 1
AND a.virtual_package_is = 0;
</update>
<!--更新-待复核根节点-->
<update id="updateRootForWaitReview">
update t_bom_new_ebom_parent set root_is_for_wait_review=0 ;
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` in (1,3) and last_version_is=1
) b on a.material_no=b.material_no
) 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;
</update>
@ -325,13 +327,17 @@
<!--检查是否已发布数据的跟节点-->
<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
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
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>
@ -351,7 +357,10 @@
</select>
<select id="getCountForWaitReviewByMaterialNo" resultType="java.lang.Integer">
select COUNT(1) from t_bom_new_ebom_child where material_no=#{materialNo} and edit_status=1
select COUNT(1)
from t_bom_new_ebom_child
where material_no = #{materialNo}
and edit_status = 1
</select>
<select id="getMaterialParent" resultType="java.lang.String">
@ -380,7 +389,8 @@
<select id="getEBomParentByMaterialNos" resultType="com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity">
<if test="job==0">
select * from t_bom_new_ebom_parent where created_by=#{createdBy} and last_version_is=1 and status in (1 ,3) and material_no in
select * from t_bom_new_ebom_parent where created_by=#{createdBy} and last_version_is=1 and status in (1 ,3)
and material_no in
<foreach collection="materialNos" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
@ -533,18 +543,24 @@
<foreach collection="parentRowIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</insert>
<insert id="insertEBomFormalChild">
INSERT INTO `t_bom_new_ebom_child_formal` (`row_id`, `parent_row_id`, `identity_no`, `order_number`, `drawing_no`, `material_no`, `material_name`, `material_desc`, `material_texture`, `material_unit`, `material_category_code`, `unit_weight`, `num`, `total_weight`, `project_type`, `project_type_input_type`, `created_by`, `virtual_part_is`, `created_time`, `modify_time`, `edit_status`, `exception_status`, `source`, `source_row_id`, `remark`, `virtual_part_type`, `virtual_part_root_material_no`, `bom_version_row_id`)
select `row_id`, `parent_row_id`, `identity_no`, `order_number`, `drawing_no`, `material_no`, `material_name`, `material_desc`, `material_texture`, `material_unit`, `material_category_code`, `unit_weight`, `num`, `total_weight`, `project_type`, `project_type_input_type`, `created_by`, `virtual_part_is`, `created_time`, `modify_time`, `edit_status`, `exception_status`, `source`, `source_row_id`, `remark`, `virtual_part_type`, `virtual_part_root_material_no`, `bom_version_row_id`
INSERT INTO `t_bom_new_ebom_child_formal` (`row_id`, `parent_row_id`, `identity_no`, `order_number`,
`drawing_no`, `material_no`, `material_name`, `material_desc`, `material_texture`, `material_unit`,
`material_category_code`, `unit_weight`, `num`, `total_weight`, `project_type`, `project_type_input_type`,
`created_by`, `virtual_part_is`, `created_time`, `modify_time`, `edit_status`, `exception_status`, `source`,
`source_row_id`, `remark`, `virtual_part_type`, `virtual_part_root_material_no`, `bom_version_row_id`)
select `row_id`, `parent_row_id`, `identity_no`, `order_number`, `drawing_no`, `material_no`, `material_name`,
`material_desc`, `material_texture`, `material_unit`, `material_category_code`, `unit_weight`, `num`,
`total_weight`, `project_type`, `project_type_input_type`, `created_by`, `virtual_part_is`, `created_time`,
`modify_time`, `edit_status`, `exception_status`, `source`, `source_row_id`, `remark`, `virtual_part_type`,
`virtual_part_root_material_no`, `bom_version_row_id`
from t_bom_new_ebom_child a
where parent_row_id in
<foreach collection="parentRowIds" item="parentRowId" open="(" separator="," close=")">
#{parentRowId}
</foreach>
)
</insert>
<delete id="delEBomHistory">