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.

192 lines
7.7 KiB

1 year ago
10 months ago
10 months ago
1 year ago
11 months ago
10 months ago
1 year ago
10 months ago
11 months ago
1 year ago
12 months ago
9 months ago
12 months ago
9 months ago
12 months ago
9 months ago
12 months ago
9 months ago
12 months ago
9 months 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
10 months ago
9 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. 'N' as bomFlag
  98. from plm_bom_component pbc
  99. left join part p on p.site = pbc.site and p.part_no = pbc.component_part
  100. where pbc.site = #{site}
  101. and pbc.part_no = #{partNo}
  102. and pbc.bom_type = #{bomType}
  103. and pbc.eng_chg_level = #{engChgLevel}
  104. and pbc.alternative_no = #{alternativeNo}
  105. and pbc.qty_per_assembly >= 0
  106. </select>
  107. <select id="queryDetailBomVersion" resultType="com.spring.modules.quote.entity.QuoteDetailBomTree">
  108. select bom.site,
  109. bom.part_no,
  110. bom.eng_chg_level,
  111. bom.bom_type,
  112. p.part_desc
  113. from plm_bom_header bom
  114. left join part p on bom.part_no = p.part_no and bom.site = p.site
  115. where bom.site = #{site}
  116. and bom.part_no = #{partNo}
  117. <if test="bomType != null and bomType != ''">
  118. and bom.bom_type = #{bomType}
  119. </if>
  120. order by bom_type, eng_chg_level
  121. </select>
  122. <select id="queryDetailBomAlternative" resultType="com.spring.modules.quote.entity.QuoteDetailBomTree">
  123. select bom.site,
  124. bom.part_no,
  125. bom.eng_chg_level,
  126. bom.bom_type,
  127. bom.alternative_no,
  128. p.part_desc
  129. from plm_bom_detail bom
  130. left join part p on bom.part_no = p.part_no and bom.site = p.site
  131. where bom.site = #{site}
  132. and bom.part_no = #{partNo}
  133. <!-- and bom.status != 'Tentative'-->
  134. <if test="bomType != null and bomType != ''">
  135. and bom.bom_type = #{bomType}
  136. </if>
  137. and bom.eng_chg_level = #{engChgLevel}
  138. order by bom.alternative_no
  139. </select>
  140. <select id="queryPartBomRouting" resultType="com.spring.modules.quote.entity.QuoteDetailRouting">
  141. select top 1 rd.site,
  142. #{buNo} as bu_no,
  143. rd.routing_revision,
  144. rd.routing_type,
  145. rd.part_no,
  146. rd.alternative_no,
  147. #{quoteId} as quote_id,
  148. #{quoteNo} as quote_no,
  149. #{id} as quote_detail_id,
  150. #{itemNo} as quote_detail_item_no,
  151. #{versionNo} as version_no
  152. from plm_routing_detail rd
  153. left join plm_routing_header rh
  154. on rd.site = rh.site and rd.part_no = rh.part_no and
  155. rd.routing_type = rh.routing_type and
  156. rd.routing_revision = rh.routing_revision
  157. where rd.site = #{site}
  158. and rd.part_no = #{partNo}
  159. <if test="engChgLevel == null">
  160. and rh.phase_out_date is null
  161. </if>
  162. <if test="engChgLevel != null">
  163. and rh.routing_revision = #{engChgLevel}
  164. </if>
  165. <if test="alternativeNo != null and alternativeNo != ''">
  166. and rd.alternative_no = #{alternativeNo}
  167. </if>
  168. <if test="alternativeNo == null or alternativeNo == ''">
  169. and rd.alternative_no = '*'
  170. </if>
  171. order by rh.phase_in_date desc, rh.create_date desc
  172. </select>
  173. <select id="getPartCost" resultType="java.math.BigDecimal">
  174. select isnull(dbo.get_part_unitCost(#{site}, #{partNo}),0)
  175. </select>
  176. <select id="queryPart" resultType="com.spring.modules.part.entity.PartInformationEntity">
  177. select top 1 site,
  178. part_no,
  179. status,
  180. ifs_part_no
  181. from part p
  182. where p.site = #{site}
  183. and p.plm_part_no = #{partNo}
  184. </select>
  185. </mapper>