Merge branch 'refs/heads/feature/DM/nflg-bom' into feature/DM/nflg-bom-transition

# Conflicts:
#	nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewEbomParentMapper.xml
This commit is contained in:
曹鹏飞 2024-06-29 14:28:02 +08:00
commit 4217fa8b83
3 changed files with 123 additions and 106 deletions

View File

@ -2676,9 +2676,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

@ -713,17 +713,17 @@ public abstract class EBomToPbomBase {
parentBom.setCurrentVersion(VersionUtil.getNextVersionForSmallVersion(oldEBom.getCurrentVersion()));
parentBom.setHasChangeState(2);
delOldEBom.add(oldEBom.getRowId());
addEBomNew.add(parentBom.getRowId());
addEBomNew.add(parentBom.getBomRowId());
} else {
parentBom.setCurrentVersion(VersionUtil.getNextVersion(oldEBom.getCurrentVersion()));
parentBom.setHasChangeState(2);
delOldEBom.add(oldEBom.getRowId());
addEBomNew.add(parentBom.getRowId());
addEBomNew.add(parentBom.getBomRowId());
}
}
else {
addEBomNew.add(parentBom.getRowId());
addEBomNew.add(parentBom.getBomRowId());
}
//如子级都为F 项父级也不转

View File

@ -13,7 +13,7 @@
<result column="material_desc" property="materialDesc" jdbcType="VARCHAR"/>
<result column="material_texture" property="materialTexture" jdbcType="VARCHAR"/>
<result column="material_unit" property="materialUnit" jdbcType="VARCHAR"/>
<result column="material_original_unit" property="materialOriginalUnit" />
<result column="material_original_unit" property="materialOriginalUnit"/>
<result column="unit_weight" property="unitWeight" jdbcType="DECIMAL"/>
<result column="total_weight" property="totalWeight" jdbcType="DECIMAL"/>
<result column="current_version" property="currentVersion" jdbcType="VARCHAR"/>
@ -54,8 +54,7 @@
<result column="change_desc" property="changeDesc" jdbcType="VARCHAR"/>
<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" />
<result column="root_is_for_wait_review" property="rootIsForWaitReview" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
@ -90,13 +89,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>
@ -104,93 +106,89 @@
<!--物料编码搜索-父级-->
<select id="getParentForMaterialNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
SELECT status , created_by as bomCreatedBy , row_id as bomRowId, row_id as childBomRowId, a.*
SELECT status , created_by as bomCreatedBy , row_id as bomRowId, row_id as childBomRowId, a.*
FROM t_bom_new_ebom_parent a
join (select material_no,max(current_version) current_version from t_bom_new_ebom_parent where
<if test="dataType==1" >
join (select material_no,max(current_version) current_version from t_bom_new_ebom_parent where
<if test="dataType==1">
status = 4
</if>
<if test="dataType==0" >
<if test="technicianIs==0 ">
<if test="dataType==0">
<if test="technicianIs==0 ">
created_by=#{createdBy} and status in (1,3)
</if>
<if test="technicianIs==1 ">
<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
group by material_no ) b on a.material_no=b.material_no and a.current_version=b.current_version
</select>
<!-- &lt;!&ndash;物料编码搜索-父级&ndash;&gt;-->
<!-- <select id="getParentForMaterialNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">-->
<!-- SELECT if(status=4 and #{dataType}!=1, 99,status) status, 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-->
<!--&lt;!&ndash; <if test="dataType!=1 and !hasParentIs" >&ndash;&gt;-->
<!--&lt;!&ndash; and a.status &lt; 4&ndash;&gt;-->
<!--&lt;!&ndash; </if>&ndash;&gt;-->
<!-- <if test="dataType==1">-->
<!-- and a.status = 4-->
<!-- </if>-->
<!-- &lt;!&ndash;物料编码搜索-父级&ndash;&gt;-->
<!-- <select id="getParentForMaterialNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">-->
<!-- SELECT if(status=4 and #{dataType}!=1, 99,status) status, 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-->
<!--&lt;!&ndash; <if test="dataType!=1 and !hasParentIs" >&ndash;&gt;-->
<!--&lt;!&ndash; and a.status &lt; 4&ndash;&gt;-->
<!--&lt;!&ndash; </if>&ndash;&gt;-->
<!-- <if test="dataType==1">-->
<!-- and a.status = 4-->
<!-- </if>-->
<!-- and material_no in-->
<!-- <foreach collection="materialNoList" item="item" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </select>-->
<!-- and material_no in-->
<!-- <foreach collection="materialNoList" item="item" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- </select>-->
<!--物料编码搜索-子级-->
<!-- <select id="getChildForMaterialNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">-->
<!-- select if(#{dataType}!=1 and c.status=4,99,c.status) as status ,c.current_version , c.created_by as bomCreatedBy-->
<!-- ,c.devise_name,c.devise_user_code,c.dept_name ,-->
<!-- c.source, if(c.row_id is null,0,c.row_id) as bomRowId, c.row_id as childBomRowId, b.*-->
<!-- 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-->
<!-- <if test="dataType!=1">-->
<!-- and a.status &lt; 4-->
<!-- </if>-->
<!-- <if test="dataType==1">-->
<!-- and a.status = 4-->
<!-- </if>-->
<!-- and ( b.material_no in-->
<!-- <foreach collection="materialNoList" item="item" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- or b.material_no=#{materialNo})-->
<!-- </select>-->
<!-- <select id="getChildForMaterialNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">-->
<!-- select if(#{dataType}!=1 and c.status=4,99,c.status) as status ,c.current_version , c.created_by as bomCreatedBy-->
<!-- ,c.devise_name,c.devise_user_code,c.dept_name ,-->
<!-- c.source, if(c.row_id is null,0,c.row_id) as bomRowId, c.row_id as childBomRowId, b.*-->
<!-- 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-->
<!-- <if test="dataType!=1">-->
<!-- and a.status &lt; 4-->
<!-- </if>-->
<!-- <if test="dataType==1">-->
<!-- and a.status = 4-->
<!-- </if>-->
<!-- and ( b.material_no in-->
<!-- <foreach collection="materialNoList" item="item" open="(" separator="," close=")">-->
<!-- #{item}-->
<!-- </foreach>-->
<!-- or b.material_no=#{materialNo})-->
<!-- </select>-->
<!--物料编码搜索-子级-->
<select id="getChildForMaterialNoSeach" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
select a.status ,a.current_version , a.created_by as bomCreatedBy,
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_ebom_child b
left join t_bom_new_ebom_parent a on a.material_no=b.material_no and a.row_id in
,ifnull( a.row_id,0) as childBomRowId, b.* from t_bom_new_ebom_child b
left join t_bom_new_ebom_parent a on a.material_no=b.material_no and a.row_id in
<foreach collection="bomRowIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
where b.parent_row_id in
where b.parent_row_id in
<foreach collection="bomRowIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and b.material_no in
and b.material_no in
<foreach collection="materialNoList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<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
@ -260,40 +258,44 @@
<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 (
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` &lt; 4
) b
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` &lt; 4
) b
on a.material_no=b.material_no
set a.root_is=1,
a.user_root_is=1
where a.`status` &lt; 4 and b.row_id is null and a.last_version_is=1 ;
update t_bom_new_ebom_parent a left join (
select b.row_id, b.material_no,a.`status` , a.created_by 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` &lt; 4
) b
update t_bom_new_ebom_parent a left join (
select b.row_id, b.material_no,a.`status` , a.created_by 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` &lt; 4
) 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
set a.user_root_is=1
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 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
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
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 ;
where a.`status` in (1, 3) and last_version_is=1 and b.row_id is null;
</update>
@ -334,14 +336,18 @@
<!--检查是否已发布数据的跟节点-->
<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 b.material_no=#{materialNo}
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 b.material_no=#{materialNo} and b.created_by=#{jobNo}
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>
<!--ebom单层反查-->
@ -351,23 +357,26 @@
where true
<if test="bomVersionRowId!=null and bomVersionRowId>0">
and a.bom_version_row_id=#{bomVersionRowId}
and a.bom_version_row_id=#{bomVersionRowId}
</if>
<if test="startDate!=null and startDate!='' and endDate!=null and endDate!=''">
and b.convert_to_ebom_time &gt;= #{startDate} and b.expire_end_time &lt;=#{endDate}
</if>
and a.material_no =#{materialNo}
and a.material_no =#{materialNo}
</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">
select a.material_no from t_bom_new_ebom_parent a join t_bom_new_ebom_child b on a.row_id=b.parent_row_id
where a.last_version_is=1
select a.material_no from t_bom_new_ebom_parent a join t_bom_new_ebom_child b on a.row_id=b.parent_row_id
where a.last_version_is=1
<if test="createdBy!=null and createdBy!=''">
and a.created_by=#{createdBy}
and a.created_by=#{createdBy}
</if>
and b.material_no in
<foreach collection="materialNos" item="item" open="(" close=")" separator=",">
@ -377,7 +386,7 @@
<select id="resetBomExist">
UPDATE t_bom_new_ebom_parent p
SET p.bom_exist = (IF(EXISTS (SELECT 1 FROM t_bom_new_ebom_child WHERE parent_row_id = p.row_id), 1, 0))
SET p.bom_exist = (IF(EXISTS(SELECT 1 FROM t_bom_new_ebom_child WHERE parent_row_id = p.row_id), 1, 0))
WHERE p.row_id = #{rowId};
</select>
@ -392,14 +401,15 @@
<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>
</if>
<if test="job==1">
select * from t_bom_new_ebom_parent where (created_by=#{createdBy} or status=2) and last_version_is=1
and material_no in
select * from t_bom_new_ebom_parent where (created_by=#{createdBy} or status=2) and last_version_is=1
and material_no in
<foreach collection="materialNos" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
@ -574,29 +584,35 @@
<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>
)
<foreach collection="parentRowIds" item="parentRowId" open="(" separator="," close=")">
#{parentRowId}
</foreach>
</insert>
<delete id="delEBomHistory">
delete from t_bom_new_ebom_parent where row_id in
<foreach collection="parentRowIds" item="parentRowId" open="(" separator="," close=");">
#{parentRowId}
</foreach>
delete from t_bom_new_ebom_child where parent_row_id in
<foreach collection="parentRowIds" item="parentRowId" open="(" separator="," close=");">
#{parentRowId}
#{parentRowId}
</foreach>
delete from t_bom_new_ebom_child where parent_row_id in
<foreach collection="parentRowIds" item="parentRowId" open="(" separator="," close=");">
#{parentRowId}
</foreach>
</delete>
</mapper>