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.

2250 lines
89 KiB

2 years ago
2 years ago
1 year ago
1 year 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
1 year 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
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
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
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. <?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.PartInformationMapper">
  4. <!-- 材料信息列表 -->
  5. <select id="partInformationSearch" parameterType="com.spring.modules.part.vo.PartInformationVo" resultType="com.spring.modules.part.vo.PartInformationVo">
  6. SELECT
  7. site,
  8. part_no,
  9. part_desc,
  10. spec,
  11. part_type_db,
  12. part_type,
  13. family_id,
  14. dbo.get_family_name(site, family_id) as familyName,
  15. group_id,
  16. dbo.get_group_name(site, group_id) as groupName,
  17. um_id,
  18. dbo.get_um_name(um_id) as umName,
  19. weight_net,
  20. uom_for_weight_net,
  21. volume_net,
  22. uom_for_volume_net,
  23. lot_tracking_code,
  24. active,
  25. case when active = 'Y' then '是' when active = 'N' then '否' else '' end as activeDesc,
  26. product_group_id1,
  27. dbo.get_product_group_name(site, product_group_id1, '1') as productGroupName1,
  28. product_group_id2,
  29. dbo.get_product_group_name(site, product_group_id2, '2') as productGroupName2,
  30. product_group_id3,
  31. dbo.get_product_group_name(site, product_group_id3, '3') as productGroupName3,
  32. product_group_id4,
  33. dbo.get_product_group_name(site, product_group_id4, '4') as productGroupName4,
  34. erp_part_no,
  35. code_no,
  36. dbo.get_code_desc(site, code_no, 'IP') as codeDesc,
  37. manufacturer_id,
  38. dbo.get_manufacturer_name(site, manufacturer_id) as manufacturerName,
  39. agent_id,
  40. dbo.split_agent_id(site, agent_id) as agentName,
  41. type_designation,
  42. hazard_code,
  43. dbo.get_hazard_name(site, hazard_code) as hazardDesc,
  44. asset_class,
  45. dbo.get_assetClass_name(site, asset_class) as assetClassDesc,
  46. dim_quality,
  47. abc_class,
  48. dbo.get_abcClass_name(site, abc_class) as abcClassDesc,
  49. frequency_class,
  50. lifecycle_stage,
  51. country_of_origin,
  52. dbo.get_country_of_origin_name(site, country_of_origin) as countryOfOriginDesc,
  53. manufacturing_lead_time,
  54. expected_lead_time,
  55. region_of_origin,
  56. dbo.get_region_of_origin_name(site, region_of_origin) as regionOfOriginDesc,
  57. customs_stat_no,
  58. dbo.get_customs_stat_name(site, customs_stat_no) as customsStatDesc,
  59. durability_day,
  60. intrastat_conv_factor,
  61. part_status,
  62. dbo.get_part_status_name(site, part_status) as partStatusDesc,
  63. configuration_id,
  64. estimated_material_cost,
  65. inventory_valuation_method,
  66. part_cost_group_id,
  67. dbo.get_part_cost_group_name(site, part_cost_group_id) as partCostGroupDesc,
  68. inventory_part_cost_level,
  69. invoice_consideration,
  70. zero_cost_flag,
  71. planning_method,
  72. dbo.get_planning_method_name(site, planning_method) as planningMethodDesc,
  73. safety_stock,
  74. min_order_qty,
  75. max_order_qty,
  76. mul_order_qty,
  77. safety_lead_time,
  78. shrinkage_fac,
  79. std_order_qty,
  80. cum_lead_time,
  81. back_flush_part,
  82. by_prod_as_supply_in_mrp_db,
  83. unprotected_lead_time,
  84. issue_type,
  85. mrp_control_flag_db,
  86. fixed_lead_time_day,
  87. over_reporting,
  88. use_theoretical_density_db,
  89. variable_lead_time_day,
  90. over_report_tolerance,
  91. fixed_lead_time_hour,
  92. density,
  93. variable_lead_time_hour,
  94. remark,
  95. status,
  96. create_date,
  97. create_by,
  98. update_date,
  99. update_by,
  100. plm_part_no,
  101. ifs_part_no,
  102. case when status = 'Y' then '正式物料' else '临时物料' end as statusDesc
  103. FROM part
  104. <where>
  105. site = #{query.site}
  106. <if test = "query.active != null and query.active != ''">
  107. AND active = #{query.active}
  108. </if>
  109. <if test = "query.partNo != null and query.partNo != ''">
  110. AND part_no like #{query.partNo}
  111. </if>
  112. <if test = "query.erpPartNo != null and query.erpPartNo != ''">
  113. AND erp_part_no like #{query.erpPartNo}
  114. </if>
  115. <if test = "query.partDesc != null and query.partDesc != ''">
  116. AND part_desc like #{query.partDesc}
  117. </if>
  118. <if test = "query.spec != null and query.spec != ''">
  119. AND spec like #{query.spec}
  120. </if>
  121. <if test="query.startDate != null ">
  122. AND create_date >= #{query.startDate}
  123. </if>
  124. <if test="query.endDate != null ">
  125. AND #{query.endDate} >= create_date
  126. </if>
  127. <if test = 'query.status != null and query.status != "" and query.status == "Y"'>
  128. AND status = 'Y'
  129. </if>
  130. <if test = 'query.status != null and query.status != "" and query.status == "N"'>
  131. AND status <![CDATA[<>]]> 'Y'
  132. </if>
  133. <if test = "query.ifsPartNo != null and query.ifsPartNo != ''">
  134. AND ifs_part_no like #{query.ifsPartNo}
  135. </if>
  136. </where>
  137. </select>
  138. <!-- 检查材料属性 -->
  139. <select id="checkValueHeaderData" resultType="PartSubPropertiesValueHeaderData">
  140. SELECT
  141. PartNo,
  142. Site,
  143. CodeNo,
  144. SubCodeSeqNo,
  145. SubCodeDesc,
  146. RecordType
  147. from PartSubPropertiesValueHeader
  148. where PartNo = #{partNo} and site = #{site} and CodeNo = #{codeNo} and RecordType = #{recordType}
  149. </select>
  150. <!-- 删除材料属性 -->
  151. <delete id="deletePartSubPropertiesValueHeader">
  152. delete from PartSubPropertiesValueHeader
  153. where PartNo = #{partNo} and site = #{site} and RecordType = #{recordType}
  154. </delete>
  155. <!-- 删除材料属性值 -->
  156. <delete id="deletePartSubPropertiesValue">
  157. delete from PartSubPropertiesValue
  158. where PartNo = #{partNo} and site = #{site} and RecordType = #{recordType}
  159. </delete>
  160. <!-- 新增材料属性 -->
  161. <insert id="savePartSubPropertiesValueHeader">
  162. insert into PartSubPropertiesValueHeader
  163. (PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc, RecordType)
  164. select
  165. #{partNo},
  166. #{site},
  167. #{codeNo},
  168. 1,
  169. Code_Desc,
  170. #{recordType}
  171. from plm_properties_model_header
  172. where Code_No = #{codeNo} and site = #{site} and function_type = #{recordType}
  173. </insert>
  174. <!-- 新增材料属性值 -->
  175. <insert id="savePartSubPropertiesValue">
  176. insert into PartSubPropertiesValue (PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc, ItemNo, PropertiesItemNo, TextValue, NumValue, RecordType)
  177. select
  178. #{partNo},
  179. #{site},
  180. #{codeNo},
  181. 1,
  182. a.Code_Desc,
  183. b.seq_No,
  184. b.properties_item_no,
  185. case when c.ValueType_DB = 'T' then c.DefaultValue else null end,
  186. case when c.ValueType_DB = 'N' and c.DefaultValue != '' then c.DefaultValue else null end,
  187. #{recordType}
  188. from plm_properties_model_header a
  189. left join plm_properties_model_detail b on a.Code_No = b.Code_No and a.site = b.site and a.function_type = b.function_type
  190. left join plm_properties_item c on b.properties_item_no = c.ItemNo and b.site = c.site and a.function_type = c.itemType
  191. where a.Code_No = #{codeNo} and a.site = #{site} AND B.SITE IS NOT NULL AND A.function_type = #{recordType}
  192. </insert>
  193. <select id="getItemModal" resultType="PartSubPropertiesValueData">
  194. SELECT
  195. a.PartNo,
  196. a.Site,
  197. a.CodeNo,
  198. a.SubCodeSeqNo,
  199. a.SubCodeDesc,
  200. a.ItemNo,
  201. a.PropertiesItemNo,
  202. a.TextValue,
  203. a.NumValue,
  204. a.RecordType,
  205. b.ItemDesc as ItemDesc,
  206. b.ValueType,
  207. b.ValueType_DB,
  208. b.ValueChooseFlag
  209. FROM PartSubPropertiesValue as a
  210. left join plm_properties_item as b on a.PropertiesItemNo = b.ItemNo and a.site = b.site and a.RecordType = b.ItemType
  211. where a.site = #{site} and RecordType = #{recordType} and a.PartNo = #{partNo,jdbcType=VARCHAR}
  212. </select>
  213. <!-- 获取属性可选值 -->
  214. <select id="getAvailableValueList" resultType="PlmPropertiesItemAvailableData">
  215. select
  216. ItemNo,
  217. ValueNo,
  218. AvailableValue
  219. from plm_properties_item_available
  220. where itemNo = #{propertiesItemNo} and site = #{site} and ItemType = #{recordType}
  221. </select>
  222. <!-- 编辑属性值 -->
  223. <update id="savePartItemValue" >
  224. update PartSubPropertiesValue
  225. set TextValue = #{textValue},
  226. NumValue = #{numValue, jdbcType=DOUBLE}
  227. where PropertiesItemNo = #{propertiesItemNo} and site = #{site} and PartNo = #{partNo} and RecordType = #{recordType}
  228. </update>
  229. <!-- 查询代理商列表 -->
  230. <select id="getAgentList" resultType="AgentInformationEntity" parameterType="AgentInformationEntity">
  231. SELECT
  232. site,
  233. agent_id,
  234. agent_name
  235. FROM agent
  236. <where>
  237. site = #{site}
  238. <if test = "agentId != null and agentId != ''">
  239. AND agent_id LIKE #{agentId}
  240. </if>
  241. <if test = "agentName != null and agentName != ''">
  242. AND agent_name LIKE #{deptName}
  243. </if>
  244. </where>
  245. </select>
  246. <!-- 查询代理商列表 -->
  247. <select id="getPartAgent" resultType="com.spring.modules.part.vo.AgentInformationVo" parameterType="com.spring.modules.part.vo.AgentInformationVo">
  248. SELECT
  249. a.site,
  250. a.part_no,
  251. a.agent_id,
  252. b.agent_name,
  253. b.active,
  254. b.create_date,
  255. b.create_by,
  256. b.update_date,
  257. b.update_by
  258. FROM part_agent as a
  259. left join agent as b on a.site = b.site and a.agent_id = b.agent_id
  260. where a.site = #{site} and a.part_no = #{partNo}
  261. </select>
  262. <!-- 获取当前物料不包含的代理商 -->
  263. <select id="getAgentList1" resultType="AgentInformationEntity" parameterType="PartInformationEntity">
  264. SELECT
  265. a.site,
  266. a.agent_id,
  267. a.agent_name,
  268. a.active,
  269. a.create_date,
  270. a.create_by,
  271. a.update_date,
  272. a.update_by
  273. FROM agent as a
  274. left join part_agent as b on a.site = b.site and a.agent_id = b.agent_id and b.part_no = #{partNo}
  275. where a.site = #{site} and b.part_no is null
  276. </select>
  277. <!-- 获取当前物料所包含的代理商 -->
  278. <select id="getAgentList2" resultType="AgentInformationEntity" parameterType="PartInformationEntity">
  279. SELECT
  280. a.site,
  281. a.agent_id,
  282. b.agent_name,
  283. b.active,
  284. b.create_date,
  285. b.create_by,
  286. b.update_date,
  287. b.update_by
  288. FROM part_agent a
  289. LEFT JOIN agent b ON a.agent_id = b.agent_id and a.site = b.site
  290. WHERE a.part_no = #{partNo} and a.site = #{site}
  291. </select>
  292. <!-- 获取当前物料所包含的代理商 -->
  293. <select id="selectAgentByPartNo" resultType="com.spring.modules.part.vo.AgentInformationVo" parameterType="com.spring.modules.part.vo.AgentInformationVo">
  294. SELECT
  295. site,
  296. agent_id
  297. FROM part_agent
  298. WHERE part_no = #{partNo} and site = #{site} and agent_id = #{agentId}
  299. </select>
  300. <!-- 新增物料代理商 -->
  301. <insert id="addPartAgent" parameterType="com.spring.modules.part.vo.AgentInformationVo">
  302. insert into part_agent (site, part_no, agent_id)
  303. values (#{site}, #{partNo}, #{agentId})
  304. </insert>
  305. <!-- 删除物料代理商 -->
  306. <delete id="deletePartAgent" parameterType="com.spring.modules.part.vo.AgentInformationVo">
  307. delete from part_agent
  308. where part_no = #{partNo} and site = #{site} and agent_id = #{agentId}
  309. </delete>
  310. <!-- 获取当前物料不包含的代理商 -->
  311. <select id="getAgentListBy" resultType="AgentInformationEntity" parameterType="com.spring.modules.part.vo.AgentInformationVo">
  312. SELECT
  313. a.site,
  314. a.agent_id,
  315. a.agent_name,
  316. a.active,
  317. a.create_date,
  318. a.create_by,
  319. a.update_date,
  320. a.update_by
  321. FROM agent as a
  322. left join part_agent as b on a.site = b.site and a.agent_id = b.agent_id and b.part_no = #{partNo}
  323. <where>
  324. a.site = #{site} and b.part_no is null
  325. <if test = "agentId != null and agentId != ''">
  326. AND a.agent_id LIKE #{agentId}
  327. </if>
  328. <if test = "agentName != null and agentName != ''">
  329. AND a.agent_name LIKE #{agentName}
  330. </if>
  331. </where>
  332. </select>
  333. <!-- 删除物料代理商 -->
  334. <delete id="deleteAgent" parameterType="com.spring.modules.part.vo.AgentInformationVo">
  335. delete from part_agent
  336. where part_no = #{partNo} and site = #{site} and agent_id = #{agentId}
  337. </delete>
  338. <!-- 查询制造商列表 -->
  339. <select id="getManufacturerList" resultType="ManufacturerInformationEntity" parameterType="ManufacturerInformationEntity">
  340. SELECT
  341. site,
  342. manufacturer_id,
  343. manufacturer_name
  344. FROM manufacturer
  345. <where>
  346. site = #{site}
  347. <if test = "manufacturerId != null and manufacturerId != ''">
  348. AND manufacturer_id LIKE #{manufacturerId}
  349. </if>
  350. <if test = "manufacturerName != null and manufacturerName != ''">
  351. AND manufacturer_name LIKE #{manufacturerName}
  352. </if>
  353. </where>
  354. </select>
  355. <!-- 查询制造商列表 -->
  356. <select id="getPartManufacturer" resultType="com.spring.modules.part.vo.ManufacturerInformationVo" parameterType="com.spring.modules.part.vo.ManufacturerInformationVo">
  357. SELECT
  358. a.site,
  359. a.part_no,
  360. a.manufacturer_id,
  361. b.manufacturer_name,
  362. b.active,
  363. b.create_date,
  364. b.create_by,
  365. b.update_date,
  366. b.update_by
  367. FROM part_manufacturer as a
  368. left join manufacturer as b on a.site = b.site and a.manufacturer_id = b.manufacturer_id
  369. where a.site = #{site} and a.part_no = #{partNo}
  370. </select>
  371. <!-- 获取当前物料不包含的制造商 -->
  372. <select id="getManufacturerList1" resultType="ManufacturerInformationEntity" parameterType="PartInformationEntity">
  373. SELECT
  374. a.site,
  375. a.manufacturer_id,
  376. a.manufacturer_name,
  377. a.active,
  378. a.create_date,
  379. a.create_by,
  380. a.update_date,
  381. a.update_by
  382. FROM manufacturer as a
  383. left join part_manufacturer as b on a.site = b.site and a.manufacturer_id = b.manufacturer_id and b.part_no = #{partNo}
  384. where a.site = #{site} and b.part_no is null
  385. </select>
  386. <!-- 获取当前物料所包含的制造商 -->
  387. <select id="getManufacturerList2" resultType="ManufacturerInformationEntity" parameterType="PartInformationEntity">
  388. SELECT
  389. a.site,
  390. a.manufacturer_id,
  391. b.manufacturer_name,
  392. b.active,
  393. b.create_date,
  394. b.create_by,
  395. b.update_date,
  396. b.update_by
  397. FROM part_manufacturer a
  398. LEFT JOIN manufacturer b ON a.manufacturer_id = b.manufacturer_id and a.site = b.site
  399. WHERE a.part_no = #{partNo} and a.site = #{site}
  400. </select>
  401. <!-- 获取当前物料所包含的制造商 -->
  402. <select id="selectManufacturerByPartNo" resultType="com.spring.modules.part.vo.ManufacturerInformationVo" parameterType="com.spring.modules.part.vo.ManufacturerInformationVo">
  403. SELECT
  404. site,
  405. manufacturer_id
  406. FROM part_manufacturer
  407. WHERE part_no = #{partNo} and site = #{site} and manufacturer_id = #{manufacturerId}
  408. </select>
  409. <!-- 新增物料制造商 -->
  410. <insert id="addPartManufacturer" parameterType="com.spring.modules.part.vo.ManufacturerInformationVo">
  411. insert into part_manufacturer (site, part_no, manufacturer_id)
  412. values (#{site}, #{partNo}, #{manufacturerId})
  413. </insert>
  414. <!-- 删除物料制造商 -->
  415. <delete id="deletePartManufacturer" parameterType="com.spring.modules.part.vo.ManufacturerInformationVo">
  416. delete from part_manufacturer
  417. where part_no = #{partNo} and site = #{site} and manufacturer_id = #{manufacturerId}
  418. </delete>
  419. <!-- 删除物料制造商 -->
  420. <delete id="deleteManufacturer">
  421. delete from part_manufacturer
  422. where part_no = #{partNo} and site = #{site} and manufacturer_id = #{manufacturerId}
  423. </delete>
  424. <!-- 获取当前物料不包含的制造商 -->
  425. <select id="getManufacturerListBy" resultType="ManufacturerInformationEntity" parameterType="com.spring.modules.part.vo.ManufacturerInformationVo">
  426. SELECT
  427. a.site,
  428. a.manufacturer_id,
  429. a.manufacturer_name,
  430. a.active,
  431. a.create_date,
  432. a.create_by,
  433. a.update_date,
  434. a.update_by
  435. FROM manufacturer as a
  436. left join part_manufacturer as b on a.site = b.site and a.manufacturer_id = b.manufacturer_id and b.part_no = #{partNo}
  437. <where>
  438. a.site = #{site} and b.part_no is null
  439. <if test = "manufacturerId != null and manufacturerId != ''">
  440. AND a.manufacturer_id LIKE #{manufacturerId}
  441. </if>
  442. <if test = "manufacturerName != null and manufacturerName != ''">
  443. AND a.manufacturer_name LIKE #{manufacturerName}
  444. </if>
  445. </where>
  446. </select>
  447. <update id="commitItemValue" parameterType="PartSubPropertiesValueData">
  448. UPDATE PartSubPropertiesValue
  449. SET TextValue = #{textValue},
  450. NumValue = #{numValue,jdbcType=DECIMAL}
  451. WHERE PartNo = #{partNo} and Site = #{site} and CodeNo = #{codeNo} and SubCodeSeqNo = #{subCodeSeqNo} and ItemNo = #{itemNo} and RecordType = #{recordType}
  452. </update>
  453. <!-- 删除属性值 -->
  454. <delete id="deleteItem" parameterType="PartSubPropertiesValueData">
  455. delete from PartSubPropertiesValue
  456. where PartNo = #{partNo} and site = #{site} and RecordType = #{recordType} and CodeNo = #{codeNo} and SubCodeSeqNo = #{subCodeSeqNo} and ItemNo = #{itemNo}
  457. </delete>
  458. <select id="getItemLists" resultType="PlmPropertiesItemData" parameterType="PartSubPropertiesValueData">
  459. SELECT
  460. a.itemNo as itNo,
  461. a.ItemDesc,
  462. a.ValueType_DB as valueTypeDb
  463. FROM plm_properties_item a
  464. LEFT JOIN PartSubPropertiesValue b on b.recordType = #{recordType} and b.codeNo = #{codeNo} and b.PartNo = #{partNo} and b.PropertiesItemNo = a.ItemNo and a.site = b.site
  465. <where>
  466. a.ItemType = #{recordType}
  467. and a.site = #{site}
  468. AND b.codeNo is null
  469. <if test = "propertiesItemNo != null and propertiesItemNo != ''">
  470. AND a.ItemNo LIKE #{propertiesItemNo}
  471. </if>
  472. <if test = "itemDesc != null and itemDesc != ''">
  473. AND a.ItemDesc LIKE #{itemDesc}
  474. </if>
  475. </where>
  476. </select>
  477. <select id="getModelItemLists" resultType="PlmPropertiesItemData" parameterType="PartSubPropertiesValueData">
  478. select
  479. a.PropertiesItemNo as itNo,
  480. b.ItemDesc,
  481. a.ItemNo,
  482. a.PartNo,
  483. a.Site,
  484. a.CodeNo,
  485. a.SubCodeSeqNo,
  486. a.recordType,
  487. b.ValueType_DB as valueTypeDb
  488. from PartSubPropertiesValue a
  489. left join plm_properties_item b on a.PropertiesItemNo = b.ItemNo and a.recordType = b.ItemType and a.site = b.site
  490. where a.codeNo = #{codeNo} and a.recordType = #{recordType} and a.site = #{site} and a.PartNo = #{partNo}
  491. </select>
  492. <select id="checkPartItem" resultType="PartSubPropertiesValueData" parameterType="PartSubPropertiesValueData">
  493. select
  494. site,
  495. PartNo,
  496. CodeNo,
  497. SubCodeSeqNo,
  498. itemNo,
  499. PropertiesItemNo,
  500. RecordType
  501. from PartSubPropertiesValue
  502. where codeNo = #{codeNo} and recordType = #{recordType} and site = #{site} and PartNo = #{partNo} and PropertiesItemNo = #{itNo}
  503. </select>
  504. <select id="checkItem" resultType="PartSubPropertiesValueData" parameterType="PartSubPropertiesValueData">
  505. SELECT
  506. ItemDesc
  507. FROM plm_properties_item
  508. where itemType = #{recordType} and itemNo = #{itNo} and site = #{site}
  509. </select>
  510. <select id="getModalDetailSeqNo" resultType="double" parameterType="PartSubPropertiesValueData">
  511. SELECT
  512. isnull(max(itemNo),0) + 1
  513. from PartSubPropertiesValue
  514. where RecordType = #{recordType} and CodeNo = #{codeNo} and site = #{site} and PartNo = #{partNo} and SubCodeSeqNo = #{subCodeSeqNo}
  515. </select>
  516. <insert id="addPartItem" parameterType="PartSubPropertiesValueData">
  517. insert into PartSubPropertiesValue
  518. (PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc, ItemNo, PropertiesItemNo, TextValue, NumValue, RecordType)
  519. values (#{partNo}, #{site}, #{codeNo}, #{subCodeSeqNo,jdbcType=FLOAT}, #{codeDesc}, #{itemNo, jdbcType=FLOAT}, #{itNo}, #{textValue}, #{numValue, jdbcType=FLOAT}, #{recordType})
  520. </insert>
  521. <delete id="deletePartItem" parameterType="PartSubPropertiesValueData">
  522. delete from PartSubPropertiesValue
  523. where PartNo = #{partNo} and site = #{site} and RecordType = #{recordType} and CodeNo = #{codeNo} and SubCodeSeqNo = #{subCodeSeqNo} and ItemNo = #{itemNo}
  524. </delete>
  525. <select id="queryCodeNo" parameterType="com.spring.modules.part.vo.MasterPartInformationVo" resultType="PartSubPropertiesValueData">
  526. SELECT
  527. PartNo,
  528. Site,
  529. CodeNo,
  530. SubCodeSeqNo,
  531. SubCodeDesc,
  532. RecordType
  533. FROM PartSubPropertiesValueHeader
  534. where PartNo = #{partNo} and Site = #{site} and SubCodeSeqNo = 1 and RecordType = 'IP'
  535. </select>
  536. <!-- 获取当前物料不包含的库位 -->
  537. <select id="getLocationList1" resultType="LocationInformationEntity" parameterType="PartInformationEntity">
  538. SELECT
  539. a.site,
  540. a.location_id,
  541. a.location_name,
  542. a.warehouse_id,
  543. a.active,
  544. a.create_date,
  545. a.create_by,
  546. a.update_date,
  547. a.update_by,
  548. a.location_type
  549. FROM location as a
  550. left join plm_part_location as b on a.site = b.site and a.location_id = b.location_id and b.part_no = #{query.partNo}
  551. where a.site = #{query.site} and b.part_no is null
  552. </select>
  553. <!-- 获取当前物料所包含的库位 -->
  554. <select id="getLocationList2" resultType="LocationInformationEntity" parameterType="com.spring.modules.part.vo.LocationInformationVo">
  555. SELECT
  556. a.site,
  557. a.location_id,
  558. b.location_name,
  559. b.warehouse_id,
  560. b.active,
  561. b.create_date,
  562. b.create_by,
  563. b.update_date,
  564. b.update_by,
  565. b.location_type
  566. FROM plm_part_location a
  567. LEFT JOIN location b ON a.location_id = b.location_id and a.site = b.site
  568. WHERE a.part_no = #{partNo} and a.site = #{site}
  569. </select>
  570. <!-- 获取当前物料不包含的库位 -->
  571. <select id="getLocationListBy" resultType="LocationInformationEntity" parameterType="com.spring.modules.part.vo.LocationInformationVo">
  572. SELECT
  573. a.site,
  574. a.location_id,
  575. a.location_name,
  576. a.warehouse_id,
  577. a.active,
  578. a.create_date,
  579. a.create_by,
  580. a.update_date,
  581. a.update_by,
  582. a.location_type
  583. FROM location as a
  584. left join plm_part_location as b on a.site = b.site and a.location_id = b.location_id and b.part_no = #{query.partNo}
  585. <where>
  586. a.site = #{query.site} and b.part_no is null
  587. <if test = "query.locationId != null and query.locationId != ''">
  588. AND a.location_id LIKE #{query.locationId}
  589. </if>
  590. <if test = "query.locationName != null and query.locationName != ''">
  591. AND a.location_name LIKE #{query.locationName}
  592. </if>
  593. </where>
  594. </select>
  595. <!-- 查询库位列表 -->
  596. <select id="getDefaultLocation" resultType="com.spring.modules.part.vo.LocationInformationVo" parameterType="com.spring.modules.part.vo.LocationInformationVo">
  597. SELECT
  598. a.site,
  599. a.part_no,
  600. a.location_id,
  601. b.location_name,
  602. b.warehouse_id,
  603. b.active,
  604. b.create_date,
  605. b.create_by,
  606. b.update_date,
  607. b.update_by,
  608. b.location_type
  609. FROM plm_part_location as a
  610. left join location as b on a.site = b.site and a.location_id = b.location_id
  611. where a.site = #{site} and a.part_no = #{partNo}
  612. </select>
  613. <!-- 获取当前物料所包含的库位 -->
  614. <select id="selectLocationByPartNo" resultType="com.spring.modules.part.vo.LocationInformationVo" parameterType="com.spring.modules.part.vo.LocationInformationVo">
  615. SELECT
  616. site,
  617. location_id
  618. FROM plm_part_location
  619. WHERE part_no = #{partNo} and site = #{site} and location_id = #{locationId}
  620. </select>
  621. <!-- 新增物料库位 -->
  622. <insert id="addDefaultLocation" parameterType="com.spring.modules.part.vo.LocationInformationVo">
  623. insert into plm_part_location (site, part_no, location_id)
  624. values (#{site}, #{partNo}, #{locationId})
  625. </insert>
  626. <!-- 删除物料库位 -->
  627. <delete id="deleteDefaultLocation" parameterType="com.spring.modules.part.vo.LocationInformationVo">
  628. delete from plm_part_location
  629. where part_no = #{partNo} and site = #{site} and location_id = #{locationId}
  630. </delete>
  631. <!-- 删除代理商 -->
  632. <delete id="deleteAgentByPartNo" parameterType="PartInformationEntity">
  633. delete from part_agent
  634. where part_no = #{partNo} and site = #{site}
  635. </delete>
  636. <!-- 删除制造商商 -->
  637. <delete id="deleteManufacturerByPartNo" parameterType="PartInformationEntity">
  638. delete from part_manufacturer
  639. where part_no = #{partNo} and site = #{site}
  640. </delete>
  641. <!-- 删除代理商 -->
  642. <delete id="deleteLocationByPartNo" parameterType="PartInformationEntity">
  643. delete from plm_part_location
  644. where part_no = #{partNo} and site = #{site}
  645. </delete>
  646. <select id="partAllInfoSearch" parameterType="com.spring.modules.part.vo.PartInformationVo" resultType="com.spring.modules.part.vo.PartInformationVo">
  647. SELECT
  648. site,
  649. part_no,
  650. part_desc,
  651. spec,
  652. part_type_db,
  653. part_type,
  654. family_id,
  655. dbo.get_family_name(site, family_id) as familyName,
  656. group_id,
  657. dbo.get_group_name(site, group_id) as groupName,
  658. um_id,
  659. dbo.get_um_name(um_id) as umName,
  660. weight_net,
  661. uom_for_weight_net,
  662. volume_net,
  663. uom_for_volume_net,
  664. lot_tracking_code,
  665. active,
  666. product_group_id1,
  667. dbo.get_product_group_name(site, product_group_id1, '1') as productGroupName1,
  668. product_group_id2,
  669. dbo.get_product_group_name(site, product_group_id2, '2') as productGroupName2,
  670. product_group_id3,
  671. dbo.get_product_group_name(site, product_group_id3, '3') as productGroupName3,
  672. product_group_id4,
  673. dbo.get_product_group_name(site, product_group_id4, '4') as productGroupName4,
  674. erp_part_no,
  675. code_no,
  676. dbo.get_code_desc(site, code_no, 'IP') as codeDesc,
  677. manufacturer_id,
  678. dbo.get_manufacturer_name(site, manufacturer_id) as manufacturerName,
  679. agent_id,
  680. dbo.split_agent_id(site, agent_id) as agentName,
  681. type_designation,
  682. hazard_code,
  683. dbo.get_hazard_name(site, hazard_code) as hazardDesc,
  684. asset_class,
  685. dbo.get_assetClass_name(site, asset_class) as assetClassDesc,
  686. dim_quality,
  687. abc_class,
  688. dbo.get_abcClass_name(site, abc_class) as abcClassDesc,
  689. frequency_class,
  690. lifecycle_stage,
  691. country_of_origin,
  692. dbo.get_country_of_origin_name(site, country_of_origin) as countryOfOriginDesc,
  693. manufacturing_lead_time,
  694. expected_lead_time,
  695. region_of_origin,
  696. dbo.get_region_of_origin_name(site, region_of_origin) as regionOfOriginDesc,
  697. customs_stat_no,
  698. dbo.get_customs_stat_name(site, customs_stat_no) as customsStatDesc,
  699. durability_day,
  700. intrastat_conv_factor,
  701. part_status,
  702. dbo.get_part_status_name(site, part_status) as partStatusDesc,
  703. configuration_id,
  704. estimated_material_cost,
  705. inventory_valuation_method,
  706. part_cost_group_id,
  707. dbo.get_part_cost_group_name(site, part_cost_group_id) as partCostGroupDesc,
  708. inventory_part_cost_level,
  709. invoice_consideration,
  710. zero_cost_flag,
  711. planning_method,
  712. dbo.get_planning_method_name(site, planning_method) as planningMethodDesc,
  713. safety_stock,
  714. min_order_qty,
  715. max_order_qty,
  716. mul_order_qty,
  717. safety_lead_time,
  718. shrinkage_fac,
  719. std_order_qty,
  720. cum_lead_time,
  721. back_flush_part,
  722. by_prod_as_supply_in_mrp_db,
  723. unprotected_lead_time,
  724. issue_type,
  725. mrp_control_flag_db,
  726. fixed_lead_time_day,
  727. over_reporting,
  728. use_theoretical_density_db,
  729. variable_lead_time_day,
  730. over_report_tolerance,
  731. fixed_lead_time_hour,
  732. density,
  733. variable_lead_time_hour,
  734. create_date,
  735. create_by,
  736. update_date,
  737. update_by
  738. FROM part
  739. <where>
  740. site = #{query.site}
  741. <if test = "query.partNo != null and query.partNo != ''">
  742. AND part_no like #{query.partNo}
  743. </if>
  744. <if test = "query.erpPartNo != null and query.erpPartNo != ''">
  745. AND erp_part_no like #{query.erpPartNo}
  746. </if>
  747. <if test = "query.partDesc != null and query.partDesc != ''">
  748. AND part_desc like #{query.partDesc}
  749. </if>
  750. <if test = "query.spec != null and query.spec != ''">
  751. AND spec like #{query.spec}
  752. </if>
  753. <if test="query.startDate != null ">
  754. AND required_completion_date >= #{query.startDate}
  755. </if>
  756. <if test="query.endDate != null ">
  757. AND #{query.endDate} >= required_completion_date
  758. </if>
  759. </where>
  760. </select>
  761. <!-- 根据物料编码查 masterPart 属性 -->
  762. <select id="queryMasterField" resultType="com.spring.modules.part.vo.MasterPartInformationVo" parameterType="PartInformationEntity">
  763. SELECT
  764. part_no,
  765. part_desc,
  766. weight_net,
  767. uom_for_weight_net,
  768. volume_net,
  769. uom_for_volume_net,
  770. um_id,
  771. dbo.get_um_name(um_id) as umName
  772. FROM part_catalog
  773. WHERE part_no = #{partNo}
  774. </select>
  775. <!-- 物料状态改为Y -->
  776. <update id="updatePartStatus" parameterType="PartInformationEntity">
  777. UPDATE part
  778. SET status = #{status},
  779. update_date = #{updateDate},
  780. update_by = #{updateBy}
  781. WHERE part_no = #{partNo} and Site = #{site}
  782. </update>
  783. <!-- 查询物料的revision列表 -->
  784. <select id="queryPartRevisionList" resultType="PartRevisionEntity" parameterType="PartRevisionEntity">
  785. SELECT
  786. site,
  787. part_no,
  788. eng_chg_level,
  789. eff_phase_in_date,
  790. eff_phase_out_date,
  791. revision_text,
  792. product_status,
  793. repair_status,
  794. eng_revision,
  795. create_date,
  796. create_by,
  797. update_date,
  798. update_by
  799. FROM part_revision
  800. WHERE site = #{site} and part_no = #{partNo}
  801. </select>
  802. <!-- 查询物料的revision列表 -->
  803. <select id="getPartRevisionList" resultType="PartIfsInventoryRevision" parameterType="PartInformationEntity">
  804. SELECT
  805. site as contract,
  806. part_no,
  807. eng_chg_level,
  808. eff_phase_in_date,
  809. eff_phase_out_date,
  810. revision_text,
  811. product_status,
  812. repair_status,
  813. eng_revision
  814. FROM part_revision
  815. WHERE site = #{site} and part_no = #{partNo}
  816. </select>
  817. <!-- 修改物料版本 -->
  818. <update id="updateRevision" parameterType="PartRevisionEntity">
  819. UPDATE part_revision
  820. SET eff_phase_in_date = #{effPhaseInDate},
  821. eff_phase_out_date = #{effPhaseOutDate},
  822. revision_text = #{revisionText},
  823. eng_revision = #{engRevision},
  824. update_date = getDate(),
  825. update_by = #{updateBy}
  826. WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel}
  827. </update>
  828. <!-- 获取当前物料所包含的库位 -->
  829. <select id="getPartLocationList" resultType="PartIfsInventoryLocation" parameterType="PartInformationEntity">
  830. SELECT
  831. a.site as contract,
  832. a.part_no,
  833. a.location_id as locationNo,
  834. b.location_type as locationType
  835. FROM plm_part_location as a
  836. left join location as b on a.site = b.site and a.location_id = b.location_id
  837. WHERE a.part_no = #{partNo} and a.site = #{site}
  838. </select>
  839. <!-- 获取物料的所有bomHeader -->
  840. <select id="getBomHeader" resultType="BomIfsHeader" parameterType="PartInformationEntity">
  841. SELECT
  842. site as contract,
  843. part_no,
  844. eng_chg_level,
  845. bom_type,
  846. eff_phase_in_date,
  847. eff_phase_out_date,
  848. note_text,
  849. create_date
  850. FROM plm_bom_header
  851. WHERE site = #{site} and part_no = #{partNo}
  852. </select>
  853. <!-- 获取header的所有detail -->
  854. <select id="getBomDetail" resultType="BomIfsAlternative" parameterType="BomIfsHeader">
  855. SELECT
  856. site as contract,
  857. part_no,
  858. eng_chg_level,
  859. bom_type,
  860. alternative_no,
  861. alternative_description as alternativeDesc,
  862. note_text
  863. FROM plm_bom_detail
  864. WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
  865. </select>
  866. <!-- 获取 detail 的所有 component -->
  867. <select id="getBomComponent" resultType="BomIfsItem" parameterType="BomIfsAlternative">
  868. SELECT
  869. site as contract,
  870. part_no,
  871. eng_chg_level,
  872. bom_type,
  873. alternative_no,
  874. line_item_no,
  875. line_sequence,
  876. component_part,
  877. qty_per_assembly,
  878. issue_type,
  879. component_scrap,
  880. shrinkage_factor
  881. FROM plm_bom_component
  882. WHERE site = #{contract} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
  883. </select>
  884. <!-- 物料的bom状态改为Y -->
  885. <update id="updateBomOfficialFlag" parameterType="PartInformationEntity">
  886. UPDATE plm_bom_header
  887. SET official_flag = #{status}
  888. WHERE part_no = #{partNo} and Site = #{site}
  889. </update>
  890. <!-- 查询版本 -->
  891. <select id="queryRevision" resultType="PartRevisionEntity" parameterType="PartRevisionEntity">
  892. SELECT
  893. site,
  894. part_no,
  895. eng_chg_level,
  896. eff_phase_in_date,
  897. eff_phase_out_date,
  898. revision_text,
  899. product_status,
  900. repair_status,
  901. eng_revision,
  902. create_date,
  903. create_by,
  904. update_date,
  905. update_by
  906. FROM part_revision
  907. WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel}
  908. </select>
  909. <!-- 新增物料版本 -->
  910. <insert id="saveRevision" parameterType="PartRevisionEntity">
  911. 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)
  912. values (#{site}, #{partNo}, #{engChgLevel}, #{effPhaseInDate}, #{effPhaseOutDate}, #{revisionText}, #{productStatus}, #{repairStatus}, #{engRevision}, getDate(), #{createBy})
  913. </insert>
  914. <!-- 修改当前物料版本的bom -->
  915. <update id="updateBomHeaderByRevision" parameterType="PartRevisionEntity">
  916. UPDATE plm_bom_header
  917. SET note_text = #{revisionText},
  918. eff_phase_in_date = #{effPhaseInDate},
  919. eff_phase_out_date = #{effPhaseOutDate},
  920. eng_revision = #{engRevision}
  921. WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel}
  922. </update>
  923. <!-- 查询版本 -->
  924. <select id="queryBomAlternative" resultType="BomDetailEntity" parameterType="PartRevisionEntity">
  925. SELECT
  926. site,
  927. part_no,
  928. alternative_no,
  929. alternative_description,
  930. bom_type,
  931. eng_chg_level,
  932. min_lot_qty,
  933. default_flag,
  934. note_text,
  935. create_date,
  936. create_by,
  937. update_date,
  938. update_by,
  939. status,
  940. official_flag
  941. FROM plm_bom_detail
  942. WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel}
  943. </select>
  944. <!-- 删除revision -->
  945. <delete id="deleteRevision" parameterType="PartRevisionEntity">
  946. delete from part_revision
  947. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel}
  948. </delete>
  949. <!-- 删除该版本下的bomDetail -->
  950. <delete id="deleteBomDetail" parameterType="PartRevisionEntity">
  951. delete from plm_bom_detail
  952. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel}
  953. </delete>
  954. <!-- 删除该版本下的bomComponent -->
  955. <delete id="deleteBomComponent" parameterType="PartRevisionEntity">
  956. delete from plm_bom_component
  957. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel}
  958. </delete>
  959. <!-- 删除该版本下的recipeDetail -->
  960. <delete id="deleteRecipeDetail" parameterType="PartRevisionEntity">
  961. delete from plm_recipe_detail
  962. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel}
  963. </delete>
  964. <!-- 删除该版本下的recipeComponent -->
  965. <delete id="deleteRecipeComponent" parameterType="PartRevisionEntity">
  966. delete from plm_recipe_component
  967. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel}
  968. </delete>
  969. <!-- 删除该版本下的副产品成本分配数据 -->
  970. <delete id="deleteManufStruct" parameterType="PartRevisionEntity">
  971. delete from plm_bom_manuf_struct_cost_distrib
  972. where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel}
  973. </delete>
  974. <!-- 获取当前物料所包含的版本 -->
  975. <select id="getFromPartRevision" resultType="PartRevisionEntity">
  976. SELECT
  977. #{toSite} as site,
  978. #{toPartNo} as partNo,
  979. eng_chg_level,
  980. eff_phase_in_date,
  981. eff_phase_out_date,
  982. revision_text,
  983. product_status,
  984. repair_status,
  985. eng_revision,
  986. #{createBy} as createBy
  987. FROM part_revision
  988. WHERE part_no = #{partNo} and site = #{site} and eff_phase_out_date is null
  989. order by eng_chg_level
  990. </select>
  991. <!-- 获取当前物料所包含的版本 -->
  992. <select id="getFromPartRevision2" resultType="PartRevisionEntity">
  993. SELECT
  994. site,
  995. #{ifsPartNo} as partNo,
  996. eng_chg_level,
  997. eff_phase_in_date,
  998. eff_phase_out_date,
  999. revision_text,
  1000. product_status,
  1001. repair_status,
  1002. eng_revision,
  1003. #{createBy} as createBy
  1004. FROM part_revision
  1005. WHERE part_no = #{partNo} and site = #{site}
  1006. </select>
  1007. <!-- 新增项目物料 -->
  1008. <insert id="saveProjectPart" parameterType="PartInformationEntity">
  1009. insert into plm_project_part
  1010. (site, project_id, test_part_no, base_no, rev_no, part_no_source,bu_no)
  1011. values
  1012. (#{site}, #{projectId}, #{partNo}, #{baseNo}, #{revNo}, #{partNoSource}, #{buNo})
  1013. </insert>
  1014. <!-- 修改项目物料finalPart -->
  1015. <update id="updateProjectFinalPart" parameterType="com.spring.modules.part.vo.PartInformationVo">
  1016. UPDATE plm_project_part
  1017. SET final_part_no = #{ifsPartNo},
  1018. update_date = getDate(),
  1019. update_by = #{updateBy}
  1020. WHERE site = #{site} and test_part_no = #{partNo}
  1021. </update>
  1022. <!-- 查询编码对象 -->
  1023. <select id="getTranNoData" resultType="TransNoControlData" parameterType="string">
  1024. SELECT
  1025. Site,
  1026. TransType,
  1027. NextNumber,
  1028. AutoAuthorize,
  1029. AutoTransfer,
  1030. TypeDesc,
  1031. Length,
  1032. TransNo
  1033. FROM TransNoControl
  1034. WHERE site = #{site} and TransType = #{projectPartNo}
  1035. </select>
  1036. <!-- 材料信息列表 -->
  1037. <select id="getProjectPartRow" resultType="com.spring.modules.part.vo.PartInformationVo">
  1038. SELECT top 1
  1039. site,
  1040. part_no,
  1041. part_desc,
  1042. spec,
  1043. part_type_db,
  1044. part_type,
  1045. family_id,
  1046. dbo.get_family_name(site, family_id) as familyName,
  1047. group_id,
  1048. dbo.get_group_name(site, group_id) as groupName,
  1049. um_id,
  1050. dbo.get_um_name(um_id) as umName,
  1051. weight_net,
  1052. uom_for_weight_net,
  1053. volume_net,
  1054. uom_for_volume_net,
  1055. lot_tracking_code,
  1056. active,
  1057. product_group_id1,
  1058. dbo.get_product_group_name(site, product_group_id1, '1') as productGroupName1,
  1059. product_group_id2,
  1060. dbo.get_product_group_name(site, product_group_id2, '2') as productGroupName2,
  1061. product_group_id3,
  1062. dbo.get_product_group_name(site, product_group_id3, '3') as productGroupName3,
  1063. product_group_id4,
  1064. dbo.get_product_group_name(site, product_group_id4, '4') as productGroupName4,
  1065. erp_part_no,
  1066. code_no,
  1067. dbo.get_code_desc(site, code_no, 'IP') as codeDesc,
  1068. manufacturer_id,
  1069. dbo.get_manufacturer_name(site, manufacturer_id) as manufacturerName,
  1070. agent_id,
  1071. dbo.split_agent_id(site, agent_id) as agentName,
  1072. type_designation,
  1073. hazard_code,
  1074. dbo.get_hazard_name(site, hazard_code) as hazardDesc,
  1075. asset_class,
  1076. dbo.get_assetClass_name(site, asset_class) as assetClassDesc,
  1077. dim_quality,
  1078. abc_class,
  1079. dbo.get_abcClass_name(site, abc_class) as abcClassDesc,
  1080. frequency_class,
  1081. lifecycle_stage,
  1082. country_of_origin,
  1083. dbo.get_country_of_origin_name(site, country_of_origin) as countryOfOriginDesc,
  1084. manufacturing_lead_time,
  1085. expected_lead_time,
  1086. region_of_origin,
  1087. dbo.get_region_of_origin_name(site, region_of_origin) as regionOfOriginDesc,
  1088. customs_stat_no,
  1089. dbo.get_customs_stat_name(site, customs_stat_no) as customsStatDesc,
  1090. durability_day,
  1091. intrastat_conv_factor,
  1092. part_status,
  1093. dbo.get_part_status_name(site, part_status) as partStatusDesc,
  1094. configuration_id,
  1095. estimated_material_cost,
  1096. inventory_valuation_method,
  1097. part_cost_group_id,
  1098. dbo.get_part_cost_group_name(site, part_cost_group_id) as partCostGroupDesc,
  1099. inventory_part_cost_level,
  1100. invoice_consideration,
  1101. zero_cost_flag,
  1102. planning_method,
  1103. dbo.get_planning_method_name(site, planning_method) as planningMethodDesc,
  1104. safety_stock,
  1105. min_order_qty,
  1106. max_order_qty,
  1107. mul_order_qty,
  1108. safety_lead_time,
  1109. shrinkage_fac,
  1110. std_order_qty,
  1111. cum_lead_time,
  1112. back_flush_part,
  1113. by_prod_as_supply_in_mrp_db,
  1114. unprotected_lead_time,
  1115. issue_type,
  1116. mrp_control_flag_db,
  1117. fixed_lead_time_day,
  1118. over_reporting,
  1119. use_theoretical_density_db,
  1120. variable_lead_time_day,
  1121. over_report_tolerance,
  1122. fixed_lead_time_hour,
  1123. density,
  1124. variable_lead_time_hour,
  1125. remark,
  1126. status,
  1127. create_date,
  1128. create_by,
  1129. update_date,
  1130. update_by
  1131. FROM part
  1132. where site = #{site} and part_no like #{partNo} + '%'
  1133. order by create_date desc
  1134. </select>
  1135. <!-- 材料信息列表 -->
  1136. <select id="getProjectPartRow2" parameterType="PlmProjectPartData" resultType="com.spring.modules.part.vo.PartInformationVo">
  1137. SELECT
  1138. a.site,
  1139. a.part_no,
  1140. a.part_desc,
  1141. a.spec,
  1142. a.part_type_db,
  1143. a.part_type,
  1144. a.family_id,
  1145. dbo.get_family_name(a.site, a.family_id) as familyName,
  1146. a.group_id,
  1147. dbo.get_group_name(a.site, a.group_id) as groupName,
  1148. a.um_id,
  1149. dbo.get_um_name(a.um_id) as umName,
  1150. a.weight_net,
  1151. a.uom_for_weight_net,
  1152. a.volume_net,
  1153. a.uom_for_volume_net,
  1154. a.lot_tracking_code,
  1155. a.active,
  1156. a.product_group_id1,
  1157. dbo.get_product_group_name(a.site, a.product_group_id1, '1') as productGroupName1,
  1158. a.product_group_id2,
  1159. dbo.get_product_group_name(a.site, a.product_group_id2, '2') as productGroupName2,
  1160. a.product_group_id3,
  1161. dbo.get_product_group_name(a.site, a.product_group_id3, '3') as productGroupName3,
  1162. a.product_group_id4,
  1163. dbo.get_product_group_name(a.site, a.product_group_id4, '4') as productGroupName4,
  1164. a.erp_part_no,
  1165. a.code_no,
  1166. dbo.get_code_desc(a.site, a.code_no, 'IP') as codeDesc,
  1167. a.manufacturer_id,
  1168. dbo.get_manufacturer_name(a.site, a.manufacturer_id) as manufacturerName,
  1169. a.agent_id,
  1170. dbo.split_agent_id(a.site, a.agent_id) as agentName,
  1171. a.type_designation,
  1172. a.hazard_code,
  1173. dbo.get_hazard_name(a.site, a.hazard_code) as hazardDesc,
  1174. a.asset_class,
  1175. dbo.get_assetClass_name(a.site, a.asset_class) as assetClassDesc,
  1176. a.dim_quality,
  1177. a.abc_class,
  1178. dbo.get_abcClass_name(a.site, a.abc_class) as abcClassDesc,
  1179. a.frequency_class,
  1180. a.lifecycle_stage,
  1181. a.country_of_origin,
  1182. dbo.get_country_of_origin_name(a.site, a.country_of_origin) as countryOfOriginDesc,
  1183. a.manufacturing_lead_time,
  1184. a.expected_lead_time,
  1185. a.region_of_origin,
  1186. dbo.get_region_of_origin_name(a.site, a.region_of_origin) as regionOfOriginDesc,
  1187. a.customs_stat_no,
  1188. dbo.get_customs_stat_name(a.site, a.customs_stat_no) as customsStatDesc,
  1189. a.durability_day,
  1190. a.intrastat_conv_factor,
  1191. a.part_status,
  1192. dbo.get_part_status_name(a.site, a.part_status) as partStatusDesc,
  1193. a.configuration_id,
  1194. a.estimated_material_cost,
  1195. a.inventory_valuation_method,
  1196. a.part_cost_group_id,
  1197. dbo.get_part_cost_group_name(a.site, a.part_cost_group_id) as partCostGroupDesc,
  1198. a.inventory_part_cost_level,
  1199. a.invoice_consideration,
  1200. a.zero_cost_flag,
  1201. a.planning_method,
  1202. dbo.get_planning_method_name(a.site, a.planning_method) as planningMethodDesc,
  1203. a.safety_stock,
  1204. a.min_order_qty,
  1205. a.max_order_qty,
  1206. a.mul_order_qty,
  1207. a.safety_lead_time,
  1208. a.shrinkage_fac,
  1209. a.std_order_qty,
  1210. a.cum_lead_time,
  1211. a.back_flush_part,
  1212. a.by_prod_as_supply_in_mrp_db,
  1213. a.unprotected_lead_time,
  1214. a.issue_type,
  1215. a.mrp_control_flag_db,
  1216. a.fixed_lead_time_day,
  1217. a.over_reporting,
  1218. a.use_theoretical_density_db,
  1219. a.variable_lead_time_day,
  1220. a.over_report_tolerance,
  1221. a.fixed_lead_time_hour,
  1222. a.density,
  1223. a.variable_lead_time_hour,
  1224. a.remark,
  1225. a.status,
  1226. a.create_date,
  1227. a.create_by,
  1228. a.update_date,
  1229. a.update_by,
  1230. d.customer_part_no,
  1231. b.bu_no,
  1232. dbo.plm_get_bu_desc(b.site,b.bu_no) buDesc
  1233. FROM part as a
  1234. LEFT JOIN plm_project_part as b on a.site = b.site and a.part_no = b.test_part_no
  1235. LEFT JOIN plm_project_info as c on b.site = c.site and b.project_id = c.project_id
  1236. LEFT JOIN plm_customer_part_info as d on c.site = d.site and c.customer_id = d.customer_no and b.test_part_no = d.part_no
  1237. where a.site = #{site} and a.part_no = #{testPartNo} and c.customer_id = #{customerId}
  1238. </select>
  1239. <!-- 新增项目物料 -->
  1240. <insert id="saveCustomerPartInfo" parameterType="PartInformationEntity">
  1241. insert into plm_customer_part_info
  1242. (site, customer_no, part_no, customer_part_no, create_date, create_by)
  1243. values
  1244. (#{site}, #{customerNo}, #{partNo}, #{customerPartNo}, getDate(), #{createBy})
  1245. </insert>
  1246. <!-- 获取当前项目不包含的物料 -->
  1247. <select id="getProjectPartList1" resultType="com.spring.modules.part.vo.PartInformationVo" parameterType="PlmProjectPartData">
  1248. SELECT
  1249. c.site,
  1250. c.part_no,
  1251. c.part_desc,
  1252. a.bu_no,
  1253. dbo.plm_get_bu_desc(a.site,a.bu_no) buDesc,
  1254. c.ifs_part_no as finalPartNo
  1255. FROM (select
  1256. prp1.site,
  1257. prp1.test_part_no,
  1258. prp1.bu_no
  1259. from plm_project_part as prp1
  1260. left join plm_project_info as ppi1 on ppi1.site = prp1.site and ppi1.project_id = prp1.project_id
  1261. where prp1.site = #{query.site} and ppi1.customer_id <![CDATA[<>]]> #{query.customerId}
  1262. ) as a
  1263. left join (select
  1264. prp2.site,
  1265. prp2.test_part_no
  1266. from plm_project_part as prp2
  1267. left join plm_project_info as ppi2 on ppi2.site = prp2.site and ppi2.project_id = prp2.project_id
  1268. where prp2.site = #{query.site} and ppi2.customer_id = #{query.customerId}) as b
  1269. on a.site = b.site and a.test_part_no = b.test_part_no
  1270. left join part as c on a.site = c.site and a.test_part_no = c.part_no
  1271. where b.test_part_no is null
  1272. and c.part_no not in
  1273. <foreach collection="query.arr" close=")" open="(" item="item" separator=",">
  1274. #{item}
  1275. </foreach>
  1276. <if test = "query.partNo != null and query.partNo != ''">
  1277. AND c.part_no like #{query.partNo}
  1278. </if>
  1279. <if test = "query.partDesc != null and query.partDesc != ''">
  1280. AND c.part_desc like #{query.partDesc}
  1281. </if>
  1282. </select>
  1283. <!-- 获取当前项目所包含的物料 -->
  1284. <select id="getProjectPartList2" resultType="com.spring.modules.part.vo.PartInformationVo" parameterType="PlmProjectPartData">
  1285. SELECT
  1286. a.site,
  1287. b.part_no,
  1288. b.part_desc,
  1289. d.customer_part_no
  1290. FROM plm_project_part a
  1291. LEFT JOIN part b ON a.site = b.site and a.test_part_no = b.part_no
  1292. LEFT JOIN plm_project_info as c on a.site = c.site and a.project_id = c.project_id
  1293. LEFT JOIN plm_customer_part_info as d on c.site = d.site and c.customer_id = d.customer_no and a.test_part_no = d.part_no
  1294. WHERE a.site = #{site} and a.project_id = #{projectId}
  1295. </select>
  1296. <!-- 获取当前项目不包含的物料 -->
  1297. <select id="getProjectPartList3" resultType="com.spring.modules.part.vo.PartInformationVo" parameterType="PlmProjectPartData">
  1298. SELECT
  1299. a.site,
  1300. a.part_no,
  1301. a.part_desc,
  1302. a.ifs_part_no as finalPartNo
  1303. FROM part as a
  1304. left join plm_project_part as b on a.site = b.site and a.part_no = b.test_part_no
  1305. where a.site = #{query.site}
  1306. and a.active = 'Y'
  1307. and b.test_part_no is null
  1308. and a.part_no not in
  1309. <foreach collection="query.arr" close=")" open="(" item="item" separator=",">
  1310. #{item}
  1311. </foreach>
  1312. <if test = "query.partNo != null and query.partNo != ''">
  1313. AND a.part_no like #{query.partNo}
  1314. </if>
  1315. <if test = "query.partDesc != null and query.partDesc != ''">
  1316. AND a.part_desc like #{query.partDesc}
  1317. </if>
  1318. </select>
  1319. <!-- 新增项目物料 -->
  1320. <insert id="addProjectPart">
  1321. insert into plm_project_part
  1322. (site, project_id, test_part_no, create_date, create_by, part_no_source, bu_no, final_part_no) VALUES
  1323. <foreach collection="list" item="item" index="index" separator=",">
  1324. (#{item.site}, #{item.projectId}, #{item.partNo}, getDate(), #{item.createBy}, #{item.partNoSource}, #{item.buNo}, #{item.finalPartNo})
  1325. </foreach>
  1326. </insert>
  1327. <!-- 新增项目物料 -->
  1328. <insert id="addCustomerPartInfo">
  1329. insert into plm_customer_part_info
  1330. (site, customer_no, part_no, customer_part_no, create_date, create_by) VALUES
  1331. <foreach collection="list" item="item" index="index" separator=",">
  1332. (#{item.site}, #{item.customerNo}, #{item.partNo}, #{item.customerPartNo}, getDate(), #{item.createBy})
  1333. </foreach>
  1334. </insert>
  1335. <!-- 获取当前项目所包含的物料 -->
  1336. <select id="getChangeRecordByPartNo" resultType="com.spring.modules.change.vo.ChangeRequestVo" parameterType="PlmProjectPartData">
  1337. SELECT
  1338. a.site,
  1339. a.change_no,
  1340. a.applicant_id,
  1341. dbo.get_userDisPlay(a.applicant_id) as applicantName,
  1342. u.department_no as applicationDepartmentId,
  1343. dbo.get_department_name(a.site, u.department_no) as applicationDepartmentName,
  1344. a.apply_date,
  1345. a.ecn_type,
  1346. a.change_impact,
  1347. a.change_impact_desc,
  1348. a.ecn_stage,
  1349. a.change_type,
  1350. a.tp_engineer_id,
  1351. dbo.get_userDisPlay(a.tp_engineer_id) as tpEngineerName,
  1352. a.change_phase_in_date,
  1353. a.df_is_product,
  1354. a.printing,
  1355. a.manufacturing_cost_is_change,
  1356. a.change_request_desc,
  1357. a.is_re_quote,
  1358. a.ul_certification_requirements,
  1359. a.ul_continue_to_meet_demand,
  1360. a.gp_certification_requirements,
  1361. a.gp_continue_to_meet_demand,
  1362. a.create_date,
  1363. a.create_by,
  1364. a.update_date,
  1365. a.update_by,
  1366. a.industrial_engineer_id,
  1367. dbo.get_userDisPlay(a.industrial_engineer_id) as industrialEngineerName,
  1368. a.change_status,
  1369. a.cqc_operator_id,
  1370. dbo.get_userDisPlay(a.cqc_operator_id) as cqcOperatorName,
  1371. a.fai_operator_id,
  1372. dbo.get_userDisPlay(a.fai_operator_id) as faiOperatorName,
  1373. d.node_id,
  1374. d.node_name,
  1375. d.create_by as createBy2
  1376. FROM plm_change_request as a
  1377. LEFT JOIN sys_user as u on a.site = u.site and a.applicant_id = u.username
  1378. LEFT JOIN plm_change_request_detail as b on a.site = b.site and a.change_no = b.change_no
  1379. LEFT JOIN plm_project_part as c on b.site = c.site and b.part_no = c.final_part_no
  1380. left join plm_request_header as prh on a.site = prh.site and prh.menu_id = #{menuId}
  1381. left join plm_request_node as d on a.site = d.site and prh.classification_no = d.classification_no and prh.workflow_id = d.workflow_id and a.step_id = d.step_id
  1382. WHERE a.site = #{site} and c.project_id = #{projectId}
  1383. </select>
  1384. <!-- 获取当前项目所包含的物料 -->
  1385. <select id="getChangeRecordByPartNo2" resultType="com.spring.modules.change.vo.ChangeRequestVo" parameterType="PlmProjectPartData">
  1386. SELECT
  1387. a.site,
  1388. a.change_no,
  1389. a.applicant_id,
  1390. dbo.get_userDisPlay(a.applicant_id) as applicantName,
  1391. u.department_no as applicationDepartmentId,
  1392. dbo.get_department_name(a.site, u.department_no) as applicationDepartmentName,
  1393. a.apply_date,
  1394. a.ecn_type,
  1395. a.change_impact,
  1396. a.change_impact_desc,
  1397. a.ecn_stage,
  1398. a.change_type,
  1399. a.tp_engineer_id,
  1400. dbo.get_userDisPlay(a.tp_engineer_id) as tpEngineerName,
  1401. a.change_phase_in_date,
  1402. a.df_is_product,
  1403. a.printing,
  1404. a.manufacturing_cost_is_change,
  1405. a.change_request_desc,
  1406. a.is_re_quote,
  1407. a.ul_certification_requirements,
  1408. a.ul_continue_to_meet_demand,
  1409. a.gp_certification_requirements,
  1410. a.gp_continue_to_meet_demand,
  1411. a.create_date,
  1412. a.create_by,
  1413. a.update_date,
  1414. a.update_by,
  1415. a.industrial_engineer_id,
  1416. dbo.get_userDisPlay(a.industrial_engineer_id) as industrialEngineerName,
  1417. a.change_status,
  1418. a.cqc_operator_id,
  1419. dbo.get_userDisPlay(a.cqc_operator_id) as cqcOperatorName,
  1420. a.fai_operator_id,
  1421. dbo.get_userDisPlay(a.fai_operator_id) as faiOperatorName,
  1422. d.node_id,
  1423. d.node_name,
  1424. d.create_by as createBy2
  1425. FROM plm_change_request as a
  1426. LEFT JOIN sys_user as u on a.site = u.site and a.applicant_id = u.username
  1427. LEFT JOIN plm_change_request_detail as b on a.site = b.site and a.change_no = b.change_no
  1428. LEFT JOIN plm_project_part as c on b.site = c.site and b.part_no = c.final_part_no
  1429. left join plm_request_header as prh on a.site = prh.site and prh.menu_id = #{menuId}
  1430. left join plm_request_node as d on a.site = d.site and prh.classification_no = d.classification_no and prh.workflow_id = d.workflow_id and a.step_id = d.step_id
  1431. WHERE a.site = #{site} and c.project_id = #{projectId} and c.final_part_no = #{finalPartNo}
  1432. </select>
  1433. <!-- 查询Bom替代 -->
  1434. <select id="queryBomAlternativeList" resultType="com.spring.modules.part.vo.BomDetailVo" parameterType="PartInformationEntity">
  1435. SELECT
  1436. a.site,
  1437. a.part_no,
  1438. a.alternative_no,
  1439. a.alternative_description,
  1440. a.bom_type,
  1441. a.eng_chg_level,
  1442. a.min_lot_qty,
  1443. a.default_flag,
  1444. a.note_text,
  1445. a.create_date,
  1446. a.create_by,
  1447. a.update_date,
  1448. a.update_by,
  1449. a.status,
  1450. a.official_flag,
  1451. b.eff_phase_in_date,
  1452. b.eff_phase_out_date,
  1453. b.note_text as bomHeaderNoteText,
  1454. b.eng_revision
  1455. FROM plm_bom_detail as a
  1456. LEFT JOIN plm_bom_header as b on a.site = b.site and a.part_no = b.part_no and a.eng_chg_level = b.eng_chg_level and a.bom_type = b.bom_type
  1457. WHERE a.site = #{site} and a.part_no = #{partNo}
  1458. </select>
  1459. <!-- 查询Bom替代 -->
  1460. <select id="queryRecipeAlternativeList" resultType="com.spring.modules.part.vo.RecipeDetailVo" parameterType="PartInformationEntity">
  1461. SELECT
  1462. a.site,
  1463. a.part_no,
  1464. a.alternative_no,
  1465. a.alternative_description,
  1466. a.bom_type,
  1467. a.eng_chg_level,
  1468. a.min_lot_qty,
  1469. a.default_flag,
  1470. a.note_text,
  1471. a.create_date,
  1472. a.create_by,
  1473. a.update_date,
  1474. a.update_by,
  1475. a.status,
  1476. a.official_flag,
  1477. b.eff_phase_in_date,
  1478. b.eff_phase_out_date,
  1479. b.note_text as bomHeaderNoteText,
  1480. b.eng_revision
  1481. FROM plm_recipe_detail as a
  1482. LEFT JOIN plm_recipe_header as b on a.site = b.site and a.part_no = b.part_no and a.eng_chg_level = b.eng_chg_level and a.bom_type = b.bom_type
  1483. WHERE a.site = #{site} and a.part_no = #{partNo}
  1484. </select>
  1485. <!-- 查询Routing替代 -->
  1486. <select id="queryRoutingAlternativeList" resultType="RoutingDetailEntity" parameterType="PartInformationEntity">
  1487. SELECT
  1488. a.site,
  1489. a.part_no,
  1490. a.routing_type,
  1491. a.routing_revision,
  1492. a.alternative_no,
  1493. a.alternative_description,
  1494. a.rout_template_id,
  1495. a.plan_date,
  1496. a.fixed_lead_time_day,
  1497. a.fixed_lead_time_hour,
  1498. a.variable_lead_time_day,
  1499. a.variable_lead_time_hour,
  1500. a.for_std_lot_by_day,
  1501. a.for_lot_by_day,
  1502. a.min_lot_qty,
  1503. a.note_text,
  1504. a.status,
  1505. a.official_flag
  1506. FROM plm_routing_detail as a
  1507. LEFT JOIN plm_routing_header 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
  1508. where a.site = #{site} and a.part_no = #{partNo}
  1509. </select>
  1510. <!-- &lt;!&ndash; 获取 component 对象&ndash;&gt;-->
  1511. <!-- <select id="getComponentPart" parameterType="com.spring.modules.part.vo.BomDetailVo" resultType="com.spring.modules.part.vo.PartInformationVo">-->
  1512. <!-- SELECT-->
  1513. <!-- a.site,-->
  1514. <!-- a.component_part as partNo,-->
  1515. <!-- a.eng_chg_level,-->
  1516. <!-- a.bom_type,-->
  1517. <!-- a.alternative_no,-->
  1518. <!-- b.alternative_description,-->
  1519. <!-- d.status-->
  1520. <!-- FROM plm_bom_component as a-->
  1521. <!-- LEFT JOIN plm_bom_detail as b on a.site = b.site and a.part_no = b.part_no and a.eng_chg_level = b.eng_chg_level and a.bom_type = b.bom_type and a.alternative_no = b.alternative_no-->
  1522. <!-- LEFT JOIN plm_bom_header as c on c.site = b.site and c.part_no = b.part_no and c.eng_chg_level = b.eng_chg_level and c.bom_type = b.bom_type-->
  1523. <!-- LEFT JOIN part as d on a.site = d.site and a.component_part = d.part_no-->
  1524. <!-- WHERE c.site = #{site} and c.part_no = #{partNo} and c.bom_type = 'Manufacturing' and c.eff_phase_out_date is null-->
  1525. <!-- </select>-->
  1526. <!-- 获取 component 对象-->
  1527. <select id="getComponentPart" parameterType="com.spring.modules.part.vo.BomDetailVo" resultType="com.spring.modules.part.vo.PartInformationVo">
  1528. SELECT
  1529. a.site,
  1530. a.component_part as partNo,
  1531. a.eng_chg_level,
  1532. a.bom_type,
  1533. a.alternative_no,
  1534. b.alternative_description,
  1535. d.status
  1536. FROM plm_bom_component as a
  1537. LEFT JOIN plm_bom_detail as b on a.site = b.site and a.part_no = b.part_no and a.eng_chg_level = b.eng_chg_level and a.bom_type = b.bom_type and a.alternative_no = b.alternative_no
  1538. LEFT JOIN part as d on a.site = d.site and a.component_part = d.part_no
  1539. 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}
  1540. </select>
  1541. <select id="getPartRevision" parameterType="PartInformationEntity" resultType="PartRevisionEntity">
  1542. SELECT
  1543. site,
  1544. part_no,
  1545. eng_chg_level,
  1546. eff_phase_in_date,
  1547. eff_phase_out_date,
  1548. revision_text,
  1549. product_status,
  1550. repair_status,
  1551. eng_revision,
  1552. create_date,
  1553. create_by,
  1554. update_date,
  1555. update_by
  1556. FROM part_revision
  1557. WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = 1
  1558. </select>
  1559. <!-- 根据物料编码删除 BOM Header -->
  1560. <delete id="deleteBomHeaderByPartNo" parameterType="PartInformationEntity">
  1561. delete from plm_bom_header
  1562. where site = #{site} and part_no = #{partNo}
  1563. </delete>
  1564. <!-- 根据物料编码删除 BOM Detail -->
  1565. <delete id="deleteBomDetailByPartNo" parameterType="PartInformationEntity">
  1566. delete from plm_bom_detail
  1567. where site = #{site} and part_no = #{partNo}
  1568. </delete>
  1569. <!-- 根据物料编码删除 BOM Component -->
  1570. <delete id="deleteBomComponentByPartNo" parameterType="PartInformationEntity">
  1571. delete from plm_bom_component
  1572. where site = #{site} and part_no = #{partNo}
  1573. </delete>
  1574. <!-- 根据物料编码删除 Recipe Header -->
  1575. <delete id="deleteRecipeHeaderByPartNo" parameterType="PartInformationEntity">
  1576. delete from plm_recipe_header
  1577. where site = #{site} and part_no = #{partNo}
  1578. </delete>
  1579. <!-- 根据物料编码删除 Recipe Detail -->
  1580. <delete id="deleteRecipeDetailByPartNo" parameterType="PartInformationEntity">
  1581. delete from plm_recipe_detail
  1582. where site = #{site} and part_no = #{partNo}
  1583. </delete>
  1584. <!-- 根据物料编码删除 Recipe Component -->
  1585. <delete id="deleteRecipeComponentByPartNo" parameterType="PartInformationEntity">
  1586. delete from plm_recipe_component
  1587. where site = #{site} and part_no = #{partNo}
  1588. </delete>
  1589. <!-- 根据物料编码删除 BOM 副产品成本分配 -->
  1590. <delete id="deleteBomManufStructCostDistribByPartNo" parameterType="PartInformationEntity">
  1591. delete from plm_bom_manuf_struct_cost_distrib
  1592. where site = #{site} and part_no = #{partNo}
  1593. </delete>
  1594. <!-- 根据物料编码删除 Routing Header -->
  1595. <delete id="deleteRoutingHeaderByPartNo" parameterType="PartInformationEntity">
  1596. delete from plm_routing_header
  1597. where site = #{site} and part_no = #{partNo}
  1598. </delete>
  1599. <!-- 根据物料编码删除 Routing Detail -->
  1600. <delete id="deleteRoutingDetailByPartNo" parameterType="PartInformationEntity">
  1601. delete from plm_routing_detail
  1602. where site = #{site} and part_no = #{partNo}
  1603. </delete>
  1604. <!-- 根据物料编码删除 Routing Component -->
  1605. <delete id="deleteRoutingComponentByPartNo" parameterType="PartInformationEntity">
  1606. delete from plm_routing_component
  1607. where site = #{site} and part_no = #{partNo}
  1608. </delete>
  1609. <!-- 根据物料编码删除 Routing Tool -->
  1610. <delete id="deleteRoutingToolByPartNo" parameterType="PartInformationEntity">
  1611. delete from routing_tool
  1612. where site = #{site} and part_no = #{partNo}
  1613. </delete>
  1614. <!-- 根据物料编码删除 Routing GuideLine -->
  1615. <delete id="deleteRoutingGuideLineByPartNo" parameterType="PartInformationEntity">
  1616. delete from plm_routing_work_guide
  1617. where site = #{site} and part_no = #{partNo}
  1618. </delete>
  1619. <!-- 新增物料版本 -->
  1620. <insert id="saveRevisions">
  1621. insert into part_revision
  1622. (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) VALUES
  1623. <foreach collection="list" item="item" index="index" separator=",">
  1624. (#{item.site}, #{item.partNo}, #{item.engChgLevel},CONVERT(datetime2, #{item.effPhaseInDate, jdbcType=TIMESTAMP}),
  1625. CONVERT(datetime2, #{item.effPhaseOutDate, jdbcType=TIMESTAMP}), #{item.revisionText}, #{item.productStatus}, #{item.repairStatus}, #{item.engRevision}, getDate(), #{item.createBy})
  1626. </foreach>
  1627. </insert>
  1628. <!-- 创建 IFS 物料的 BOM 替代 -->
  1629. <insert id="saveIfsBomAlternatives">
  1630. insert into plm_bom_detail
  1631. (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) VALUES
  1632. <foreach collection="list" item="item" index="index" separator=",">
  1633. (#{item.site}, #{item.partNo}, #{item.engChgLevel}, #{item.bomType}, #{item.alternativeNo}, #{item.alternativeDescription}, #{item.status}, #{item.minLotQty}, #{item.defaultFlag}, #{item.detailNoteText}, getDate(), #{item.createBy}, #{item.officialFlag})
  1634. </foreach>
  1635. </insert>
  1636. <!-- 创建 IFS 物料的 Recipe 替代 -->
  1637. <insert id="saveIfsRecipeAlternatives">
  1638. insert into plm_recipe_detail
  1639. (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) VALUES
  1640. <foreach collection="list" item="item" index="index" separator=",">
  1641. (#{item.site}, #{item.partNo}, #{item.engChgLevel}, #{item.bomType}, #{item.alternativeNo}, #{item.alternativeDescription}, #{item.status}, #{item.minLotQty}, #{item.defaultFlag}, #{item.detailNoteText}, getDate(), #{item.createBy}, #{item.officialFlag}, #{item.displayWeightUom}, #{item.displayVolumeUom}, #{item.regUnit})
  1642. </foreach>
  1643. </insert>
  1644. <!-- 创建 IFS 物料的 Routing 替代 -->
  1645. <insert id="saveIfsRoutingAlternatives">
  1646. insert into plm_routing_detail
  1647. (site, part_no, routing_revision, routing_type, alternative_no, alternative_description, fixed_lead_time_day, fixed_lead_time_hour, variable_lead_time_day, variable_lead_time_hour, for_std_lot_by_day, for_lot_by_day, min_lot_qty, note_text, create_date, create_by, status, official_flag) VALUES
  1648. <foreach collection="list" item="item" index="index" separator=",">
  1649. (#{item.site}, #{item.ifsPartNo}, #{item.routingRevision}, #{item.routingType}, #{item.alternativeNo}, #{item.alternativeDescription}, #{item.fixedLeadTimeDay}, #{item.fixedLeadTimeHour}, #{item.variableLeadTimeDay}, #{item.variableLeadTimeHour}, #{item.forStdLotByDay}, #{item.forLotByDay}, #{item.minLotQty}, #{item.detailNoteText}, getDate(), #{item.createBy}, #{item.status}, #{item.officialFlag})
  1650. </foreach>
  1651. </insert>
  1652. <!-- 查询代理商列表 -->
  1653. <select id="getPartAgents" resultType="com.spring.modules.part.vo.AgentInformationVo" parameterType="PartInformationEntity">
  1654. SELECT
  1655. site,
  1656. part_no,
  1657. agent_id
  1658. FROM part_agent
  1659. where site = #{site} and part_no = #{partNo}
  1660. </select>
  1661. <!-- 查询制造商列表 -->
  1662. <select id="getPartManufacturers" resultType="com.spring.modules.part.vo.ManufacturerInformationVo" parameterType="PartInformationEntity">
  1663. SELECT
  1664. site,
  1665. part_no,
  1666. manufacturer_id
  1667. FROM part_manufacturer
  1668. where site = #{site} and part_no = #{partNo}
  1669. </select>
  1670. <!-- 查询默认库位列表 -->
  1671. <select id="getPartDefaultLocations" resultType="com.spring.modules.part.vo.LocationInformationVo" parameterType="PartInformationEntity">
  1672. SELECT
  1673. site,
  1674. part_no,
  1675. location_id
  1676. FROM plm_part_location
  1677. where site = #{site} and part_no = #{partNo}
  1678. </select>
  1679. <!-- 查询文件列表 -->
  1680. <select id="getPartFiles" resultType="SysOssEntity" parameterType="PartInformationEntity">
  1681. SELECT
  1682. id,
  1683. url,
  1684. create_date,
  1685. file_name,
  1686. new_file_name,
  1687. create_by,
  1688. order_ref1,
  1689. order_ref2,
  1690. order_ref3,
  1691. file_type,
  1692. file_suffix,
  1693. file_type_code,
  1694. file_remark
  1695. FROM sys_oss
  1696. where order_ref1 = #{site} and order_ref2 = #{partNo}
  1697. </select>
  1698. <!-- 新增物料代理商 -->
  1699. <insert id="savePartAgent">
  1700. insert into part_agent
  1701. (site, part_no, agent_id) VALUES
  1702. <foreach collection="list" item="item" index="index" separator=",">
  1703. (#{item.site}, #{item.partNo}, #{item.agentId})
  1704. </foreach>
  1705. </insert>
  1706. <!-- 新增物料制造商 -->
  1707. <insert id="savePartManufacturer">
  1708. insert into part_manufacturer
  1709. (site, part_no, manufacturer_id) VALUES
  1710. <foreach collection="list" item="item" index="index" separator=",">
  1711. (#{item.site}, #{item.partNo}, #{item.manufacturerId})
  1712. </foreach>
  1713. </insert>
  1714. <!-- 新增物料制造商 -->
  1715. <insert id="savePartDefaultLocation">
  1716. insert into plm_part_location
  1717. (site, part_no, location_id) VALUES
  1718. <foreach collection="list" item="item" index="index" separator=",">
  1719. (#{item.site}, #{item.partNo}, #{item.locationId})
  1720. </foreach>
  1721. </insert>
  1722. <!-- 新增物料文件 -->
  1723. <insert id="savePartFile">
  1724. insert into sys_oss
  1725. (url, create_date, file_name, new_file_name, create_by, order_ref1, order_ref2, order_ref3, file_type, file_suffix, file_type_code, file_remark) VALUES
  1726. <foreach collection="list" item="item" index="index" separator=",">
  1727. (#{item.url}, #{item.createDate}, #{item.fileName}, #{item.newFileName}, #{item.createBy}, #{item.orderRef1}, #{item.orderRef2}, #{item.orderRef3}, #{item.fileType}, #{item.fileSuffix}, #{item.fileTypeCode}, #{item.fileRemark})
  1728. </foreach>
  1729. </insert>
  1730. <!-- 下一个物料编码 -->
  1731. <select id="getNextPartNo2" resultType="string" parameterType="com.spring.modules.part.vo.PartInformationVo">
  1732. select dbo.get_next_part_code(#{ifsPartNo})
  1733. </select>
  1734. <select id="checkPartLocationType" resultType="com.spring.modules.part.vo.LocationInformationVo" parameterType="com.spring.modules.part.vo.LocationInformationVo">
  1735. SELECT
  1736. a.site,
  1737. a.part_no,
  1738. a.location_id,
  1739. b.location_type
  1740. FROM plm_part_location as a
  1741. left join location as b on a.site = b.site and a.location_id = b.location_id
  1742. WHERE a.part_no = #{partNo} and a.site = #{site} and b.location_type = #{locationType}
  1743. </select>
  1744. <select id="checkPartLocationType2" resultType="com.spring.modules.part.vo.LocationInformationVo" parameterType="com.spring.modules.part.vo.LocationInformationVo">
  1745. SELECT
  1746. a.site,
  1747. a.part_no,
  1748. a.location_id,
  1749. b.location_type
  1750. FROM plm_part_location as a
  1751. left join location as b on a.site = b.site and a.location_id = b.location_id
  1752. WHERE a.part_no = #{partNo} and a.site = #{site} and b.location_type in ('Picking', 'Floor stock', 'Production line')
  1753. </select>
  1754. <!-- 修改物料版本 -->
  1755. <update id="updateRevisionOutDate">
  1756. UPDATE part_revision
  1757. SET eff_phase_out_date = #{effPhaseOutDate}
  1758. WHERE site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel}
  1759. </update>
  1760. <select id="getModelHeader" resultType="PartSubPropertiesValueHeaderData">
  1761. SELECT
  1762. #{ifsPartNo} as partNo,
  1763. Site,
  1764. CodeNo,
  1765. SubCodeSeqNo,
  1766. SubCodeDesc,
  1767. RecordType
  1768. FROM PartSubPropertiesValueHeader
  1769. where site = #{site} and RecordType = #{recordType} and PartNo = #{partNo} and CodeNo = #{codeNo}
  1770. </select>
  1771. <select id="getModelDetail" resultType="PartSubPropertiesValueData">
  1772. SELECT
  1773. #{ifsPartNo} as partNo,
  1774. Site,
  1775. CodeNo,
  1776. SubCodeSeqNo,
  1777. SubCodeDesc,
  1778. ItemNo,
  1779. PropertiesItemNo,
  1780. TextValue,
  1781. NumValue,
  1782. RecordType,
  1783. order_id
  1784. FROM PartSubPropertiesValue
  1785. where site = #{site} and RecordType = #{recordType} and PartNo = #{partNo} and CodeNo = #{codeNo}
  1786. </select>
  1787. <select id="getPartPropertyList" resultType="PartIfsInventoryProperty">
  1788. SELECT
  1789. a.PartNo as partNo,
  1790. a.Site as contract,
  1791. a.CodeNo as engAttribute,
  1792. a.PropertiesItemNo as characteristicCode,
  1793. isnull(a.TextValue, '') as attrValueAlpha,
  1794. ISNULL(CONVERT(VARCHAR(20), a.NumValue, 1), '') as attrValueNumeric,
  1795. case when b.ValueType_DB = 'T' then 'Alpha' when b.ValueType_DB = 'N' then 'Numeric' else '' end as characteristicType,
  1796. '' as unitMeas
  1797. FROM PartSubPropertiesValue as a
  1798. left join plm_properties_item as b on a.site = b.site and a.PropertiesItemNo = b.ItemNo and a.RecordType = b.ItemType
  1799. where a.site = #{site} and a.RecordType = #{recordType} and a.PartNo = #{partNo} and a.CodeNo = #{codeNo}
  1800. </select>
  1801. <select id="getMasterPartPropertyList" resultType="PartIfsCatalogProperty">
  1802. SELECT
  1803. 'PartCatalog' as luName,
  1804. ('PART_NO=' + a.PartNo + '^') as keyRef,
  1805. a.CodeNo as technicalClass,
  1806. a.PropertiesItemNo as attribute,
  1807. isnull(a.TextValue, '') as valueText,
  1808. ISNULL(CONVERT(VARCHAR(20), a.NumValue, 1), '') as valueNo,
  1809. case when b.ValueType_DB = 'T' then 'Alpha' when b.ValueType_DB = 'N' then 'Numeric' else '' end as attributeType,
  1810. '' as lowerLimit,
  1811. '' as upperLimit,
  1812. '' as info
  1813. FROM PartSubPropertiesValue as a
  1814. left join plm_properties_item as b on a.site = b.site and a.PropertiesItemNo = b.ItemNo and a.RecordType = b.ItemType
  1815. where a.RecordType = #{recordType} and a.PartNo = #{partNo} and a.CodeNo = #{codeNo}
  1816. </select>
  1817. <insert id="savePartModelHeaders">
  1818. insert into PartSubPropertiesValueHeader
  1819. (PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc, RecordType) VALUES
  1820. <foreach collection="list" item="item" index="index" separator=",">
  1821. (#{item.partNo}, #{item.site}, #{item.codeNo}, #{item.subCodeSeqNo,jdbcType=FLOAT}, #{item.subCodeDesc}, #{item.recordType})
  1822. </foreach>
  1823. </insert>
  1824. <insert id="savePartModelDetails">
  1825. insert into PartSubPropertiesValue
  1826. (PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc, ItemNo, PropertiesItemNo, TextValue, NumValue, RecordType, order_id) VALUES
  1827. <foreach collection="list" item="item" index="index" separator=",">
  1828. (#{item.partNo}, #{item.site}, #{item.codeNo}, #{item.subCodeSeqNo,jdbcType=FLOAT}, #{item.subCodeDesc}, #{item.itemNo,jdbcType=FLOAT}, #{item.propertiesItemNo}, #{item.textValue}, #{item.numValue,jdbcType=FLOAT}, #{item.recordType}, #{item.orderId})
  1829. </foreach>
  1830. </insert>
  1831. <select id="queryPart" resultType="com.spring.modules.part.entity.PartInformationEntity">
  1832. select top 100 site,
  1833. part_no,
  1834. part_desc,
  1835. spec,
  1836. part_type_db,
  1837. dbo.get_part_unitCost(site, part_no) as standardCost,
  1838. status,
  1839. um_id
  1840. from part
  1841. where site = #{site}
  1842. and part_no = #{partNo}
  1843. and active = 'Y'
  1844. </select>
  1845. <!-- 单独的方法 修改项目物料的BU相关信息 -->
  1846. <update id="updateProjectPartBuNo" parameterType="PartInformationEntity">
  1847. UPDATE plm_project_part
  1848. SET bu_no = #{buNo}
  1849. WHERE site = #{site} AND project_id = #{projectId} AND test_part_no = #{partNo}
  1850. </update>
  1851. <!-- 修改项目物料的客户料号相关信息 -->
  1852. <update id="updateProjectCustomerPartNo" parameterType="PartInformationEntity">
  1853. UPDATE plm_customer_part_info
  1854. SET customer_part_no = #{customerPartNo}
  1855. WHERE site = #{site} AND customer_no = #{customerNo} AND part_no = #{partNo}
  1856. </update>
  1857. <select id="queryPartByPartNo" resultType="com.spring.modules.part.entity.PartInformationEntity">
  1858. select
  1859. site,
  1860. part_no,
  1861. part_desc,
  1862. spec,
  1863. part_type_db,
  1864. dbo.get_part_unitCost(site, part_no) as standardCost,
  1865. status,
  1866. um_id
  1867. from part
  1868. where active = 'Y'
  1869. <if test="params.site != null and params.site != ''">
  1870. and site = #{params.site}
  1871. </if>
  1872. <if test="params.partNo != null and params.partNo != ''">
  1873. and part_no like #{params.partNo}
  1874. </if>
  1875. <if test="params.partDesc != null and params.partDesc != ''">
  1876. and part_desc like #{params.partDesc}
  1877. </if>
  1878. </select>
  1879. <!-- 查询文件ID -->
  1880. <select id="queryFileId" parameterType="SysOssEntity" resultType="SysOssEntity">
  1881. SELECT id, file_name
  1882. FROM sys_oss
  1883. WHERE order_ref1 = #{orderRef1} and order_ref2 = #{orderRef2}
  1884. </select>
  1885. <select id="getFileData" resultType="SysOssEntity">
  1886. select
  1887. url,
  1888. file_name,
  1889. new_file_name
  1890. from sys_oss
  1891. where id = #{id}
  1892. </select>
  1893. <select id="getTblBaseData" resultType="TblBaseDataEntity">
  1894. select
  1895. id,
  1896. site,
  1897. first_type,
  1898. second_type,
  1899. base_data,
  1900. base_desc,
  1901. status,
  1902. sort_no,
  1903. remark
  1904. from tbl_base_data
  1905. where first_type = #{firstType}
  1906. </select>
  1907. <delete id="delProjectPartByPartNo">
  1908. delete from plm_project_part
  1909. where site = #{site} and test_part_no = #{partNo}
  1910. </delete>
  1911. <select id="getMaxPartRevision" resultType="com.spring.modules.part.vo.PartRevisionVo">
  1912. SELECT
  1913. site,
  1914. part_no,
  1915. eng_chg_level,
  1916. eff_phase_in_date,
  1917. eff_phase_out_date,
  1918. revision_text,
  1919. product_status,
  1920. repair_status,
  1921. eng_revision
  1922. FROM part_revision
  1923. WHERE part_no = #{partNo} and site = #{site}
  1924. order by eng_chg_level desc
  1925. </select>
  1926. <!-- 查询物料的revision列表 -->
  1927. <select id="queryPartUnitCostList" resultType="InventoryPartUnitCostSumEntity" parameterType="InventoryPartUnitCostSumEntity">
  1928. SELECT
  1929. site,
  1930. part_no,
  1931. configuration_id,
  1932. inventory_value,
  1933. lot_batch_no,
  1934. serial_no
  1935. FROM inventory_part_unit_cost_sum
  1936. WHERE site = #{site} and part_no = #{partNo} and configuration_id = #{configurationId}
  1937. </select>
  1938. <select id="getMaxUnitValueRowVersion" resultType="java.lang.String">
  1939. select
  1940. isnull(max(ifs_row_version),'')
  1941. from inventory_part_unit_cost_sum
  1942. </select>
  1943. <select id="getPLMUnitValues" resultType="InventoryPartUnitCostSumEntity">
  1944. select
  1945. site,
  1946. part_no,
  1947. configuration_id,
  1948. inventory_value,
  1949. lot_batch_no,
  1950. serial_no,
  1951. ifs_row_version
  1952. from inventory_part_unit_cost_sum
  1953. where site in
  1954. <foreach collection="arr" close=")" open="(" item="item" separator=",">
  1955. #{item}
  1956. </foreach>
  1957. </select>
  1958. <!-- 批量新增 -->
  1959. <insert id="syncSaveUnitValue">
  1960. INSERT INTO inventory_part_unit_cost_sum (site, part_no, configuration_id, inventory_value, lot_batch_no, serial_no, ifs_row_version)
  1961. VALUES
  1962. <foreach item="item" collection="list" separator=",">
  1963. (#{item.site}, #{item.partNo}, #{item.configurationId}, #{item.inventoryValue}, #{item.lotBatchNo}, #{item.serialNo}, #{item.ifsRowVersion})
  1964. </foreach>
  1965. </insert>
  1966. <!-- 批量更新 -->
  1967. <update id="syncUpdateUnitValue" parameterType="java.util.List">
  1968. UPDATE inventory_part_unit_cost_sum
  1969. SET
  1970. inventory_value = CASE
  1971. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1972. WHEN site = #{item.site} AND part_no = #{item.partNo} AND configuration_id = #{item.configurationId} THEN #{item.inventoryValue}
  1973. </foreach>
  1974. ELSE inventory_value
  1975. END,
  1976. lot_batch_no = CASE
  1977. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1978. WHEN site = #{item.site} AND part_no = #{item.partNo} AND configuration_id = #{item.configurationId} THEN #{item.lotBatchNo}
  1979. </foreach>
  1980. ELSE lot_batch_no
  1981. END,
  1982. serial_no = CASE
  1983. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1984. WHEN site = #{item.site} AND part_no = #{item.partNo} AND configuration_id = #{item.configurationId} THEN #{item.serialNo}
  1985. </foreach>
  1986. ELSE serial_no
  1987. END,
  1988. ifs_row_version = CASE
  1989. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1990. WHEN site = #{item.site} AND part_no = #{item.partNo} AND configuration_id = #{item.configurationId} THEN #{item.ifsRowVersion}
  1991. </foreach>
  1992. ELSE ifs_row_version
  1993. END
  1994. WHERE (site, part_no, configuration_id) IN
  1995. <foreach item="item" index="index" collection="list" open="(" separator="),(" close=")">
  1996. (#{item.site}, #{item.partNo}, #{item.configurationId})
  1997. </foreach>
  1998. </update>
  1999. <select id="getItemListByCodeNo" resultType="PartSubPropertiesValueData">
  2000. select
  2001. #{site} as site,
  2002. #{codeNo} as CodeNo,
  2003. 1 as SubCodeSeqNo,
  2004. a.Code_Desc as SubCodeDesc,
  2005. b.seq_No as ItemNo,
  2006. b.properties_item_no as PropertiesItemNo,
  2007. case when c.ValueType_DB = 'T' then c.DefaultValue else null end as TextValue,
  2008. case when c.ValueType_DB = 'N' and c.DefaultValue != '' then c.DefaultValue else null end as NumValue,
  2009. #{recordType} as RecordType,
  2010. c.ItemDesc as ItemDesc,
  2011. c.ValueType,
  2012. c.ValueType_DB,
  2013. c.ValueChooseFlag
  2014. from plm_properties_model_header a
  2015. left join plm_properties_model_detail b on a.Code_No = b.Code_No and a.site = b.site and a.function_type = b.function_type
  2016. left join plm_properties_item c on b.properties_item_no = c.ItemNo and b.site = c.site and a.function_type = c.itemType
  2017. where a.Code_No = #{codeNo} and a.site = #{site} AND B.SITE IS NOT NULL AND A.function_type = #{recordType}
  2018. </select>
  2019. <!-- 获取当前项目不包含的物料 -->
  2020. <select id="getItemExclusionAlreadyExists" resultType="PartSubPropertiesValueData" parameterType="PartSubPropertiesValueData">
  2021. SELECT
  2022. site,
  2023. ItemNo as PropertiesItemNo,
  2024. ItemDesc,
  2025. ValueType,
  2026. ValueType_DB,
  2027. ValueChooseFlag,
  2028. itemType as RecordType
  2029. FROM plm_properties_item
  2030. where site = #{query.site} and itemType = #{query.recordType}
  2031. and ItemNo not in
  2032. <foreach collection="query.arr" close=")" open="(" item="item" separator=",">
  2033. #{item}
  2034. </foreach>
  2035. <if test = "query.propertiesItemNo != null and query.propertiesItemNo != ''">
  2036. AND ItemNo like #{query.propertiesItemNo}
  2037. </if>
  2038. <if test = "query.itemDesc != null and query.itemDesc != ''">
  2039. AND ItemDesc like #{query.itemDesc}
  2040. </if>
  2041. </select>
  2042. <select id="getProjectCustomerPartNo" parameterType="com.spring.modules.part.vo.PartInformationVo" resultType="com.spring.modules.part.vo.PartInformationVo">
  2043. select
  2044. site,
  2045. customer_no,
  2046. part_no,
  2047. customer_part_no,
  2048. create_date,
  2049. create_by,
  2050. update_date,
  2051. update_by
  2052. from plm_customer_part_info
  2053. where site = #{site} and part_no = #{partNo} and customer_no = #{customerNo}
  2054. </select>
  2055. <!-- 新增BOM header -->
  2056. <insert id="saveBomHeaders">
  2057. insert into plm_bom_header
  2058. (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) VALUES
  2059. <foreach collection="list" item="item" index="index" separator=",">
  2060. (#{item.site}, #{item.partNo}, #{item.engChgLevel}, #{item.bomType}, #{item.noteText}, #{item.effPhaseInDate}, #{item.effPhaseOutDate}, #{item.engRevision}, #{item.typeFlag}, #{item.netWeight}, #{item.officialFlag}, getDate(), #{item.createBy})
  2061. </foreach>
  2062. </insert>
  2063. <!-- 新增Recipe header -->
  2064. <insert id="saveRecipeHeaders">
  2065. insert into plm_recipe_header
  2066. (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) VALUES
  2067. <foreach collection="list" item="item" index="index" separator=",">
  2068. (#{item.site}, #{item.partNo}, #{item.engChgLevel}, #{item.bomType}, #{item.noteText}, #{item.effPhaseInDate}, #{item.effPhaseOutDate}, #{item.engRevision}, #{item.typeFlag}, #{item.netWeight}, #{item.officialFlag}, getDate(), #{item.createBy})
  2069. </foreach>
  2070. </insert>
  2071. <select id="getMasterPartModal" resultType="PartSubPropertiesValueHeaderData">
  2072. SELECT
  2073. PartNo,
  2074. Site,
  2075. CodeNo,
  2076. SubCodeSeqNo,
  2077. SubCodeDesc,
  2078. RecordType
  2079. FROM PartSubPropertiesValueHeader
  2080. where PartNo = #{partNo} and Site = #{site} and RecordType = #{recordType}
  2081. </select>
  2082. <select id="locationInformationSearch" parameterType="com.spring.modules.part.vo.LocationInformationVo" resultType="com.spring.modules.part.vo.LocationInformationVo">
  2083. SELECT
  2084. site,
  2085. location_id,
  2086. location_name,
  2087. warehouse_id,
  2088. active,
  2089. location_type
  2090. FROM location
  2091. where site = #{query.site}
  2092. <if test = "query.locationId != null and query.locationId != ''">
  2093. AND location_id like #{query.locationId}
  2094. </if>
  2095. <if test = "query.locationName != null and query.locationName != ''">
  2096. AND location_name like #{query.locationName}
  2097. </if>
  2098. <if test = "query.warehouseId != null and query.warehouseId != ''">
  2099. AND warehouse_id like #{query.warehouseId}
  2100. </if>
  2101. <if test = "query.locationType != null and query.locationType != ''">
  2102. AND location_type = #{query.locationType}
  2103. </if>
  2104. </select>
  2105. </mapper>