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.

642 lines
28 KiB

2 years ago
2 years ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
1 year ago
1 year ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
11 months ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
10 months ago
10 months ago
10 months ago
2 years ago
10 months ago
10 months ago
2 years ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
1 year ago
1 year ago
2 years ago
1 year 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
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 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
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
11 months 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
1 year ago
1 year ago
1 year ago
12 months ago
1 year ago
1 year ago
11 months ago
12 months ago
1 year ago
11 months ago
12 months ago
1 year ago
1 year ago
11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
11 months 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.project.dao.ProjectDao">
  4. <select id="selectProjectInfoList" resultType="PlmProjectInfoData">
  5. SELECT project_id,ori_project_id,project_type_db,project_name,status,project_source,customer_id,create_by,
  6. create_date,update_by,update_date,priority,site,id,project_desc,customer_remark,remark,dbo.get_projectTeamName(site,project_id,'owner') projectOwnerName
  7. ,dbo.get_projectTeamName(site,project_id,'manager') ProjectManagerName,dbo.plm_get_dictDataLabel('project_info_type_db',project_type_db,site) projectType,
  8. dbo.plm_get_projectBaseDesc(status,'project_status') projectStatusDesc,dbo.plm_get_dictDataLabel('project_info_source',project_source,site) projectSourceDesc,
  9. dbo.plm_get_customer_desc(site,customer_id) customerName,dbo.plm_get_dictDataLabel('project_info_priority',priority,site) priorityDesc,need_date,
  10. dbo.get_projectUserRoleName(site,project_id) userRoleName,parent_project_no,
  11. final_customer_id,dbo.plm_get_dictDataLabel('finalCustomer',final_customer_id,site) finalCustomerName,productSet
  12. FROM plm_project_info
  13. <where>
  14. <if test="site != null and site != ''">
  15. AND site = #{site}
  16. </if>
  17. <if test="projectId != null and projectId != ''">
  18. AND project_id like #{projectId}
  19. </if>
  20. <if test="projectName != null and projectName != ''">
  21. AND project_name like #{projectName}
  22. </if>
  23. <if test="customerId != null and customerId != ''">
  24. AND customer_id like #{customerId}
  25. </if>
  26. </where>
  27. order by LEFT(project_id, CHARINDEX('-', project_id + '-') - 1) desc
  28. </select>
  29. <select id="projectInfoSearch" parameterType="PlmProjectInfoData" resultType="PlmProjectInfoData">
  30. SELECT project_id,ori_project_id,project_type_db,project_name,status,project_source,customer_id,create_by,
  31. create_date,update_by,update_date,priority,site,id,project_desc,customer_remark,remark,dbo.get_projectTeamName(site,project_id,'owner') projectOwnerName
  32. ,dbo.get_projectTeamName(site,project_id,'manager') ProjectManagerName,dbo.plm_get_dictDataLabel('project_info_type_db',project_type_db,site) projectType,
  33. dbo.plm_get_projectBaseDesc(status,'project_status') projectStatusDesc,dbo.plm_get_dictDataLabel('project_info_source',project_source,site) projectSourceDesc,
  34. dbo.plm_get_customer_desc(site,customer_id) customerName,dbo.plm_get_dictDataLabel('project_info_priority',priority,site) priorityDesc,need_date,
  35. dbo.get_projectUserRoleName(site,project_id) userRoleName,parent_project_no,customer_project_no,
  36. final_customer_id,dbo.plm_get_dictDataLabel('finalCustomer',final_customer_id,site) finalCustomerName,productSet
  37. FROM plm_project_info
  38. <where>
  39. <if test="query.id != null">
  40. AND id = #{query.id}
  41. </if>
  42. <if test="query.customerProjectNo != null and query.customerProjectNo != ''">
  43. AND customer_project_no like #{query.customerProjectNo}
  44. </if>
  45. <if test="query.site != null and query.site != ''">
  46. AND site = #{query.site}
  47. </if>
  48. <if test="query.projectId != null and query.projectId != ''">
  49. AND project_id like #{query.projectId}
  50. </if>
  51. <if test="query.projectType != null and query.projectType != ''">
  52. AND plm_project_info.project_type_db like #{query.projectType}
  53. </if>
  54. <if test="query.projectOwnerName != null and query.projectOwnerName != ''">
  55. AND dbo.get_projectTeamName(site,project_id,'owner') like #{query.projectOwnerName}
  56. </if>
  57. <if test="query.userName != null and query.userName != '' and query.userName != 'admin'">
  58. AND project_id in ( select project_id from AccessProject where site=#{query.site} and username=#{query.userName} and searchFlag='Y' )
  59. </if>
  60. <if test="query.priority != null and query.priority != ''">
  61. AND plm_project_info.priority = #{query.priority}
  62. </if>
  63. <if test="query.customerName != null and query.customerName != ''">
  64. AND dbo.plm_get_customer_desc(site,customer_id) like #{query.customerName}
  65. </if>
  66. <if test="query.customerId != null and query.customerId != ''">
  67. AND plm_project_info.customer_Id like #{query.customerId}
  68. </if>
  69. </where>
  70. order by LEFT(project_id, CHARINDEX('-', project_id + '-') - 1) desc
  71. </select>
  72. <select id="checkPlmProjectInfoData" resultType="PlmProjectInfoData">
  73. SELECT project_id,ori_project_id,project_type_db,project_name,status,project_source,customer_id,create_by,
  74. create_date,update_by,update_date,priority,site,id,project_desc,customer_remark,remark,dbo.get_projectTeamName(site,project_id,'owner') projectOwnerName
  75. ,dbo.get_projectTeamName(site,project_id,'manager') ProjectManagerName,dbo.plm_get_dictDataLabel('project_info_type_db',project_type_db,site) projectType,
  76. dbo.plm_get_projectBaseDesc(status,'project_status') projectStatusDesc,dbo.plm_get_dictDataLabel('project_info_source',project_source,site) projectSourceDesc,
  77. dbo.plm_get_customer_desc(site,customer_id) customerName,dbo.plm_get_dictDataLabel('project_info_priority',priority,site) priorityDesc,need_date,
  78. dbo.get_projectUserRoleName(site,project_id) userRoleName,parent_project_no,productSet
  79. FROM plm_project_info where id=#{id}
  80. </select>
  81. <select id="searchOperatorWithSite" resultType="com.spring.modules.project.data.PlmOperatorData">
  82. select operator_id,operator_name from plm_operator u
  83. <if test="roleNo != null and roleNo != ''">
  84. inner join AccessRole r on u.site = r.site and u.operator_id = r.username and role_no = #{roleNo}
  85. </if>
  86. <where>
  87. and u.site=#{site}
  88. <if test="operatorId != null and operatorId != ''">
  89. AND u.operator_id like #{operatorId}
  90. </if>
  91. </where>
  92. order by operator_id desc
  93. </select>
  94. <select id="searchProjectTeam" resultType="PlmOperatorData">
  95. select b.operator_id,b.operator_name
  96. from plm_project_team a left join plm_operator b on a.site=b.site and a.operator_id=b.operator_id
  97. where a.site=#{site} AND a.project_id=#{projectId} and b.operator_id is not null and type=#{type}
  98. </select>
  99. <select id="searchProjectTeamStr" resultType="String">
  100. select b.operator_id
  101. from plm_project_team a left join plm_operator b on a.site=b.site and a.operator_id=b.operator_id
  102. where a.site=#{site} AND a.project_id=#{projectId} and b.operator_id is not null and type=#{type}
  103. </select>
  104. <select id="searchUserRoll" resultType="PlmUserRoleData">
  105. select
  106. a.username,
  107. a.user_display,
  108. c.site,
  109. c.project_id,
  110. isnull(c.searchFlag,'N') searchFlag,
  111. isnull(c.updateFlag,'N') updateFlag,
  112. isnull(c.downFlag,'N') downFlag,
  113. isnull(c.deleteFlag,'N') deleteFlag
  114. from sys_user a
  115. left join AccessSite b on a.username = b.UserID
  116. left join AccessProject c on a.username = c.username and c.project_id = #{projectId} and c.site = b.site
  117. left join AccessRole e on a.username=e.username and e.site= #{site}
  118. <where>
  119. and e.role_no='R001'
  120. <if test="site != null and site != ''">
  121. and b.site = #{site}
  122. </if>
  123. <if test="username != null and username != ''">
  124. and a.username like #{username}
  125. </if>
  126. <if test="userDisplay != null and userDisplay != ''">
  127. and a.user_display like #{userDisplay}
  128. </if>
  129. </where>
  130. </select>
  131. <insert id="saveProjectInfo">
  132. insert into plm_project_info
  133. (project_id,ori_project_id,project_type_db,project_name,status,project_source,customer_id,create_by,
  134. create_date,priority,site,project_desc,customer_remark,remark,need_date,parent_project_no,final_customer_id,
  135. customer_Project_No,productSet ) values
  136. (#{projectId},#{projectId},#{projectTypeDb},#{projectName},#{status},#{projectSource},#{customerId},
  137. #{createBy},GetDate(),#{priority},#{site},#{projectDesc},#{customerRemark},#{remark},#{needDate},#{parentProjectNo}
  138. ,#{finalCustomerId},#{customerProjectNo},#{productSet})
  139. </insert>
  140. <update id="updateProjectInfo">
  141. update plm_project_info set project_type_db=#{projectTypeDb},project_name=#{projectName},project_source=#{projectSource},status=#{status},
  142. customer_id=#{customerId},priority=#{priority},project_desc=#{projectDesc},customer_remark=#{customerRemark},remark=#{remark},need_date=#{needDate},
  143. update_by=#{updateBy},update_date=GetDate(),parent_project_no = #{parentProjectNo},final_customer_id=#{finalCustomerId},productSet=#{productSet}
  144. ,customer_Project_No=#{customerProjectNo} where id=#{id}
  145. </update>
  146. <delete id="deletePlmProjectTeam">
  147. delete from plm_project_team where site=#{site} and project_id=#{projectId}
  148. </delete>
  149. <delete id="deleteUserRoleList">
  150. delete from AccessProject where site=#{site} and project_id=#{projectId}
  151. </delete>
  152. <insert id="saveProjectTeams">
  153. insert into plm_project_team (site,project_id,operator_id,type) values
  154. (#{site},#{projectId},#{operatorId},#{type})
  155. </insert>
  156. <insert id="savePlmUserRoleData">
  157. insert into AccessProject(site,project_id,username,searchFlag,updateFlag,downFlag,deleteFlag) values
  158. (#{site},#{projectId},#{username},#{searchFlag},#{updateFlag},#{downFlag},#{deleteFlag})
  159. </insert>
  160. <select id="getCustomerContactData" resultType="PlmProjectContactData">
  161. select b.site,b.customer_no,b.contact_name,b.contact_landline_number,b.contact_phone_number1,b.contact_phone_number2,
  162. b.contact_phone_number3,b.position,b.mailbox,b.primary_contact,b.contact_status,b.remark,b.create_date,b.create_by,
  163. b.update_date,b.update_by,b.contact_id,a.customer_id
  164. from plm_project_contact a left join plm_customer_contact b on a.site=b.site and a.customer_id=b.customer_no and a.contact_id=b.contact_id
  165. where a.site=#{site} and a.project_id=#{projectId} and a.customer_id=#{customerId} and b.contact_status='启用'
  166. </select>
  167. <select id="getPlmProjectContactString" resultType="String">
  168. select b.contact_id
  169. from plm_project_contact a left join plm_customer_contact b on a.site=b.site and a.customer_id=b.customer_no and a.contact_id=b.contact_id
  170. where a.site=#{site} and a.project_id=#{projectId} and a.customer_id=#{customerId} and b.contact_status='启用'
  171. </select>
  172. <select id="getCustomerContactString" resultType="PlmProjectContactData">
  173. select contact_id,contact_name from plm_customer_contact
  174. where site=#{site} and customer_no=#{customerId} and contact_status='启用'
  175. </select>
  176. <!-- <select id="getPlmProjectContactString2" resultType="PlmProjectContactData">-->
  177. <!-- select-->
  178. <!-- a.contact_id,-->
  179. <!-- b.contact_name-->
  180. <!-- from plm_project_contact a-->
  181. <!-- left join plm_customer_contact b on a.site = b.site and a.customer_id = b.customer_no and a.contact_id = b.contact_id-->
  182. <!-- <where>-->
  183. <!-- a.site = #{site} and a.customer_id = #{customerId} AND b.contact_id is null-->
  184. <!-- </where>-->
  185. <!-- </select>-->
  186. <select id="getPlmProjectContactString2" resultType="PlmProjectContactData" parameterType="PlmProjectInfoData">
  187. select
  188. a.site,
  189. a.contact_id,
  190. a.contact_name
  191. from plm_customer_contact a
  192. left join plm_project_contact b on a.site = b.site and a.customer_no = b.customer_id and a.contact_id = b.contact_id and b.project_id = #{projectId}
  193. <where>
  194. a.site = #{site} and a.customer_no = #{customerId} AND b.project_id is null
  195. <if test = "contactName != null and contactName != ''">
  196. AND a.contact_name LIKE #{contactName}
  197. </if>
  198. </where>
  199. </select>
  200. <select id="getCustomerContactString2" resultType="PlmProjectContactData" parameterType="PlmProjectInfoData">
  201. select
  202. b.site,
  203. b.contact_id,
  204. b.contact_name
  205. from plm_project_contact as a
  206. left join plm_customer_contact as b on a.site = b.site and a.customer_id = b.customer_no and a.contact_id = b.contact_id
  207. where a.project_id = #{projectId} and a.site = #{site}
  208. </select>
  209. <select id="checkProjectContact" resultType="PlmProjectContactData" parameterType="ProjectContactData">
  210. select
  211. site,
  212. project_id,
  213. customer_id,
  214. contact_id
  215. from plm_project_contact
  216. where site = #{site} and project_id = #{projectId} and customer_id = #{customerId} and contact_id = #{contactId}
  217. </select>
  218. <select id="checkCustomerContact" resultType="PlmProjectContactData" parameterType="ProjectContactData">
  219. SELECT
  220. site,
  221. customer_no as customerId,
  222. contact_id
  223. FROM plm_customer_contact
  224. where site = #{site} and customer_no = #{customerId} and contact_id = #{contactId}
  225. </select>
  226. <insert id="addContact" parameterType="ProjectContactData">
  227. insert into plm_project_contact
  228. (site, project_id, customer_id, contact_id)
  229. values (#{site}, #{projectId}, #{customerId}, #{contactId})
  230. </insert>
  231. <delete id="deleteContact" parameterType="ProjectContactData">
  232. delete from plm_project_contact
  233. where site = #{site} and project_id = #{projectId} and customer_id = #{customerId} and contact_id = #{contactId}
  234. </delete>
  235. <delete id="deleteProjectContact">
  236. delete from plm_project_contact where site=#{site} and project_id=#{projectId}
  237. </delete>
  238. <insert id="saveProjectContactList">
  239. insert into plm_project_contact (site,project_id,contact_id,customer_id)
  240. values (#{site},#{projectId},#{contactId},#{customerId})
  241. </insert>
  242. <delete id="deleteProjectInfo">
  243. delete from plm_project_info where site=#{site} and project_id=#{projectId}
  244. </delete>
  245. <delete id="deleteProjectPart">
  246. delete from plm_project_part where site=#{site} and project_id=#{projectId}
  247. </delete>
  248. <select id="getProjectInfoPartList" resultType="PlmProjectPartData">
  249. select
  250. a.id,
  251. a.site,
  252. a.project_id,
  253. a.test_part_no,
  254. b.family_id as partType,
  255. b.part_desc,
  256. dbo.get_family_name(b.site, b.family_id) as partTypeDesc,
  257. b.code_no,
  258. dbo.get_code_desc(b.site, b.code_no, 'IP') as codeDesc,
  259. b.group_id,
  260. dbo.get_group_name(b.site, b.group_id) as groupName,
  261. b.product_group_id1,
  262. dbo.get_product_group_name(b.site, b.product_group_id1, '1') as productGroupName1,
  263. b.product_group_id2,
  264. dbo.get_product_group_name(b.site, b.product_group_id2, '2') as productGroupName2,
  265. b.remark,
  266. b.create_date,
  267. b.create_by,
  268. b.update_date,
  269. b.update_by,
  270. c.customer_id,
  271. b.status,
  272. b.plm_part_no,
  273. case when b.status = 'Y' or (b.ifs_part_no is not null and b.ifs_part_no <![CDATA[<>]]> '') then '正式物料' else '临时物料' end as statusDesc,
  274. a.final_part_no,
  275. a.part_no_source,
  276. a.unit_price,
  277. a.tax_unit_price,
  278. a.bu_no,
  279. dbo.plm_get_bu_desc(a.site,a.bu_no) buDesc,
  280. d.customer_part_no
  281. from plm_project_part as a
  282. LEFT JOIN part as b on a.site = b.site and a.test_part_no = b.part_no
  283. left join plm_project_info as c on a.site = c.site and a.project_id = c.project_id
  284. 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
  285. where a.site = #{query.site} and a.project_id = #{query.projectId}
  286. </select>
  287. <select id="checkProjectInfoPartList" resultType="PlmProjectPartData">
  288. select top 1
  289. id,
  290. site,
  291. project_id,
  292. test_part_no,
  293. part_type,
  294. part_desc,
  295. part_spec,
  296. material_number,
  297. remark,
  298. create_date,
  299. create_by,
  300. update_date,
  301. part_name,
  302. update_by,
  303. dbo.get_family_name(site, part_type) as partTypeDesc,
  304. final_part_no,
  305. code_no,
  306. dbo.get_code_desc(site, code_no, 'IP') as codeDesc,
  307. group_id,
  308. dbo.get_group_name(site, group_id) as groupName,
  309. product_group_id1,
  310. dbo.get_product_group_name(site, product_group_id1, '1') as productGroupName1,
  311. product_group_id2,
  312. dbo.get_product_group_name(site, product_group_id2, '2') as productGroupName2
  313. from view_Project_Part where site=#{site} and test_part_no=#{testPartNo}
  314. </select>
  315. <select id="getTestPartNo" resultType="String">
  316. select top 1 #{projectId}+'-'+ Right( '0000'+ convert(VARCHAR(10), isnull(max(convert(INT,RIGHT(test_part_no, 4))),0)+1) ,4) from view_Project_Part
  317. where site=#{site} and project_id=#{projectId}
  318. </select>
  319. <insert id="saveProjectPart">
  320. insert into plm_project_part
  321. (site,project_id,
  322. test_part_no,
  323. part_type,
  324. part_desc,
  325. part_spec,
  326. material_number,
  327. remark,
  328. create_date,
  329. create_by,
  330. part_name,
  331. code_no,
  332. group_id,
  333. product_group_id1,
  334. product_group_id2)
  335. values
  336. (#{site},
  337. #{projectId},
  338. #{testPartNo},
  339. #{partType},
  340. #{partDesc},
  341. #{partSpec},
  342. #{materialNumber},
  343. #{remark},
  344. GetDate(),
  345. #{username},
  346. #{partName},
  347. #{codeNo},
  348. #{groupId},
  349. #{productGroupId1},
  350. #{productGroupId2})
  351. </insert>
  352. <update id="updateProjectPart">
  353. update plm_project_part
  354. set part_type=#{partType},
  355. part_desc=#{partDesc},
  356. part_spec=#{partSpec},
  357. material_number=#{materialNumber},
  358. remark=#{remark},
  359. update_date=GetDate(),
  360. update_by=#{username},
  361. part_name=#{partName},
  362. code_no=#{codeNo},
  363. group_id = #{groupId},
  364. product_group_id1 = #{productGroupId1},
  365. product_group_id2 = #{productGroupId2}
  366. where id=#{id}
  367. </update>
  368. <delete id="deleteProjectPartWithId">
  369. delete from plm_project_part where id=#{id}
  370. </delete>
  371. <select id="getPlmToolPurchaseRequestDataByProject" resultType="PlmToolPurchaseRequestData">
  372. select id,site,order_no,test_part_no,project_id,tool_id,type,reason,tool_offset,qty,party_a,supplier_id,price,tool_cost,
  373. all_cost,IFS_PR_No,po_number,remark,create_by,create_date,update_by,update_date,planner,applicant,dbo.get_userDisPlay(applicant) applicantName,
  374. dbo.get_userDisPlay(planner) plannerName,dbo.plm_get_test_part_name(site,test_part_no) partName
  375. ,status ,dbo.plm_get_projectBaseDesc(status,'purchaseRequest_status') statusDesc
  376. from plm_tool_purchase_request
  377. where site=#{site} and project_id=#{projectId}
  378. </select>
  379. <insert id="savePlmToolPurchaseRequestData">
  380. insert into plm_tool_purchase_request (site,order_no,test_part_no,project_id,tool_id,type,status,reason,tool_offset,qty,party_a,supplier_id,price,tool_cost,
  381. all_cost,IFS_PR_No,po_number,remark,create_by,create_date,planner,applicant) values
  382. (#{site},#{orderNo},#{testPartNo},#{projectId},#{toolId},#{type},#{status},#{reason},#{toolOffset},#{qty},#{partyA},#{supplierId},${price},#{toolCost},
  383. #{allCost},#{ifsPrNo},#{poNumber},#{remark},#{username},GetDate(),#{planner},#{applicant})
  384. </insert>
  385. <select id="searchBIAddress" resultType="BiAddress">
  386. select top 1 menu_id ,address from BI_Address where menu_id=#{menuId}
  387. </select>
  388. <select id="getProjectUserRole" resultType="PlmUserRoleData">
  389. select site,project_id,username,searchFlag,updateFlag,downFlag,deleteFlag
  390. from AccessProject where site=#{site} and project_id=#{projectId} and username=#{username}
  391. </select>
  392. <select id="getProjectPartList" resultType="com.spring.modules.project.data.PlmProjectPartData">
  393. select vpp.id,
  394. vpp.site,
  395. vpp.project_id,
  396. vpp.test_part_no,
  397. vpp.part_type,
  398. vpp.part_desc,
  399. vpp.part_spec,
  400. vpp.material_number,
  401. vpp.remark,
  402. vpp.create_date,
  403. vpp.create_by,
  404. vpp.update_date,
  405. vpp.part_name,
  406. vpp.update_by,
  407. dbo.get_family_name(vpp.site, vpp.part_type) as partTypeDesc,
  408. vpp.final_part_no,
  409. vpp.code_no,
  410. dbo.get_code_desc(vpp.site, vpp.code_no, 'IP') as codeDesc,
  411. vpp.group_id,
  412. dbo.get_group_name(vpp.site, vpp.group_id) as groupName,
  413. vpp.product_group_id1,
  414. dbo.get_product_group_name(vpp.site, vpp.product_group_id1, '1') as productGroupName1,
  415. vpp.product_group_id2,
  416. dbo.get_product_group_name(vpp.site, vpp.product_group_id2, '2') as productGroupName2,
  417. vpp.um_id,
  418. vpp.type,
  419. pcpi.customer_part_no
  420. from view_Project_Part vpp
  421. left join plm_project_info ppi on vpp.site = ppi.site and vpp.project_id = ppi.project_id
  422. left join plm_customer_part_info pcpi on vpp.site = pcpi.site and ppi.customer_id = pcpi.customer_no and vpp.test_part_no = pcpi.part_no
  423. where vpp.site = #{params.site}
  424. <if test="params.projectId != null and params.projectId != ''">
  425. and vpp.project_id = #{params.projectId}
  426. </if>
  427. <if test="params.testPartNo != null and params.testPartNo != ''">
  428. and vpp.test_part_no like #{params.testPartNo}
  429. </if>
  430. <if test="params.partDesc != null and params.partDesc != ''">
  431. and vpp.part_desc like #{params.partDesc}
  432. </if>
  433. <if test="params.finalPartNo != null and params.finalPartNo != ''">
  434. and vpp.final_part_no like #{params.finalPartNo}
  435. </if>
  436. <if test="params.customerPartNo != null and params.customerPartNo != ''">
  437. and pcpi.customer_part_no like #{params.customerPartNo}
  438. </if>
  439. <if test="params.partType != null and params.partType != ''">
  440. and vpp.type = #{params.partType}
  441. </if>
  442. </select>
  443. <select id="getProjectPart" resultType="com.spring.modules.project.data.PlmProjectPartData">
  444. select
  445. id,
  446. site,
  447. project_id,
  448. test_part_no,
  449. part_type,
  450. part_desc,
  451. part_spec,
  452. material_number,
  453. remark,
  454. create_date,
  455. create_by,
  456. update_date,
  457. part_name,
  458. update_by,
  459. dbo.get_family_name(site, part_type) as partTypeDesc,
  460. final_part_no,
  461. code_no,
  462. dbo.get_code_desc(site, code_no, 'IP') as codeDesc,
  463. group_id,
  464. dbo.get_group_name(site, group_id) as groupName,
  465. product_group_id1,
  466. dbo.get_product_group_name(site, product_group_id1, '1') as productGroupName1,
  467. product_group_id2,
  468. dbo.get_product_group_name(site, product_group_id2, '2') as productGroupName2
  469. from view_Project_Part where site=#{site}
  470. <if test="testPartNo != null and testPartNo != ''">
  471. and test_part_no = #{testPartNo}
  472. </if>
  473. </select>
  474. <select id="getProjectData" resultType="com.spring.modules.project.entity.PlmProjectInfo">
  475. select project_id,ori_project_id,project_type_db,project_name,status,project_source,customer_id,create_by,create_date,
  476. update_by,update_date,priority,site,id,project_desc,customer_remark,remark,need_date,parent_project_no,final_customer_id
  477. from plm_project_info where site=#{site} and project_id=#{projectId}
  478. </select>
  479. <select id="projectInfoPartSearch" resultType="PlmProjectPartData">
  480. select
  481. a.id,
  482. a.site,
  483. a.bu_no,
  484. a.project_id,
  485. a.test_part_no,
  486. a.final_part_no,
  487. a.material_number,
  488. a.part_name,
  489. a.part_desc,
  490. a.part_spec,
  491. a.create_date,
  492. a.create_by,
  493. a.update_date,
  494. a.update_by,
  495. a.code_no,
  496. dbo.get_code_desc(a.site, a.code_no, 'IP') as codeDesc,
  497. a.um_id,
  498. a.group_id,
  499. dbo.get_group_name(a.site, a.group_id) as groupName,
  500. a.part_type,
  501. dbo.get_family_name(a.site, a.part_type) as partTypeDesc,
  502. a.type,
  503. a.product_group_id1,
  504. dbo.get_product_group_name(a.site, a.product_group_id1, '1') as productGroupName1,
  505. a.product_group_id2,
  506. dbo.get_product_group_name(a.site, a.product_group_id2, '2') as productGroupName2,
  507. a.remark,
  508. b.customer_id,
  509. c.customer_part_no,
  510. b.final_customer_id
  511. from view_Project_Part as a
  512. left join plm_project_info as b on a.site = b.site and a.project_id = b.project_id
  513. left join plm_customer_part_info as c on b.site = c.site and b.customer_id = c.customer_no and a.test_part_no = c.part_no
  514. where a.site = #{query.site}
  515. <if test = "query.buNo != null and query.buNo != ''">
  516. AND a.bu_no = #{query.buNo}
  517. </if>
  518. <if test = "query.customerPartNo != null and query.customerPartNo != ''">
  519. AND c.customer_part_no like #{query.customerPartNo}
  520. </if>
  521. <if test = "query.finalPartNo != null and query.finalPartNo != ''">
  522. AND a.final_part_no like #{query.finalPartNo}
  523. </if>
  524. <if test="query.testPartNo != null and query.testPartNo != ''">
  525. and a.test_part_no like #{query.testPartNo}
  526. </if>
  527. <if test="query.projectId != null and query.projectId != ''">
  528. and a.project_id like #{query.projectId}
  529. </if>
  530. </select>
  531. <select id="queryProject" resultType="com.spring.modules.project.data.PlmProjectInfoData">
  532. select project_id,
  533. project_name,
  534. final_customer_id,
  535. dbo.plm_get_dictDataLabel('finalCustomer',final_customer_id,site) finalCustomerName
  536. from plm_project_info
  537. where site = #{site}
  538. and project_id = #{projectId}
  539. and customer_id = #{customerId}
  540. </select>
  541. <select id="queryProjectPart" resultType="com.spring.modules.project.entity.PlmProjectPart">
  542. select
  543. project_id,
  544. test_part_no,
  545. part_desc
  546. from
  547. view_Project_Part
  548. where site = #{site} and project_id = #{projectId} and test_part_no = #{testPartNo}
  549. </select>
  550. <select id="getProjectPartNewBm" resultType="PlmProjectPartData">
  551. select
  552. site,
  553. project_id,
  554. test_part_no,
  555. part_desc,
  556. now_bm,
  557. final_part_no
  558. from
  559. plm_project_part
  560. where site = #{site} and (test_part_no = #{testPartNo} or final_part_no= #{testPartNo}) and now_bm is not null
  561. </select>
  562. <select id="queryProjectCustomer" resultType="com.spring.modules.customer.vo.CustomerInformationVo">
  563. select top 1 pci.site,
  564. pci.customer_no,
  565. pci.customer_desc,
  566. dbo.plm_get_dictDataLabel('plm_customer_information_customer_customer_currency', pci.customer_currency,pci.site) as customer_currency,
  567. pci.turnover_of_year,
  568. pci.potential_revenue_of_year,
  569. pci.customer_status,
  570. pci.customer_type,
  571. dbo.plm_get_dictDataLabel('plm_customer_information_customer_industry', pci.customer_industry,
  572. pci.site) as customer_industry,
  573. case
  574. when pci.customer_status = 'Y' then '启用'
  575. when pci.customer_status = 'N' then '停用'
  576. else '' end as customerStatusDesc,
  577. pci.customer_description,
  578. dbo.plm_get_dictDataLabel('plm_customer_information_important_customer', pci.important_customer, pci.site) as important_customer,
  579. pci.customer_group
  580. from plm_project_info ppi
  581. left join dbo.plm_customer_information pci on ppi.customer_id = pci.customer_no
  582. where ppi.project_id = #{projectId} and ppi.site = #{site}
  583. </select>
  584. <select id="queryProjectFinalCustomer" resultType="com.spring.modules.customer.entity.CustomerInformationEntity">
  585. select top 1 pci.site,
  586. pci.customer_no,
  587. pci.customer_desc,
  588. dbo.plm_get_dictDataLabel('plm_customer_information_customer_customer_currency', pci.customer_currency,
  589. pci.site) as customer_currency,
  590. pci.turnover_of_year,
  591. pci.potential_revenue_of_year,
  592. pci.customer_status,
  593. pci.customer_description,
  594. dbo.plm_get_dictDataLabel('plm_customer_information_important_customer', pci.important_customer, ppi.site) as important_customer,
  595. pci.customer_industry,
  596. pci.customer_group,
  597. pci.customer_type
  598. from plm_project_info ppi
  599. left join dbo.plm_customer_information pci on ppi.final_customer_id = pci.customer_no
  600. where ppi.project_id = #{projectId} and ppi.site = #{site}
  601. </select>
  602. </mapper>