dbo.qc_get_um_name(a.site, b.umid2) as printUnitName,
dbo.qc_get_um_name(a.site, b.umid2) as printUnitName,
isnull(c.yield_rate, 100) as yieldRate
isnull(dbo.get_yield_rate(a.site, a.bu_no, b.product_group_id2, '2'), 100) as yieldRate
FROM plm_bom_header as a
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 part as b on a.site = b.site and a.bu_no = b.sourceBu and a.part_no = b.part_no
left join part_product_group as c on b.site = c.site and b.sourceBu = c.bu_no and b.product_group_id2 = c.product_group_id
left join plm_bom_detail as d on a.site = d.site and a.bu_no = d.bu_no and a.part_no = d.part_no and a.eng_chg_level = d.eng_chg_level and a.bom_type = d.bom_type
<where>
<where>
a.site in (select site from eam_access_site where username = #{query.userName})
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}))
and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
and c.type = '2'
and d.alternative_no = '*'
<iftest="query.buNo != null and query.buNo != ''">
<iftest="query.buNo != null and query.buNo != ''">
AND a.bu_no = #{query.buNo}
AND a.bu_no = #{query.buNo}
</if>
</if>
@ -41,12 +41,15 @@
<iftest ="query.partDesc != null and query.partDesc != ''">
<iftest ="query.partDesc != null and query.partDesc != ''">
AND dbo.qc_get_part_desc(a.site, a.bu_no, a.part_no) like '%' + #{query.partDesc} + '%'
AND dbo.qc_get_part_desc(a.site, a.bu_no, a.part_no) like '%' + #{query.partDesc} + '%'
</if>
</if>
<iftest ="query.bomType != null and query.bomType != ''">
<iftest ="query.bomType != null and query.bomType != ''">
AND a.bom_type = #{query.bomType}
AND a.bom_type = #{query.bomType}
</if>
</if>
<iftest ="query.engChgLevel != null and query.engChgLevel != ''">
<iftest ="query.engChgLevel != null and query.engChgLevel != ''">
AND a.eng_chg_level = #{query.engChgLevel}
AND a.eng_chg_level = #{query.engChgLevel}
</if>
</if>
<iftest ="query.status != null and query.status != ''">
AND d.status = #{query.status}
</if>
</where>
</where>
</select>
</select>
@ -64,9 +67,8 @@
case when a.part_type2 = 'Manufactured' then '成品' when a.part_type2 = 'Manufactured Recipe' then '半成品' when a.part_type2 = 'Purchased (raw)' then '原材料' end as partType2Desc,
case when a.part_type2 = 'Manufactured' then '成品' when a.part_type2 = 'Manufactured Recipe' then '半成品' when a.part_type2 = 'Purchased (raw)' then '原材料' end as partType2Desc,
a.FamilyID,
a.FamilyID,
dbo.get_family_name(a.site, a.sourceBu, a.FamilyID) as familyName,
dbo.get_family_name(a.site, a.sourceBu, a.FamilyID) as familyName,
isnull(b.yield_rate, 100) as yieldRate
isnull(dbo.get_yield_rate(a.site, a.sourceBu, a.product_group_id2, '2'), 100) as yieldRate
FROM part as a
FROM part as a
left join part_product_group as b on a.site = b.site and a.sourceBu = b.bu_no and a.product_group_id2 = b.product_group_id and b.type = '2'
<where>
<where>
a.site = #{query.site} and a.sourceBu = #{query.buNo} and a.active = 'Y'
a.site = #{query.site} and a.sourceBu = #{query.buNo} and a.active = 'Y'
and (a.part_type2 <![CDATA[<>]]> 'Purchased (raw)' or a.part_type2 is null)
and (a.part_type2 <![CDATA[<>]]> 'Purchased (raw)' or a.part_type2 is null)
@ -93,9 +95,8 @@
case when a.part_type2 = 'Manufactured' then '成品' when a.part_type2 = 'Manufactured Recipe' then '半成品' when a.part_type2 = 'Purchased (raw)' then '原材料' end as partType2Desc,
case when a.part_type2 = 'Manufactured' then '成品' when a.part_type2 = 'Manufactured Recipe' then '半成品' when a.part_type2 = 'Purchased (raw)' then '原材料' end as partType2Desc,
a.FamilyID,
a.FamilyID,
dbo.get_family_name(a.site, a.sourceBu, a.FamilyID) as familyName,
dbo.get_family_name(a.site, a.sourceBu, a.FamilyID) as familyName,
isnull(b.yield_rate, 100) as yieldRate
isnull(dbo.get_yield_rate(a.site, a.sourceBu, a.product_group_id2, '2'), 100) as yieldRate
FROM part as a
FROM part as a
left join part_product_group as b on a.site = b.site and a.sourceBu = b.bu_no and a.product_group_id2 = b.product_group_id and b.type = '2'
<where>
<where>
a.site = #{query.site} and a.sourceBu = #{query.buNo} and a.active = 'Y'
a.site = #{query.site} and a.sourceBu = #{query.buNo} and a.active = 'Y'
and (a.part_type2 <![CDATA[<>]]> 'Purchased (raw)' or a.part_type2 is null)
and (a.part_type2 <![CDATA[<>]]> 'Purchased (raw)' or a.part_type2 is null)
@ -309,11 +310,10 @@
a.type_flag,
a.type_flag,
a.net_weight,
a.net_weight,
a.note_text,
a.note_text,
isnull(c.yield_rate, 0) as yieldRate
isnull(dbo.get_yield_rate(b.site, b.sourceBu, b.product_group_id2, '2'), 100) as yieldRate
FROM plm_bom_header as a
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 part as b on a.site = b.site and a.bu_no = b.sourceBu and a.part_no = b.part_no
left join part_product_group as c on b.site = c.site and b.sourceBu = c.bu_no and b.product_group_id2 = c.product_group_id
where a.site = #{site} and a.bu_no = #{buNo} and a.part_no = #{partNo} and a.bom_type = #{bomType} and a.eng_chg_level = #{engChgLevel} and c.type = '2'
where a.site = #{site} and a.bu_no = #{buNo} and a.part_no = #{partNo} and a.bom_type = #{bomType} and a.eng_chg_level = #{engChgLevel}
</select>
</select>
<!-- bom明细查重 -->
<!-- bom明细查重 -->
@ -667,18 +667,16 @@
a.update_by,
a.update_by,
b.umid2 as printUnit,
b.umid2 as printUnit,
dbo.qc_get_um_name(a.site, b.umid2) as printUnitName,
dbo.qc_get_um_name(a.site, b.umid2) as printUnitName,
isnull(c.yield_rate, 100) as yieldRate,
isnull(dbo.get_yield_rate(b.site, b.sourceBu, b.product_group_id2, '2'), 100) as yieldRate
#{alternativeNo} as alternativeNo
#{alternativeNo} as alternativeNo
FROM plm_bom_header as a
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 part as b on a.site = b.site and a.bu_no = b.sourceBu and a.part_no = b.part_no
left join part_product_group as c on b.site = c.site and b.sourceBu = c.bu_no and b.product_group_id2 = c.product_group_id