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.

181 lines
7.3 KiB

1 year ago
12 months ago
12 months ago
1 year ago
12 months ago
12 months ago
1 year ago
12 months 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 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
12 months 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. u.um_name,
  36. p.status,
  37. #{quoteId} as quote_id,
  38. #{quoteNo} as quote_no,
  39. #{id} as quote_detail_id,
  40. #{itemNo} as quote_detail_item_no,
  41. #{versionNo} as version_no
  42. from plm_bom_detail bd
  43. left join plm_bom_header bh
  44. on bd.site = bh.site and bd.part_no = bh.part_no and bd.bom_type = bh.bom_type and bd.eng_chg_level = bh.eng_chg_level
  45. left join part p on p.part_no = bd.part_no and p.site = bd.site
  46. left join um u on u.um_id = p.um_id
  47. where bd.site = #{site}
  48. and bd.part_no = #{partNo}
  49. <!-- and bd.status != 'Tentative'-->
  50. <if test="engChgLevel == null">
  51. and bh.eff_phase_out_date is null
  52. </if>
  53. <if test="engChgLevel != null">
  54. and bh.eng_chg_level = #{engChgLevel}
  55. </if>
  56. <if test="alternativeNo != null and alternativeNo != ''">
  57. and bd.alternative_no = #{alternativeNo}
  58. </if>
  59. <if test="alternativeNo == null or alternativeNo == ''">
  60. and bd.alternative_no = '*'
  61. </if>
  62. <if test="bomType != null and bomType != ''">
  63. and bd.bom_type = #{bomType}
  64. </if>
  65. order by bh.eff_phase_in_date desc,bh.create_date desc
  66. </select>
  67. <select id="queryBomComponentPart" resultType="com.spring.modules.quote.entity.QuoteDetailBom">
  68. select pbc.site,
  69. #{buNo} as bu_no,
  70. pbc.part_no,
  71. pbc.eng_chg_level,
  72. pbc.bom_type,
  73. pbc.alternative_no,
  74. pbc.component_part,
  75. pbc.print_unit,
  76. pbc.qty_per_assembly,
  77. pbc.component_scrap,
  78. pbc.issue_type,
  79. pbc.shrinkage_factor,
  80. pbc.line_item_no,
  81. pbc.operation_no as operation_id,
  82. pbc.issue_to_loc,
  83. pbc.note_text,
  84. pbc.create_date,
  85. pbc.create_by,
  86. pbc.line_sequence,
  87. pbc.consumption_item,
  88. dbo.get_part_unitCost(pbc.site, pbc.component_part) as unit_price,
  89. dbo.get_part_unitCost(pbc.site, pbc.component_part) as actual_price,
  90. dbo.get_part_unitCost(pbc.site, pbc.component_part) as quote_price,
  91. #{quoteId} as quote_id,
  92. #{quoteNo} as quote_no,
  93. #{quoteDetailId} as quote_detail_id,
  94. #{quoteDetailItemNo} as quote_detail_item_no,
  95. #{versionNo} as version_no,
  96. p.status
  97. from plm_bom_component pbc
  98. left join part p on p.site = pbc.site and p.part_no = pbc.component_part
  99. where pbc.site = #{site}
  100. and pbc.part_no = #{partNo}
  101. and pbc.bom_type = #{bomType}
  102. and pbc.eng_chg_level = #{engChgLevel}
  103. and pbc.alternative_no = #{alternativeNo}
  104. and pbc.qty_per_assembly >= 0
  105. </select>
  106. <select id="queryDetailBomVersion" resultType="com.spring.modules.quote.entity.QuoteDetailBomTree">
  107. select bom.site,
  108. bom.part_no,
  109. bom.eng_chg_level,
  110. bom.bom_type,
  111. p.part_desc
  112. from plm_bom_header bom
  113. left join part p on bom.part_no = p.part_no and bom.site = p.site
  114. where bom.site = #{site}
  115. and bom.part_no = #{partNo}
  116. <if test="bomType != null and bomType != ''">
  117. and bom.bom_type = #{bomType}
  118. </if>
  119. order by bom_type, eng_chg_level
  120. </select>
  121. <select id="queryDetailBomAlternative" resultType="com.spring.modules.quote.entity.QuoteDetailBomTree">
  122. select bom.site,
  123. bom.part_no,
  124. bom.eng_chg_level,
  125. bom.bom_type,
  126. bom.alternative_no,
  127. p.part_desc
  128. from plm_bom_detail bom
  129. left join part p on bom.part_no = p.part_no and bom.site = p.site
  130. where bom.site = #{site}
  131. and bom.part_no = #{partNo}
  132. <!-- and bom.status != 'Tentative'-->
  133. <if test="bomType != null and bomType != ''">
  134. and bom.bom_type = #{bomType}
  135. </if>
  136. and bom.eng_chg_level = #{engChgLevel}
  137. order by bom.alternative_no
  138. </select>
  139. <select id="queryPartBomRouting" resultType="com.spring.modules.quote.entity.QuoteDetailRouting">
  140. select top 1 rd.site,
  141. #{buNo} as bu_no,
  142. rd.routing_revision,
  143. rd.routing_type,
  144. rd.part_no,
  145. rd.alternative_no,
  146. #{quoteId} as quote_id,
  147. #{quoteNo} as quote_no,
  148. #{id} as quote_detail_id,
  149. #{itemNo} as quote_detail_item_no,
  150. #{versionNo} as version_no
  151. from plm_routing_detail rd
  152. left join plm_routing_header rh
  153. on rd.site = rh.site and rd.part_no = rh.part_no and
  154. rd.routing_type = rh.routing_type and
  155. rd.routing_revision = rh.routing_revision
  156. where rd.site = #{site}
  157. and rd.part_no = #{partNo}
  158. <if test="engChgLevel == null">
  159. and rh.phase_out_date is null
  160. </if>
  161. <if test="engChgLevel != null">
  162. and rh.routing_revision = #{engChgLevel}
  163. </if>
  164. <if test="alternativeNo != null and alternativeNo != ''">
  165. and rd.alternative_no = #{alternativeNo}
  166. </if>
  167. <if test="alternativeNo == null or alternativeNo == ''">
  168. and rd.alternative_no = '*'
  169. </if>
  170. order by rh.phase_in_date desc, rh.create_date desc
  171. </select>
  172. <select id="getPartCost" resultType="java.math.BigDecimal">
  173. select isnull(dbo.get_part_unitCost(#{site}, #{partNo}),0)
  174. </select>
  175. </mapper>