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.

103 lines
4.4 KiB

  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.BomSearch3Mapper">
  4. <!-- Bom列表 -->
  5. <select id="bomSearchHeader" 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. b.part_desc,
  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. dbo.getOperatorDesc(a.site, a.create_by) as createByDesc,
  22. a.update_date,
  23. a.update_by,
  24. dbo.getOperatorDesc(a.site, a.update_by) as updateByDesc,
  25. b.umid2 as printUnit,
  26. c.UMName as printUnitName,
  27. b.part_type2,
  28. case
  29. when part_type2 = 'Manufactured' then '成品'
  30. when part_type2 = 'Manufactured Recipe' then '半成品'
  31. when part_type2 = 'Purchased (raw)' then '原材料' end as partType2Desc
  32. FROM plm_bom_header as a
  33. left join part as b on a.site = b.site and a.bu_no = b.sourceBu and a.part_no = b.part_no
  34. left join UM as c on a.site = c.site and b.umid2 = c.UMID
  35. <where>
  36. a.site in (select site from eam_access_site where username = #{query.userName})
  37. and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
  38. <if test="query.buNo != null and query.buNo != ''">
  39. AND a.bu_no = #{query.buNo}
  40. </if>
  41. <if test = "query.partNo != null and query.partNo != ''">
  42. AND a.part_no like '%' + #{query.partNo} + '%'
  43. </if>
  44. <if test = "query.partDesc != null and query.partDesc != ''">
  45. AND b.part_desc like '%' + #{query.partDesc} + '%'
  46. </if>
  47. <if test = "query.partType2 != null and query.partType2 != ''">
  48. AND b.part_type2 = #{query.partType2}
  49. </if>
  50. <if test = "query.engChgLevel != null and query.engChgLevel != ''">
  51. AND a.eng_chg_level = #{query.engChgLevel}
  52. </if>
  53. </where>
  54. </select>
  55. <!-- 查bom明细 -->
  56. <select id="getAlternativeTree" parameterType="com.xujie.sys.modules.part.vo.BomHeaderVo" resultType="com.xujie.sys.modules.part.entity.BomComponentEntity">
  57. SELECT
  58. a.site,
  59. a.bu_no,
  60. a.part_no,
  61. a.bom_type,
  62. a.eng_chg_level,
  63. a.alternative_no,
  64. a.component_part,
  65. (a.site + '-' + a.component_part + '-' + a.bom_type + '-' + convert(varchar, a.eng_chg_level)) as id,
  66. (a.site + '-' + a.part_no + '-' + a.bom_type + '-' + convert(varchar, c.eng_chg_level)) as parentId
  67. FROM plm_bom_component as a
  68. left join plm_bom_header as c on a.site = c.site and a.bu_no = c.bu_no and a.component_part = c.part_no and a.bom_type = c.bom_type
  69. where a.site = #{site}
  70. </select>
  71. <!-- 查bom子明细 -->
  72. <select id="getComponentPartList" parameterType="com.xujie.sys.modules.part.vo.BomComponentVo" resultType="com.xujie.sys.modules.part.vo.BomComponentVo">
  73. SELECT
  74. a.site,
  75. a.bu_no,
  76. a.part_no,
  77. a.bom_type,
  78. a.eng_chg_level,
  79. a.alternative_no,
  80. a.component_part,
  81. b.part_desc as componentPartDesc,
  82. a.print_unit,
  83. dbo.qc_get_um_name(a.site, a.print_unit) as printUnitName,
  84. a.qty_per_assembly,
  85. a.component_scrap,
  86. a.issue_type,
  87. a.shrinkage_factor,
  88. a.line_item_no,
  89. a.operation_id,
  90. a.issue_to_loc,
  91. dbo.get_location_name(a.site, a.bu_no, a.issue_to_loc) as issueToLocName,
  92. a.note_text,
  93. a.line_sequence,
  94. a.consumption_item
  95. FROM plm_bom_component as a
  96. left join part as b on a.site = b.site and a.bu_no = b.sourceBu and a.component_part = b.part_no
  97. where a.site = #{site} and a.part_no = #{componentPart} and a.bom_type = #{bomType} and a.eng_chg_level = #{engChgLevel} and a.alternative_no = '*'
  98. order by a.line_sequence
  99. </select>
  100. </mapper>