|
|
<?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, #{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 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> order by bh.eff_phase_in_date desc,bh.create_date desc </select>
<select id="queryBomComponentPart" resultType="com.spring.modules.quote.entity.QuoteDetailBom"> select site, #{buNo} as bu_no, part_no, eng_chg_level, bom_type, alternative_no, component_part, print_unit, qty_per_assembly, component_scrap, issue_type, shrinkage_factor, line_item_no, operation_no as operation_id, issue_to_loc, note_text, create_date, create_by, line_sequence, consumption_item, dbo.get_part_unitCost(site, component_part) as unit_price, dbo.get_part_unitCost(site, component_part) as actual_price, dbo.get_part_unitCost(site, 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 from plm_bom_component where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo} and 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>
</mapper>
|