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.
192 lines
7.7 KiB
192 lines
7.7 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.spring.modules.quote.mapper.QuoteDetailBomTreeMapper">
|
|
|
|
<select id="queryDetailBomTree" resultType="com.spring.modules.quote.entity.QuoteDetailBomTree">
|
|
select qdbt.id,
|
|
qdbt.quote_id,
|
|
qdbt.quote_detail_id,
|
|
qdbt.quote_detail_item_no,
|
|
qdbt.site,
|
|
qdbt.bu_no,
|
|
qdbt.quote_no,
|
|
qdbt.version_no,
|
|
qdbt.part_no,
|
|
qdbt.bom_type,
|
|
qdbt.eng_chg_level,
|
|
qdbt.alternative_no,
|
|
qdbt.parent_id,
|
|
qdbt.level,
|
|
qdbt.process_time,
|
|
qdbt.yield,
|
|
qdbt.bom_un_yield,
|
|
qdbt.bom_yield,
|
|
qdbt.bom_actual_un_yield,
|
|
qdbt.bom_actual_yield
|
|
from plm_quote_detail_bom_tree qdbt
|
|
where quote_detail_id = #{id}
|
|
</select>
|
|
|
|
<select id="queryPartBom" resultType="com.spring.modules.quote.entity.QuoteDetailBomTree">
|
|
select top 1 bd.site,
|
|
#{buNo} as bu_no,
|
|
bd.part_no,
|
|
bd.alternative_no,
|
|
bd.bom_type,
|
|
bd.eng_chg_level,
|
|
u.um_name,
|
|
p.status,
|
|
#{quoteId} as quote_id,
|
|
#{quoteNo} as quote_no,
|
|
#{id} as quote_detail_id,
|
|
#{itemNo} as quote_detail_item_no,
|
|
#{versionNo} as version_no
|
|
from plm_bom_detail bd
|
|
left join plm_bom_header bh
|
|
on bd.site = bh.site and bd.part_no = bh.part_no and bd.bom_type = bh.bom_type and bd.eng_chg_level = bh.eng_chg_level
|
|
left join part p on p.part_no = bd.part_no and p.site = bd.site
|
|
left join um u on u.um_id = p.um_id
|
|
where bd.site = #{site}
|
|
and bd.part_no = #{partNo}
|
|
<!-- and bd.status != 'Tentative'-->
|
|
<if test="engChgLevel == null">
|
|
and bh.eff_phase_out_date is null
|
|
</if>
|
|
<if test="engChgLevel != null">
|
|
and bh.eng_chg_level = #{engChgLevel}
|
|
</if>
|
|
<if test="alternativeNo != null and alternativeNo != ''">
|
|
and bd.alternative_no = #{alternativeNo}
|
|
</if>
|
|
<if test="alternativeNo == null or alternativeNo == ''">
|
|
and bd.alternative_no = '*'
|
|
</if>
|
|
<if test="bomType != null and bomType != ''">
|
|
and bd.bom_type = #{bomType}
|
|
</if>
|
|
order by bh.eff_phase_in_date desc,bh.create_date desc
|
|
</select>
|
|
|
|
<select id="queryBomComponentPart" resultType="com.spring.modules.quote.entity.QuoteDetailBom">
|
|
select pbc.site,
|
|
#{buNo} as bu_no,
|
|
pbc.part_no,
|
|
pbc.eng_chg_level,
|
|
pbc.bom_type,
|
|
pbc.alternative_no,
|
|
pbc.component_part,
|
|
pbc.print_unit,
|
|
pbc.qty_per_assembly,
|
|
pbc.component_scrap,
|
|
pbc.issue_type,
|
|
pbc.shrinkage_factor,
|
|
pbc.line_item_no,
|
|
pbc.operation_no as operation_id,
|
|
pbc.issue_to_loc,
|
|
pbc.note_text,
|
|
pbc.create_date,
|
|
pbc.create_by,
|
|
pbc.line_sequence,
|
|
pbc.consumption_item,
|
|
dbo.get_part_unitCost(pbc.site, pbc.component_part) as unit_price,
|
|
dbo.get_part_unitCost(pbc.site, pbc.component_part) as actual_price,
|
|
dbo.get_part_unitCost(pbc.site, pbc.component_part) as quote_price,
|
|
#{quoteId} as quote_id,
|
|
#{quoteNo} as quote_no,
|
|
#{quoteDetailId} as quote_detail_id,
|
|
#{quoteDetailItemNo} as quote_detail_item_no,
|
|
#{versionNo} as version_no,
|
|
p.status,
|
|
'N' as bomFlag
|
|
from plm_bom_component pbc
|
|
left join part p on p.site = pbc.site and p.part_no = pbc.component_part
|
|
where pbc.site = #{site}
|
|
and pbc.part_no = #{partNo}
|
|
and pbc.bom_type = #{bomType}
|
|
and pbc.eng_chg_level = #{engChgLevel}
|
|
and pbc.alternative_no = #{alternativeNo}
|
|
and pbc.qty_per_assembly >= 0
|
|
</select>
|
|
<select id="queryDetailBomVersion" resultType="com.spring.modules.quote.entity.QuoteDetailBomTree">
|
|
select bom.site,
|
|
bom.part_no,
|
|
bom.eng_chg_level,
|
|
bom.bom_type,
|
|
p.part_desc
|
|
from plm_bom_header bom
|
|
left join part p on bom.part_no = p.part_no and bom.site = p.site
|
|
where bom.site = #{site}
|
|
and bom.part_no = #{partNo}
|
|
|
|
<if test="bomType != null and bomType != ''">
|
|
and bom.bom_type = #{bomType}
|
|
</if>
|
|
order by bom_type, eng_chg_level
|
|
</select>
|
|
<select id="queryDetailBomAlternative" resultType="com.spring.modules.quote.entity.QuoteDetailBomTree">
|
|
select bom.site,
|
|
bom.part_no,
|
|
bom.eng_chg_level,
|
|
bom.bom_type,
|
|
bom.alternative_no,
|
|
p.part_desc
|
|
from plm_bom_detail bom
|
|
left join part p on bom.part_no = p.part_no and bom.site = p.site
|
|
where bom.site = #{site}
|
|
and bom.part_no = #{partNo}
|
|
<!-- and bom.status != 'Tentative'-->
|
|
<if test="bomType != null and bomType != ''">
|
|
and bom.bom_type = #{bomType}
|
|
</if>
|
|
and bom.eng_chg_level = #{engChgLevel}
|
|
order by bom.alternative_no
|
|
</select>
|
|
|
|
<select id="queryPartBomRouting" resultType="com.spring.modules.quote.entity.QuoteDetailRouting">
|
|
select top 1 rd.site,
|
|
#{buNo} as bu_no,
|
|
rd.routing_revision,
|
|
rd.routing_type,
|
|
rd.part_no,
|
|
rd.alternative_no,
|
|
#{quoteId} as quote_id,
|
|
#{quoteNo} as quote_no,
|
|
#{id} as quote_detail_id,
|
|
#{itemNo} as quote_detail_item_no,
|
|
#{versionNo} as version_no
|
|
from plm_routing_detail rd
|
|
left join plm_routing_header rh
|
|
on rd.site = rh.site and rd.part_no = rh.part_no and
|
|
rd.routing_type = rh.routing_type and
|
|
rd.routing_revision = rh.routing_revision
|
|
where rd.site = #{site}
|
|
and rd.part_no = #{partNo}
|
|
<if test="engChgLevel == null">
|
|
and rh.phase_out_date is null
|
|
</if>
|
|
<if test="engChgLevel != null">
|
|
and rh.routing_revision = #{engChgLevel}
|
|
</if>
|
|
<if test="alternativeNo != null and alternativeNo != ''">
|
|
and rd.alternative_no = #{alternativeNo}
|
|
</if>
|
|
<if test="alternativeNo == null or alternativeNo == ''">
|
|
and rd.alternative_no = '*'
|
|
</if>
|
|
order by rh.phase_in_date desc, rh.create_date desc
|
|
</select>
|
|
|
|
<select id="getPartCost" resultType="java.math.BigDecimal">
|
|
select isnull(dbo.get_part_unitCost(#{site}, #{partNo}),0)
|
|
</select>
|
|
|
|
<select id="queryPart" resultType="com.spring.modules.part.entity.PartInformationEntity">
|
|
select top 1 site,
|
|
part_no,
|
|
status,
|
|
ifs_part_no
|
|
from part p
|
|
where p.site = #{site}
|
|
and p.plm_part_no = #{partNo}
|
|
</select>
|
|
</mapper>
|