常熟吴彦祖 3 weeks ago
parent
commit
216a06bfa4
  1. 52
      src/main/resources/mapper/supplier/PurQuotationDetailMapper.xml

52
src/main/resources/mapper/supplier/PurQuotationDetailMapper.xml

@ -110,22 +110,22 @@
, B.part_desc
, B.umid
, B.qty
, B.price
, B.material_cost
, B.produce_fee
, B.profit
, B.freight
, B.duty
, B.additional_cost
, ISNULL(H.price, B.price) as price
, ISNULL(H.material_cost, B.material_cost) as material_cost
, ISNULL(H.produce_fee, B.produce_fee) as produce_fee
, ISNULL(H.profit, B.profit) as profit
, ISNULL(H.freight, B.freight) as freight
, ISNULL(H.duty, B.duty) as duty
, ISNULL(H.additional_cost, B.additional_cost) as additional_cost
, B.pur_lead_time
, B.remark
, B.tax
, B.last_update_by
, ISNULL(H.remark, B.remark) as remark
, ISNULL(H.tax, B.tax) as tax
, ISNULL(H.created_by, B.last_update_by) as last_update_by
, B.status
, B.tax_rate
, B.surface_fee
, B.purchase_cycle
, B.mould_fee
, ISNULL(H.tax_rate, B.tax_rate) as tax_rate
, ISNULL(H.surface_fee, B.surface_fee) as surface_fee
, ISNULL(H.purchase_cycle, B.purchase_cycle) as purchase_cycle
, ISNULL(H.mould_fee, B.mould_fee) as mould_fee
, B.remark2
, E.user_display
@ -133,13 +133,25 @@
, G.payment_term as paymentTerm
, P.part_spec as spec
, round((round(round(B.qty, 2) * round(B.price, 4), 2) + round(B.additional_cost, 2)) *
, round((round(round(B.qty, 2) * round(ISNULL(H.price, B.price), 4), 2) + round(ISNULL(H.additional_cost, B.additional_cost), 2)) *
round(A.currency_rate, 6), 2) as total_vale_base
, (round(round(B.qty, 2) * round(B.price, 4), 2) + round(B.additional_cost, 2)) as total_vale
, (SELECT dbo.Get_Tax_TaxRate(A.site, A.tax_code)) as taxRate
, (round(round(B.qty, 2) * round(ISNULL(H.price, B.price), 4), 2) + round(ISNULL(H.additional_cost, B.additional_cost), 2)) as total_vale
from PurQuotationHeader as A
left join PurQuotationDetail B on A.site = B.site and A.order_no = B.order_no
left join (
select H1.site, H1.order_no, H1.item_no, H1.price, H1.material_cost, H1.produce_fee, H1.profit, H1.freight, H1.duty,
H1.additional_cost, H1.remark, H1.tax, H1.tax_rate, H1.surface_fee, H1.purchase_cycle, H1.mould_fee, H1.created_by
from PurQuotationReplyHist H1
inner join (
select site, order_no, item_no, max(seq_no) as max_seq_no
from PurQuotationReplyHist
group by site, order_no, item_no
) HM on HM.site = H1.site
and HM.order_no = H1.order_no
and HM.item_no = H1.item_no
and HM.max_seq_no = H1.seq_no
) H on H.site = B.site and H.order_no = B.order_no and H.item_no = B.item_no
left join part as P On B.site = P.site and B.part_no = P.part_no
left join srm_supplier D on A.supplier_id = D.supplier_no and A.site = D.site
left join sys_user E on A.site = E.site and A.buyer = E.username
@ -205,7 +217,7 @@
,act_reply_date = #{actReplyDate}
</if>
where order_no = #{orderNo}
and site = #{site}
and site = #{site} and item_no = #{itemNo}
<if test="partNo != null and partNo != ''">
and part_no = #{partNo}
</if>
@ -318,10 +330,10 @@
from PurQuotationHeader as A
left join PurQuotationDetail B on A.site = B.site and A.order_no = B.order_no
left join PurQuotationReplyHist H on H.order_no = B.order_no and H.site = B.site
left join PurQuotationReplyHist H on H.order_no = B.order_no and H.site = B.site and H.item_no=B.item_no
left join part as P On B.site = P.site and B.part_no = P.part_no
left join srm_supplier D on A.supplier_id = D.supplier_no and A.site = D.site
left join sys_user E on A.site = E.site and A.buyer = E.username
left join sys_user E on A.buyer = E.username
left join DeliveryTerm F on A.site = F.site and A.delivery_term = F.delivery_term_id
left join PaymentTerm G on A.site = G.site and A.payment_term = G.payment_term_id
where B.site = '${query.site}' and A.status not in ('待提交','已关闭')

Loading…
Cancel
Save