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.

170 lines
6.6 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year 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.spring.modules.quote.mapper.QuoteDetailBomTreeMapper">
  4. <select id="queryDetailBomTree" resultType="com.spring.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. qdbt.bom_actual_un_yield,
  24. qdbt.bom_actual_yield
  25. from plm_quote_detail_bom_tree qdbt
  26. where quote_detail_id = #{id}
  27. </select>
  28. <select id="queryPartBom" resultType="com.spring.modules.quote.entity.QuoteDetailBomTree">
  29. select top 1 bd.site,
  30. #{buNo} as bu_no,
  31. bd.part_no,
  32. bd.alternative_no,
  33. bd.bom_type,
  34. bd.eng_chg_level,
  35. #{quoteId} as quote_id,
  36. #{quoteNo} as quote_no,
  37. #{id} as quote_detail_id,
  38. #{itemNo} as quote_detail_item_no,
  39. #{versionNo} as version_no
  40. from plm_bom_detail bd
  41. left join plm_bom_header bh
  42. on bd.site = bh.site and bd.part_no = bh.part_no
  43. and bd.bom_type = bh.bom_type and bd.eng_chg_level = bh.eng_chg_level
  44. where bd.site = #{site}
  45. and bd.part_no = #{partNo}
  46. <!-- and bd.status != 'Tentative'-->
  47. <if test="engChgLevel == null">
  48. and bh.eff_phase_out_date is null
  49. </if>
  50. <if test="engChgLevel != null">
  51. and bh.eng_chg_level = #{engChgLevel}
  52. </if>
  53. <if test="alternativeNo != null and alternativeNo != ''">
  54. and bd.alternative_no = #{alternativeNo}
  55. </if>
  56. <if test="alternativeNo == null or alternativeNo == ''">
  57. and bd.alternative_no = '*'
  58. </if>
  59. order by bh.eff_phase_in_date desc,bh.create_date desc
  60. </select>
  61. <select id="queryBomComponentPart" resultType="com.spring.modules.quote.entity.QuoteDetailBom">
  62. select site,
  63. #{buNo} as bu_no,
  64. part_no,
  65. eng_chg_level,
  66. bom_type,
  67. alternative_no,
  68. component_part,
  69. print_unit,
  70. qty_per_assembly,
  71. component_scrap,
  72. issue_type,
  73. shrinkage_factor,
  74. line_item_no,
  75. operation_no as operation_id,
  76. issue_to_loc,
  77. note_text,
  78. create_date,
  79. create_by,
  80. line_sequence,
  81. consumption_item,
  82. dbo.get_part_unitCost(site, component_part) as unit_price,
  83. dbo.get_part_unitCost(site, component_part) as actual_price,
  84. dbo.get_part_unitCost(site, component_part) as quote_price,
  85. #{quoteId} as quote_id,
  86. #{quoteNo} as quote_no,
  87. #{quoteDetailId} as quote_detail_id,
  88. #{quoteDetailItemNo} as quote_detail_item_no,
  89. #{versionNo} as version_no
  90. from plm_bom_component
  91. where site = #{site}
  92. and part_no = #{partNo}
  93. and bom_type = #{bomType}
  94. and eng_chg_level = #{engChgLevel}
  95. and alternative_no = #{alternativeNo}
  96. and qty_per_assembly >= 0
  97. </select>
  98. <select id="queryDetailBomVersion" resultType="com.spring.modules.quote.entity.QuoteDetailBomTree">
  99. select bom.site,
  100. bom.part_no,
  101. bom.eng_chg_level,
  102. bom.bom_type,
  103. p.part_desc
  104. from plm_bom_header bom
  105. left join part p on bom.part_no = p.part_no and bom.site = p.site
  106. where bom.site = #{site}
  107. and bom.part_no = #{partNo}
  108. <if test="bomType != null and bomType != ''">
  109. and bom.bom_type = #{bomType}
  110. </if>
  111. order by bom_type, eng_chg_level
  112. </select>
  113. <select id="queryDetailBomAlternative" resultType="com.spring.modules.quote.entity.QuoteDetailBomTree">
  114. select bom.site,
  115. bom.part_no,
  116. bom.eng_chg_level,
  117. bom.bom_type,
  118. bom.alternative_no,
  119. p.part_desc
  120. from plm_bom_detail bom
  121. left join part p on bom.part_no = p.part_no and bom.site = p.site
  122. where bom.site = #{site}
  123. and bom.part_no = #{partNo}
  124. <!-- and bom.status != 'Tentative'-->
  125. <if test="bomType != null and bomType != ''">
  126. and bom.bom_type = #{bomType}
  127. </if>
  128. and bom.eng_chg_level = #{engChgLevel}
  129. order by bom.alternative_no
  130. </select>
  131. <select id="queryPartBomRouting" resultType="com.spring.modules.quote.entity.QuoteDetailRouting">
  132. select top 1 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.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. </mapper>