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.
 
 
 
 
 
 

166 lines
5.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.quotation.mapper.QuoteDetailMapper">
<select id="selectQuoteDetailList" resultType="com.spring.modules.quotation.vo.QuoteDetailVo">
select quotation_detail_id,
quotation_header_id,
site,
product_no,
dbo.get_part_name(site, product_no) as product_desc,
internal_inquiry_no,
quotation_detail_quantity,
quotation_detail_count,
quotation_detail_status,
compute_part_cost,
compute_labour_cost,
compute_fabricate_cost,
compute_tool_cost,
adjust_part_cost,
adjust_labour_cost,
adjust_fabricate_cost,
adjust_tool_cost,
detail_other_cost,
detail_manage_cost,
detail_total_cost,
detail_profit_rate,
detail_profit_amount,
system_compute_amount,
system_compute_price,
final_untaxed_price,
final_taxed_price,
remark,
compute_machine_cost,
adjust_machine_cost,
tax_rate,
active
from quotation_detail qd
<where>
and active = 'Y'
<if test="quotationHeaderId != null">
and quotation_header_id = #{quotationHeaderId}
</if>
</where>
order by quotation_detail_id
</select>
<select id="queryQuoteDetailByInquiryNo" resultType="com.spring.modules.quotation.vo.QuoteDetailVo">
select qh.quotation_date,
qh.quotation_no + '-' + qh.version_code as quotation_no,
qd.quotation_detail_id,
qd.quotation_header_id,
qd.site,
qd.product_no,
qd.product_desc,
qd.internal_inquiry_no,
qd.quotation_detail_quantity,
qd.quotation_detail_count,
qd.quotation_detail_status,
qd.compute_part_cost,
qd.compute_labour_cost,
qd.compute_fabricate_cost,
qd.compute_tool_cost,
qd.adjust_part_cost,
qd.adjust_labour_cost,
qd.adjust_fabricate_cost,
qd.adjust_tool_cost,
qd.detail_other_cost,
qd.detail_manage_cost,
qd.detail_total_cost,
qd.detail_profit_rate,
qd.detail_profit_amount,
qd.system_compute_amount,
qd.system_compute_price,
qd.final_untaxed_price,
qd.final_taxed_price,
qd.remark,
qd.compute_machine_cost,
qd.adjust_machine_cost,
qd.tax_rate,
qd.active
from quotation_header qh
left join quotation_detail qd on qh.quotation_header_id = qd.quotation_header_id
where qh.site = #{site}
and qh.internal_inquiry_no = #{internalInquiryNo}
and qd.active = 'Y'
</select>
<select id="queryQuoteDetailByPartNo" resultType="com.spring.modules.quotation.vo.QuoteDetailVo">
select qh.quotation_date,
qh.quotation_no + '-' + qh.version_code as quotation_no,
qd.quotation_detail_id,
qd.quotation_header_id,
qd.site,
qd.product_no,
qd.product_no as partNo,
qd.product_desc,
qd.internal_inquiry_no,
qd.quotation_detail_quantity,
qd.quotation_detail_count,
qd.quotation_detail_status,
qd.compute_part_cost,
qd.compute_labour_cost,
qd.compute_fabricate_cost,
qd.compute_tool_cost,
qd.adjust_part_cost,
qd.adjust_labour_cost,
qd.adjust_fabricate_cost,
qd.adjust_tool_cost,
qd.detail_other_cost,
qd.detail_manage_cost,
qd.detail_total_cost,
qd.detail_profit_rate,
qd.detail_profit_amount,
qd.system_compute_amount,
qd.system_compute_price,
qd.final_untaxed_price,
qd.final_taxed_price,
qd.remark,
qd.compute_machine_cost,
qd.adjust_machine_cost,
qd.tax_rate,
qd.active,
qh.project_id
from quotation_header qh
left join quotation_detail qd on qh.quotation_header_id = qd.quotation_header_id and qd.product_no = #{partNo}
where qh.site = #{site}
and qh.project_id = #{projectId}
and qd.active = 'Y'
</select>
<select id="queryQuoteDetailBom" resultType="com.spring.modules.quotation.entity.QuoteBomHeader">
select site,
quote_detail_id,
part_no,
bom_type,
version,
alternative_no,
test_part_no,
id,
parent_id
from quote_bom_header
where quote_detail_id = #{quotationDetailId}
and parent_id = 0
</select>
<select id="queryQuoteDetailRouting" resultType="com.spring.modules.quotation.entity.QuoteRoutingHeader">
select site,
quote_detail_id,
part_no,
routing_type,
version,
alternative_no,
test_part_no,
id,
parent_id
from quote_routing_header
where quote_detail_id = #{quotationDetailId}
and parent_id = 0
</select>
<update id="updateInquiry">
update plm_quotation_information
set quotation_amount = #{systemComputePrice} where quotation_no = #{internalInquiryNo} and site = #{site}
</update>
</mapper>