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.

2333 lines
93 KiB

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