O
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.

183 lines
6.9 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.xujie.sys.modules.quote.mapper.QuoteDetailBomTreeMapper">
  4. <select id="queryDetailBomTree" resultType="com.xujie.sys.modules.quote.entity.QuoteDetailBomTree">
  5. select qdbt.id,
  6. qdbt.quote_id,
  7. qdbt.quote_detail_id,
  8. qdbt.quote_detail_item_no,
  9. qdbt.site,
  10. qdbt.bu_no,
  11. qdbt.quote_no,
  12. qdbt.version_no,
  13. qdbt.part_no,
  14. qdbt.bom_type,
  15. qdbt.eng_chg_level,
  16. qdbt.alternative_no,
  17. qdbt.parent_id,
  18. qdbt.level,
  19. qdbt.process_time,
  20. qdbt.yield,
  21. qdbt.bom_un_yield,
  22. qdbt.bom_yield
  23. from plm_quote_detail_bom_tree qdbt
  24. where quote_detail_id = #{id}
  25. </select>
  26. <select id="queryPartBom" resultType="com.xujie.sys.modules.quote.entity.QuoteDetailBomTree">
  27. select top 1 bd.site,
  28. #{buNo} as bu_no,
  29. bd.part_no,
  30. bd.alternative_no,
  31. bd.bom_type,
  32. bd.eng_chg_level,
  33. #{quoteId} as quote_id,
  34. #{quoteNo} as quote_no,
  35. #{id} as quote_detail_id,
  36. #{itemNo} as quote_detail_item_no,
  37. #{versionNo} as version_no
  38. from plm_bom_detail bd
  39. left join plm_bom_header bh
  40. on bd.site = bh.site and bd.part_no = bh.part_no and bd.bu_no = bh.bu_no
  41. and bd.bom_type = bh.bom_type and bd.eng_chg_level = bh.eng_chg_level
  42. where bd.site = #{site}
  43. and bd.part_no = #{partNo}
  44. and bd.status != 'Tentative'
  45. <if test="engChgLevel == null">
  46. and bh.eff_phase_out_date is null
  47. </if>
  48. <if test="engChgLevel != null">
  49. and bh.eng_chg_level = #{engChgLevel}
  50. </if>
  51. <if test="alternativeNo != null and alternativeNo != ''">
  52. and bd.alternative_no = #{alternativeNo}
  53. </if>
  54. <if test="alternativeNo == null or alternativeNo == ''">
  55. and bd.alternative_no = '*'
  56. </if>
  57. order by bh.eff_phase_in_date desc,bh.create_date desc
  58. </select>
  59. <select id="queryBomComponentPart" resultType="com.xujie.sys.modules.quote.entity.QuoteDetailBom">
  60. select site,
  61. #{buNo} as bu_no,
  62. part_no,
  63. eng_chg_level,
  64. bom_type,
  65. alternative_no,
  66. component_part,
  67. print_unit,
  68. qty_per_assembly,
  69. component_scrap,
  70. issue_type,
  71. shrinkage_factor,
  72. line_item_no,
  73. operation_id,
  74. issue_to_loc,
  75. note_text,
  76. create_date,
  77. create_by,
  78. line_sequence,
  79. consumption_item,
  80. dbo.get_part_unit_price(site, component_part) as unit_price,
  81. dbo.get_part_actual_price(site, component_part) as actual_price,
  82. dbo.get_part_quote_price(site, component_part) as quote_price,
  83. #{quoteId} as quote_id,
  84. #{quoteNo} as quote_no,
  85. #{quoteDetailId} as quote_detail_id,
  86. #{quoteDetailItemNo} as quote_detail_item_no,
  87. #{versionNo} as version_no
  88. from plm_bom_component
  89. where site = #{site}
  90. and part_no = #{partNo}
  91. and bom_type = #{bomType}
  92. and eng_chg_level = #{engChgLevel}
  93. and alternative_no = #{alternativeNo}
  94. </select>
  95. <select id="queryDetailBomVersion" resultType="com.xujie.sys.modules.quote.entity.QuoteDetailBomTree">
  96. select bom.site,
  97. bom.bu_no,
  98. bom.part_no,
  99. bom.eng_chg_level,
  100. bom.bom_type,
  101. p.part_desc
  102. from plm_bom_header bom
  103. left join part p on bom.part_no = p.part_no and bom.site = p.site
  104. where bom.site = #{site}
  105. and bom.part_no = #{partNo}
  106. <if test="bomType != null and bomType != ''">
  107. and bom.bom_type = #{bomType}
  108. </if>
  109. order by bom_type, eng_chg_level
  110. </select>
  111. <select id="queryDetailBomAlternative" resultType="com.xujie.sys.modules.quote.entity.QuoteDetailBomTree">
  112. select bom.site,
  113. bom.bu_no,
  114. bom.part_no,
  115. bom.eng_chg_level,
  116. bom.bom_type,
  117. bom.alternative_no,
  118. p.part_desc
  119. from plm_bom_detail bom
  120. left join part p on bom.part_no = p.part_no and bom.site = p.site
  121. where bom.site = #{site}
  122. and bom.part_no = #{partNo}
  123. and bom.status != 'Tentative'
  124. <if test="bomType != null and bomType != ''">
  125. and bom.bom_type = #{bomType}
  126. </if>
  127. and bom.eng_chg_level = #{engChgLevel}
  128. order by bom.alternative_no
  129. </select>
  130. <select id="queryPartBomRouting" resultType="com.xujie.sys.modules.quote.entity.QuoteDetailRouting">
  131. select top 1
  132. rd.site,
  133. #{buNo} as bu_no,
  134. rd.routing_revision,
  135. rd.routing_type,
  136. rd.part_no,
  137. rd.alternative_no,
  138. #{quoteId} as quote_id,
  139. #{quoteNo} as quote_no,
  140. #{id} as quote_detail_id,
  141. #{itemNo} as quote_detail_item_no,
  142. #{versionNo} as version_no
  143. from plm_routing_detail rd
  144. left join plm_routing_header rh
  145. on rd.site = rh.site and rd.bu_no = rh.bu_no and rd.part_no = rh.part_no and
  146. rd.routing_type = rh.routing_type and
  147. rd.routing_revision = rh.routing_revision
  148. where rd.site = #{site}
  149. and rd.part_no = #{partNo}
  150. <if test="engChgLevel == null">
  151. and rh.phase_out_date is null
  152. </if>
  153. <if test="engChgLevel != null">
  154. and rh.routing_revision = #{engChgLevel}
  155. </if>
  156. <if test="alternativeNo != null and alternativeNo != ''">
  157. and rd.alternative_no = #{alternativeNo}
  158. </if>
  159. <if test="alternativeNo == null or alternativeNo == ''">
  160. and rd.alternative_no = '*'
  161. </if>
  162. order by rh.phase_in_date desc,rh.create_date desc
  163. </select>
  164. <select id="queryYieldRate" resultType="java.math.BigDecimal">
  165. select d.yield_rate from plm_quote_detail_bom_tree t
  166. left join part p on t.part_no = p.part_no and p.site = t.site
  167. left join part_product_group d on p.site = d.site and p.OtherGroup2 = d.product_group_id
  168. where t.site = #{site} and quote_id = #{quoteId} and quote_detail_id = #{quoteDetailId} and t.part_no = #{partNo}
  169. </select>
  170. </mapper>