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.

274 lines
11 KiB

3 years ago
​
​
​
​
3 years ago
3 years ago
​
​
3 years ago
​
​
​
​
​
​
​
​
3 years ago
​
​
​
3 years ago
3 years ago
​
​
​
​
​
3 years ago
3 years ago
3 years ago
​
​
​
​
​
​
​
​
​
3 years ago
3 years ago
​
​
​
​
3 years ago
3 years ago
​
3 years ago
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
3 years ago
​
​
​
3 years ago
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
3 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.spring.modules.part.mapper.BomManagementMapper">
  4. <!-- 材料信息列表 -->
  5. <select id="bomManagementSearch" parameterType="com.spring.modules.part.vo.BomHeaderVo" resultType="com.spring.modules.part.vo.BomHeaderVo">
  6. SELECT
  7. site,
  8. part_no,
  9. dbo.get_part_name(site, part_no) as partDesc,
  10. eng_chg_level,
  11. bom_type,
  12. note_text,
  13. eff_phase_in_date,
  14. eff_phase_out_date,
  15. eng_revision,
  16. type_flag,
  17. net_weight,
  18. create_date,
  19. create_by,
  20. update_date,
  21. update_by
  22. FROM plm_bom_header
  23. <where>
  24. site = #{query.site}
  25. <if test = "query.partNo != null and query.partNo != ''">
  26. AND part_no like #{query.partNo}
  27. </if>
  28. <if test = "query.partDesc != null and query.partDesc != ''">
  29. AND dbo.get_part_name(site, part_no) like #{query.partDesc}
  30. </if>
  31. </where>
  32. </select>
  33. <!-- 查询物料清单 -->
  34. <select id="queryPartList" parameterType="PartInformationEntity" resultType="BomAllFieldEntity">
  35. SELECT
  36. site,
  37. part_no,
  38. part_desc,
  39. um_id as printUnit,
  40. dbo.get_um_name(site, um_id) as printUnitName
  41. FROM part
  42. <where>
  43. site = #{site} and active = 'Y'
  44. <if test = "partNo != null and partNo != ''">
  45. AND part_no like #{partNo}
  46. </if>
  47. <if test = "partDesc != null and partDesc != ''">
  48. AND part_desc like #{partDesc}
  49. </if>
  50. </where>
  51. </select>
  52. <!-- 新增BOM主表内容 -->
  53. <insert id="saveBomHeader" parameterType="BomHeaderEntity">
  54. INSERT INTO plm_bom_header
  55. (site, part_no, eng_chg_level, bom_type, note_text, eff_phase_in_date, eff_phase_out_date, eng_revision, type_flag, net_weight, create_date, create_by)
  56. VALUES
  57. (#{site}, #{partNo}, #{engChgLevel}, #{bomType}, #{noteText}, #{effPhaseInDate}, #{effPhaseOutDate}, #{engRevision}, #{typeFlag}, #{netWeight}, getDate(), #{createBy})
  58. </insert>
  59. <!-- bom明细新增 -->
  60. <insert id="bomDetailSave" parameterType="BomDetailEntity">
  61. INSERT INTO plm_bom_detail
  62. (site, part_no, eng_chg_level, bom_type, alternative_no, alternative_description, min_lot_qty, default_flag, note_text, create_date, create_by)
  63. VALUES
  64. (#{site}, #{partNo}, #{engChgLevel}, #{bomType}, #{alternativeNo}, #{alternativeDescription}, #{minLotQty}, #{defaultFlag}, #{detailNoteText}, getDate(), #{createBy})
  65. </insert>
  66. <!-- 新增BOM子明细表内容 -->
  67. <insert id="saveBomComponent" parameterType="BomComponentEntity">
  68. INSERT INTO plm_bom_component
  69. (site, part_no, eng_chg_level, bom_type, alternative_no, component_part, print_unit, qty_per_assembly, component_scrap, shrinkage_factor, issue_type, issue_to_loc, operation_no, note_text, create_date, create_by)
  70. VALUES
  71. (#{site}, #{partNo}, #{engChgLevel}, #{bomType}, #{alternativeNo}, #{componentPart}, #{printUnit}, #{qtyPerAssembly}, #{componentScrap}, #{shrinkageFactor}, #{issueType}, #{issueToLoc}, #{operationNo}, #{noteText}, getDate(), #{createBy})
  72. </insert>
  73. <!-- 查bom明细 -->
  74. <select id="queryBomDetail" parameterType="BomHeaderEntity" resultType="BomDetailEntity">
  75. SELECT
  76. site,
  77. part_no,
  78. bom_type,
  79. eng_chg_level,
  80. alternative_no,
  81. alternative_description,
  82. min_lot_qty,
  83. default_flag,
  84. note_text as detailNoteText
  85. FROM plm_bom_detail
  86. where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel}
  87. </select>
  88. <!-- 查bom明细对象 -->
  89. <select id="queryDetailDataByNo" parameterType="BomDetailEntity" resultType="BomDetailEntity">
  90. SELECT
  91. site,
  92. part_no,
  93. bom_type,
  94. eng_chg_level,
  95. alternative_no,
  96. alternative_description,
  97. min_lot_qty,
  98. default_flag,
  99. note_text as detailNoteText
  100. FROM plm_bom_detail
  101. where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo}
  102. </select>
  103. <!-- 查bom子明细 -->
  104. <select id="queryBomComponent" parameterType="BomDetailEntity" resultType="com.spring.modules.part.vo.BomComponentVo">
  105. SELECT
  106. site,
  107. part_no,
  108. bom_type,
  109. eng_chg_level,
  110. alternative_no,
  111. component_part,
  112. dbo.get_part_name(site, component_part) as componentPartDesc,
  113. print_unit,
  114. dbo.get_um_name(site, print_unit) as printUnitName,
  115. qty_per_assembly,
  116. component_scrap,
  117. issue_type,
  118. case when issue_type = 'A' then '领退料倒冲'
  119. when issue_type = 'B' then '工单倒冲'
  120. when issue_type = 'C' then '生产订单倒冲'
  121. when issue_type = 'D' then '投料倒冲'
  122. when issue_type = 'E' then '批次倒冲'
  123. when issue_type = 'F' then '销售订单倒冲'
  124. when issue_type = 'G' then '项目倒冲'
  125. else '' end as issueTypeName,
  126. shrinkage_factor,
  127. line_item_no,
  128. operation_no,
  129. issue_to_loc,
  130. dbo.get_location_name(site, issue_to_loc) as issueToLocName,
  131. note_text as componentNoteText
  132. FROM plm_bom_component
  133. where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo}
  134. </select>
  135. <!-- bom主表编辑 -->
  136. <update id="updateBomHeader" parameterType="BomAllFieldEntity">
  137. update plm_bom_header
  138. set eff_phase_in_date = #{effPhaseInDate},
  139. eff_phase_out_date = #{effPhaseOutDate},
  140. eng_revision = #{engRevision},
  141. type_flag = #{typeFlag},
  142. net_weight = #{netWeight},
  143. note_text = #{noteText},
  144. update_date = getDate(),
  145. update_by = #{updateBy}
  146. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
  147. </update>
  148. <!-- bom明细表编辑 -->
  149. <update id="updateBomDetail" parameterType="BomAllFieldEntity">
  150. update plm_bom_detail
  151. set alternative_description = #{alternativeDescription},
  152. min_lot_qty = #{minLotQty},
  153. note_text = #{detailNoteText},
  154. update_date = getDate(),
  155. update_by = #{updateBy}
  156. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
  157. </update>
  158. <!-- 删除bom子明细 -->
  159. <delete id="deleteBomComponent" parameterType="BomAllFieldEntity">
  160. delete from plm_bom_component
  161. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
  162. </delete>
  163. <!-- 删除替代 -->
  164. <delete id="bomDetailDelete" parameterType="BomDetailEntity">
  165. delete from plm_bom_detail
  166. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
  167. </delete>
  168. <!-- bom主表查重 -->
  169. <select id="checkBomOnlyOne" parameterType="BomAllFieldEntity" resultType="com.spring.modules.part.vo.BomHeaderVo">
  170. SELECT
  171. site,
  172. part_no,
  173. dbo.get_part_name(site, part_no) as partDesc,
  174. bom_type,
  175. eng_chg_level,
  176. eff_phase_in_date,
  177. eff_phase_out_date,
  178. eng_revision,
  179. type_flag,
  180. net_weight,
  181. note_text
  182. FROM plm_bom_header
  183. where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel}
  184. </select>
  185. <!-- bom明细查重 -->
  186. <select id="checkBomDetailOnlyOne" parameterType="BomDetailEntity" resultType="BomDetailEntity">
  187. SELECT
  188. site,
  189. part_no,
  190. bom_type,
  191. eng_chg_level,
  192. alternative_no
  193. FROM plm_bom_detail
  194. where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo}
  195. </select>
  196. <!-- 批量删除子明细物料 -->
  197. <insert id="deleteBomComponents">
  198. delete from plm_bom_component
  199. where
  200. <foreach collection="list" item="item" separator=",">
  201. (site = #{item.site} and part_no = #{item.partNo} and eng_chg_level = #{item.engChgLevel} and bom_type = #{item.bomType} and alternative_no = #{item.alternativeNo} and component_part = #{item.componentPart})
  202. </foreach>
  203. </insert>
  204. <!-- 删除bom子明细 -->
  205. <insert id="deleteBomComponentByPartNo">
  206. delete from plm_bom_component
  207. where
  208. <foreach collection="list" item="item" separator=",">
  209. (site = #{item.site} and part_no = #{item.partNo} and eng_chg_level = #{item.engChgLevel} and bom_type = #{item.bomType})
  210. </foreach>
  211. </insert>
  212. <!-- 删除bom明细 -->
  213. <insert id="deleteBomDetailByPartNo">
  214. delete from plm_bom_detail
  215. where
  216. <foreach collection="list" item="item" separator=",">
  217. (site = #{item.site} and part_no = #{item.partNo} and eng_chg_level = #{item.engChgLevel} and bom_type = #{item.bomType})
  218. </foreach>
  219. </insert>
  220. <!-- 删除bom主记录 -->
  221. <insert id="deleteBomHeaderByPartNo">
  222. delete from plm_bom_header
  223. where
  224. <foreach collection="list" item="item" separator=",">
  225. (site = #{item.site} and part_no = #{item.partNo} and eng_chg_level = #{item.engChgLevel} and bom_type = #{item.bomType})
  226. </foreach>
  227. </insert>
  228. <!-- bom明细查重 -->
  229. <select id="checkBomComponentOnlyOne" parameterType="BomComponentEntity" resultType="BomComponentEntity">
  230. SELECT
  231. site,
  232. part_no,
  233. bom_type,
  234. eng_chg_level,
  235. alternative_no,
  236. component_part
  237. FROM plm_bom_component
  238. where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo} and component_part = #{componentPart}
  239. </select>
  240. <!-- 修改bom子明细 -->
  241. <update id="updateBomComponent" parameterType="BomComponentEntity">
  242. update plm_bom_component
  243. set qty_per_assembly = #{qtyPerAssembly},
  244. component_scrap = #{componentScrap},
  245. issue_type = #{issueType},
  246. shrinkage_factor = #{shrinkageFactor},
  247. operation_no = #{operationNo},
  248. issue_to_loc = #{issueToLoc},
  249. note_text = #{noteText},
  250. update_date = getDate(),
  251. update_by = #{updateBy}
  252. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} and component_part = #{componentPart}
  253. </update>
  254. </mapper>