|
|
<?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.quotation.mapper.QuoteBomHeaderMapper"> <insert id="saveBatchQuoteDetailBom"> insert into quote_bom_detail (site, quote_detail_id, part_no, version, bom_type, alternative_no, component_part, print_unit, qty_per_assembly, component_scrap, issue_type, shrinkage_factor, line_item_no, operation_id, issue_to_loc, note_text, line_sequence) values <foreach collection="list" item="item" separator=","> (#{item.site}, #{item.quoteDetailId}, #{item.partNo}, #{item.version}, #{item.bomType}, #{item.alternativeNo}, #{item.componentPart}, #{item.printUnit}, #{item.qtyPerAssembly}, #{item.componentScrap}, #{item.issueType}, #{item.shrinkageFactor}, #{item.lineItemNo}, #{item.operationId}, #{item.issueToLoc}, #{item.noteText}, #{item.lineSequence}) </foreach> </insert>
<select id="getProjectPart" resultType="com.spring.modules.project.entity.PlmProjectPart"> select top 1 final_part_no from view_Project_Part where site = #{site} and test_part_no = #{testPartNo} </select> <select id="getBomComponentEntityList" resultType="com.spring.modules.quotation.entity.QuoteBomDetail"> SELECT site, part_no, eng_chg_level as version, bom_type, alternative_no, component_part, print_unit, qty_per_assembly, component_scrap, issue_type, shrinkage_factor, line_item_no, operation_id, issue_to_loc, note_text, line_sequence FROM plm_bom_component where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{version} and alternative_no = #{alternativeNo} and qty_per_assembly > 0 order by line_sequence </select>
<select id="searchQuoteBomDetailList" resultType="com.spring.modules.quotation.vo.QuoteBomDetailVo"> SELECT a.id, a.header_id, a.site, a.part_no, a.bom_type, a.version, a.alternative_no, a.component_part, p.part_desc as componentPartDesc, dbo.get_part_unitCost(a.site, a.part_no) as unitCost, a.print_unit, dbo.get_um_name(a.print_unit) as printUnitName, a.qty_per_assembly, a.component_scrap, a.issue_type, case when a.issue_type = 'A' then '领退料倒冲' when a.issue_type = 'B' then '工单倒冲' when a.issue_type = 'C' then '生产订单倒冲' when a.issue_type = 'D' then '投料倒冲' when a.issue_type = 'E' then '批次倒冲' when a.issue_type = 'F' then '销售订单倒冲' when a.issue_type = 'G' then '项目倒冲' else '' end as issueTypeName, a.shrinkage_factor, a.line_item_no, a.operation_id, a.issue_to_loc, dbo.get_location_name(a.site, a.issue_to_loc) as issueToLocName, a.note_text, a.line_sequence FROM quote_bom_detail a, part p where a.site = p.site and a.component_part = p.part_no and a.header_id in ( <foreach collection="list" item="item" separator=","> #{item.id} </foreach> ) order by a.header_id, a.line_sequence </select>
<select id="searchQuoteBomDetailAllList" resultType="com.spring.modules.quotation.vo.QuoteBomDetailVo"> SELECT a.site, a.part_no, a.bom_type, a.version, a.alternative_no, a.component_part, p.part_desc as componentPartDesc, dbo.get_part_unitCost(a.site, p.part_no) as unitCost, a.print_unit, dbo.get_um_name(a.print_unit) as printUnitName, a.qty_per_assembly, a.component_scrap, a.issue_type, case when a.issue_type = 'A' then '领退料倒冲' when a.issue_type = 'B' then '工单倒冲' when a.issue_type = 'C' then '生产订单倒冲' when a.issue_type = 'D' then '投料倒冲' when a.issue_type = 'E' then '批次倒冲' when a.issue_type = 'F' then '销售订单倒冲' when a.issue_type = 'G' then '项目倒冲' else '' end as issueTypeName, a.shrinkage_factor, a.line_item_no, a.operation_id, a.issue_to_loc, dbo.get_location_name(a.site, a.issue_to_loc) as issueToLocName, a.note_text, a.line_sequence FROM quote_bom_detail a, part p where a.site = #{site} and a.quote_detail_id = #{quoteDetailId} and a.header_id = #{id} and a.site = p.site and a.component_part = p.part_no order by a.line_sequence </select>
<select id="selectBomHeader" resultType="com.spring.modules.part.entity.BomHeaderEntity"> select top 1 site, part_no, eng_chg_level, bom_type, note_text, eff_phase_in_date, eff_phase_out_date, eng_revision, row_version, row_key, type_flag, net_weight, create_date, create_by, update_date, update_by, official_flag from plm_bom_header where site = #{site} and part_no = #{partNo} and eff_phase_out_date is null order by eff_phase_in_date </select>
<select id="searchQuoteBOMVersion" resultType="com.spring.modules.quotation.vo.QuoteBomDetailVo"> SELECT a.site, a.part_no, a.eng_chg_level as version, a.bom_type, p.part_desc as componentPartDesc, a.eff_phase_in_date, a.eff_phase_out_date FROM plm_bom_header a, part p where a.site = #{site} <if test="partNo != null and partNo != ''"> and a.part_no = #{partNo} </if> <if test="testPartNo != null and testPartNo != '' and partNo == null or partNo == ''"> and a.part_no = #{testPartNo} </if> and a.site = p.site and a.part_no = p.part_no order by a.eng_chg_level </select>
<select id="searchQuoteBOMAlternativeNo" resultType="com.spring.modules.quotation.vo.QuoteBomDetailVo"> SELECT a.site, a.part_no, a.eng_chg_level as version, a.bom_type, p.part_desc as componentPartDesc, a.alternative_no, a.alternative_description, a.status FROM plm_bom_detail a, part p where a.site = #{site} <if test="partNo != null and partNo != ''"> and a.part_no = #{partNo} </if> <if test="version != null"> and a.eng_chg_level = #{version} </if> <if test="bomType != null and bomType != ''"> and a.bom_type = #{bomType} </if> and a.site = p.site and a.part_no = p.part_no order by a.eng_chg_level </select>
<select id="selectBomHeaderList" resultType="com.spring.modules.quotation.entity.QuoteBomHeader"> select site, part_no, eng_chg_level as version, bom_type from plm_bom_header where site = #{site} and part_no in ( <foreach item="item" collection="list" separator=","> #{item} </foreach> ) and eff_phase_out_date is null order by eff_phase_in_date </select>
<select id="selectBomHeaderData" resultType="com.spring.modules.quotation.entity.QuoteBomHeader"> select top 1 site, part_no, eng_chg_level as version, bom_type from plm_bom_header where site = #{site} and part_no = #{partNo} and eff_phase_out_date is null order by case when bom_type='Manufacturing' then 1 when bom_type='Purchase' then 2 when bom_type='Repair' then 3 end </select>
<select id="selectBomHeaderByPartNoAndVersionAndAlternative" resultType="com.spring.modules.quotation.vo.QuoteDetailBomHeaderVo"> select top 1 b.site, b.part_no, b.alternative_no, b.eng_chg_level as version, b.bom_type, b.part_no as test_part_no from plm_bom_detail b left join plm_bom_header a on a.site = b.site and a.part_no = b.part_no and a.bom_type = b.bom_type and a.eng_chg_level = b.eng_chg_level <where> <if test="site != null and site != ''"> and b.site = #{site} </if> <if test="partNo != null and partNo != ''"> and b.part_no = #{partNo} </if> <if test="version != null"> and b.eng_chg_level = #{version} </if> <if test="version == null"> and a.eff_phase_out_date is null </if> <if test="alternativeNo != null and alternativeNo != ''"> and b.alternative_no = #{alternativeNo} </if> </where> order by a.eff_phase_in_date </select>
<select id="selectBomDetailByPartNoAndVersionAndAlternative" resultType="com.spring.modules.quotation.vo.QuoteDetailBomHeaderVo"> select site, part_no, eng_chg_level as version, bom_type, alternative_no, component_part as part_no, component_part as test_part_no, from plm_bom_component <where> <if test="site != null and site != ''"> and site = #{site} </if> <if test="partNo != null and partNo != ''"> and part_no = #{partNo} </if> <if test="version != null"> and eng_chg_level = #{version} </if> <if test="bomType != null and bomType != ''"> and bom_type = #{bomType} </if> <if test="alternativeNo != null and alternativeNo != ''"> and alternative_no = #{alternativeNo} </if> </where> </select></mapper>
|