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

2 years ago
1 year ago
1 year ago
1 year ago
2 years ago
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="com.spring.modules.quotation.mapper.QuoteDetailMapper">
  5. <select id="selectQuoteDetailList" resultType="com.spring.modules.quotation.vo.QuoteDetailVo">
  6. select quotation_detail_id,
  7. quotation_header_id,
  8. site,
  9. product_no,
  10. dbo.get_part_name(site, product_no) as product_desc,
  11. internal_inquiry_no,
  12. quotation_detail_quantity,
  13. quotation_detail_count,
  14. quotation_detail_status,
  15. compute_part_cost,
  16. compute_labour_cost,
  17. compute_fabricate_cost,
  18. compute_tool_cost,
  19. adjust_part_cost,
  20. adjust_labour_cost,
  21. adjust_fabricate_cost,
  22. adjust_tool_cost,
  23. detail_other_cost,
  24. detail_manage_cost,
  25. detail_total_cost,
  26. detail_profit_rate,
  27. detail_profit_amount,
  28. system_compute_amount,
  29. system_compute_price,
  30. final_untaxed_price,
  31. final_taxed_price,
  32. remark,
  33. compute_machine_cost,
  34. adjust_machine_cost,
  35. tax_rate,
  36. active
  37. from quotation_detail qd
  38. <where>
  39. and active = 'Y'
  40. <if test="quotationHeaderId != null">
  41. and quotation_header_id = #{quotationHeaderId}
  42. </if>
  43. </where>
  44. order by quotation_detail_id
  45. </select>
  46. <select id="queryQuoteDetailByInquiryNo" resultType="com.spring.modules.quotation.vo.QuoteDetailVo">
  47. select qh.quotation_date,
  48. qh.quotation_no + '-' + qh.version_code as quotation_no,
  49. qd.quotation_detail_id,
  50. qd.quotation_header_id,
  51. qd.site,
  52. qd.product_no,
  53. qd.product_desc,
  54. qd.internal_inquiry_no,
  55. qd.quotation_detail_quantity,
  56. qd.quotation_detail_count,
  57. qd.quotation_detail_status,
  58. qd.compute_part_cost,
  59. qd.compute_labour_cost,
  60. qd.compute_fabricate_cost,
  61. qd.compute_tool_cost,
  62. qd.adjust_part_cost,
  63. qd.adjust_labour_cost,
  64. qd.adjust_fabricate_cost,
  65. qd.adjust_tool_cost,
  66. qd.detail_other_cost,
  67. qd.detail_manage_cost,
  68. qd.detail_total_cost,
  69. qd.detail_profit_rate,
  70. qd.detail_profit_amount,
  71. qd.system_compute_amount,
  72. qd.system_compute_price,
  73. qd.final_untaxed_price,
  74. qd.final_taxed_price,
  75. qd.remark,
  76. qd.compute_machine_cost,
  77. qd.adjust_machine_cost,
  78. qd.tax_rate,
  79. qd.active
  80. from quotation_header qh
  81. left join quotation_detail qd on qh.quotation_header_id = qd.quotation_header_id
  82. where qh.site = #{site}
  83. and qh.internal_inquiry_no = #{internalInquiryNo}
  84. and qd.active = 'Y'
  85. </select>
  86. <select id="queryQuoteDetailByPartNo" resultType="com.spring.modules.quotation.vo.QuoteDetailVo">
  87. select qh.quotation_date,
  88. qh.quotation_no + '-' + qh.version_code as quotation_no,
  89. qd.quotation_detail_id,
  90. qd.quotation_header_id,
  91. qd.site,
  92. qd.product_no,
  93. qd.product_no as partNo,
  94. qd.product_desc,
  95. qd.internal_inquiry_no,
  96. qd.quotation_detail_quantity,
  97. qd.quotation_detail_count,
  98. qd.quotation_detail_status,
  99. qd.compute_part_cost,
  100. qd.compute_labour_cost,
  101. qd.compute_fabricate_cost,
  102. qd.compute_tool_cost,
  103. qd.adjust_part_cost,
  104. qd.adjust_labour_cost,
  105. qd.adjust_fabricate_cost,
  106. qd.adjust_tool_cost,
  107. qd.detail_other_cost,
  108. qd.detail_manage_cost,
  109. qd.detail_total_cost,
  110. qd.detail_profit_rate,
  111. qd.detail_profit_amount,
  112. qd.system_compute_amount,
  113. qd.system_compute_price,
  114. qd.final_untaxed_price,
  115. qd.final_taxed_price,
  116. qd.remark,
  117. qd.compute_machine_cost,
  118. qd.adjust_machine_cost,
  119. qd.tax_rate,
  120. qd.active,
  121. qh.project_id
  122. from quotation_header qh
  123. left join quotation_detail qd on qh.quotation_header_id = qd.quotation_header_id and qd.product_no = #{partNo}
  124. where qh.site = #{site}
  125. and qh.project_id = #{projectId}
  126. and qd.active = 'Y'
  127. </select>
  128. <select id="queryQuoteDetailBom" resultType="com.spring.modules.quotation.entity.QuoteBomHeader">
  129. select site,
  130. quote_detail_id,
  131. part_no,
  132. bom_type,
  133. version,
  134. alternative_no,
  135. test_part_no,
  136. id,
  137. parent_id
  138. from quote_bom_header
  139. where quote_detail_id = #{quotationDetailId}
  140. and parent_id = 0
  141. </select>
  142. <select id="queryQuoteDetailRouting" resultType="com.spring.modules.quotation.entity.QuoteRoutingHeader">
  143. select site,
  144. quote_detail_id,
  145. part_no,
  146. routing_type,
  147. version,
  148. alternative_no,
  149. test_part_no,
  150. id,
  151. parent_id
  152. from quote_routing_header
  153. where quote_detail_id = #{quotationDetailId}
  154. and parent_id = 0
  155. </select>
  156. <update id="updateInquiry">
  157. update plm_quotation_information
  158. set quotation_amount = #{systemComputePrice} where quotation_no = #{internalInquiryNo} and site = #{site}
  159. </update>
  160. </mapper>