You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

103 lines
4.4 KiB

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xujie.sys.modules.part.mapper.BomSearch3Mapper">
<!-- Bom列表 -->
<select id="bomSearchHeader" parameterType="com.xujie.sys.modules.part.vo.BomHeaderVo" resultType="com.xujie.sys.modules.part.vo.BomHeaderVo">
SELECT
a.site,
a.bu_no,
a.part_no,
b.part_desc,
a.eng_chg_level,
a.bom_type,
a.note_text,
a.eff_phase_in_date,
a.eff_phase_out_date,
a.eng_revision,
a.type_flag,
a.net_weight,
a.create_date,
a.create_by,
dbo.getOperatorDesc(a.site, a.create_by) as createByDesc,
a.update_date,
a.update_by,
dbo.getOperatorDesc(a.site, a.update_by) as updateByDesc,
b.umid2 as printUnit,
c.UMName as printUnitName,
b.part_type2,
case
when part_type2 = 'Manufactured' then '成品'
when part_type2 = 'Manufactured Recipe' then '半成品'
when part_type2 = 'Purchased (raw)' then '原材料' end as partType2Desc
FROM plm_bom_header as a
left join part as b on a.site = b.site and a.bu_no = b.sourceBu and a.part_no = b.part_no
left join UM as c on a.site = c.site and b.umid2 = c.UMID
<where>
a.site in (select site from eam_access_site where username = #{query.userName})
and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
<if test="query.buNo != null and query.buNo != ''">
AND a.bu_no = #{query.buNo}
</if>
<if test = "query.partNo != null and query.partNo != ''">
AND a.part_no like '%' + #{query.partNo} + '%'
</if>
<if test = "query.partDesc != null and query.partDesc != ''">
AND b.part_desc like '%' + #{query.partDesc} + '%'
</if>
<if test = "query.partType2 != null and query.partType2 != ''">
AND b.part_type2 = #{query.partType2}
</if>
<if test = "query.engChgLevel != null and query.engChgLevel != ''">
AND a.eng_chg_level = #{query.engChgLevel}
</if>
</where>
</select>
<!-- 查bom明细 -->
<select id="getAlternativeTree" parameterType="com.xujie.sys.modules.part.vo.BomHeaderVo" resultType="com.xujie.sys.modules.part.entity.BomComponentEntity">
SELECT
a.site,
a.bu_no,
a.part_no,
a.bom_type,
a.eng_chg_level,
a.alternative_no,
a.component_part,
(a.site + '-' + a.component_part + '-' + a.bom_type + '-' + convert(varchar, a.eng_chg_level)) as id,
(a.site + '-' + a.part_no + '-' + a.bom_type + '-' + convert(varchar, c.eng_chg_level)) as parentId
FROM plm_bom_component as a
left join plm_bom_header as c on a.site = c.site and a.bu_no = c.bu_no and a.component_part = c.part_no and a.bom_type = c.bom_type
where a.site = #{site}
</select>
<!-- 查bom子明细 -->
<select id="getComponentPartList" parameterType="com.xujie.sys.modules.part.vo.BomComponentVo" resultType="com.xujie.sys.modules.part.vo.BomComponentVo">
SELECT
a.site,
a.bu_no,
a.part_no,
a.bom_type,
a.eng_chg_level,
a.alternative_no,
a.component_part,
b.part_desc as componentPartDesc,
a.print_unit,
dbo.qc_get_um_name(a.site, a.print_unit) as printUnitName,
a.qty_per_assembly,
a.component_scrap,
a.issue_type,
a.shrinkage_factor,
a.line_item_no,
a.operation_id,
a.issue_to_loc,
dbo.get_location_name(a.site, a.bu_no, a.issue_to_loc) as issueToLocName,
a.note_text,
a.line_sequence,
a.consumption_item
FROM plm_bom_component as a
left join part as b on a.site = b.site and a.bu_no = b.sourceBu and a.component_part = b.part_no
where a.site = #{site} and a.part_no = #{componentPart} and a.bom_type = #{bomType} and a.eng_chg_level = #{engChgLevel} and a.alternative_no = '*'
order by a.line_sequence
</select>
</mapper>