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.

798 lines
31 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  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. product_group_id1,
  26. dbo.get_product_group_name(site, product_group_id1, '1') as productGroupName1,
  27. product_group_id2,
  28. dbo.get_product_group_name(site, product_group_id2, '2') as productGroupName2,
  29. product_group_id3,
  30. dbo.get_product_group_name(site, product_group_id3, '3') as productGroupName3,
  31. product_group_id4,
  32. dbo.get_product_group_name(site, product_group_id4, '4') as productGroupName4,
  33. erp_part_no,
  34. code_no,
  35. dbo.get_code_desc(site, code_no, 'IP') as codeDesc,
  36. manufacturer_id,
  37. dbo.get_manufacturer_name(site, manufacturer_id) as manufacturerName,
  38. agent_id,
  39. dbo.split_agent_id(site, agent_id) as agentName,
  40. type_designation,
  41. hazard_code,
  42. dbo.get_hazard_name(site, hazard_code) as hazardDesc,
  43. asset_class,
  44. dbo.get_assetClass_name(site, asset_class) as assetClassDesc,
  45. dim_quality,
  46. abc_class,
  47. dbo.get_abcClass_name(site, abc_class) as abcClassDesc,
  48. frequency_class,
  49. lifecycle_stage,
  50. country_of_origin,
  51. dbo.get_country_of_origin_name(site, country_of_origin) as countryOfOriginDesc,
  52. manufacturing_lead_time,
  53. expected_lead_time,
  54. region_of_origin,
  55. dbo.get_region_of_origin_name(site, region_of_origin) as regionOfOriginDesc,
  56. customs_star_no,
  57. dbo.get_customs_star_name(site, customs_star_no) as customsStarDesc,
  58. durability_day,
  59. intrastat_conv_factor,
  60. part_status,
  61. dbo.get_part_status_name(site, part_status) as partStatusDesc,
  62. configuration_id,
  63. estimated_material_cost,
  64. inventory_valuation_method,
  65. part_cost_group_id,
  66. dbo.get_part_cost_group_name(site, part_cost_group_id) as partCostGroupDesc,
  67. inventory_part_cost_level,
  68. invoice_consideration,
  69. zero_cost_flag,
  70. planning_method,
  71. dbo.get_planning_method_name(site, planning_method) as planningMethodDesc,
  72. safety_stock,
  73. min_order_qty,
  74. max_order_qty,
  75. mul_order_qty,
  76. safety_lead_time,
  77. shrinkage_fac,
  78. std_order_qty,
  79. cum_lead_time,
  80. back_flush_part,
  81. by_prod_as_supply_in_mrp_db,
  82. unprotected_lead_time,
  83. issue_type,
  84. mrp_control_flag_db,
  85. fixed_lead_time_day,
  86. over_reporting,
  87. use_theoretical_density_db,
  88. variable_lead_time_day,
  89. over_report_tolerance,
  90. fixed_lead_time_hour,
  91. density,
  92. variable_lead_time_hour,
  93. remark,
  94. status,
  95. create_date,
  96. create_by,
  97. update_date,
  98. update_by
  99. FROM part
  100. <where>
  101. site = #{query.site}
  102. <if test = "query.partNo != null and query.partNo != ''">
  103. AND part_no like #{query.partNo}
  104. </if>
  105. <if test = "query.erpPartNo != null and query.erpPartNo != ''">
  106. AND erp_part_no like #{query.erpPartNo}
  107. </if>
  108. <if test = "query.partDesc != null and query.partDesc != ''">
  109. AND part_desc like #{query.partDesc}
  110. </if>
  111. <if test = "query.spec != null and query.spec != ''">
  112. AND spec like #{query.spec}
  113. </if>
  114. <if test="query.startDate != null ">
  115. AND required_completion_date >= #{query.startDate}
  116. </if>
  117. <if test="query.endDate != null ">
  118. AND #{query.endDate} >= required_completion_date
  119. </if>
  120. </where>
  121. </select>
  122. <!-- 检查材料属性 -->
  123. <select id="checkValueHeaderData" resultType="PartSubPropertiesValueHeaderData">
  124. SELECT
  125. PartNo,
  126. Site,
  127. CodeNo,
  128. SubCodeSeqNo,
  129. SubCodeDesc,
  130. RecordType
  131. from PartSubPropertiesValueHeader
  132. where PartNo = #{partNo} and site = #{site} and CodeNo = #{codeNo} and RecordType = #{recordType}
  133. </select>
  134. <!-- 删除材料属性 -->
  135. <delete id="deletePartSubPropertiesValueHeader">
  136. delete from PartSubPropertiesValueHeader
  137. where PartNo = #{partNo} and site = #{site} and RecordType = #{recordType}
  138. </delete>
  139. <!-- 删除材料属性值 -->
  140. <delete id="deletePartSubPropertiesValue">
  141. delete from PartSubPropertiesValue
  142. where PartNo = #{partNo} and site = #{site} and RecordType = #{recordType}
  143. </delete>
  144. <!-- 新增材料属性 -->
  145. <insert id="savePartSubPropertiesValueHeader">
  146. insert into PartSubPropertiesValueHeader (PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc, RecordType)
  147. select #{partNo}, #{site}, #{codeNo}, 1, Code_Desc, #{recordType} from plm_properties_model_header
  148. where Code_No = #{codeNo} and site = #{site} and function_type = #{recordType}
  149. </insert>
  150. <!-- 新增材料属性值 -->
  151. <insert id="savePartSubPropertiesValue">
  152. insert into PartSubPropertiesValue (PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc, ItemNo, PropertiesItemNo, TextValue, NumValue, RecordType)
  153. select
  154. #{partNo},
  155. #{site},
  156. #{codeNo},
  157. 1,
  158. a.Code_Desc,
  159. b.seq_No,
  160. b.properties_item_no,
  161. case when c.ValueType_DB = 'T' then c.DefaultValue else null end,
  162. case when c.ValueType_DB = 'N' and c.DefaultValue != '' then c.DefaultValue else null end,
  163. #{recordType}
  164. from plm_properties_model_header a
  165. 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
  166. left join plm_properties_item c on b.properties_item_no = c.ItemNo and b.site = c.site and a.function_type = c.itemType
  167. where a.Code_No = #{codeNo} and a.site = #{site} AND B.SITE IS NOT NULL AND A.function_type = #{recordType}
  168. </insert>
  169. <select id="getItemModal" resultType="PartSubPropertiesValueData">
  170. SELECT
  171. a.PartNo,
  172. a.Site,
  173. a.CodeNo,
  174. a.SubCodeSeqNo,
  175. a.SubCodeDesc,
  176. a.ItemNo,
  177. a.PropertiesItemNo,
  178. a.TextValue,
  179. a.NumValue,
  180. a.RecordType,
  181. b.ItemDesc as ItemDesc,
  182. b.ValueType,
  183. b.ValueType_DB,
  184. b.ValueChooseFlag
  185. FROM PartSubPropertiesValue as a
  186. left join plm_properties_item as b on a.PropertiesItemNo = b.ItemNo and a.site = b.site and a.RecordType = b.ItemType
  187. where a.site = #{site} and RecordType = #{recordType} and a.PartNo = #{partNo,jdbcType=VARCHAR}
  188. </select>
  189. <!-- 获取属性可选值 -->
  190. <select id="getAvailableValueList" resultType="PlmPropertiesItemAvailableData">
  191. select
  192. ItemNo,
  193. ValueNo,
  194. AvailableValue
  195. from plm_properties_item_available
  196. where itemNo = #{propertiesItemNo} and site = #{site} and ItemType = #{recordType}
  197. </select>
  198. <!-- 编辑属性值 -->
  199. <update id="savePartItemValue" >
  200. update PartSubPropertiesValue
  201. set TextValue = #{textValue},
  202. NumValue = #{numValue, jdbcType=DOUBLE}
  203. where PropertiesItemNo = #{propertiesItemNo} and site = #{site} and PartNo = #{partNo} and RecordType = #{recordType}
  204. </update>
  205. <!-- 查询代理商列表 -->
  206. <select id="getAgentList" resultType="AgentInformationEntity" parameterType="AgentInformationEntity">
  207. SELECT
  208. site,
  209. agent_id,
  210. agent_name
  211. FROM agent
  212. <where>
  213. site = #{site}
  214. <if test = "agentId != null and agentId != ''">
  215. AND agent_id LIKE #{agentId}
  216. </if>
  217. <if test = "agentName != null and agentName != ''">
  218. AND agent_name LIKE #{deptName}
  219. </if>
  220. </where>
  221. </select>
  222. <!-- 查询代理商列表 -->
  223. <select id="getPartAgent" resultType="com.spring.modules.part.vo.AgentInformationVo" parameterType="com.spring.modules.part.vo.AgentInformationVo">
  224. SELECT
  225. a.site,
  226. a.part_no,
  227. a.agent_id,
  228. b.agent_name,
  229. b.active,
  230. b.create_date,
  231. b.create_by,
  232. b.update_date,
  233. b.update_by
  234. FROM part_agent as a
  235. left join agent as b on a.site = b.site and a.agent_id = b.agent_id
  236. where a.site = #{site} and a.part_no = #{partNo}
  237. </select>
  238. <!-- 获取当前物料不包含的代理商 -->
  239. <select id="getAgentList1" resultType="AgentInformationEntity" parameterType="PartInformationEntity">
  240. SELECT
  241. a.site,
  242. a.agent_id,
  243. a.agent_name,
  244. a.active,
  245. a.create_date,
  246. a.create_by,
  247. a.update_date,
  248. a.update_by
  249. FROM agent as a
  250. left join part_agent as b on a.site = b.site and a.agent_id = b.agent_id and b.part_no = #{partNo}
  251. where a.site = #{site} and b.part_no is null
  252. </select>
  253. <!-- 获取当前物料所包含的代理商 -->
  254. <select id="getAgentList2" resultType="AgentInformationEntity" parameterType="PartInformationEntity">
  255. SELECT
  256. a.site,
  257. a.agent_id,
  258. b.agent_name,
  259. b.active,
  260. b.create_date,
  261. b.create_by,
  262. b.update_date,
  263. b.update_by
  264. FROM part_agent a
  265. LEFT JOIN agent b ON a.agent_id = b.agent_id and a.site = b.site
  266. WHERE a.part_no = #{partNo} and a.site = #{site}
  267. </select>
  268. <!-- 获取当前物料所包含的代理商 -->
  269. <select id="selectAgentByPartNo" resultType="com.spring.modules.part.vo.AgentInformationVo" parameterType="com.spring.modules.part.vo.AgentInformationVo">
  270. SELECT
  271. site,
  272. agent_id
  273. FROM part_agent
  274. WHERE part_no = #{partNo} and site = #{site} and agent_id = #{agentId}
  275. </select>
  276. <!-- 新增物料代理商 -->
  277. <insert id="addPartAgent" parameterType="com.spring.modules.part.vo.AgentInformationVo">
  278. insert into part_agent (site, part_no, agent_id)
  279. values (#{site}, #{partNo}, #{agentId})
  280. </insert>
  281. <!-- 删除物料代理商 -->
  282. <delete id="deletePartAgent" parameterType="com.spring.modules.part.vo.AgentInformationVo">
  283. delete from part_agent
  284. where part_no = #{partNo} and site = #{site} and agent_id = #{agentId}
  285. </delete>
  286. <!-- 获取当前物料不包含的代理商 -->
  287. <select id="getAgentListBy" resultType="AgentInformationEntity" parameterType="com.spring.modules.part.vo.AgentInformationVo">
  288. SELECT
  289. a.site,
  290. a.agent_id,
  291. a.agent_name,
  292. a.active,
  293. a.create_date,
  294. a.create_by,
  295. a.update_date,
  296. a.update_by
  297. FROM agent as a
  298. left join part_agent as b on a.site = b.site and a.agent_id = b.agent_id and b.part_no = #{partNo}
  299. <where>
  300. a.site = #{site} and b.part_no is null
  301. <if test = "agentId != null and agentId != ''">
  302. AND a.agent_id LIKE #{agentId}
  303. </if>
  304. <if test = "agentName != null and agentName != ''">
  305. AND a.agent_name LIKE #{agentName}
  306. </if>
  307. </where>
  308. </select>
  309. <!-- 删除物料代理商 -->
  310. <delete id="deleteAgent" parameterType="com.spring.modules.part.vo.AgentInformationVo">
  311. delete from part_agent
  312. where part_no = #{partNo} and site = #{site} and agent_id = #{agentId}
  313. </delete>
  314. <!-- 查询制造商列表 -->
  315. <select id="getManufacturerList" resultType="ManufacturerInformationEntity" parameterType="ManufacturerInformationEntity">
  316. SELECT
  317. site,
  318. manufacturer_id,
  319. manufacturer_name
  320. FROM manufacturer
  321. <where>
  322. site = #{site}
  323. <if test = "manufacturerId != null and manufacturerId != ''">
  324. AND manufacturer_id LIKE #{manufacturerId}
  325. </if>
  326. <if test = "manufacturerName != null and manufacturerName != ''">
  327. AND manufacturer_name LIKE #{manufacturerName}
  328. </if>
  329. </where>
  330. </select>
  331. <!-- 查询制造商列表 -->
  332. <select id="getPartManufacturer" resultType="com.spring.modules.part.vo.ManufacturerInformationVo" parameterType="com.spring.modules.part.vo.ManufacturerInformationVo">
  333. SELECT
  334. a.site,
  335. a.part_no,
  336. a.manufacturer_id,
  337. b.manufacturer_name,
  338. b.active,
  339. b.create_date,
  340. b.create_by,
  341. b.update_date,
  342. b.update_by
  343. FROM part_manufacturer as a
  344. left join manufacturer as b on a.site = b.site and a.manufacturer_id = b.manufacturer_id
  345. where a.site = #{site} and a.part_no = #{partNo}
  346. </select>
  347. <!-- 获取当前物料不包含的制造商 -->
  348. <select id="getManufacturerList1" resultType="ManufacturerInformationEntity" parameterType="PartInformationEntity">
  349. SELECT
  350. a.site,
  351. a.manufacturer_id,
  352. a.manufacturer_name,
  353. a.active,
  354. a.create_date,
  355. a.create_by,
  356. a.update_date,
  357. a.update_by
  358. FROM manufacturer as a
  359. left join part_manufacturer as b on a.site = b.site and a.manufacturer_id = b.manufacturer_id and b.part_no = #{partNo}
  360. where a.site = #{site} and b.part_no is null
  361. </select>
  362. <!-- 获取当前物料所包含的制造商 -->
  363. <select id="getManufacturerList2" resultType="ManufacturerInformationEntity" parameterType="PartInformationEntity">
  364. SELECT
  365. a.site,
  366. a.manufacturer_id,
  367. b.manufacturer_name,
  368. b.active,
  369. b.create_date,
  370. b.create_by,
  371. b.update_date,
  372. b.update_by
  373. FROM part_manufacturer a
  374. LEFT JOIN manufacturer b ON a.manufacturer_id = b.manufacturer_id and a.site = b.site
  375. WHERE a.part_no = #{partNo} and a.site = #{site}
  376. </select>
  377. <!-- 获取当前物料所包含的制造商 -->
  378. <select id="selectManufacturerByPartNo" resultType="com.spring.modules.part.vo.ManufacturerInformationVo" parameterType="com.spring.modules.part.vo.ManufacturerInformationVo">
  379. SELECT
  380. site,
  381. manufacturer_id
  382. FROM part_manufacturer
  383. WHERE part_no = #{partNo} and site = #{site} and manufacturer_id = #{manufacturerId}
  384. </select>
  385. <!-- 新增物料制造商 -->
  386. <insert id="addPartManufacturer" parameterType="com.spring.modules.part.vo.ManufacturerInformationVo">
  387. insert into part_manufacturer (site, part_no, manufacturer_id)
  388. values (#{site}, #{partNo}, #{manufacturerId})
  389. </insert>
  390. <!-- 删除物料制造商 -->
  391. <delete id="deletePartManufacturer" parameterType="com.spring.modules.part.vo.ManufacturerInformationVo">
  392. delete from part_manufacturer
  393. where part_no = #{partNo} and site = #{site} and manufacturer_id = #{manufacturerId}
  394. </delete>
  395. <!-- 删除物料制造商 -->
  396. <delete id="deleteManufacturer">
  397. delete from part_manufacturer
  398. where part_no = #{partNo} and site = #{site} and manufacturer_id = #{manufacturerId}
  399. </delete>
  400. <!-- 获取当前物料不包含的制造商 -->
  401. <select id="getManufacturerListBy" resultType="ManufacturerInformationEntity" parameterType="com.spring.modules.part.vo.ManufacturerInformationVo">
  402. SELECT
  403. a.site,
  404. a.manufacturer_id,
  405. a.manufacturer_name,
  406. a.active,
  407. a.create_date,
  408. a.create_by,
  409. a.update_date,
  410. a.update_by
  411. FROM manufacturer as a
  412. left join part_manufacturer as b on a.site = b.site and a.manufacturer_id = b.manufacturer_id and b.part_no = #{partNo}
  413. <where>
  414. a.site = #{site} and b.part_no is null
  415. <if test = "manufacturerId != null and manufacturerId != ''">
  416. AND a.manufacturer_id LIKE #{manufacturerId}
  417. </if>
  418. <if test = "manufacturerName != null and manufacturerName != ''">
  419. AND a.manufacturer_name LIKE #{manufacturerName}
  420. </if>
  421. </where>
  422. </select>
  423. <!-- 修改IQC明细记录信息 -->
  424. <update id="commitItemValue" parameterType="PartSubPropertiesValueData">
  425. UPDATE PartSubPropertiesValue
  426. SET TextValue = #{textValue},
  427. NumValue = #{numValue,jdbcType=DECIMAL}
  428. WHERE PartNo = #{partNo} and Site = #{site} and CodeNo = #{codeNo} and SubCodeSeqNo = #{subCodeSeqNo} and ItemNo = #{itemNo} and RecordType = #{recordType}
  429. </update>
  430. <!-- 删除属性值 -->
  431. <delete id="deleteItem" parameterType="PartSubPropertiesValueData">
  432. delete from PartSubPropertiesValue
  433. where PartNo = #{partNo} and site = #{site} and RecordType = #{recordType} and CodeNo = #{codeNo} and SubCodeSeqNo = #{subCodeSeqNo} and ItemNo = #{itemNo}
  434. </delete>
  435. <select id="getItemLists" resultType="PlmPropertiesItemData" parameterType="PartSubPropertiesValueData">
  436. SELECT
  437. a.itemNo as itNo,
  438. a.ItemDesc
  439. FROM plm_properties_item a
  440. 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
  441. <where>
  442. a.ItemType = #{recordType}
  443. and a.site = #{site}
  444. AND b.codeNo is null
  445. <if test = "propertiesItemNo != null and propertiesItemNo != ''">
  446. AND a.ItemNo LIKE #{propertiesItemNo}
  447. </if>
  448. <if test = "itemDesc != null and itemDesc != ''">
  449. AND a.ItemDesc LIKE #{itemDesc}
  450. </if>
  451. </where>
  452. </select>
  453. <select id="getModelItemLists" resultType="PlmPropertiesItemData" parameterType="PartSubPropertiesValueData">
  454. select
  455. a.PropertiesItemNo as itNo,
  456. b.ItemDesc,
  457. a.ItemNo,
  458. a.PartNo,
  459. a.Site,
  460. a.CodeNo,
  461. a.SubCodeSeqNo,
  462. a.recordType
  463. from PartSubPropertiesValue a
  464. left join plm_properties_item b on a.PropertiesItemNo = b.ItemNo and a.recordType = b.ItemType and a.site = b.site
  465. where a.codeNo = #{codeNo} and a.recordType = #{recordType} and a.site = #{site} and a.PartNo = #{partNo}
  466. </select>
  467. <select id="checkPartItem" resultType="PartSubPropertiesValueData" parameterType="PartSubPropertiesValueData">
  468. select
  469. site,
  470. PartNo,
  471. CodeNo,
  472. SubCodeSeqNo,
  473. itemNo,
  474. PropertiesItemNo,
  475. RecordType
  476. from PartSubPropertiesValue
  477. where codeNo = #{codeNo} and recordType = #{recordType} and site = #{site} and PartNo = #{partNo} and PropertiesItemNo = #{itNo}
  478. </select>
  479. <select id="checkItem" resultType="PartSubPropertiesValueData" parameterType="PartSubPropertiesValueData">
  480. SELECT
  481. ItemDesc
  482. FROM plm_properties_item
  483. where itemType = #{recordType} and itemNo = #{itNo} and site = #{site}
  484. </select>
  485. <select id="getModalDetailSeqNo" resultType="double" parameterType="PartSubPropertiesValueData">
  486. SELECT
  487. isnull(max(itemNo),0) + 1
  488. from PartSubPropertiesValue
  489. where RecordType = #{recordType} and CodeNo = #{codeNo} and site = #{site} and PartNo = #{partNo} and SubCodeSeqNo = #{subCodeSeqNo}
  490. </select>
  491. <insert id="addPartItem" parameterType="PartSubPropertiesValueData">
  492. insert into PartSubPropertiesValue
  493. (PartNo, Site, CodeNo, SubCodeSeqNo, SubCodeDesc, ItemNo, PropertiesItemNo, TextValue, NumValue, RecordType)
  494. values (#{partNo}, #{site}, #{codeNo}, #{subCodeSeqNo,jdbcType=FLOAT}, #{codeDesc}, #{itemNo, jdbcType=FLOAT}, #{itNo}, #{textValue}, #{numValue, jdbcType=FLOAT}, #{recordType})
  495. </insert>
  496. <delete id="deletePartItem" parameterType="PartSubPropertiesValueData">
  497. delete from PartSubPropertiesValue
  498. where PartNo = #{partNo} and site = #{site} and RecordType = #{recordType} and CodeNo = #{codeNo} and SubCodeSeqNo = #{subCodeSeqNo} and ItemNo = #{itemNo}
  499. </delete>
  500. <select id="queryCodeNo" parameterType="com.spring.modules.part.vo.MasterPartInformationVo" resultType="PartSubPropertiesValueData">
  501. SELECT
  502. PartNo,
  503. Site,
  504. CodeNo,
  505. SubCodeSeqNo,
  506. SubCodeDesc,
  507. RecordType
  508. FROM PartSubPropertiesValueHeader
  509. where PartNo = #{partNo} and Site = #{site} and SubCodeSeqNo = 1 and RecordType = 'IP'
  510. </select>
  511. <!-- 获取当前物料不包含的库位 -->
  512. <select id="getLocationList1" resultType="LocationInformationEntity" parameterType="PartInformationEntity">
  513. SELECT
  514. a.site,
  515. a.location_id,
  516. a.location_name,
  517. a.warehouse_id,
  518. a.active,
  519. a.create_date,
  520. a.create_by,
  521. a.update_date,
  522. a.update_by
  523. FROM plm_location as a
  524. left join plm_part_location as b on a.site = b.site and a.location_id = b.location_id and b.part_no = #{partNo}
  525. where a.site = #{site} and b.part_no is null
  526. </select>
  527. <!-- 获取当前物料所包含的库位 -->
  528. <select id="getLocationList2" resultType="LocationInformationEntity" parameterType="PartInformationEntity">
  529. SELECT
  530. a.site,
  531. a.location_id,
  532. b.location_name,
  533. b.warehouse_id,
  534. b.active,
  535. b.create_date,
  536. b.create_by,
  537. b.update_date,
  538. b.update_by
  539. FROM plm_part_location a
  540. LEFT JOIN plm_location b ON a.location_id = b.location_id and a.site = b.site
  541. WHERE a.part_no = #{partNo} and a.site = #{site}
  542. </select>
  543. <!-- 获取当前物料不包含的库位 -->
  544. <select id="getLocationListBy" resultType="LocationInformationEntity" parameterType="com.spring.modules.part.vo.LocationInformationVo">
  545. SELECT
  546. a.site,
  547. a.location_id,
  548. a.location_name,
  549. a.warehouse_id,
  550. a.active,
  551. a.create_date,
  552. a.create_by,
  553. a.update_date,
  554. a.update_by
  555. FROM plm_location as a
  556. left join plm_part_location as b on a.site = b.site and a.location_id = b.location_id and b.part_no = #{partNo}
  557. <where>
  558. a.site = #{site} and b.part_no is null
  559. <if test = "locationId != null and locationId != ''">
  560. AND a.location_id LIKE #{locationId}
  561. </if>
  562. <if test = "locationName != null and locationName != ''">
  563. AND a.location_name LIKE #{locationName}
  564. </if>
  565. </where>
  566. </select>
  567. <!-- 查询库位列表 -->
  568. <select id="getDefaultLocation" resultType="com.spring.modules.part.vo.LocationInformationVo" parameterType="com.spring.modules.part.vo.LocationInformationVo">
  569. SELECT
  570. a.site,
  571. a.part_no,
  572. a.location_id,
  573. b.location_name,
  574. b.warehouse_id,
  575. b.active,
  576. b.create_date,
  577. b.create_by,
  578. b.update_date,
  579. b.update_by
  580. FROM plm_part_location as a
  581. left join plm_location as b on a.site = b.site and a.location_id = b.location_id
  582. where a.site = #{site} and a.part_no = #{partNo}
  583. </select>
  584. <!-- 获取当前物料所包含的库位 -->
  585. <select id="selectLocationByPartNo" resultType="com.spring.modules.part.vo.LocationInformationVo" parameterType="com.spring.modules.part.vo.LocationInformationVo">
  586. SELECT
  587. site,
  588. location_id
  589. FROM plm_part_location
  590. WHERE part_no = #{partNo} and site = #{site} and location_id = #{locationId}
  591. </select>
  592. <!-- 新增物料库位 -->
  593. <insert id="addDefaultLocation" parameterType="com.spring.modules.part.vo.LocationInformationVo">
  594. insert into plm_part_location (site, part_no, location_id)
  595. values (#{site}, #{partNo}, #{locationId})
  596. </insert>
  597. <!-- 删除物料库位 -->
  598. <delete id="deleteDefaultLocation" parameterType="com.spring.modules.part.vo.LocationInformationVo">
  599. delete from plm_part_location
  600. where part_no = #{partNo} and site = #{site} and location_id = #{locationId}
  601. </delete>
  602. <!-- 删除代理商 -->
  603. <delete id="deleteAgentByPartNo" parameterType="PartInformationEntity">
  604. delete from part_agent
  605. where part_no = #{partNo} and site = #{site}
  606. </delete>
  607. <!-- 删除制造商商 -->
  608. <delete id="deleteManufacturerByPartNo" parameterType="PartInformationEntity">
  609. delete from part_manufacturer
  610. where part_no = #{partNo} and site = #{site}
  611. </delete>
  612. <!-- 删除代理商 -->
  613. <delete id="deleteLocationByPartNo" parameterType="PartInformationEntity">
  614. delete from plm_part_location
  615. where part_no = #{partNo} and site = #{site}
  616. </delete>
  617. <select id="partAllInfoSearch" parameterType="com.spring.modules.part.vo.PartInformationVo" resultType="com.spring.modules.part.vo.PartInformationVo">
  618. SELECT
  619. site,
  620. part_no,
  621. part_desc,
  622. spec,
  623. part_type_db,
  624. part_type,
  625. family_id,
  626. dbo.get_family_name(site, family_id) as familyName,
  627. group_id,
  628. dbo.get_group_name(site, group_id) as groupName,
  629. um_id,
  630. dbo.get_um_name(site, um_id) as umName,
  631. weight_net,
  632. uom_for_weight_net,
  633. volume_net,
  634. uom_for_volume_net,
  635. lot_tracking_code,
  636. active,
  637. product_group_id1,
  638. dbo.get_product_group_name(site, product_group_id1, '1') as productGroupName1,
  639. product_group_id2,
  640. dbo.get_product_group_name(site, product_group_id2, '2') as productGroupName2,
  641. product_group_id3,
  642. dbo.get_product_group_name(site, product_group_id3, '3') as productGroupName3,
  643. product_group_id4,
  644. dbo.get_product_group_name(site, product_group_id4, '4') as productGroupName4,
  645. erp_part_no,
  646. code_no,
  647. dbo.get_code_desc(site, code_no, 'IP') as codeDesc,
  648. manufacturer_id,
  649. dbo.get_manufacturer_name(site, manufacturer_id) as manufacturerName,
  650. agent_id,
  651. dbo.split_agent_id(site, agent_id) as agentName,
  652. type_designation,
  653. hazard_code,
  654. dbo.get_hazard_name(site, hazard_code) as hazardDesc,
  655. asset_class,
  656. dbo.get_assetClass_name(site, asset_class) as assetClassDesc,
  657. dim_quality,
  658. abc_class,
  659. dbo.get_abcClass_name(site, abc_class) as abcClassDesc,
  660. frequency_class,
  661. lifecycle_stage,
  662. country_of_origin,
  663. dbo.get_country_of_origin_name(site, country_of_origin) as countryOfOriginDesc,
  664. manufacturing_lead_time,
  665. expected_lead_time,
  666. region_of_origin,
  667. dbo.get_region_of_origin_name(site, region_of_origin) as regionOfOriginDesc,
  668. customs_star_no,
  669. dbo.get_customs_star_name(site, customs_star_no) as customsStarDesc,
  670. durability_day,
  671. intrastat_conv_factor,
  672. part_status,
  673. dbo.get_part_status_name(site, part_status) as partStatusDesc,
  674. configuration_id,
  675. estimated_material_cost,
  676. inventory_valuation_method,
  677. part_cost_group_id,
  678. dbo.get_part_cost_group_name(site, part_cost_group_id) as partCostGroupDesc,
  679. inventory_part_cost_level,
  680. invoice_consideration,
  681. zero_cost_flag,
  682. planning_method,
  683. dbo.get_planning_method_name(site, planning_method) as planningMethodDesc,
  684. safety_stock,
  685. min_order_qty,
  686. max_order_qty,
  687. mul_order_qty,
  688. safety_lead_time,
  689. shrinkage_fac,
  690. std_order_qty,
  691. cum_lead_time,
  692. back_flush_part,
  693. by_prod_as_supply_in_mrp_db,
  694. unprotected_lead_time,
  695. issue_type,
  696. mrp_control_flag_db,
  697. fixed_lead_time_day,
  698. over_reporting,
  699. use_theoretical_density_db,
  700. variable_lead_time_day,
  701. over_report_tolerance,
  702. fixed_lead_time_hour,
  703. density,
  704. variable_lead_time_hour,
  705. create_date,
  706. create_by,
  707. update_date,
  708. update_by
  709. FROM part
  710. <where>
  711. site = #{query.site}
  712. <if test = "query.partNo != null and query.partNo != ''">
  713. AND part_no like #{query.partNo}
  714. </if>
  715. <if test = "query.erpPartNo != null and query.erpPartNo != ''">
  716. AND erp_part_no like #{query.erpPartNo}
  717. </if>
  718. <if test = "query.partDesc != null and query.partDesc != ''">
  719. AND part_desc like #{query.partDesc}
  720. </if>
  721. <if test = "query.spec != null and query.spec != ''">
  722. AND spec like #{query.spec}
  723. </if>
  724. <if test="query.startDate != null ">
  725. AND required_completion_date >= #{query.startDate}
  726. </if>
  727. <if test="query.endDate != null ">
  728. AND #{query.endDate} >= required_completion_date
  729. </if>
  730. </where>
  731. </select>
  732. <!-- 根据物料编码查 masterPart 属性 -->
  733. <select id="queryMasterField" resultType="com.spring.modules.part.vo.MasterPartInformationVo" parameterType="PartInformationEntity">
  734. SELECT
  735. part_no,
  736. part_desc,
  737. weight_net,
  738. uom_for_weight_net,
  739. volume_net,
  740. uom_for_volume_net,
  741. um_id,
  742. dbo.get_um_name(um_id) as umName
  743. FROM part_catalog
  744. WHERE part_no = #{partNo}
  745. </select>
  746. </mapper>