|
|
@ -137,6 +137,166 @@ |
|
|
</where> |
|
|
</where> |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 报价单查询条件片段(供 Count 和 Data 两个查询共用) --> |
|
|
|
|
|
<sql id="quotePageWhereConditions"> |
|
|
|
|
|
<if test="params.id != null"> |
|
|
|
|
|
and q.id = #{params.id} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="params.site != null and params.site != ''"> |
|
|
|
|
|
and q.site = #{params.site} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="params.quoteNo != null and params.quoteNo != ''"> |
|
|
|
|
|
and q.quote_no = #{params.quoteNo} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="params.buNo != null and params.buNo != ''"> |
|
|
|
|
|
and q.bu_no = #{params.buNo} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="params.customerNo != null and params.customerNo != ''"> |
|
|
|
|
|
and q.customer_no = #{params.customerNo} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="params.projectNo != null and params.projectNo != ''"> |
|
|
|
|
|
and q.project_no = #{params.projectNo} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="params.status != null and params.status != ''"> |
|
|
|
|
|
and q.status = #{params.status} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="params.quoteVersionNo != null and params.quoteVersionNo != ''"> |
|
|
|
|
|
and q.quote_version_no like #{params.quoteVersionNo} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="params.customerDesc != null and params.customerDesc != ''"> |
|
|
|
|
|
and c.customer_desc like #{params.customerDesc} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="params.projectDesc != null and params.projectDesc != ''"> |
|
|
|
|
|
and p.project_name like #{params.projectDesc} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="params.purchase != null and params.purchase != ''"> |
|
|
|
|
|
and dbo.plm_get_user_display(q.site, q.purchase) like #{params.purchase} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="params.quoter != null and params.quoter != ''"> |
|
|
|
|
|
and dbo.plm_get_user_display(q.site, q.quoter) like #{params.quoter} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="params.customerInquiryNo != null and params.customerInquiryNo != ''"> |
|
|
|
|
|
and q.customer_inquiry_no like #{params.customerInquiryNo} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="params.insideInquiryNo != null and params.insideInquiryNo != ''"> |
|
|
|
|
|
and q.inside_inquiry_no like #{params.insideInquiryNo} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="params.startDate != null"> |
|
|
|
|
|
and q.quote_date >= #{params.startDate} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="params.endDate != null"> |
|
|
|
|
|
and q.quote_date <= #{params.endDate} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="params.ids != null and params.ids.size() > 0"> |
|
|
|
|
|
and q.id in ( |
|
|
|
|
|
<foreach collection="params.ids" item="id" separator=","> |
|
|
|
|
|
#{id} |
|
|
|
|
|
</foreach> |
|
|
|
|
|
) |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="params.searchPartNo != null and params.searchPartNo != ''"> |
|
|
|
|
|
AND EXISTS ( |
|
|
|
|
|
SELECT 1 |
|
|
|
|
|
FROM plm_quote_detail b |
|
|
|
|
|
left join part pp on b.part_no = pp.part_no and b.site = pp.site |
|
|
|
|
|
left join plm_customer_part_info as pc on b.part_no = pc.part_no and b.site = pc.site |
|
|
|
|
|
WHERE b.quote_id = q.id |
|
|
|
|
|
AND (pp.plm_part_no like #{params.searchPartNo} or pp.ifs_part_no like #{params.searchPartNo} or pc.customer_part_no like #{params.searchPartNo}) |
|
|
|
|
|
) |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="params.nodeId != null and params.nodeId != ''"> |
|
|
|
|
|
and prn.node_id = #{params.nodeId} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="params.approvalUsername != null and params.approvalUsername != ''"> |
|
|
|
|
|
AND dbo.get_plm_Approval_username(q.site, prh.workflow_id, prn.node_id, q.quote_version_no) like #{params.approvalUsername} |
|
|
|
|
|
</if> |
|
|
|
|
|
</sql> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 报价单分页-总数(直接 COUNT,不经过 PaginationInterceptor) --> |
|
|
|
|
|
<select id="queryQuotePageCount" resultType="long"> |
|
|
|
|
|
SELECT COUNT(1) |
|
|
|
|
|
FROM plm_quote q |
|
|
|
|
|
left join plm_customer_information c on q.customer_no = c.customer_no |
|
|
|
|
|
left join plm_project_info p on q.project_no = p.project_id and q.site = p.site |
|
|
|
|
|
left join plm_request_header prh on q.site = prh.site and prh.menu_id = '5011' |
|
|
|
|
|
left join plm_request_node prn on q.site = prn.site and prh.classification_no = prn.classification_no |
|
|
|
|
|
and prh.workflow_id = prn.workflow_id and q.step_id = prn.step_id |
|
|
|
|
|
<where> |
|
|
|
|
|
<include refid="quotePageWhereConditions"/> |
|
|
|
|
|
</where> |
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 报价单分页-数据(原生 OFFSET/FETCH NEXT,按报价单号倒排,不经过 PaginationInterceptor) --> |
|
|
|
|
|
<select id="queryQuotePageData" resultType="com.spring.modules.quote.entity.Quote"> |
|
|
|
|
|
select q.id, |
|
|
|
|
|
q.quote_no, |
|
|
|
|
|
q.site, |
|
|
|
|
|
q.bu_no, |
|
|
|
|
|
q.version_no, |
|
|
|
|
|
q.quote_date, |
|
|
|
|
|
q.quote_version_no, |
|
|
|
|
|
q.customer_no, |
|
|
|
|
|
q.project_no, |
|
|
|
|
|
q.project_no as project_id, |
|
|
|
|
|
p.project_name as projectDesc, |
|
|
|
|
|
q.purchase, |
|
|
|
|
|
q.quoter, |
|
|
|
|
|
q.currency, |
|
|
|
|
|
dbo.plm_get_dictDataLabel('plm_customer_information_customer_customer_currency', q.currency, |
|
|
|
|
|
q.site) as currencyDesc, |
|
|
|
|
|
q.status, |
|
|
|
|
|
q.customer_inquiry_no, |
|
|
|
|
|
q.inside_inquiry_no, |
|
|
|
|
|
q.require_approval, |
|
|
|
|
|
q.approval_status, |
|
|
|
|
|
q.require_tool_flag, |
|
|
|
|
|
q.active, |
|
|
|
|
|
q.create_by, |
|
|
|
|
|
q.create_date, |
|
|
|
|
|
q.update_by, |
|
|
|
|
|
q.update_date, |
|
|
|
|
|
q.remark, |
|
|
|
|
|
c.customer_desc, |
|
|
|
|
|
q.application, |
|
|
|
|
|
q.annual_demand, |
|
|
|
|
|
q.cost_model, |
|
|
|
|
|
q.markup, |
|
|
|
|
|
q.chip_price, |
|
|
|
|
|
q.step_id, |
|
|
|
|
|
q.reject_flag, |
|
|
|
|
|
q.reject_step_id, |
|
|
|
|
|
q.annual_sales, |
|
|
|
|
|
dbo.plm_get_user_display(q.site, q.quoter) as quoterName, |
|
|
|
|
|
dbo.plm_get_user_display(q.site, q.purchase) as purchaseName, |
|
|
|
|
|
p.final_customer_id as finalCustomerNo, |
|
|
|
|
|
dbo.plm_get_dictDataLabel('finalCustomer', p.final_customer_id, q.site) as finalCustomerDesc, |
|
|
|
|
|
prn.node_id as nodeId, |
|
|
|
|
|
prn.node_name as nodeName, |
|
|
|
|
|
prn.is_reject as isReject, |
|
|
|
|
|
dbo.get_plm_Approval_username(q.site, prh.workflow_id, prn.node_id, |
|
|
|
|
|
q.quote_version_no) as approvalUsername, |
|
|
|
|
|
gd.plm_part_no as plmPartNo, |
|
|
|
|
|
gd.ifs_part_no as ifsPartNo, |
|
|
|
|
|
gd.part_desc as partDesc |
|
|
|
|
|
from plm_quote q |
|
|
|
|
|
left join plm_customer_information c on q.customer_no = c.customer_no |
|
|
|
|
|
left join plm_project_info p on q.project_no = p.project_id and q.site = p.site |
|
|
|
|
|
left join plm_request_header prh on q.site = prh.site and prh.menu_id = '5011' |
|
|
|
|
|
left join plm_request_node prn on q.site = prn.site and prh.classification_no = prn.classification_no |
|
|
|
|
|
and prh.workflow_id = prn.workflow_id and q.step_id = prn.step_id |
|
|
|
|
|
outer apply ( |
|
|
|
|
|
select top 1 pp.plm_part_no, pp.ifs_part_no, pp.part_desc |
|
|
|
|
|
from plm_quote_group_detail qd |
|
|
|
|
|
left join part pp on qd.part_no = pp.part_no and qd.site = pp.site |
|
|
|
|
|
where qd.quote_id = q.id |
|
|
|
|
|
) gd |
|
|
|
|
|
<where> |
|
|
|
|
|
<include refid="quotePageWhereConditions"/> |
|
|
|
|
|
</where> |
|
|
|
|
|
ORDER BY q.quote_version_no DESC |
|
|
|
|
|
OFFSET #{offset} ROWS FETCH NEXT #{size} ROWS ONLY |
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
<select id="queryQuoteList" resultType="com.spring.modules.quote.entity.Quote"> |
|
|
<select id="queryQuoteList" resultType="com.spring.modules.quote.entity.Quote"> |
|
|
select q.id, |
|
|
select q.id, |
|
|
q.quote_no, |
|
|
q.quote_no, |
|
|
|