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.

892 lines
38 KiB

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