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.

592 lines
24 KiB

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.part.mapper.BomManagementMapper">
  4. <!-- 材料信息列表 -->
  5. <select id="bomManagementSearch" parameterType="com.xujie.sys.modules.part.vo.BomHeaderVo" resultType="com.xujie.sys.modules.part.vo.BomHeaderVo">
  6. SELECT
  7. a.site,
  8. a.bu_no,
  9. a.part_no,
  10. dbo.qc_get_part_desc(a.site, a.bu_no, a.part_no) as partDesc,
  11. a.eng_chg_level,
  12. a.bom_type,
  13. a.note_text,
  14. a.eff_phase_in_date,
  15. a.eff_phase_out_date,
  16. a.eng_revision,
  17. a.type_flag,
  18. a.net_weight,
  19. a.create_date,
  20. a.create_by,
  21. a.update_date,
  22. a.update_by,
  23. b.umid as printUnit,
  24. dbo.qc_get_um_name(a.site, b.umid) as printUnitName
  25. FROM plm_bom_header as a
  26. left join part as b on a.site = b.site and a.bu_no = b.sourceBu and a.part_no = b.part_no
  27. <where>
  28. a.site in (select site from eam_access_site where username = #{query.userName})
  29. and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
  30. <if test="query.buNo != null and query.buNo != ''">
  31. AND a.bu_no = #{query.buNo}
  32. </if>
  33. <if test = "query.partNo != null and query.partNo != ''">
  34. AND a.part_no like '%' + #{query.partNo} + '%'
  35. </if>
  36. <if test = "query.partDesc != null and query.partDesc != ''">
  37. AND dbo.qc_get_part_desc(a.site, a.bu_no, a.part_no) like '%' + #{query.partDesc} + '%'
  38. </if>
  39. <if test = "query.bomType != null and query.bomType != ''">
  40. AND a.bom_type = #{query.bomType}
  41. </if>
  42. <if test = "query.engChgLevel != null and query.engChgLevel != ''">
  43. AND a.eng_chg_level like '%' + #{query.engChgLevel} + '%'
  44. </if>
  45. </where>
  46. </select>
  47. <!-- 查询物料清单 -->
  48. <select id="queryPartList" parameterType="ComponentPartData" resultType="BomAllFieldEntity">
  49. SELECT
  50. site,
  51. sourceBu as buNo,
  52. part_no,
  53. part_desc,
  54. spec,
  55. umid as printUnit,
  56. dbo.qc_get_um_name(site, umid) as printUnitName,
  57. part_type,
  58. FamilyID,
  59. dbo.get_family_name(site, sourceBu, FamilyID) as familyName
  60. FROM part
  61. <where>
  62. site = #{query.site}
  63. and sourceBu = #{query.buNo}
  64. and part_type <![CDATA[<>]]> 'Purchased (raw)'
  65. and active = 'Y'
  66. <if test = "query.partNo != null and query.partNo != ''">
  67. AND part_no like '%' + #{query.partNo} + '%'
  68. </if>
  69. <if test = "query.partDesc != null and query.partDesc != ''">
  70. AND part_desc like '%' + #{query.partDesc} + '%'
  71. </if>
  72. </where>
  73. </select>
  74. <!-- 查出可创建BOM的物料 -->
  75. <select id="queryPartListBom" parameterType="ComponentPartData" resultType="BomAllFieldEntity">
  76. SELECT
  77. site,
  78. sourceBu as buNo,
  79. part_no,
  80. part_desc,
  81. spec,
  82. umid as printUnit,
  83. dbo.qc_get_um_name(site, umid) as printUnitName,
  84. part_type,
  85. FamilyID,
  86. dbo.get_family_name(site, sourceBu, FamilyID) as familyName
  87. FROM part
  88. <where>
  89. site = #{query.site}
  90. and sourceBu = #{query.buNo}
  91. and active = 'Y'
  92. and part_type <![CDATA[<>]]> 'Purchased (raw)'
  93. <if test = "query.partNo != null and query.partNo != ''">
  94. AND part_no like '%' + #{query.partNo} + '%'
  95. </if>
  96. <if test = "query.partDesc != null and query.partDesc != ''">
  97. AND part_desc like '%' + #{query.partDesc} + '%'
  98. </if>
  99. </where>
  100. </select>
  101. <!-- 新增BOM主表内容 -->
  102. <insert id="saveBomHeader" parameterType="BomHeaderEntity">
  103. INSERT INTO plm_bom_header
  104. (site, bu_no, 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)
  105. VALUES
  106. (#{site}, #{buNo}, #{partNo}, #{engChgLevel}, #{bomType}, #{noteText}, #{effPhaseInDate}, #{effPhaseOutDate}, #{engRevision}, #{typeFlag}, #{netWeight}, getDate(), #{createBy})
  107. </insert>
  108. <!-- bom明细新增 -->
  109. <insert id="bomDetailSave" parameterType="BomDetailEntity">
  110. INSERT INTO plm_bom_detail
  111. (site, bu_no, part_no, eng_chg_level, bom_type, alternative_no, alternative_description, status, min_lot_qty, default_flag, note_text, create_date, create_by)
  112. VALUES
  113. (#{site}, #{buNo}, #{partNo}, #{engChgLevel}, #{bomType}, #{alternativeNo}, #{alternativeDescription}, #{status}, #{minLotQty}, #{defaultFlag}, #{detailNoteText}, getDate(), #{createBy})
  114. </insert>
  115. <!-- 新增BOM子明细表内容 -->
  116. <insert id="saveBomComponent" parameterType="BomComponentEntity">
  117. INSERT INTO plm_bom_component
  118. (site, bu_no, part_no, eng_chg_level, bom_type, alternative_no, component_part, line_item_no, print_unit, qty_per_assembly, component_scrap, shrinkage_factor, issue_type, issue_to_loc, operation_id, note_text, create_date, create_by, line_sequence, consumption_item)
  119. VALUES
  120. (#{site}, #{buNo}, #{partNo}, #{engChgLevel}, #{bomType}, #{alternativeNo}, #{componentPart}, #{lineItemNo}, #{printUnit}, #{qtyPerAssembly}, #{componentScrap}, #{shrinkageFactor}, #{issueType}, #{issueToLoc}, #{operationId}, #{noteText}, getDate(), #{createBy}, #{lineSequence}, #{consumptionItem})
  121. </insert>
  122. <!-- 查bom明细 -->
  123. <select id="queryBomDetail" parameterType="BomHeaderEntity" resultType="BomDetailEntity">
  124. SELECT
  125. site,
  126. bu_no,
  127. part_no,
  128. bom_type,
  129. eng_chg_level,
  130. alternative_no,
  131. alternative_description,
  132. status,
  133. min_lot_qty,
  134. default_flag,
  135. note_text as detailNoteText
  136. FROM plm_bom_detail
  137. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel}
  138. </select>
  139. <!-- 查bom明细对象 -->
  140. <select id="queryDetailDataByNo" parameterType="BomDetailEntity" resultType="BomDetailEntity">
  141. SELECT
  142. site,
  143. bu_no,
  144. part_no,
  145. bom_type,
  146. eng_chg_level,
  147. alternative_no,
  148. alternative_description,
  149. status,
  150. min_lot_qty,
  151. default_flag,
  152. note_text as detailNoteText
  153. FROM plm_bom_detail
  154. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo}
  155. </select>
  156. <!-- 查bom子明细 -->
  157. <select id="queryBomComponent" parameterType="BomDetailEntity" resultType="com.xujie.sys.modules.part.vo.BomComponentVo">
  158. SELECT
  159. site,
  160. bu_no,
  161. part_no,
  162. bom_type,
  163. eng_chg_level,
  164. alternative_no,
  165. component_part,
  166. dbo.qc_get_part_desc(site, bu_no, component_part) as componentPartDesc,
  167. print_unit,
  168. dbo.qc_get_um_name(site, print_unit) as printUnitName,
  169. qty_per_assembly,
  170. component_scrap,
  171. issue_type,
  172. shrinkage_factor,
  173. line_item_no,
  174. operation_id,
  175. dbo.plm_get_operation_no(operation_id) as operationNo,
  176. issue_to_loc,
  177. dbo.get_location_name(site, bu_no, issue_to_loc) as issueToLocName,
  178. note_text,
  179. line_sequence,
  180. consumption_item
  181. FROM plm_bom_component
  182. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo} and qty_per_assembly <![CDATA[ >= ]]> 0
  183. order by line_sequence
  184. </select>
  185. <!-- 查bom子明细 -->
  186. <select id="queryBomByProducts" parameterType="BomDetailEntity" resultType="com.xujie.sys.modules.part.vo.BomComponentVo">
  187. SELECT
  188. site,
  189. bu_no,
  190. part_no,
  191. bom_type,
  192. eng_chg_level,
  193. alternative_no,
  194. component_part,
  195. dbo.qc_get_part_desc(site, bu_no, component_part) as componentPartDesc,
  196. print_unit,
  197. dbo.qc_get_um_name(site, print_unit) as printUnitName,
  198. abs(qty_per_assembly) as qtyPerAssembly,
  199. component_scrap,
  200. issue_type,
  201. shrinkage_factor,
  202. line_item_no,
  203. operation_id,
  204. issue_to_loc,
  205. dbo.get_location_name(site, bu_no, issue_to_loc) as issueToLocName,
  206. note_text,
  207. line_sequence,
  208. consumption_item
  209. FROM plm_bom_component
  210. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo} and qty_per_assembly <![CDATA[ < ]]> 0
  211. order by line_sequence
  212. </select>
  213. <!-- 查bom子明细 -->
  214. <select id="queryBomComponentAll" parameterType="BomDetailEntity" resultType="com.xujie.sys.modules.part.vo.BomComponentVo">
  215. SELECT
  216. site,
  217. bu_no,
  218. part_no,
  219. bom_type,
  220. eng_chg_level,
  221. alternative_no,
  222. component_part,
  223. dbo.qc_get_part_desc(site, bu_no, component_part) as componentPartDesc,
  224. print_unit,
  225. dbo.qc_get_um_name(site, print_unit) as printUnitName,
  226. qty_per_assembly,
  227. component_scrap,
  228. issue_type,
  229. shrinkage_factor,
  230. line_item_no,
  231. operation_id,
  232. issue_to_loc,
  233. dbo.get_location_name(site, bu_no, issue_to_loc) as issueToLocName,
  234. note_text,
  235. line_sequence,
  236. consumption_item
  237. FROM plm_bom_component
  238. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo}
  239. order by line_sequence
  240. </select>
  241. <!-- bom主表编辑 -->
  242. <update id="updateBomHeader" parameterType="BomAllFieldEntity">
  243. update plm_bom_header
  244. set eff_phase_in_date = #{effPhaseInDate},
  245. eff_phase_out_date = #{effPhaseOutDate},
  246. eng_revision = #{engRevision},
  247. type_flag = #{typeFlag},
  248. net_weight = #{netWeight},
  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}
  253. </update>
  254. <!-- bom明细表编辑 -->
  255. <update id="updateBomDetail" parameterType="BomDetailEntity">
  256. update plm_bom_detail
  257. set alternative_description = #{alternativeDescription},
  258. min_lot_qty = #{minLotQty},
  259. note_text = #{detailNoteText},
  260. status = #{status},
  261. update_date = getDate(),
  262. update_by = #{updateBy}
  263. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
  264. </update>
  265. <!-- 删除bom子明细 -->
  266. <delete id="deleteBomComponent" parameterType="BomAllFieldEntity">
  267. delete from plm_bom_component
  268. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
  269. </delete>
  270. <!-- 删除替代 -->
  271. <delete id="bomDetailDelete" parameterType="BomDetailEntity">
  272. delete from plm_bom_detail
  273. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
  274. </delete>
  275. <!-- bom主表查重 -->
  276. <select id="checkBomOnlyOne" parameterType="BomAllFieldEntity" resultType="com.xujie.sys.modules.part.vo.BomHeaderVo">
  277. SELECT
  278. site,
  279. bu_no,
  280. part_no,
  281. dbo.qc_get_part_desc(site, bu_no, part_no) as partDesc,
  282. bom_type,
  283. eng_chg_level,
  284. eff_phase_in_date,
  285. eff_phase_out_date,
  286. eng_revision,
  287. type_flag,
  288. net_weight,
  289. note_text
  290. FROM plm_bom_header
  291. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel}
  292. </select>
  293. <!-- bom明细查重 -->
  294. <select id="checkBomDetailOnlyOne" parameterType="BomDetailEntity" resultType="BomDetailEntity">
  295. SELECT
  296. site,
  297. bu_no,
  298. part_no,
  299. bom_type,
  300. eng_chg_level,
  301. alternative_no,
  302. alternative_description,
  303. bom_type,
  304. eng_chg_level,
  305. min_lot_qty,
  306. default_flag,
  307. note_text as detailNoteText,
  308. status
  309. FROM plm_bom_detail
  310. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo}
  311. </select>
  312. <!-- 批量删除子明细物料 -->
  313. <delete id="deleteBomComponents" parameterType="BomComponentEntity">
  314. delete from plm_bom_component
  315. where site = #{site}
  316. and bu_no = #{buNo}
  317. and part_no = #{partNo}
  318. and eng_chg_level = #{engChgLevel}
  319. and bom_type = #{bomType}
  320. and alternative_no = #{alternativeNo}
  321. and line_item_no = #{lineItemNo}
  322. </delete>
  323. <!-- 删除bom子明细 -->
  324. <delete id="deleteBomComponentByPartNo" parameterType="BomHeaderEntity">
  325. delete from plm_bom_component
  326. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
  327. </delete>
  328. <!-- 删除bom明细 -->
  329. <delete id="deleteBomDetailByPartNo" parameterType="BomHeaderEntity">
  330. delete from plm_bom_detail
  331. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
  332. </delete>
  333. <!-- 删除bom主记录 -->
  334. <delete id="deleteBomHeaderByPartNo" parameterType="BomHeaderEntity">
  335. delete from plm_bom_header
  336. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
  337. </delete>
  338. <!-- 修改bom子明细 -->
  339. <update id="updateBomComponent" parameterType="BomComponentEntity">
  340. update plm_bom_component
  341. set qty_per_assembly = #{qtyPerAssembly},
  342. component_scrap = #{componentScrap},
  343. issue_type = #{issueType},
  344. shrinkage_factor = #{shrinkageFactor},
  345. operation_id = #{operationId},
  346. issue_to_loc = #{issueToLoc},
  347. note_text = #{noteText},
  348. line_sequence = #{lineSequence},
  349. consumption_item = #{consumptionItem},
  350. update_date = getDate(),
  351. update_by = #{updateBy}
  352. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} and line_item_no = #{lineItemNo}
  353. </update>
  354. <!-- 查bom明细对象 -->
  355. <select id="queryOperationList" parameterType="OperationEntity" resultType="OperationEntity">
  356. select
  357. a.site,
  358. a.bu_no,
  359. a.part_no,
  360. a.routing_revision,
  361. a.routing_type,
  362. a.alternative_no,
  363. b.alternative_description,
  364. b.status,
  365. a.operation_id,
  366. a.operation_no,
  367. a.operation_name
  368. from plm_routing_component as a
  369. left join plm_routing_detail as b on a.site = b.site and a.bu_no = b.bu_no and a.part_no = b.part_no and a.routing_revision = b.routing_revision and a.routing_type = b.routing_type and a.alternative_no = b.alternative_no
  370. <where>
  371. a.site = #{site} and a.bu_no = #{buNo} and a.part_no = #{partNo}
  372. <if test = "routingRevision != null and routingRevision != ''">
  373. AND a.routing_revision = #{routingRevision}
  374. </if>
  375. <if test = "routingType != null and routingType != ''">
  376. AND a.routing_type = #{routingType}
  377. </if>
  378. <if test = "alternativeNo != null and alternativeNo != ''">
  379. AND a.alternative_no = #{alternativeNo}
  380. </if>
  381. <if test = "operationNo != null and operationNo != ''">
  382. AND a.operation_no = #{operationNo}
  383. </if>
  384. <if test = "operationName != null and operationName != ''">
  385. AND a.operation_name like #{operationName}
  386. </if>
  387. <if test = "operationId != null and operationId != ''">
  388. AND a.operation_id = #{operationId}
  389. </if>
  390. </where>
  391. </select>
  392. <!-- 查 max line_item_no -->
  393. <select id="selectMaxLineItemNo" parameterType="BomComponentEntity" resultType="BomComponentEntity">
  394. SELECT
  395. site,
  396. bu_no,
  397. part_no,
  398. eng_chg_level,
  399. bom_type,
  400. alternative_no,
  401. component_part,
  402. line_item_no
  403. FROM plm_bom_component
  404. WHERE site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} and line_item_no = (
  405. SELECT MAX(line_item_no)
  406. FROM plm_bom_component
  407. WHERE site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo})
  408. </select>
  409. <!-- 判断是否已有该物料的 bom -->
  410. <select id="queryPartBom" parameterType="BomAllFieldEntity" resultType="com.xujie.sys.modules.part.vo.BomHeaderVo">
  411. SELECT top 1
  412. site,
  413. bu_no,
  414. part_no,
  415. bom_type,
  416. eng_chg_level,
  417. note_text,
  418. eff_phase_in_date,
  419. eff_phase_out_date,
  420. eng_revision,
  421. net_weight
  422. FROM plm_bom_header
  423. WHERE site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and bom_type = #{bomType} order by eng_chg_level desc
  424. </select>
  425. <!-- 获取子料的序号 -->
  426. <select id="getComponentLineSequence" parameterType="BomAllFieldEntity" resultType="com.xujie.sys.modules.part.vo.BomComponentVo">
  427. SELECT top 1
  428. site,
  429. bu_no,
  430. part_no,
  431. eng_chg_level,
  432. bom_type,
  433. alternative_no,
  434. line_sequence
  435. FROM plm_bom_component
  436. WHERE site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} order by line_sequence desc
  437. </select>
  438. <!-- 判断该 bom 是否有 Buildable Obsolete 状态的替代 -->
  439. <select id="queryAlternativeStatus" parameterType="BomHeaderEntity" resultType="com.xujie.sys.modules.part.vo.BomDetailVo">
  440. SELECT
  441. site,
  442. part_no,
  443. eng_chg_level,
  444. bom_type,
  445. alternative_no,
  446. status
  447. FROM plm_bom_detail
  448. WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and (status = 'Buildable' or status = 'Obsolete')
  449. </select>
  450. <!-- 判断 BOM 是否存在子料 -->
  451. <select id="queryComponentPart" parameterType="BomHeaderEntity" resultType="com.xujie.sys.modules.part.vo.BomComponentVo">
  452. SELECT
  453. site,
  454. part_no,
  455. eng_chg_level,
  456. bom_type,
  457. alternative_no,
  458. component_part
  459. FROM plm_bom_component
  460. WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
  461. </select>
  462. <!-- 获取bom header 对象-->
  463. <select id="queryBomHeader" parameterType="BomHeaderEntity" resultType="BomHeaderEntity">
  464. SELECT
  465. site,
  466. bu_no,
  467. part_no,
  468. eng_chg_level,
  469. bom_type,
  470. note_text,
  471. eff_phase_in_date,
  472. eff_phase_out_date,
  473. eng_revision,
  474. type_flag,
  475. net_weight
  476. FROM plm_bom_header
  477. WHERE site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
  478. </select>
  479. <!-- 新增BOM子明细表内容 -->
  480. <insert id="saveBomComponents">
  481. insert into plm_bom_component
  482. (site, bu_no, part_no, eng_chg_level, bom_type, alternative_no, component_part, line_item_no, print_unit, qty_per_assembly, component_scrap, shrinkage_factor, issue_type, issue_to_loc, operation_id, note_text, create_date, create_by, line_sequence, consumption_item) VALUES
  483. <foreach collection="list" item="item" index="index" separator=",">
  484. (#{item.site}, #{item.buNo}, #{item.partNo}, #{item.engChgLevel}, #{item.bomType}, #{item.alternativeNo}, #{item.componentPart}, #{item.lineItemNo}, #{item.printUnit}, #{item.qtyPerAssembly}, #{item.componentScrap}, #{item.shrinkageFactor}, #{item.issueType}, #{item.issueToLoc}, #{item.operationId}, #{item.noteText}, getDate(), #{item.createBy}, #{item.lineSequence}, #{item.consumptionItem})
  485. </foreach>
  486. </insert>
  487. <!-- 判断 BOM 是否存在子料 -->
  488. <select id="queryComponentPart2" parameterType="BomDetailEntity" resultType="com.xujie.sys.modules.part.vo.BomComponentVo">
  489. SELECT
  490. site,
  491. bu_no,
  492. part_no,
  493. eng_chg_level,
  494. bom_type,
  495. alternative_no,
  496. component_part
  497. FROM plm_bom_component
  498. WHERE site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
  499. </select>
  500. <!-- 修改替代状态 -->
  501. <update id="updateAlternativeStatus" parameterType="BomDetailEntity">
  502. update plm_bom_detail
  503. set status = #{status},
  504. update_date = getDate(),
  505. update_by = #{updateBy}
  506. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
  507. </update>
  508. <select id="getComponentByLineSequenceNo" parameterType="BomComponentEntity" resultType="BomComponentEntity">
  509. SELECT
  510. site,
  511. bu_no,
  512. part_no,
  513. eng_chg_level,
  514. bom_type,
  515. alternative_no,
  516. component_part,
  517. line_sequence
  518. FROM plm_bom_component
  519. WHERE site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} and line_sequence = #{lineSequence}
  520. </select>
  521. <!-- bom主表编辑 -->
  522. <update id="updateInDate" parameterType="BomHeaderEntity">
  523. update plm_bom_header
  524. set eff_phase_out_date = #{effPhaseOutDate},
  525. update_date = getDate(),
  526. update_by = #{createBy}
  527. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
  528. </update>
  529. <!-- 查出所有类型的物料 -->
  530. <select id="queryPartListAll" parameterType="ComponentPartData" resultType="BomAllFieldEntity">
  531. SELECT
  532. site,
  533. sourceBu as buNo,
  534. part_no,
  535. part_desc,
  536. spec,
  537. umid as printUnit,
  538. dbo.qc_get_um_name(site, umid) as printUnitName,
  539. part_type,
  540. FamilyID,
  541. dbo.get_family_name(site, sourceBu, FamilyID) as familyName
  542. FROM part
  543. <where>
  544. site = #{query.site}
  545. and sourceBu = #{query.buNo}
  546. and active = 'Y'
  547. <!-- and part_type <![CDATA[<>]]> 'Purchased (raw)' -->
  548. <if test = "query.partNo != null and query.partNo != ''">
  549. AND part_no like '%' + #{query.partNo} + '%'
  550. </if>
  551. <if test = "query.partDesc != null and query.partDesc != ''">
  552. AND part_desc like '%' + #{query.partDesc} + '%'
  553. </if>
  554. </where>
  555. </select>
  556. </mapper>