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.

761 lines
32 KiB

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