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.

1131 lines
47 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
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.spring.modules.part.mapper.RecipeManagementMapper">
  4. <!-- 材料信息列表 -->
  5. <select id="recipeManagementSearch" parameterType="com.spring.modules.part.vo.RecipeHeaderVo" resultType="com.spring.modules.part.vo.RecipeHeaderVo">
  6. SELECT
  7. a.site,
  8. a.part_no,
  9. dbo.get_part_name(a.site, a.part_no) as partDesc,
  10. a.eng_chg_level,
  11. a.bom_type,
  12. a.note_text,
  13. a.eff_phase_in_date,
  14. a.eff_phase_out_date,
  15. a.eng_revision,
  16. a.type_flag,
  17. a.net_weight,
  18. a.create_date,
  19. a.create_by,
  20. a.update_date,
  21. a.update_by,
  22. b.um_id as printUnit,
  23. dbo.get_um_name(b.um_id) as printUnitName,
  24. a.official_flag,
  25. b.ifs_part_no
  26. FROM plm_recipe_header as a
  27. left join part as b on a.site = b.site and a.part_no = b.part_no
  28. <where>
  29. a.site = #{query.site}
  30. AND NOT (b.status = 'Y' AND (b.plm_part_no IS NULL OR b.plm_part_no = ''))
  31. <if test = "query.partNo != null and query.partNo != ''">
  32. AND a.part_no like #{query.partNo}
  33. </if>
  34. <if test = "query.partDesc != null and query.partDesc != ''">
  35. AND dbo.get_part_name(a.site, a.part_no) like #{query.partDesc}
  36. </if>
  37. <if test = "query.bomType != null and query.bomType != ''">
  38. AND a.bom_type = #{query.bomType}
  39. </if>
  40. <if test = "query.engChgLevel != null and query.engChgLevel != ''">
  41. AND a.eng_chg_level = #{query.engChgLevel}
  42. </if>
  43. </where>
  44. </select>
  45. <!-- 查询物料清单 -->
  46. <select id="queryPartList" parameterType="ComponentPartData" resultType="RecipeAllFieldEntity">
  47. SELECT
  48. site,
  49. part_no,
  50. part_desc,
  51. spec,
  52. um_id as printUnit,
  53. dbo.get_um_name(um_id) as printUnitName,
  54. part_type,
  55. family_id,
  56. dbo.get_family_name(site, family_id) as familyName,
  57. part_status,
  58. dbo.get_part_status_name(site, part_status) as partStatusDesc
  59. FROM part
  60. <where>
  61. site = #{query.site}
  62. and part_type in ('Manufactured', 'Manufactured Recipe', 'Purchased')
  63. and active = 'Y'
  64. <if test = "query.partNo != null and query.partNo != ''">
  65. AND part_no = #{query.partNo}
  66. </if>
  67. <if test = "query.partDesc != null and query.partDesc != ''">
  68. AND part_desc like #{query.partDesc}
  69. </if>
  70. <if test = "query.status != null and query.status != ''">
  71. AND status = #{query.status}
  72. </if>
  73. </where>
  74. </select>
  75. <!-- 查出可创建Recipe的物料 -->
  76. <select id="queryPartListRecipe" parameterType="ComponentPartData" resultType="RecipeAllFieldEntity">
  77. SELECT
  78. site,
  79. part_no,
  80. part_desc,
  81. spec,
  82. um_id as printUnit,
  83. dbo.get_um_name(um_id) as printUnitName,
  84. part_type,
  85. family_id,
  86. dbo.get_family_name(site, family_id) as familyName,
  87. part_status,
  88. dbo.get_part_status_name(site, part_status) as partStatusDesc
  89. FROM part
  90. <where>
  91. site = #{query.site}
  92. and active = 'Y'
  93. and part_type <![CDATA[<>]]> 'Purchased (raw)'
  94. <if test = "query.partNo != null and query.partNo != ''">
  95. AND part_no = #{query.partNo}
  96. </if>
  97. <if test = "query.partDesc != null and query.partDesc != ''">
  98. AND part_desc like #{query.partDesc}
  99. </if>
  100. <if test = "query.status != null and query.status != ''">
  101. AND status = #{query.status}
  102. </if>
  103. </where>
  104. </select>
  105. <!-- 查出所有类型的物料 -->
  106. <select id="queryPartListAll" parameterType="ComponentPartData" resultType="RecipeAllFieldEntity">
  107. SELECT
  108. site,
  109. part_no,
  110. part_desc,
  111. spec,
  112. um_id as printUnit,
  113. dbo.get_um_name(um_id) as printUnitName,
  114. part_type,
  115. family_id,
  116. dbo.get_family_name(site, family_id) as familyName,
  117. part_status,
  118. dbo.get_part_status_name(site, part_status) as partStatusDesc
  119. FROM part
  120. <where>
  121. site = #{query.site}
  122. and active = 'Y'
  123. <if test = "query.partNo != null and query.partNo != ''">
  124. AND part_no like #{query.partNo}
  125. </if>
  126. <if test = "query.partDesc != null and query.partDesc != ''">
  127. AND part_desc like #{query.partDesc}
  128. </if>
  129. <if test = "query.status != null and query.status != ''">
  130. AND status = #{query.status}
  131. </if>
  132. </where>
  133. </select>
  134. <!-- 新增Recipe主表内容 -->
  135. <insert id="saveRecipeHeader" parameterType="RecipeHeaderEntity">
  136. INSERT INTO plm_recipe_header
  137. (site, part_no, eng_chg_level, bom_type, note_text, eff_phase_in_date, eff_phase_out_date, eng_revision, type_flag, net_weight, official_flag, create_date, create_by)
  138. VALUES
  139. (#{site}, #{partNo}, #{engChgLevel}, #{bomType}, #{noteText}, #{effPhaseInDate}, #{effPhaseOutDate}, #{engRevision}, #{typeFlag}, #{netWeight}, #{officialFlag}, getDate(), #{createBy})
  140. </insert>
  141. <!-- recipe明细新增 -->
  142. <insert id="recipeDetailSave" parameterType="RecipeDetailEntity">
  143. INSERT INTO plm_recipe_detail
  144. (site, part_no, eng_chg_level, bom_type, alternative_no, alternative_description, status, min_lot_qty, default_flag, note_text, create_date, create_by, official_flag, display_weight_uom, display_volume_uom, reg_unit)
  145. VALUES
  146. (#{site}, #{partNo}, #{engChgLevel}, #{bomType}, #{alternativeNo}, #{alternativeDescription}, #{status}, #{minLotQty}, #{defaultFlag}, #{detailNoteText}, getDate(), #{createBy}, #{officialFlag}, #{displayWeightUom}, #{displayVolumeUom}, #{regUnit})
  147. </insert>
  148. <!-- 新增Recipe子明细表内容 -->
  149. <insert id="saveRecipeComponent" parameterType="RecipeComponentEntity">
  150. INSERT INTO plm_recipe_component
  151. (site, 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,
  152. issue_to_loc, operation_no, note_text, create_date, create_by, line_sequence, consumption_item, parts_by_weight, qty_uom, issue_planned_scrap_db, issue_overreported_qty_db,
  153. fixed_qty_flag, promise_planned, phantom_consume, oper_cost_distribution, gen_oh_cost_distribution, qty_kg, by_prod_as_supply_in_mrp_db, leadtime_offset, std_planned_item,
  154. charged_item, last_activity_date, exclude_from_calculations_db, exclude_from_as_built_db, lot_batch_origin_db, weight_share)
  155. VALUES
  156. (#{site}, #{partNo}, #{engChgLevel}, #{bomType}, #{alternativeNo}, #{componentPart}, #{lineItemNo}, #{printUnit}, #{qtyPerAssembly}, #{componentScrap}, #{shrinkageFactor}, #{issueType},
  157. #{issueToLoc}, #{operationNo}, #{noteText}, getDate(), #{createBy}, #{lineSequence}, #{consumptionItem}, #{partsByWeight}, #{qtyUom}, #{issuePlannedScrapDb}, #{issueOverreportedQtyDb},
  158. #{fixedQtyFlag}, #{promisePlanned}, #{phantomConsume}, #{operCostDistribution}, #{genOhCostDistribution}, #{qtyKg}, #{byProdAsSupplyInMrpDb}, #{leadtimeOffset}, #{stdPlannedItem},
  159. #{chargedItem}, getDate(), #{excludeFromCalculationsDb}, #{excludeFromAsBuiltDb}, #{lotBatchOriginDb}, #{weightShare})
  160. </insert>
  161. <!-- 查recipe明细 -->
  162. <select id="queryRecipeDetail" parameterType="RecipeHeaderEntity" resultType="RecipeDetailEntity">
  163. SELECT
  164. site,
  165. part_no,
  166. bom_type,
  167. eng_chg_level,
  168. alternative_no,
  169. alternative_description,
  170. status,
  171. min_lot_qty,
  172. default_flag,
  173. note_text as detailNoteText,
  174. official_flag,
  175. display_weight_uom,
  176. display_volume_uom,
  177. reg_unit
  178. FROM plm_recipe_detail
  179. where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel}
  180. </select>
  181. <!-- 查recipe明细对象 -->
  182. <select id="queryDetailDataByNo" parameterType="RecipeDetailEntity" resultType="RecipeDetailEntity">
  183. SELECT
  184. site,
  185. part_no,
  186. bom_type,
  187. eng_chg_level,
  188. alternative_no,
  189. alternative_description,
  190. status,
  191. min_lot_qty,
  192. default_flag,
  193. note_text as detailNoteText,
  194. official_flag,
  195. display_weight_uom,
  196. display_volume_uom,
  197. reg_unit
  198. FROM plm_recipe_detail
  199. where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo}
  200. </select>
  201. <!-- 查recipe子明细 -->
  202. <select id="queryRecipeComponent" parameterType="RecipeDetailEntity" resultType="com.spring.modules.part.vo.RecipeComponentVo">
  203. SELECT
  204. a.site,
  205. a.part_no,
  206. a.bom_type,
  207. a.eng_chg_level,
  208. a.alternative_no,
  209. a.component_part,
  210. b.part_desc as componentPartDesc,
  211. a.print_unit,
  212. dbo.get_um_name(a.print_unit) as printUnitName,
  213. a.qty_per_assembly,
  214. a.component_scrap,
  215. a.issue_type,
  216. a.shrinkage_factor,
  217. a.line_item_no,
  218. a.operation_no,
  219. a.issue_to_loc,
  220. dbo.get_location_name(a.site, a.issue_to_loc) as issueToLocName,
  221. a.note_text,
  222. a.line_sequence,
  223. a.consumption_item,
  224. b.part_status,
  225. dbo.get_part_status_name(a.site, b.part_status) as partStatusDesc,
  226. a.parts_by_weight,
  227. a.qty_uom,
  228. a.issue_planned_scrap_db,
  229. a.issue_overreported_qty_db,
  230. a.fixed_qty_flag,
  231. a.promise_planned,
  232. a.phantom_consume,
  233. a.oper_cost_distribution,
  234. a.gen_oh_cost_distribution,
  235. a.qty_kg,
  236. a.by_prod_as_supply_in_mrp_db,
  237. a.leadtime_offset,
  238. a.std_planned_item,
  239. a.charged_item,
  240. a.last_activity_date,
  241. a.exclude_from_calculations_db,
  242. a.exclude_from_as_built_db,
  243. a.lot_batch_origin_db,
  244. a.weight_share
  245. FROM plm_recipe_component as a
  246. left join part as b on a.site = b.site and a.component_part = b.part_no
  247. where a.site = #{site} and a.part_no = #{partNo} and a.bom_type = #{bomType} and a.eng_chg_level = #{engChgLevel} and a.alternative_no = #{alternativeNo} and a.qty_per_assembly <![CDATA[ >= ]]> 0
  248. order by a.line_sequence
  249. </select>
  250. <!-- 查recipe子明细 -->
  251. <select id="queryRecipeByProducts" parameterType="RecipeDetailEntity" resultType="com.spring.modules.part.vo.RecipeComponentVo">
  252. SELECT
  253. a.site,
  254. a.part_no,
  255. a.bom_type,
  256. a.eng_chg_level,
  257. a.alternative_no,
  258. a.component_part,
  259. b.part_desc as componentPartDesc,
  260. a.print_unit,
  261. dbo.get_um_name(a.print_unit) as printUnitName,
  262. abs(a.qty_per_assembly) as qtyPerAssembly,
  263. a.component_scrap,
  264. a.issue_type,
  265. a.shrinkage_factor,
  266. a.line_item_no,
  267. a.operation_no,
  268. a.issue_to_loc,
  269. dbo.get_location_name(a.site, a.issue_to_loc) as issueToLocName,
  270. a.note_text,
  271. a.line_sequence,
  272. a.consumption_item,
  273. b.part_status,
  274. dbo.get_part_status_name(a.site, b.part_status) as partStatusDesc,
  275. a.parts_by_weight,
  276. a.qty_uom,
  277. a.issue_planned_scrap_db,
  278. a.issue_overreported_qty_db,
  279. a.fixed_qty_flag,
  280. a.promise_planned,
  281. a.phantom_consume,
  282. a.oper_cost_distribution,
  283. a.gen_oh_cost_distribution,
  284. a.qty_kg,
  285. a.by_prod_as_supply_in_mrp_db,
  286. a.leadtime_offset,
  287. a.std_planned_item,
  288. a.charged_item,
  289. a.last_activity_date,
  290. a.exclude_from_calculations_db,
  291. a.exclude_from_as_built_db,
  292. a.lot_batch_origin_db,
  293. a.weight_share
  294. FROM plm_recipe_component as a
  295. left join part as b on a.site = b.site and a.component_part = b.part_no
  296. where a.site = #{site} and a.part_no = #{partNo} and a.bom_type = #{bomType} and a.eng_chg_level = #{engChgLevel} and a.alternative_no = #{alternativeNo} and a.qty_per_assembly <![CDATA[ < ]]> 0
  297. order by a.line_sequence
  298. </select>
  299. <!-- 查recipe子明细 -->
  300. <select id="queryRecipeComponentAll" parameterType="RecipeDetailEntity" resultType="com.spring.modules.part.vo.RecipeComponentVo">
  301. SELECT
  302. site,
  303. part_no,
  304. bom_type,
  305. eng_chg_level,
  306. alternative_no,
  307. component_part,
  308. dbo.get_part_name(site, component_part) as componentPartDesc,
  309. print_unit,
  310. dbo.get_um_name(print_unit) as printUnitName,
  311. qty_per_assembly,
  312. component_scrap,
  313. issue_type,
  314. shrinkage_factor,
  315. line_item_no,
  316. operation_no,
  317. issue_to_loc,
  318. dbo.get_location_name(site, issue_to_loc) as issueToLocName,
  319. note_text,
  320. line_sequence,
  321. consumption_item,
  322. parts_by_weight,
  323. qty_uom,
  324. issue_planned_scrap_db,
  325. issue_overreported_qty_db,
  326. fixed_qty_flag,
  327. promise_planned,
  328. phantom_consume,
  329. oper_cost_distribution,
  330. gen_oh_cost_distribution,
  331. qty_kg,
  332. by_prod_as_supply_in_mrp_db,
  333. leadtime_offset,
  334. std_planned_item,
  335. charged_item,
  336. last_activity_date,
  337. exclude_from_calculations_db,
  338. exclude_from_as_built_db,
  339. lot_batch_origin_db,
  340. weight_share
  341. FROM plm_recipe_component
  342. where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo}
  343. order by line_sequence
  344. </select>
  345. <!-- recipe主表编辑 -->
  346. <update id="updateRecipeHeader" parameterType="RecipeAllFieldEntity">
  347. update plm_recipe_header
  348. set eff_phase_in_date = #{effPhaseInDate},
  349. eff_phase_out_date = #{effPhaseOutDate},
  350. eng_revision = #{engRevision},
  351. type_flag = #{typeFlag},
  352. net_weight = #{netWeight},
  353. note_text = #{noteText},
  354. update_date = getDate(),
  355. update_by = #{updateBy}
  356. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
  357. </update>
  358. <!-- recipe明细表编辑 -->
  359. <update id="updateRecipeDetail" parameterType="RecipeDetailEntity">
  360. update plm_recipe_detail
  361. set alternative_description = #{alternativeDescription},
  362. min_lot_qty = #{minLotQty},
  363. note_text = #{detailNoteText},
  364. status = #{status},
  365. update_date = getDate(),
  366. update_by = #{updateBy},
  367. display_weight_uom = #{displayWeightUom},
  368. display_volume_uom = #{displayVolumeUom}
  369. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
  370. </update>
  371. <!-- 删除recipe子明细 -->
  372. <delete id="deleteRecipeComponent" parameterType="RecipeAllFieldEntity">
  373. delete from plm_recipe_component
  374. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
  375. </delete>
  376. <!-- 删除替代 -->
  377. <delete id="recipeDetailDelete" parameterType="RecipeDetailEntity">
  378. delete from plm_recipe_detail
  379. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
  380. </delete>
  381. <!-- recipe主表查重 -->
  382. <select id="checkRecipeOnlyOne" parameterType="RecipeAllFieldEntity" resultType="com.spring.modules.part.vo.RecipeHeaderVo">
  383. SELECT
  384. site,
  385. part_no,
  386. dbo.get_part_name(site, part_no) as partDesc,
  387. bom_type,
  388. eng_chg_level,
  389. eff_phase_in_date,
  390. eff_phase_out_date,
  391. eng_revision,
  392. type_flag,
  393. net_weight,
  394. note_text,
  395. official_flag
  396. FROM plm_recipe_header
  397. where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel}
  398. </select>
  399. <!-- recipe明细查重 -->
  400. <select id="checkRecipeDetailOnlyOne" parameterType="RecipeDetailEntity" resultType="RecipeDetailEntity">
  401. SELECT
  402. site,
  403. part_no,
  404. bom_type,
  405. eng_chg_level,
  406. alternative_no,
  407. alternative_description,
  408. bom_type,
  409. eng_chg_level,
  410. min_lot_qty,
  411. default_flag,
  412. note_text as detailNoteText,
  413. status,
  414. official_flag,
  415. display_weight_uom,
  416. display_volume_uom,
  417. reg_unit
  418. FROM plm_recipe_detail
  419. where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo}
  420. </select>
  421. <!-- 批量删除子明细物料 -->
  422. <delete id="deleteRecipeComponents" parameterType="RecipeComponentEntity">
  423. delete from plm_recipe_component
  424. where site = #{site}
  425. and part_no = #{partNo}
  426. and eng_chg_level = #{engChgLevel}
  427. and bom_type = #{bomType}
  428. and alternative_no = #{alternativeNo}
  429. and line_item_no = #{lineItemNo}
  430. </delete>
  431. <!-- 删除recipe子明细 -->
  432. <delete id="deleteRecipeComponentByPartNo" parameterType="RecipeHeaderEntity">
  433. delete from plm_recipe_component
  434. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
  435. </delete>
  436. <!-- 删除recipe明细 -->
  437. <delete id="deleteRecipeDetailByPartNo" parameterType="RecipeHeaderEntity">
  438. delete from plm_recipe_detail
  439. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
  440. </delete>
  441. <!-- 删除recipe主记录 -->
  442. <delete id="deleteRecipeHeaderByPartNo" parameterType="RecipeHeaderEntity">
  443. delete from plm_recipe_header
  444. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
  445. </delete>
  446. <!-- recipe明细查重 -->
  447. <select id="checkRecipeComponentOnlyOne" parameterType="RecipeComponentEntity" resultType="RecipeComponentEntity">
  448. SELECT
  449. site,
  450. part_no,
  451. bom_type,
  452. eng_chg_level,
  453. alternative_no,
  454. component_part,
  455. line_item_no
  456. FROM plm_recipe_component
  457. where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo} and line_item_no = #{lineItemNo}
  458. </select>
  459. <!-- 修改recipe子明细 -->
  460. <update id="updateRecipeComponent" parameterType="RecipeComponentEntity">
  461. update plm_recipe_component
  462. set qty_per_assembly = #{qtyPerAssembly},
  463. component_scrap = #{componentScrap},
  464. issue_type = #{issueType},
  465. shrinkage_factor = #{shrinkageFactor},
  466. operation_no = #{operationNo},
  467. issue_to_loc = #{issueToLoc},
  468. note_text = #{noteText},
  469. line_sequence = #{lineSequence},
  470. consumption_item = #{consumptionItem},
  471. update_date = getDate(),
  472. update_by = #{updateBy},
  473. weight_share = #{weightShare},
  474. parts_by_weight = #{partsByWeight},
  475. qty_uom = #{qtyUom},
  476. qty_kg = #{qtyKg}
  477. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} and line_item_no = #{lineItemNo}
  478. </update>
  479. <!-- 修改替代状态 -->
  480. <update id="updateAlternativeStatus" parameterType="RecipeDetailEntity">
  481. update plm_recipe_detail
  482. set status = #{status},
  483. update_date = getDate(),
  484. update_by = #{updateBy}
  485. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
  486. </update>
  487. <!-- 查recipe明细对象 -->
  488. <select id="queryOperationList" parameterType="OperationEntity" resultType="OperationEntity">
  489. select
  490. a.site,
  491. a.part_no,
  492. a.routing_revision,
  493. a.routing_type,
  494. a.alternative_no,
  495. b.alternative_description,
  496. b.status,
  497. a.operation_id,
  498. a.operation_no,
  499. a.operation_name
  500. from plm_routing_component as a
  501. left join plm_routing_detail as b on a.site = b.site 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
  502. <where>
  503. a.site = #{site} and a.part_no = #{partNo}
  504. <if test = "routingRevision != null and routingRevision != ''">
  505. AND a.routing_revision = #{routingRevision}
  506. </if>
  507. <if test = "routingType != null and routingType != ''">
  508. AND a.routing_type = #{routingType}
  509. </if>
  510. <if test = "alternativeNo != null and alternativeNo != ''">
  511. AND a.alternative_no = #{alternativeNo}
  512. </if>
  513. <if test = "operationNo != null and operationNo != ''">
  514. AND a.operation_no = #{operationNo}
  515. </if>
  516. <if test = "operationName != null and operationName != ''">
  517. AND a.operation_name like #{operationName}
  518. </if>
  519. <if test = "operationId != null and operationId != ''">
  520. AND a.operation_id = #{operationId}
  521. </if>
  522. </where>
  523. </select>
  524. <!-- 查 max line_item_no -->
  525. <select id="selectMaxLineItemNo" parameterType="RecipeComponentEntity" resultType="RecipeComponentEntity">
  526. SELECT
  527. site,
  528. part_no,
  529. eng_chg_level,
  530. bom_type,
  531. alternative_no,
  532. component_part,
  533. line_item_no
  534. FROM plm_recipe_component
  535. WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} and line_item_no = (
  536. SELECT MAX(line_item_no)
  537. FROM plm_recipe_component
  538. WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo})
  539. </select>
  540. <!-- 判断是否已有该物料的 recipe -->
  541. <select id="queryPartRecipe" parameterType="RecipeAllFieldEntity" resultType="com.spring.modules.part.vo.RecipeHeaderVo">
  542. SELECT top 1
  543. site,
  544. part_no,
  545. bom_type,
  546. eng_chg_level,
  547. note_text,
  548. eff_phase_in_date,
  549. eff_phase_out_date,
  550. eng_revision,
  551. net_weight,
  552. official_flag
  553. FROM plm_recipe_header
  554. WHERE site = #{site} and part_no = #{partNo} and bom_type = #{bomType} order by eng_chg_level desc
  555. </select>
  556. <!-- 获取子料的序号 -->
  557. <select id="getComponentLineSequence" parameterType="RecipeAllFieldEntity" resultType="com.spring.modules.part.vo.RecipeComponentVo">
  558. SELECT top 1
  559. site,
  560. part_no,
  561. eng_chg_level,
  562. bom_type,
  563. alternative_no,
  564. line_sequence
  565. FROM plm_recipe_component
  566. WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} order by line_sequence desc
  567. </select>
  568. <!-- 判断该 recipe 是否有 Buildable Obsolete 状态的替代 -->
  569. <select id="queryAlternativeStatus" parameterType="RecipeHeaderEntity" resultType="com.spring.modules.part.vo.RecipeDetailVo">
  570. SELECT
  571. site,
  572. part_no,
  573. eng_chg_level,
  574. bom_type,
  575. alternative_no,
  576. status,
  577. display_weight_uom,
  578. display_volume_uom,
  579. reg_unit
  580. FROM plm_recipe_detail
  581. WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and (status = 'Buildable' or status = 'Obsolete')
  582. </select>
  583. <!-- 判断该 Recipe 是否有正式的替代 -->
  584. <select id="queryOfficialRecipeDetail" parameterType="RecipeHeaderEntity" resultType="com.spring.modules.part.vo.RecipeDetailVo">
  585. SELECT
  586. site,
  587. part_no,
  588. eng_chg_level,
  589. bom_type,
  590. alternative_no,
  591. status,
  592. official_flag,
  593. display_weight_uom,
  594. display_volume_uom,
  595. reg_unit
  596. FROM plm_recipe_detail
  597. WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and official_flag = 'Y'
  598. </select>
  599. <!-- 判断 Recipe 是否存在子料 -->
  600. <select id="queryComponentPart" parameterType="RecipeHeaderEntity" resultType="com.spring.modules.part.vo.RecipeComponentVo">
  601. SELECT
  602. site,
  603. part_no,
  604. eng_chg_level,
  605. bom_type,
  606. alternative_no,
  607. component_part
  608. FROM plm_recipe_component
  609. WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
  610. </select>
  611. <!-- 判断 Recipe 是否存在子料 -->
  612. <select id="queryComponentPart2" parameterType="RecipeDetailEntity" resultType="com.spring.modules.part.vo.RecipeComponentVo">
  613. SELECT
  614. site,
  615. part_no,
  616. eng_chg_level,
  617. bom_type,
  618. alternative_no,
  619. component_part
  620. FROM plm_recipe_component
  621. WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
  622. </select>
  623. <!-- 获取ifs header 对象-->
  624. <select id="getRecipeHeader" parameterType="RecipeDetailEntity" resultType="RecipeIfsHeader">
  625. SELECT
  626. site as contract,
  627. part_no,
  628. eng_chg_level,
  629. bom_type,
  630. eff_phase_in_date,
  631. eff_phase_out_date,
  632. note_text,
  633. create_date,
  634. 'add' as histType
  635. FROM plm_recipe_header
  636. WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
  637. </select>
  638. <!-- 获取ifs component 对象-->
  639. <select id="getRecipeComponent" parameterType="RecipeDetailEntity" resultType="RecipeIfsItem">
  640. SELECT
  641. site as contract,
  642. part_no,
  643. eng_chg_level,
  644. bom_type,
  645. alternative_no,
  646. line_item_no,
  647. line_sequence,
  648. component_part,
  649. qty_per_assembly,
  650. issue_type,
  651. component_scrap,
  652. shrinkage_factor,
  653. note_text,
  654. consumption_item,
  655. operation_no,
  656. parts_by_weight,
  657. qty_uom,
  658. issue_planned_scrap_db,
  659. issue_overreported_qty_db,
  660. fixed_qty_flag,
  661. promise_planned,
  662. phantom_consume,
  663. oper_cost_distribution,
  664. gen_oh_cost_distribution,
  665. qty_kg,
  666. by_prod_as_supply_in_mrp_db,
  667. leadtime_offset,
  668. std_planned_item,
  669. charged_item,
  670. last_activity_date,
  671. exclude_from_calculations_db,
  672. exclude_from_as_built_db,
  673. lot_batch_origin_db,
  674. weight_share
  675. FROM plm_recipe_component
  676. WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
  677. </select>
  678. <!-- 获取recipe header 对象-->
  679. <select id="queryRecipeHeader" parameterType="RecipeHeaderEntity" resultType="RecipeHeaderEntity">
  680. SELECT
  681. site,
  682. part_no,
  683. eng_chg_level,
  684. bom_type,
  685. note_text,
  686. eff_phase_in_date,
  687. eff_phase_out_date,
  688. eng_revision,
  689. row_version,
  690. row_key,
  691. type_flag,
  692. net_weight
  693. FROM plm_recipe_header
  694. WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
  695. </select>
  696. <!-- recipe主表编辑 -->
  697. <update id="updateInDate" parameterType="RecipeHeaderEntity">
  698. update plm_recipe_header
  699. set eff_phase_out_date = #{effPhaseOutDate},
  700. update_date = getDate(),
  701. update_by = #{createBy}
  702. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
  703. </update>
  704. <!-- 校验物料版本是否存在-->
  705. <select id="queryPartRevision" parameterType="RecipeHeaderEntity" resultType="PartRevisionEntity">
  706. SELECT
  707. site,
  708. part_no,
  709. eng_chg_level,
  710. eff_phase_in_date,
  711. eff_phase_out_date,
  712. revision_text,
  713. product_status,
  714. repair_status,
  715. eng_revision,
  716. create_date,
  717. create_by,
  718. update_date,
  719. update_by
  720. FROM part_revision
  721. WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel}
  722. </select>
  723. <!-- 新增物料版本 -->
  724. <insert id="savePartRevision" parameterType="RecipeHeaderEntity">
  725. insert into part_revision (site, part_no, eng_chg_level, eff_phase_in_date, eff_phase_out_date, revision_text, product_status, repair_status, eng_revision, create_date, create_by)
  726. values (#{site}, #{partNo}, #{engChgLevel}, #{effPhaseInDate}, #{effPhaseOutDate}, #{noteText}, 'Not In Effect', 'Not In Effect', #{engRevision}, getDate(), #{createBy})
  727. </insert>
  728. <select id="queryRecipeDetailOfficialFlag" parameterType="RecipeComponentEntity" resultType="RecipeDetailEntity">
  729. SELECT
  730. site,
  731. part_no,
  732. bom_type,
  733. eng_chg_level,
  734. alternative_no,
  735. alternative_description,
  736. min_lot_qty,
  737. default_flag,
  738. note_text as detailNoteText,
  739. status,
  740. official_flag,
  741. display_weight_uom,
  742. display_volume_uom,
  743. reg_unit
  744. FROM plm_recipe_detail
  745. where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo}
  746. </select>
  747. <!-- 获取 component 对象-->
  748. <select id="queryComponentPartFlag" parameterType="RecipeDetailEntity" resultType="PartInformationEntity">
  749. SELECT
  750. a.site,
  751. a.part_no,
  752. b.status
  753. FROM plm_recipe_component as a
  754. LEFT JOIN part as b on a.site = b.site and a.component_part = b.part_no
  755. WHERE a.site = #{site} and a.part_no = #{partNo} and a.eng_chg_level = #{engChgLevel} and a.bom_type = #{bomType} and a.alternative_no = #{alternativeNo}
  756. </select>
  757. <select id="queryRecipeDetailEntityList" resultType="com.spring.modules.part.entity.RecipeDetailEntity">
  758. SELECT
  759. site,
  760. part_no,
  761. bom_type,
  762. eng_chg_level,
  763. alternative_no,
  764. alternative_description,
  765. status,
  766. min_lot_qty,
  767. default_flag,
  768. note_text as detailNoteText,
  769. official_flag,
  770. display_weight_uom,
  771. display_volume_uom,
  772. reg_unit
  773. FROM plm_recipe_detail
  774. where site = #{site} and part_no = #{partNo}
  775. order by eng_chg_level desc
  776. </select>
  777. <!-- 查询库位 -->
  778. <select id="selectLocation" parameterType="RecipeComponentEntity" resultType="LocationInformationEntity">
  779. SELECT
  780. site,
  781. location_id,
  782. location_name
  783. FROM view_location
  784. <where>
  785. site = #{site} AND location_id = #{issueToLoc}
  786. </where>
  787. </select>
  788. <!-- 查询part revision -->
  789. <select id="selectPartRevision" parameterType="RecipeDetailEntity" resultType="com.spring.modules.part.vo.PartRevisionVo">
  790. SELECT
  791. site,
  792. part_no,
  793. eng_chg_level,
  794. eff_phase_in_date,
  795. eff_phase_out_date,
  796. revision_text,
  797. product_status,
  798. repair_status,
  799. eng_revision
  800. FROM part_revision
  801. where site = #{site} AND part_no = #{partNo} and eng_chg_level = #{engChgLevel}
  802. </select>
  803. <!-- 修改revision状态 -->
  804. <update id="updatePartRevisionProductStatus" parameterType="com.spring.modules.part.vo.PartRevisionVo">
  805. update part_revision
  806. set product_status = #{productStatus},
  807. <if test = "bomType == 'Repair'">
  808. repair_status = 'In Effect',
  809. </if>
  810. update_date = getDate(),
  811. update_by = #{updateBy}
  812. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel}
  813. </update>
  814. <!-- 新增副产品成本分配数据 -->
  815. <insert id="saveRecipeManufStructCostDistrib">
  816. insert into plm_recipe_manuf_struct_cost_distrib
  817. (site, part_no, eng_chg_level, bom_type, alternative_no, by_prod_line_item_no, component_line_item_no, item_cost_distribution, component_part_no, by_prod_part_no, create_date, create_by) VALUES
  818. <foreach collection="list" item="item" index="index" separator=",">
  819. (#{item.site}, #{item.partNo}, #{item.engChgLevel}, #{item.bomType}, #{item.alternativeNo}, #{item.byProdLineItemNo}, #{item.componentLineItemNo}, #{item.itemCostDistribution,jdbcType=FLOAT}, #{item.componentPartNo}, #{item.byProdPartNo}, getDate(), #{item.createBy})
  820. </foreach>
  821. </insert>
  822. <!-- 查recipe副产品成本分配 -->
  823. <select id="queryRecipeManufStructCostDistrib" parameterType="RecipeDetailEntity" resultType="com.spring.modules.part.vo.RecipeManufStructCostDistribVo">
  824. SELECT
  825. site,
  826. part_no,
  827. bom_type,
  828. eng_chg_level,
  829. alternative_no,
  830. by_prod_line_item_no,
  831. component_line_item_no,
  832. item_cost_distribution,
  833. component_part_no,
  834. dbo.get_part_name(site, component_part_no) as componentPartDesc,
  835. by_prod_part_no,
  836. dbo.get_part_name(site, by_prod_part_no) as byProdPartDesc
  837. FROM plm_recipe_manuf_struct_cost_distrib
  838. where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo}
  839. </select>
  840. <delete id="deletemanufStructCostDistribByProductPartNo" parameterType="RecipeComponentEntity">
  841. delete from plm_recipe_manuf_struct_cost_distrib
  842. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} and by_prod_line_item_no = #{lineItemNo}
  843. </delete>
  844. <delete id="deletemanufStructCostDistribByComponentPartNo" parameterType="RecipeComponentEntity">
  845. delete from plm_recipe_manuf_struct_cost_distrib
  846. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} and component_line_item_no = #{lineItemNo}
  847. </delete>
  848. <!-- 编辑副产品成本分配 -->
  849. <update id="updateManufStructCostDistrib" parameterType="com.spring.modules.part.vo.RecipeManufStructCostDistribVo">
  850. update plm_recipe_manuf_struct_cost_distrib
  851. set item_cost_distribution = #{itemCostDistribution,jdbcType=FLOAT},
  852. update_date = getDate(),
  853. update_by = #{updateBy}
  854. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} and by_prod_line_item_no = #{byProdLineItemNo} and component_line_item_no = #{componentLineItemNo}
  855. </update>
  856. <!-- 查recipe子明细 -->
  857. <select id="queryRecipeMultiLevelStructureList" parameterType="RecipeDetailEntity" resultType="RecipeMultiLevelStructureData">
  858. SELECT
  859. a.site,
  860. a.part_no,
  861. dbo.get_part_name(a.site, a.part_no) as partDesc,
  862. a.bom_type,
  863. a.eng_chg_level,
  864. a.alternative_no,
  865. b.alternative_description,
  866. a.component_part,
  867. dbo.get_part_name(a.site, a.component_part) as componentPartDesc,
  868. a.qty_per_assembly,
  869. a.print_unit,
  870. dbo.get_um_name(a.print_unit) as printUnitName,
  871. c.product_group_id4,
  872. dbo.get_product_group_name(c.site, c.product_group_id4, '4') as productGroupName4,
  873. c.min_order_qty,
  874. c.mul_order_qty,
  875. c.planning_method,
  876. c.cum_lead_time,
  877. c.unprotected_lead_time,
  878. dbo.get_cum_lead_time(a.site, a.component_part) as componentCumLeadTime,
  879. dbo.get_unprotected_lead_time(a.site, a.component_part) as componentUnprotectedLeadTime
  880. FROM plm_recipe_component as a
  881. LEFT JOIN plm_recipe_detail as b on a.site = b.site and a.part_no = b.part_no and a.bom_type = b.bom_type and a.eng_chg_level = b.eng_chg_level and a.alternative_no = b.alternative_no
  882. LEFT JOIN part as c on a.site = c.site and a.part_no = c.part_no
  883. where a.site = #{site} and a.part_no = #{partNo} and a.bom_type = #{bomType} and a.eng_chg_level = #{engChgLevel} and a.alternative_no = #{alternativeNo}
  884. </select>
  885. <!-- 新增Recipe子明细表内容 -->
  886. <insert id="saveRecipeComponents">
  887. insert into plm_recipe_component
  888. (site, 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,
  889. issue_to_loc, operation_no, note_text, create_date, create_by, line_sequence, consumption_item, parts_by_weight, qty_uom, issue_planned_scrap_db, issue_overreported_qty_db,
  890. fixed_qty_flag, promise_planned, phantom_consume, oper_cost_distribution, gen_oh_cost_distribution, qty_kg, by_prod_as_supply_in_mrp_db, leadtime_offset, std_planned_item,
  891. charged_item, last_activity_date, exclude_from_calculations_db, exclude_from_as_built_db, lot_batch_origin_db, weight_share)
  892. VALUES
  893. <foreach collection="list" item="item" index="index" separator=",">
  894. (#{item.site}, #{item.partNo}, #{item.engChgLevel}, #{item.bomType}, #{item.alternativeNo}, #{item.componentPart}, #{item.lineItemNo}, #{item.printUnit}, #{item.qtyPerAssembly}, #{item.componentScrap}, #{item.shrinkageFactor}, #{item.issueType},
  895. #{item.issueToLoc}, #{item.operationNo}, #{item.noteText}, getDate(), #{item.createBy}, #{item.lineSequence}, #{item.consumptionItem}, #{item.partsByWeight}, #{item.qtyUom}, #{item.issuePlannedScrapDb}, #{item.issueOverreportedQtyDb},
  896. #{item.fixedQtyFlag}, #{item.promisePlanned}, #{item.phantomConsume}, #{item.operCostDistribution}, #{item.genOhCostDistribution}, #{item.qtyKg}, #{item.byProdAsSupplyInMrpDb}, #{item.leadtimeOffset}, #{item.stdPlannedItem},
  897. #{item.chargedItem}, getDate(), #{item.excludeFromCalculationsDb}, #{item.excludeFromAsBuiltDb}, #{item.lotBatchOriginDb}, #{item.weightShare})
  898. </foreach>
  899. </insert>
  900. <update id="updateRecipeHeaderOfficialFlag" parameterType="com.spring.modules.part.vo.RecipeDetailVo">
  901. update plm_recipe_header
  902. set official_flag = 'Y'
  903. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
  904. </update>
  905. <update id="updateRecipeDetailOfficialFlag" parameterType="com.spring.modules.part.vo.RecipeDetailVo">
  906. update plm_recipe_detail
  907. set official_flag = 'Y'
  908. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
  909. </update>
  910. <!-- 查recipe副产品成本分配 -->
  911. <select id="queryRecipeManufStructCostDistribToIfs" resultType="RecipeIfsManufStructCostDistrib">
  912. SELECT
  913. site as contract,
  914. part_no,
  915. bom_type,
  916. eng_chg_level,
  917. alternative_no,
  918. by_prod_line_item_no,
  919. component_line_item_no,
  920. item_cost_distribution,
  921. component_part_no,
  922. by_prod_part_no as byProductPartNo,
  923. FROM plm_recipe_manuf_struct_cost_distrib
  924. where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo}
  925. </select>
  926. <delete id="deleteManufStructCostDistribByAlternative" parameterType="RecipeDetailEntity">
  927. delete from plm_recipe_manuf_struct_cost_distrib
  928. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
  929. </delete>
  930. <select id="selectRecipeHeaderByPartNo" resultType="com.spring.modules.part.vo.RecipeHeaderVo">
  931. SELECT
  932. a.site,
  933. a.part_no,
  934. a.bom_type,
  935. a.eng_chg_level,
  936. a.note_text,
  937. a.eff_phase_in_date,
  938. a.eff_phase_out_date,
  939. a.eng_revision,
  940. a.type_flag,
  941. a.net_weight,
  942. a.official_flag
  943. FROM plm_recipe_header as a
  944. left join part_revision as b on a.site = b.site and a.part_no = b.part_no and a.eng_chg_level = b.eng_chg_level
  945. where a.site = #{site} and a.part_no = #{partNo} and b.eff_phase_out_date is null
  946. </select>
  947. <select id="selectRecipeDetailByPartNo" resultType="com.spring.modules.part.vo.RecipeDetailVo">
  948. SELECT
  949. a.site,
  950. a.part_no,
  951. a.bom_type,
  952. a.eng_chg_level,
  953. a.alternative_no,
  954. a.alternative_description,
  955. a.status,
  956. a.min_lot_qty,
  957. a.default_flag,
  958. a.note_text as detailNoteText,
  959. a.official_flag,
  960. a.display_weight_uom,
  961. a.display_volume_uom,
  962. a.reg_unit
  963. FROM plm_recipe_detail as a
  964. left join part_revision as b on a.site = b.site and a.part_no = b.part_no and a.eng_chg_level = b.eng_chg_level
  965. where a.site = #{site} and a.part_no = #{partNo} and b.eff_phase_out_date is null
  966. </select>
  967. <!-- recipe明细查重 -->
  968. <select id="selectRecipeComponentByPartNo" resultType="com.spring.modules.part.vo.RecipeComponentVo">
  969. SELECT
  970. a.site,
  971. a.part_no,
  972. a.bom_type,
  973. a.eng_chg_level,
  974. a.alternative_no,
  975. a.component_part,
  976. a.print_unit,
  977. a.qty_per_assembly,
  978. a.component_scrap,
  979. a.issue_type,
  980. a.shrinkage_factor,
  981. a.line_item_no,
  982. a.operation_no,
  983. a.issue_to_loc,
  984. a.note_text,
  985. a.line_sequence,
  986. a.consumption_item,
  987. a.parts_by_weight,
  988. a.qty_uom,
  989. a.issue_planned_scrap_db,
  990. a.issue_overreported_qty_db,
  991. a.fixed_qty_flag,
  992. a.promise_planned,
  993. a.phantom_consume,
  994. a.oper_cost_distribution,
  995. a.gen_oh_cost_distribution,
  996. a.qty_kg,
  997. a.by_prod_as_supply_in_mrp_db,
  998. a.leadtime_offset,
  999. a.std_planned_item,
  1000. a.charged_item,
  1001. a.last_activity_date,
  1002. a.exclude_from_calculations_db,
  1003. a.exclude_from_as_built_db,
  1004. a.lot_batch_origin_db,
  1005. a.weight_share
  1006. FROM plm_recipe_component as a
  1007. left join part_revision as b on a.site = b.site and a.part_no = b.part_no and a.eng_chg_level = b.eng_chg_level
  1008. where a.site = #{site} and a.part_no = #{partNo} and b.eff_phase_out_date is null
  1009. </select>
  1010. <!-- 查recipe副产品成本分配 -->
  1011. <select id="selectRecipeManufStructCostDistribByPartNo" resultType="com.spring.modules.part.vo.RecipeManufStructCostDistribVo">
  1012. SELECT
  1013. a.site,
  1014. a.part_no,
  1015. a.bom_type,
  1016. a.eng_chg_level,
  1017. a.alternative_no,
  1018. a.by_prod_line_item_no,
  1019. a.component_line_item_no,
  1020. a.item_cost_distribution,
  1021. a.component_part_no,
  1022. a.by_prod_part_no
  1023. FROM plm_recipe_manuf_struct_cost_distrib as a
  1024. left join part_revision as b on a.site = b.site and a.part_no = b.part_no and a.eng_chg_level = b.eng_chg_level
  1025. where a.site = #{site} and a.part_no = #{partNo} and b.eff_phase_out_date is null
  1026. </select>
  1027. <!-- 查recipe子明细 -->
  1028. <select id="queryRecipeComponentList" parameterType="RecipeComponentEntity" resultType="com.spring.modules.part.vo.RecipeComponentVo">
  1029. SELECT
  1030. site,
  1031. part_no,
  1032. bom_type,
  1033. eng_chg_level,
  1034. alternative_no,
  1035. component_part,
  1036. print_unit,
  1037. qty_per_assembly,
  1038. component_scrap,
  1039. issue_type,
  1040. shrinkage_factor,
  1041. line_item_no,
  1042. operation_no,
  1043. issue_to_loc,
  1044. note_text,
  1045. line_sequence,
  1046. consumption_item,
  1047. parts_by_weight,
  1048. qty_uom,
  1049. issue_planned_scrap_db,
  1050. issue_overreported_qty_db,
  1051. fixed_qty_flag,
  1052. promise_planned,
  1053. phantom_consume,
  1054. oper_cost_distribution,
  1055. gen_oh_cost_distribution,
  1056. qty_kg,
  1057. by_prod_as_supply_in_mrp_db,
  1058. leadtime_offset,
  1059. std_planned_item,
  1060. charged_item,
  1061. last_activity_date,
  1062. exclude_from_calculations_db,
  1063. exclude_from_as_built_db,
  1064. lot_batch_origin_db,
  1065. weight_share
  1066. FROM plm_recipe_component
  1067. where site = #{site} and part_no = #{partNo} and bom_type = #{bomType} and eng_chg_level = #{engChgLevel} and alternative_no = #{alternativeNo}
  1068. </select>
  1069. </mapper>