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.

1786 lines
73 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
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
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
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
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
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.spring.modules.part.mapper.RoutingManagementMapper">
  4. <!-- 材料信息列表 -->
  5. <select id="routingManagementSearch" parameterType="com.spring.modules.part.vo.RoutingHeaderVo" resultType="com.spring.modules.part.vo.RoutingHeaderVo">
  6. SELECT
  7. a.site,
  8. a.part_no,
  9. dbo.get_part_name(a.site, a.part_no) as partDesc,
  10. a.routing_revision,
  11. a.routing_type,
  12. a.note_text,
  13. a.phase_in_date,
  14. a.phase_out_date,
  15. a.create_date,
  16. a.create_by,
  17. a.update_date,
  18. a.update_by,
  19. b.um_id as printUnit,
  20. dbo.get_um_name(b.um_id) as printUnitName,
  21. b.ifs_part_no
  22. FROM plm_routing_header as a
  23. left join part as b on a.site = b.site and a.part_no = b.part_no
  24. <where>
  25. a.site = #{query.site}
  26. <if test = "query.partNo != null and query.partNo != ''">
  27. AND a.part_no like #{query.partNo}
  28. </if>
  29. <if test = "query.partDesc != null and query.partDesc != ''">
  30. AND dbo.get_part_name(a.site, a.part_no) like #{query.partDesc}
  31. </if>
  32. <if test = "query.routingType != null and query.routingType != ''">
  33. AND a.routing_type = #{query.routingType}
  34. </if>
  35. <if test = "query.routingRevision != null and query.routingRevision != ''">
  36. AND a.routing_revision like #{query.routingRevision}
  37. </if>
  38. </where>
  39. </select>
  40. <!-- 查询物料清单 -->
  41. <select id="queryPartList" parameterType="PartInformationEntity" resultType="RoutingAllFieldEntity">
  42. SELECT
  43. site,
  44. part_no,
  45. part_desc,
  46. spec,
  47. um_id as printUnit,
  48. dbo.get_um_name(um_id) as printUnitName,
  49. part_type
  50. FROM part
  51. <where>
  52. site = #{query.site}
  53. and part_type in ('Manufactured', 'Manufactured Recipe')
  54. and active = 'Y'
  55. <if test = "query.partNo != null and query.partNo != ''">
  56. AND part_no = #{query.partNo}
  57. </if>
  58. <if test = "query.partDesc != null and query.partDesc != ''">
  59. AND part_desc like #{query.partDesc}
  60. </if>
  61. <if test = "query.status != null and query.status != ''">
  62. AND status = #{query.status}
  63. </if>
  64. </where>
  65. </select>
  66. <!-- 查出可创建Routing的物料 -->
  67. <select id="queryPartListRouting" parameterType="PartInformationEntity" resultType="RoutingAllFieldEntity">
  68. SELECT
  69. site,
  70. part_no,
  71. part_desc,
  72. spec,
  73. um_id as printUnit,
  74. dbo.get_um_name(um_id) as printUnitName,
  75. part_type
  76. FROM part
  77. <where>
  78. site = #{query.site} and active = 'Y' and part_type in ('Manufactured', 'Manufactured Recipe')
  79. <if test = "query.partNo != null and query.partNo != ''">
  80. AND part_no = #{query.partNo}
  81. </if>
  82. <if test = "query.partDesc != null and query.partDesc != ''">
  83. AND part_desc like #{query.partDesc}
  84. </if>
  85. <if test = "query.status != null and query.status != ''">
  86. AND status = #{query.status}
  87. </if>
  88. </where>
  89. </select>
  90. <!-- 新增Routing主表内容 -->
  91. <insert id="saveRoutingHeader" parameterType="RoutingHeaderEntity">
  92. INSERT INTO plm_routing_header
  93. (site, part_no, routing_revision, routing_type, note_text, phase_in_date, phase_out_date, create_date, create_by, official_flag)
  94. VALUES
  95. (#{site}, #{partNo}, #{routingRevision}, #{routingType}, #{noteText}, #{phaseInDate}, #{phaseOutDate}, getDate(), #{createBy}, #{officialFlag})
  96. </insert>
  97. <!-- routing明细新增 -->
  98. <insert id="routingDetailSave" parameterType="RoutingDetailEntity">
  99. INSERT INTO plm_routing_detail
  100. (site, part_no, routing_revision, routing_type, alternative_no, alternative_description, fixed_lead_time_day, fixed_lead_time_hour, variable_lead_time_day, variable_lead_time_hour, for_std_lot_by_day, for_lot_by_day, min_lot_qty, note_text, create_date, create_by, status, official_flag)
  101. VALUES
  102. (#{site}, #{partNo}, #{routingRevision}, #{routingType}, #{alternativeNo}, #{alternativeDescription}, #{fixedLeadTimeDay}, #{fixedLeadTimeHour}, #{variableLeadTimeDay}, #{variableLeadTimeHour}, #{forStdLotByDay}, #{forLotByDay}, #{minLotQty}, #{detailNoteText}, getDate(), #{createBy}, #{status}, #{officialFlag})
  103. </insert>
  104. <!-- 新增Routing子明细表内容 -->
  105. <insert id="saveRoutingComponent" parameterType="RoutingComponentEntity" useGeneratedKeys="true" keyProperty="operationId">
  106. INSERT INTO plm_routing_component
  107. (site, part_no, routing_revision, routing_type, alternative_no, operation_name, operation_no, efficiency_factor, mach_run_factor, mach_setup_time, run_time_code, labor_run_factor, labor_setup_time, crew_size, setup_crew_size, outside_op_item, machine_no, work_center_no, labor_class_no, setup_labor_class_no, overlap, note_text, create_date, create_by, ifs_row_id, ifs_row_version)
  108. VALUES
  109. (#{site}, #{partNo}, #{routingRevision}, #{routingType}, #{alternativeNo}, #{operationName}, #{operationNo}, #{efficiencyFactor}, #{machRunFactor}, #{machSetupTime}, #{runTimeCode}, #{laborRunFactor}, #{laborSetupTime}, #{crewSize}, #{setupCrewSize}, #{outsideOpItem}, #{machineNo}, #{workCenterNo}, #{laborClassNo}, #{setupLaborClassNo}, #{overlap}, #{noteText}, getDate(), #{createBy}, #{ifsRowId}, #{ifsRowVersion})
  110. </insert>
  111. <!-- 新增Routing子明细表内容 -->
  112. <insert id="saveRoutingComponents">
  113. insert into plm_routing_component
  114. (site, part_no, routing_revision, routing_type, alternative_no, operation_name, operation_no, efficiency_factor, mach_run_factor, mach_setup_time, run_time_code, labor_run_factor, labor_setup_time, crew_size, setup_crew_size, outside_op_item, machine_no, work_center_no, labor_class_no, setup_labor_class_no, overlap, note_text, create_date, create_by, ifs_row_id, ifs_row_version) VALUES
  115. <foreach collection="list" item="item" index="index" separator=",">
  116. (#{item.site}, #{item.partNo}, #{item.routingRevision}, #{item.routingType}, #{item.alternativeNo}, #{item.operationName}, #{item.operationNo}, #{item.efficiencyFactor}, #{item.machRunFactor}, #{item.machSetupTime}, #{item.runTimeCode}, #{item.laborRunFactor}, #{item.laborSetupTime}, #{item.crewSize}, #{item.setupCrewSize}, #{item.outsideOpItem}, #{item.machineNo}, #{item.workCenterNo}, #{item.laborClassNo}, #{item.setupLaborClassNo}, #{item.overlap}, #{item.noteText}, getDate(), #{item.createBy}, #{item.ifsRowId}, #{item.ifsRowVersion})
  117. </foreach>
  118. </insert>
  119. <!-- 查routing明细 -->
  120. <select id="queryRoutingDetail" parameterType="RoutingHeaderEntity" resultType="RoutingDetailEntity">
  121. SELECT
  122. site,
  123. part_no,
  124. routing_type,
  125. routing_revision,
  126. alternative_no,
  127. alternative_description,
  128. rout_template_id,
  129. plan_date,
  130. fixed_lead_time_day,
  131. fixed_lead_time_hour,
  132. variable_lead_time_day,
  133. variable_lead_time_hour,
  134. for_std_lot_by_day,
  135. for_lot_by_day,
  136. min_lot_qty,
  137. note_text as detailNoteText,
  138. status,
  139. official_flag
  140. FROM plm_routing_detail
  141. where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision}
  142. </select>
  143. <!-- 查routing明细对象 -->
  144. <select id="queryDetailDataByNo" parameterType="RoutingDetailEntity" resultType="RoutingDetailEntity">
  145. SELECT
  146. site,
  147. part_no,
  148. routing_type,
  149. routing_revision,
  150. alternative_no,
  151. alternative_description,
  152. rout_template_id,
  153. plan_date,
  154. fixed_lead_time_day,
  155. fixed_lead_time_hour,
  156. variable_lead_time_day,
  157. variable_lead_time_hour,
  158. for_std_lot_by_day,
  159. for_lot_by_day,
  160. min_lot_qty,
  161. note_text as detailNoteText,
  162. status,
  163. official_flag
  164. FROM plm_routing_detail
  165. where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo}
  166. </select>
  167. <!-- 查routing子明细 -->
  168. <select id="queryRoutingComponent" parameterType="RoutingDetailEntity" resultType="com.spring.modules.part.vo.RoutingComponentVo">
  169. SELECT
  170. a.site,
  171. a.part_no,
  172. a.routing_type,
  173. a.routing_revision,
  174. a.alternative_no,
  175. a.operation_id,
  176. a.operation_no,
  177. a.operation_name,
  178. a.efficiency_factor,
  179. a.mach_run_factor,
  180. a.mach_setup_time,
  181. a.run_time_code,
  182. case when a.run_time_code = 'Units/Hour' then '单位/小时'
  183. when a.run_time_code = 'Hours/Unit' then '小时/单位'
  184. when a.run_time_code = 'Hours' then '小时'
  185. else '' end as runTimeCodeDesc,
  186. a.labor_run_factor,
  187. a.labor_setup_time,
  188. a.crew_size,
  189. a.setup_crew_size,
  190. a.outside_op_item,
  191. a.machine_no,
  192. a.work_center_no,
  193. b.work_center_desc,
  194. b.work_center_type,
  195. a.labor_class_no,
  196. dbo.get_labor_class_desc(a.site, a.labor_class_no) as laborClassDesc,
  197. a.setup_labor_class_no,
  198. dbo.get_labor_class_desc(a.site, a.setup_labor_class_no) as setupLaborClassDesc,
  199. a.overlap,
  200. a.note_text,
  201. a.ifs_row_id,
  202. a.ifs_row_version
  203. FROM plm_routing_component as a
  204. LEFT JOIN work_center as b on a.site = b.site and a.work_center_no = b.work_center_no
  205. where a.site = #{site} and a.part_no = #{partNo} and a.routing_type = #{routingType} and a.routing_revision = #{routingRevision} and a.alternative_no = #{alternativeNo}
  206. order by a.operation_no
  207. </select>
  208. <!-- routing主表编辑 -->
  209. <update id="updateRoutingHeader" parameterType="RoutingAllFieldEntity">
  210. update plm_routing_header
  211. set phase_in_date = #{phaseInDate},
  212. phase_out_date = #{phaseOutDate},
  213. note_text = #{noteText},
  214. update_date = getDate(),
  215. update_by = #{updateBy}
  216. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  217. </update>
  218. <!-- routing明细表编辑 -->
  219. <update id="updateRoutingDetail" parameterType="RoutingDetailEntity">
  220. update plm_routing_detail
  221. set alternative_description = #{alternativeDescription},
  222. rout_template_id = #{routTemplateId},
  223. plan_date = #{planDate},
  224. fixed_lead_time_day = #{fixedLeadTimeDay},
  225. fixed_lead_time_hour = #{fixedLeadTimeHour},
  226. variable_lead_time_day = #{variableLeadTimeDay},
  227. variable_lead_time_hour = #{variableLeadTimeHour},
  228. for_std_lot_by_day = #{forStdLotByDay},
  229. for_lot_by_day = #{forLotByDay},
  230. min_lot_qty = #{minLotQty},
  231. note_text = #{detailNoteText},
  232. update_date = getDate(),
  233. update_by = #{updateBy},
  234. status = #{status}
  235. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  236. </update>
  237. <!-- 删除routing子明细 -->
  238. <delete id="deleteRoutingComponent" parameterType="RoutingAllFieldEntity">
  239. delete from plm_routing_component
  240. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  241. </delete>
  242. <!-- 删除替代 -->
  243. <delete id="routingDetailDelete" parameterType="RoutingDetailEntity">
  244. delete from plm_routing_detail
  245. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  246. </delete>
  247. <!-- routing主表查重 -->
  248. <select id="checkRoutingOnlyOne" parameterType="RoutingAllFieldEntity" resultType="com.spring.modules.part.vo.RoutingHeaderVo">
  249. SELECT
  250. site,
  251. part_no,
  252. dbo.get_part_name(site, part_no) as partDesc,
  253. routing_type,
  254. routing_revision,
  255. phase_in_date,
  256. phase_out_date,
  257. note_text,
  258. official_flag
  259. FROM plm_routing_header
  260. where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision}
  261. </select>
  262. <!-- routing明细查重 -->
  263. <select id="checkRoutingDetailOnlyOne" parameterType="RoutingDetailEntity" resultType="RoutingDetailEntity">
  264. SELECT
  265. site,
  266. part_no,
  267. routing_type,
  268. routing_revision,
  269. alternative_no,
  270. alternative_description,
  271. rout_template_id,
  272. plan_date,
  273. fixed_lead_time_day,
  274. fixed_lead_time_hour,
  275. variable_lead_time_day,
  276. variable_lead_time_hour,
  277. for_std_lot_by_day,
  278. for_lot_by_day,
  279. min_lot_qty,
  280. note_text as detailNoteText,
  281. row_key,
  282. row_version,
  283. status,
  284. official_flag
  285. FROM plm_routing_detail
  286. where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo}
  287. </select>
  288. <!-- 批量删除子明细物料 -->
  289. <delete id="deleteRoutingComponents" parameterType="RoutingComponentEntity">
  290. delete from plm_routing_component
  291. where site = #{site}
  292. and part_no = #{partNo}
  293. and routing_revision = #{routingRevision}
  294. and routing_type = #{routingType}
  295. and alternative_no = #{alternativeNo}
  296. and operation_id = #{operationId}
  297. </delete>
  298. <!-- 删除routing子明细 -->
  299. <delete id="deleteRoutingComponentByPartNo" parameterType="RoutingHeaderEntity">
  300. delete from plm_routing_component
  301. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  302. </delete>
  303. <!-- 删除routing明细 -->
  304. <delete id="deleteRoutingDetailByPartNo" parameterType="RoutingHeaderEntity">
  305. delete from plm_routing_detail
  306. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  307. </delete>
  308. <!-- 删除routing主记录 -->
  309. <delete id="deleteRoutingHeaderByPartNo" parameterType="RoutingHeaderEntity">
  310. delete from plm_routing_header
  311. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  312. </delete>
  313. <!-- routing明细查重 -->
  314. <select id="checkRoutingComponentOnlyOne" parameterType="RoutingComponentEntity" resultType="RoutingComponentEntity">
  315. SELECT
  316. site,
  317. part_no,
  318. routing_type,
  319. routing_revision,
  320. alternative_no,
  321. operation_id,
  322. operation_no
  323. FROM plm_routing_component
  324. where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo} and operation_no = #{operationNo}
  325. </select>
  326. <!-- 修改routing子明细 -->
  327. <update id="updateRoutingComponent" parameterType="RoutingComponentEntity">
  328. update plm_routing_component
  329. set efficiency_factor = #{efficiencyFactor},
  330. mach_run_factor = #{machRunFactor},
  331. mach_setup_time = #{machSetupTime},
  332. run_time_code = #{runTimeCode},
  333. labor_run_factor = #{laborRunFactor},
  334. labor_setup_time = #{laborSetupTime},
  335. crew_size = #{crewSize},
  336. setup_crew_size = #{setupCrewSize},
  337. outside_op_item = #{outsideOpItem},
  338. machine_no = #{machineNo},
  339. work_center_no = #{workCenterNo},
  340. labor_class_no = #{laborClassNo},
  341. setup_labor_class_no = #{setupLaborClassNo},
  342. overlap = #{overlap},
  343. note_text = #{noteText},
  344. update_date = getDate(),
  345. update_by = #{updateBy},
  346. operation_no = #{operationNo},
  347. operation_name = #{operationName},
  348. ifs_row_id = #{ifsRowId},
  349. ifs_row_version = #{ifsRowVersion}
  350. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo} and operation_id = #{operationId}
  351. </update>
  352. <!-- 查询工序清单 -->
  353. <select id="queryOperationList" parameterType="OperationEntity" resultType="OperationEntity">
  354. SELECT
  355. site,
  356. operation_id,
  357. operation_name,
  358. work_center_no
  359. FROM dbo.operation
  360. <where>
  361. site = #{site}
  362. <if test = "operationId != null and operationId != ''">
  363. AND operation_id like #{operationId}
  364. </if>
  365. <if test = "operationName != null and operationName != ''">
  366. AND operation_name like #{operationName}
  367. </if>
  368. </where>
  369. </select>
  370. <!-- 修改替代状态 -->
  371. <update id="updateAlternativeStatus" parameterType="RoutingDetailEntity">
  372. update plm_routing_detail
  373. set status = #{status},
  374. update_date = getDate(),
  375. update_by = #{updateBy}
  376. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  377. </update>
  378. <!-- 判断是否已有该物料的 routing -->
  379. <select id="queryPartRouting" parameterType="RoutingAllFieldEntity" resultType="com.spring.modules.part.vo.RoutingHeaderVo">
  380. SELECT top 1
  381. site,
  382. part_no,
  383. routing_type,
  384. routing_revision,
  385. phase_in_date,
  386. phase_out_date,
  387. note_text,
  388. official_flag
  389. FROM plm_routing_header
  390. WHERE site = #{site} and part_no = #{partNo} and routing_type = #{routingType} order by routing_revision desc
  391. </select>
  392. <!-- 判断该 routing 是否有 Buildable Obsolete 状态的替代 -->
  393. <select id="queryAlternativeStatus" parameterType="RoutingHeaderEntity" resultType="com.spring.modules.part.vo.RoutingDetailVo">
  394. SELECT
  395. site,
  396. part_no,
  397. routing_revision,
  398. routing_type,
  399. alternative_no,
  400. status
  401. FROM plm_routing_detail
  402. WHERE site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and (status = 'Buildable' or status = 'Obsolete')
  403. </select>
  404. <!-- 判断该 routing 是否有正式的替代 -->
  405. <select id="queryOfficialRoutingDetail" parameterType="RoutingHeaderEntity" resultType="com.spring.modules.part.vo.RoutingDetailVo">
  406. SELECT
  407. site,
  408. part_no,
  409. routing_revision,
  410. routing_type,
  411. alternative_no,
  412. status,
  413. official_flag
  414. FROM plm_routing_detail
  415. WHERE site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and official_flag = 'Y'
  416. </select>
  417. <!-- 判断 routing 是否存在子料 -->
  418. <select id="queryComponentPart" parameterType="RoutingHeaderEntity" resultType="com.spring.modules.part.vo.RoutingComponentVo">
  419. SELECT
  420. site,
  421. part_no,
  422. routing_revision,
  423. routing_type,
  424. alternative_no,
  425. operation_id
  426. FROM plm_routing_component
  427. WHERE site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  428. </select>
  429. <!-- 判断工序是否被引用 -->
  430. <select id="checkOperatorIsUse" parameterType="RoutingComponentEntity" resultType="com.spring.modules.part.vo.BomComponentVo">
  431. SELECT
  432. site,
  433. part_no,
  434. eng_chg_level,
  435. bom_type,
  436. alternative_no,
  437. component_part
  438. FROM plm_bom_component
  439. WHERE site = #{site} and part_no = #{partNo} and operation_id = #{operationId}
  440. </select>
  441. <!-- 获取ifs header 对象-->
  442. <select id="getRoutingHeader" parameterType="RoutingDetailEntity" resultType="RoutingIfsHeader">
  443. SELECT
  444. site as contract,
  445. part_no,
  446. routing_revision,
  447. routing_type,
  448. phase_in_date,
  449. phase_out_date,
  450. note_text,
  451. 'add' as histType
  452. FROM plm_routing_header
  453. WHERE site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  454. </select>
  455. <!-- 获取ifs component 对象-->
  456. <select id="getRoutingComponent" parameterType="RoutingDetailEntity" resultType="RoutingIfsItem">
  457. SELECT
  458. site as contract,
  459. part_no,
  460. routing_revision,
  461. routing_type,
  462. alternative_no,
  463. operation_id,
  464. operation_no,
  465. operation_name as operationDesc,
  466. work_center_no,
  467. efficiency_factor,
  468. mach_setup_time,
  469. mach_run_factor,
  470. run_time_code,
  471. labor_run_factor,
  472. labor_setup_time,
  473. crew_size,
  474. setup_crew_size,
  475. machine_no,
  476. note_text,
  477. case when outside_op_item is null then '' else outside_op_item end as outsideOpItem,
  478. labor_class_no,
  479. setup_labor_class_no,
  480. case when overlap is null then '' else overlap end as overlap,
  481. ifs_row_id,
  482. ifs_row_version
  483. FROM plm_routing_component
  484. WHERE site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  485. </select>
  486. <!-- 获取ifs component 对象-->
  487. <select id="searchRoutingTools" parameterType="RoutingToolEntity" resultType="com.spring.modules.part.vo.RoutingToolVo">
  488. SELECT
  489. a.id,
  490. a.site,
  491. a.part_no,
  492. a.routing_revision,
  493. a.routing_type,
  494. a.alternative_no,
  495. dbo.plm_get_alternativeDesc(a.site, a.part_no, a.routing_revision, a.routing_type, a.alternative_no) as alternativeDescription,
  496. a.operation_id,
  497. b.operation_no,
  498. b.operation_name,
  499. a.tool_id,
  500. dbo.plm_get_toolDesc(a.site, a.tool_id) as toolDescription,
  501. a.tool_qty,
  502. a.remark,
  503. a.create_date,
  504. a.create_by,
  505. a.update_date,
  506. a.update_by,
  507. a.ifs_row_id,
  508. a.ifs_row_version
  509. FROM routing_tool as a
  510. left join plm_routing_component as b on a.operation_id = b.operation_id
  511. WHERE a.site = #{site} and a.part_no = #{partNo} and a.routing_revision = #{routingRevision} and a.routing_type = #{routingType}
  512. </select>
  513. <!-- 新增 routingTools -->
  514. <insert id="routingToolSave" parameterType="com.spring.modules.part.vo.RoutingToolVo" keyProperty="id" useGeneratedKeys="true">
  515. INSERT INTO routing_tool
  516. (site, part_no, routing_revision, routing_type, alternative_no, operation_id, tool_id, tool_qty, remark, create_date, create_by)
  517. VALUES
  518. (#{site}, #{partNo}, #{routingRevision}, #{routingType}, #{alternativeNo}, #{operationId}, #{toolId}, #{toolQty}, #{remark}, getDate(), #{createBy})
  519. </insert>
  520. <!-- 根据替代查询工序列表 -->
  521. <select id="queryOperationListByAlternative" parameterType="OperationEntity" resultType="OperationEntity">
  522. SELECT
  523. site,
  524. part_no,
  525. routing_revision,
  526. routing_type,
  527. alternative_no,
  528. operation_id,
  529. operation_no,
  530. operation_name
  531. FROM plm_routing_component
  532. <where>
  533. site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  534. <if test = "operationNo != null and operationNo != ''">
  535. AND operation_no = #{operationNo}
  536. </if>
  537. <if test = "operationName != null and operationName != ''">
  538. AND operation_name like #{operationName}
  539. </if>
  540. </where>
  541. </select>
  542. <!-- 根据替代查询工序列表 -->
  543. <select id="queryAlternativeListByPartNo" parameterType="AlternativeEntity" resultType="AlternativeEntity">
  544. SELECT
  545. site,
  546. part_no,
  547. routing_revision,
  548. routing_type,
  549. alternative_no,
  550. alternative_description
  551. FROM plm_routing_detail
  552. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  553. </select>
  554. <!-- 编辑 routingTools -->
  555. <update id="routingToolEdit" parameterType="RoutingToolEntity">
  556. update routing_tool
  557. set tool_qty = #{toolQty},
  558. remark = #{remark},
  559. update_date = getDate(),
  560. update_by = #{updateBy}
  561. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo} and operation_id = #{operationId} and tool_id = #{toolId}
  562. </update>
  563. <!-- 删除 routingTools -->
  564. <delete id="deleteRoutingTool" parameterType="RoutingToolEntity">
  565. delete from routing_tool
  566. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo} and operation_id = #{operationId} and tool_id = #{toolId}
  567. </delete>
  568. <select id="routingAllInfoSearch" parameterType="com.spring.modules.part.vo.RoutingHeaderVo" resultType="com.spring.modules.part.vo.RoutingInfoVo">
  569. select
  570. a.site,
  571. a.part_no,
  572. e.part_desc partDesc,
  573. dbo.get_um_name(e.um_id) printUnitName,
  574. a.routing_revision,
  575. a.routing_type,
  576. a.phase_in_date,
  577. a.phase_out_date,
  578. a.note_text,
  579. b.alternative_no,
  580. b.alternative_description,
  581. b.rout_template_id,
  582. b.plan_date,
  583. b.fixed_lead_time_day,
  584. b.fixed_lead_time_hour,
  585. b.variable_lead_time_day,
  586. b.variable_lead_time_hour,
  587. b.for_std_lot_by_day,
  588. b.for_lot_by_day,
  589. b.min_lot_qty,
  590. b.note_text alternativeNoteText,
  591. b.status,
  592. c.operation_no,
  593. c.efficiency_factor,
  594. c.mach_run_factor,
  595. c.mach_setup_time,
  596. c.run_time_code,
  597. case when c.run_time_code = 'Units/Hour' then '单位/小时'
  598. when c.run_time_code = 'Hours/Unit' then '小时/单位'
  599. when c.run_time_code = 'Hours' then '小时'
  600. else '' end as runTimeCodeDesc,
  601. c.labor_run_factor,
  602. c.labor_setup_time,
  603. c.crew_size,
  604. c.setup_crew_size,
  605. c.outside_op_item,
  606. c.machine_no,
  607. c.work_center_no,
  608. dbo.get_workCenter_desc(a.site,c.work_center_no) workCenterDesc,
  609. c.labor_class_no,
  610. g.level_desc laborClassDesc,
  611. c.setup_labor_class_no,
  612. j.level_desc setupLaborClassDesc,
  613. c.overlap,
  614. c.operation_name,
  615. c.operation_id,
  616. c.note_text operationNoteText,
  617. d.tool_id,
  618. f.tool_description toolDescription,
  619. d.tool_qty,
  620. d.remark
  621. from plm_routing_header a
  622. LEFT JOIN part e on a.site = e.site AND a.part_no =e.part_no
  623. LEFT JOIN plm_routing_detail b on a.site = b.site AND a.part_no =b.part_no AND a.routing_revision = b.routing_revision and a.routing_type = b.routing_type
  624. LEFT JOIN plm_routing_component c on a.site = c.site AND a.part_no =c.part_no AND a.routing_revision = c.routing_revision and a.routing_type = c.routing_type and b.alternative_no = c.alternative_no
  625. LEFT JOIN routing_tool d on a.site = d.site AND a.part_no =d.part_no AND a.routing_revision = d.routing_revision and a.routing_type = d.routing_type and c.alternative_no = d.alternative_no and c.operation_id = d.operation_id
  626. LEFT JOIN tool_header f on a.site = f.site AND d.tool_id =f.tool_id
  627. LEFT JOIN labor_class g on a.site = g.site AND c.labor_class_no = g.level_id
  628. LEFT JOIN labor_class j on a.site = j.site AND c.setup_labor_class_no = j.level_id
  629. <where>
  630. a.site = #{query.site}
  631. <if test = "query.partNo != null and query.partNo != ''">
  632. AND a.part_no like #{query.partNo}
  633. </if>
  634. <if test = "query.partDesc != null and query.partDesc != ''">
  635. AND e.part_desc like #{query.partDesc}
  636. </if>
  637. </where>
  638. </select>
  639. <!-- 获取routing header 对象-->
  640. <select id="queryRoutingHeader" parameterType="RoutingHeaderEntity" resultType="RoutingHeaderEntity">
  641. SELECT
  642. site,
  643. part_no,
  644. routing_revision,
  645. routing_type,
  646. note_text,
  647. phase_in_date,
  648. phase_out_date,
  649. row_version,
  650. row_key,
  651. official_flag
  652. FROM plm_routing_header
  653. WHERE site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  654. </select>
  655. <!-- routing主表编辑 -->
  656. <update id="updateInDate" parameterType="RoutingHeaderEntity">
  657. update plm_routing_header
  658. set phase_out_date = #{phaseOutDate},
  659. update_date = getDate(),
  660. update_by = #{createBy}
  661. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  662. </update>
  663. <!-- 根据RoutingType查询-->
  664. <select id="selectRoutingHeaderByType" parameterType="RoutingHeaderEntity" resultType="RoutingHeaderEntity">
  665. SELECT
  666. site,
  667. part_no,
  668. routing_revision,
  669. routing_type,
  670. note_text,
  671. phase_in_date,
  672. phase_out_date,
  673. row_version,
  674. row_key,
  675. official_flag
  676. FROM plm_routing_header
  677. where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} order by routing_revision desc
  678. </select>
  679. <!-- 校验日期是否冲突-->
  680. <select id="queryHeaderPhaseDate" parameterType="RoutingHeaderEntity" resultType="RoutingHeaderEntity">
  681. SELECT
  682. site,
  683. part_no,
  684. routing_revision,
  685. routing_type,
  686. note_text,
  687. phase_in_date,
  688. phase_out_date,
  689. row_version,
  690. row_key,
  691. official_flag
  692. FROM plm_routing_header
  693. <where>
  694. site = #{site} and part_no = #{partNo} and routing_type = #{routingType}
  695. <if test = "phaseOutDate == null">
  696. and phase_in_date >= #{phaseInDate}
  697. </if>
  698. <if test = "phaseOutDate != null">
  699. and #{phaseInDate} >= phase_in_date and phase_out_date >= #{phaseOutDate}
  700. </if>
  701. </where>
  702. </select>
  703. <!-- 将上一个版本的失效日期改为当前生效日期减一 -->
  704. <update id="updatePhaseOutDate" parameterType="RoutingHeaderEntity">
  705. update plm_routing_header
  706. set phase_out_date = #{phaseOutDate},
  707. update_date = getDate(),
  708. update_by = #{createBy}
  709. where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision}
  710. </update>
  711. <!-- 查routing子明细 -->
  712. <select id="queryComponent" parameterType="RoutingDetailEntity" resultType="RoutingComponentEntity">
  713. SELECT
  714. site,
  715. part_no,
  716. routing_type,
  717. routing_revision,
  718. alternative_no,
  719. operation_id,
  720. operation_no,
  721. operation_name,
  722. efficiency_factor,
  723. mach_run_factor,
  724. mach_setup_time,
  725. run_time_code,
  726. labor_run_factor,
  727. labor_setup_time,
  728. crew_size,
  729. setup_crew_size,
  730. outside_op_item,
  731. machine_no,
  732. work_center_no,
  733. labor_class_no,
  734. setup_labor_class_no,
  735. overlap,
  736. note_text,
  737. ifs_row_id,
  738. ifs_row_version
  739. FROM plm_routing_component
  740. where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo}
  741. </select>
  742. <!-- 判断替代是否为正式 -->
  743. <select id="queryRoutingDetailOfficialFlag" parameterType="RoutingComponentEntity" resultType="RoutingDetailEntity">
  744. SELECT
  745. site,
  746. part_no,
  747. routing_type,
  748. routing_revision,
  749. alternative_no,
  750. alternative_description,
  751. rout_template_id,
  752. plan_date,
  753. fixed_lead_time_day,
  754. fixed_lead_time_hour,
  755. variable_lead_time_day,
  756. variable_lead_time_hour,
  757. for_std_lot_by_day,
  758. for_lot_by_day,
  759. min_lot_qty,
  760. note_text as detailNoteText,
  761. status,
  762. official_flag
  763. FROM plm_routing_detail
  764. where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo}
  765. </select>
  766. <!-- 获取该routing的全部Tool -->
  767. <select id="getRoutingToolByHeader" parameterType="RoutingHeaderEntity" resultType="RoutingToolEntity">
  768. SELECT
  769. id,
  770. site,
  771. part_no,
  772. routing_type,
  773. routing_revision,
  774. alternative_no,
  775. operation_id,
  776. tool_id,
  777. tool_qty,
  778. remark
  779. FROM routing_tool
  780. where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision}
  781. </select>
  782. <!-- 批量新增routingTool -->
  783. <insert id="saveRoutingTool">
  784. insert into routing_tool
  785. (site, part_no, routing_revision, routing_type, alternative_no, operation_id, tool_id, tool_qty, remark, create_date, create_by) VALUES
  786. <foreach collection="list" item="item" index="index" separator=",">
  787. (#{item.site}, #{item.partNo}, #{item.routingRevision}, #{item.routingType}, #{item.alternativeNo}, #{item.operationId}, #{item.toolId}, #{item.toolQty}, #{item.remark}, getDate(), #{item.createBy})
  788. </foreach>
  789. </insert>
  790. <!-- 获取该routing的全部guideLine -->
  791. <select id="getGuideLineByHeader" parameterType="RoutingHeaderEntity" resultType="WorkGuidelineEntity">
  792. SELECT
  793. site,
  794. part_no,
  795. routing_type,
  796. routing_revision,
  797. alternative_no,
  798. id,
  799. guideline_seq,
  800. guideline_desc,
  801. guideline_text,
  802. guideline_type,
  803. sign_off_required,
  804. inspection_sign_off_required,
  805. operation_id
  806. FROM plm_routing_work_guide
  807. where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision}
  808. </select>
  809. <!-- 批量新增guideLine -->
  810. <insert id="saveGuideLine">
  811. insert into plm_routing_work_guide
  812. (site, part_no, routing_revision, routing_type, alternative_no, guideline_seq, guideline_desc, guideline_text, guideline_type, sign_off_required, inspection_sign_off_required, operation_id, create_date, create_by) VALUES
  813. <foreach collection="list" item="item" index="index" separator=",">
  814. (#{item.site}, #{item.partNo}, #{item.routingRevision}, #{item.routingType}, #{item.alternativeNo}, #{item.guidelineSeq}, #{item.guidelineDesc}, #{item.guidelineText}, #{item.guidelineType}, #{item.signOffRequired}, #{item.inspectionSignOffRequired}, #{item.operationId}, getDate(), #{item.createBy})
  815. </foreach>
  816. </insert>
  817. <!-- 获取该工序的Tool -->
  818. <select id="getRoutingToolByOperation" parameterType="RoutingComponentEntity" resultType="RoutingToolEntity">
  819. SELECT
  820. id,
  821. site,
  822. part_no,
  823. routing_type,
  824. routing_revision,
  825. alternative_no,
  826. operation_id,
  827. tool_id,
  828. tool_qty,
  829. remark
  830. FROM routing_tool
  831. where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo} and operation_id = #{operationId}
  832. </select>
  833. <!-- 获取该工序的Tool(ifs) -->
  834. <select id="getRoutingToolByOperationToIfs" resultType="RoutingIfsTool">
  835. SELECT
  836. a.id,
  837. a.site as contract,
  838. a.part_no,
  839. a.routing_type,
  840. a.routing_revision,
  841. a.alternative_no,
  842. a.operation_id,
  843. b.operation_no,
  844. a.tool_id,
  845. a.tool_qty as toolQuantity,
  846. a.remark as noteText,
  847. b.ifs_row_id,
  848. b.ifs_row_version
  849. FROM routing_tool as a
  850. left join plm_routing_component as b on a.site = b.site and a.part_no = b.part_no and a.routing_type = b.routing_type and a.routing_revision = b.routing_revision and a.alternative_no = b.alternative_no and a.operation_id = b.operation_id
  851. where a.site = #{site} and a.part_no = #{partNo} and a.routing_type = #{routingType} and a.routing_revision = #{routingRevision} and a.alternative_no = #{alternativeNo} and a.operation_id = #{operationId}
  852. </select>
  853. <!-- 修改工序Tool的 rowKey rowRevision -->
  854. <update id="updateIfsToolRowKeyAndRevision" parameterType="RoutingIfsTool">
  855. update routing_tool
  856. set ifs_row_id = #{ifsRowId},
  857. ifs_row_version = #{ifsRowVersion}
  858. where id = #{id}
  859. </update>
  860. <!-- 获取该替代的全部guideLine -->
  861. <select id="getGuideLineByOperation" parameterType="RoutingComponentEntity" resultType="WorkGuidelineEntity">
  862. SELECT
  863. site,
  864. part_no,
  865. routing_type,
  866. routing_revision,
  867. alternative_no,
  868. id,
  869. guideline_seq,
  870. guideline_desc,
  871. guideline_text,
  872. guideline_type,
  873. sign_off_required,
  874. inspection_sign_off_required,
  875. operation_id
  876. FROM plm_routing_work_guide
  877. where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo} and operation_id = #{operationId}
  878. </select>
  879. <!-- 修改工序Guideline的 rowKey rowRevision -->
  880. <update id="updateIfsGuidelineRowKeyAndRevision" parameterType="RoutingIfsGuideLine">
  881. update plm_routing_work_guide
  882. set ifs_row_id = #{ifsRowId},
  883. ifs_row_version = #{ifsRowVersion}
  884. where id = #{id}
  885. </update>
  886. <!-- 获取该工序的Tool(ifs) -->
  887. <select id="getRoutingGuidelineByOperationToIfs" resultType="RoutingIfsGuideLine">
  888. SELECT
  889. a.id,
  890. a.site as contract,
  891. a.part_no,
  892. a.routing_type,
  893. a.routing_revision,
  894. a.alternative_no,
  895. a.operation_id,
  896. b.operation_no,
  897. a.guideline_seq,
  898. a.guideline_desc,
  899. a.guideline_text,
  900. a.guideline_type as operWorkGuideType,
  901. a.sign_off_required as signOffReq,
  902. a.inspection_sign_off_required as inspectSignOffReq,
  903. b.ifs_row_id,
  904. b.ifs_row_version
  905. FROM plm_routing_work_guide as a
  906. left join plm_routing_component as b on a.site = b.site and a.part_no = b.part_no and a.routing_type = b.routing_type and a.routing_revision = b.routing_revision and a.alternative_no = b.alternative_no and a.operation_id = b.operation_id
  907. where a.site = #{site} and a.part_no = #{partNo} and a.routing_type = #{routingType} and a.routing_revision = #{routingRevision} and a.alternative_no = #{alternativeNo} and a.operation_id = #{operationId}
  908. </select>
  909. <!-- 根据工序删除RoutingTool -->
  910. <delete id="deleteRoutingToolByOperation" parameterType="RoutingComponentEntity">
  911. delete from routing_tool
  912. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo} and operation_id = #{operationId}
  913. </delete>
  914. <!-- 根据工序删除guideLine -->
  915. <delete id="deleteGuideLineByOperation" parameterType="RoutingComponentEntity">
  916. delete from plm_routing_work_guide
  917. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo} and operation_id = #{operationId}
  918. </delete>
  919. <!-- 根据替代删除RoutingTool -->
  920. <delete id="deleteRoutingToolByAlternative" parameterType="RoutingDetailEntity">
  921. delete from routing_tool
  922. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  923. </delete>
  924. <!-- 根据替代删除guideLine -->
  925. <delete id="deleteGuideLineByAlternative" parameterType="RoutingDetailEntity">
  926. delete from plm_routing_work_guide
  927. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  928. </delete>
  929. <select id="queryRoutingDetailList" resultType="com.spring.modules.quotation.entity.QuoteRoutingHeader">
  930. SELECT
  931. site,
  932. part_no,
  933. routing_type,
  934. routing_revision as version,
  935. alternative_no
  936. FROM plm_routing_detail
  937. where site = #{site} and part_no = #{partNo}
  938. </select>
  939. <!-- 查询最大工序号 -->
  940. <select id="queryMaxOperationNo" parameterType="RoutingDetailEntity" resultType="RoutingComponentEntity">
  941. SELECT top 1
  942. site,
  943. part_no,
  944. routing_revision,
  945. routing_type,
  946. alternative_no,
  947. operation_no
  948. FROM plm_routing_component
  949. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  950. order by operation_no desc
  951. </select>
  952. <!-- 修改工序的 rowKey rowRevision -->
  953. <update id="updateIfsRowKeyAndRevision" parameterType="RoutingIfsItem">
  954. update plm_routing_component
  955. set ifs_row_id = #{ifsRowId},
  956. ifs_row_version = #{ifsRowVersion}
  957. where site = #{contract} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo} and operation_id = #{operationId}
  958. </update>
  959. <!-- 修改工具的 rowKey rowRevision -->
  960. <update id="updateRoutingToolIfsRow" parameterType="com.spring.modules.part.vo.RoutingToolVo">
  961. update routing_tool
  962. set ifs_row_id = #{ifsRowId},
  963. ifs_row_version = #{ifsRowVersion}
  964. where id = #{id}
  965. </update>
  966. <update id="updateRoutingHeaderOfficialFlag" parameterType="com.spring.modules.part.vo.RoutingDetailVo">
  967. update plm_routing_header
  968. set official_flag = 'Y'
  969. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  970. </update>
  971. <update id="updateRoutingDetailOfficialFlag" parameterType="com.spring.modules.part.vo.RoutingDetailVo">
  972. update plm_routing_detail
  973. set official_flag = 'Y'
  974. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  975. </update>
  976. <!-- 根据routing的替代查Tool -->
  977. <select id="getRoutingToolByAlternative" parameterType="com.spring.modules.part.vo.RoutingDetailVo" resultType="RoutingIfsTool">
  978. SELECT
  979. a.id,
  980. a.site as contract,
  981. a.part_no,
  982. a.routing_type,
  983. a.routing_revision,
  984. a.alternative_no,
  985. a.operation_id,
  986. b.operation_no,
  987. a.tool_id,
  988. a.tool_qty as toolQuantity,
  989. a.remark as noteText,
  990. b.ifs_row_id,
  991. b.ifs_row_version
  992. FROM routing_tool as a
  993. left join plm_routing_component as b on a.site = b.site and a.part_no = b.part_no and a.routing_type = b.routing_type and a.routing_revision = b.routing_revision and a.alternative_no = b.alternative_no and a.operation_id = b.operation_id
  994. where a.site = #{site} and a.part_no = #{partNo} and a.routing_type = #{routingType} and a.routing_revision = #{routingRevision} and a.alternative_no = #{alternativeNo}
  995. </select>
  996. <!-- 根据routing的替代查guideLine -->
  997. <select id="getGuideLineByAlternative" parameterType="com.spring.modules.part.vo.RoutingDetailVo" resultType="RoutingIfsGuideLine">
  998. SELECT
  999. a.site as contract,
  1000. a.part_no,
  1001. a.routing_type,
  1002. a.routing_revision,
  1003. a.alternative_no,
  1004. a.id,
  1005. a.guideline_seq,
  1006. a.guideline_desc,
  1007. a.guideline_text,
  1008. a.guideline_type as operWorkGuideType,
  1009. a.sign_off_required as signOffReq,
  1010. a.inspection_sign_off_required as inspectSignOffReq,
  1011. a.operation_id,
  1012. b.ifs_row_id,
  1013. b.ifs_row_version
  1014. FROM plm_routing_work_guide as a
  1015. left join plm_routing_component as b on a.operation_id = b.operation_id
  1016. where a.site = #{site} and a.part_no = #{partNo} and a.routing_type = #{routingType} and a.routing_revision = #{routingRevision} and a.alternative_no = #{alternativeNo}
  1017. </select>
  1018. <!-- 获取Tool(ifs) -->
  1019. <select id="getRoutingToolToIfs" parameterType="RoutingToolEntity" resultType="RoutingIfsTool">
  1020. SELECT
  1021. id,
  1022. site as contract,
  1023. part_no,
  1024. routing_type,
  1025. routing_revision,
  1026. alternative_no,
  1027. operation_id,
  1028. tool_id,
  1029. tool_qty as toolQuantity,
  1030. remark as noteText,
  1031. ifs_row_id,
  1032. ifs_row_version
  1033. FROM routing_tool
  1034. where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo} and operation_id = #{operationId} and tool_id = #{toolId}
  1035. </select>
  1036. <!-- 修改工序的 rowKey rowRevision -->
  1037. <update id="updateRoutingComponentIfsRow" parameterType="RoutingComponentEntity">
  1038. update plm_routing_component
  1039. set ifs_row_id = #{ifsRowId},
  1040. ifs_row_version = #{ifsRowVersion}
  1041. where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo} and operation_id = #{operationId}
  1042. </update>
  1043. <!-- 获取工序(ifs) -->
  1044. <select id="getRoutingComponentToIfs" parameterType="RoutingComponentEntity" resultType="RoutingIfsItem">
  1045. SELECT
  1046. site as contract,
  1047. part_no,
  1048. routing_type,
  1049. routing_revision,
  1050. alternative_no,
  1051. operation_id,
  1052. operation_no,
  1053. efficiency_factor,
  1054. mach_run_factor,
  1055. mach_setup_time,
  1056. run_time_code,
  1057. labor_run_factor,
  1058. labor_setup_time,
  1059. crew_size,
  1060. setup_crew_size,
  1061. outside_op_item,
  1062. machine_no,
  1063. work_center_no,
  1064. labor_class_no,
  1065. setup_labor_class_no,
  1066. overlap,
  1067. note_text,
  1068. operation_name as operationDesc,
  1069. ifs_row_id,
  1070. ifs_row_version
  1071. FROM plm_routing_component
  1072. where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo} and operation_id = #{operationId}
  1073. </select>
  1074. <select id="getPLMLocations" resultType="LocationInformationEntity">
  1075. select
  1076. site,
  1077. location_id,
  1078. location_name,
  1079. warehouse_id,
  1080. active,
  1081. location_type,
  1082. ifs_row_version
  1083. from location
  1084. where site in
  1085. <foreach collection="arr" close=")" open="(" item="item" separator=",">
  1086. #{item}
  1087. </foreach>
  1088. </select>
  1089. <!-- 批量删除 -->
  1090. <delete id="syncDeleteLocation" parameterType="java.util.List">
  1091. DELETE FROM location WHERE
  1092. <foreach item="item" index="index" collection="list" open="(" separator=") OR (" close=")">
  1093. location_id = #{item.locationId} AND site = #{item.site}
  1094. </foreach>
  1095. </delete>
  1096. <!-- 批量新增 -->
  1097. <insert id="syncSaveLocation">
  1098. INSERT INTO location (site, location_id, location_name, warehouse_id, active, location_type, ifs_row_version)
  1099. VALUES
  1100. <foreach item="item" collection="list" separator=",">
  1101. (#{item.site}, #{item.locationId}, #{item.locationName}, #{item.warehouseId}, #{item.active}, #{item.locationType}, #{item.ifsRowVersion})
  1102. </foreach>
  1103. </insert>
  1104. <!-- 批量更新 -->
  1105. <update id="syncUpdateLocation" parameterType="java.util.List">
  1106. UPDATE location
  1107. SET
  1108. location_name = CASE location_id
  1109. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1110. WHEN #{item.locationId} THEN #{item.locationName}
  1111. </foreach>
  1112. ELSE location_name
  1113. END,
  1114. active = CASE location_id
  1115. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1116. WHEN #{item.locationId} THEN #{item.active}
  1117. </foreach>
  1118. ELSE active
  1119. END,
  1120. warehouse_id = CASE location_id
  1121. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1122. WHEN #{item.locationId} THEN #{item.warehouseId}
  1123. </foreach>
  1124. ELSE warehouse_id
  1125. END,
  1126. location_type = CASE location_id
  1127. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1128. WHEN #{item.locationId} THEN #{item.locationType}
  1129. </foreach>
  1130. ELSE location_type
  1131. END,
  1132. ifs_row_version = CASE location_id
  1133. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1134. WHEN #{item.locationId} THEN #{item.ifsRowVersion}
  1135. </foreach>
  1136. ELSE ifs_row_version
  1137. END
  1138. WHERE location_id IN
  1139. <foreach item="item" index="index" collection="list" open="(" close=")" separator=",">
  1140. #{item.locationId}
  1141. </foreach>
  1142. AND site = #{list[0].site}
  1143. </update>
  1144. <!-- &lt;!&ndash; 批量更新 &ndash;&gt;-->
  1145. <!-- <update id="syncUpdateLocation" parameterType="LocationInformationEntity">-->
  1146. <!-- UPDATE location SET-->
  1147. <!-- location_name = #{locationName},-->
  1148. <!-- active = #{active},-->
  1149. <!-- warehouse_id = #{warehouseId},-->
  1150. <!-- location_type = #{locationType},-->
  1151. <!-- ifs_row_version = #{ifsRowVersion}-->
  1152. <!-- WHERE location_id = #{locationId} AND site = #{site}-->
  1153. <!-- </update>-->
  1154. <select id="getPLMLaborClasss" resultType="PersonnelLevel">
  1155. select
  1156. site,
  1157. level_id,
  1158. level_desc,
  1159. level_cost,
  1160. active,
  1161. ifs_row_version
  1162. from labor_class
  1163. where site in
  1164. <foreach collection="arr" close=")" open="(" item="item" separator=",">
  1165. #{item}
  1166. </foreach>
  1167. </select>
  1168. <!-- 批量删除 -->
  1169. <delete id="syncDeleteLaborClass" parameterType="java.util.List">
  1170. DELETE FROM labor_class WHERE
  1171. <foreach item="item" index="index" collection="list" open="(" separator=") OR (" close=")">
  1172. level_id = #{item.levelId} AND site = #{item.site}
  1173. </foreach>
  1174. </delete>
  1175. <!-- 批量新增 -->
  1176. <insert id="syncSaveLaborClass">
  1177. INSERT INTO labor_class (site, level_id, level_desc, level_cost, active, ifs_row_version)
  1178. VALUES
  1179. <foreach item="item" collection="list" separator=",">
  1180. (#{item.site}, #{item.levelId}, #{item.levelDesc}, #{item.levelCost}, #{item.active}, #{item.ifsRowVersion})
  1181. </foreach>
  1182. </insert>
  1183. <!-- 批量更新 -->
  1184. <update id="syncUpdateLaborClass" parameterType="java.util.List">
  1185. UPDATE labor_class
  1186. SET
  1187. level_desc = CASE level_id
  1188. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1189. WHEN #{item.levelId} THEN #{item.levelDesc}
  1190. </foreach>
  1191. ELSE level_desc
  1192. END,
  1193. active = CASE level_id
  1194. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1195. WHEN #{item.levelId} THEN #{item.active}
  1196. </foreach>
  1197. ELSE active
  1198. END,
  1199. level_cost = CASE level_id
  1200. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1201. WHEN #{item.levelId} THEN #{item.levelCost}
  1202. </foreach>
  1203. ELSE level_cost
  1204. END,
  1205. ifs_row_version = CASE level_id
  1206. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1207. WHEN #{item.levelId} THEN #{item.ifsRowVersion}
  1208. </foreach>
  1209. ELSE ifs_row_version
  1210. END
  1211. WHERE level_id IN
  1212. <foreach item="item" index="index" collection="list" open="(" close=")" separator=",">
  1213. #{item.levelId}
  1214. </foreach>
  1215. AND site = #{list[0].site}
  1216. </update>
  1217. <!-- &lt;!&ndash; 批量更新 &ndash;&gt;-->
  1218. <!-- <update id="syncUpdateLaborClass" parameterType="PersonnelLevel">-->
  1219. <!-- UPDATE labor_class SET-->
  1220. <!-- level_desc = #{levelDesc},-->
  1221. <!-- active = #{active},-->
  1222. <!-- level_cost = #{levelCost},-->
  1223. <!-- ifs_row_version = #{ifsRowVersion}-->
  1224. <!-- WHERE level_id = #{levelId} AND site = #{site}-->
  1225. <!-- </update>-->
  1226. <select id="getPLMWorkCenters" resultType="WorkCenter">
  1227. select
  1228. site,
  1229. work_center_no,
  1230. work_center_desc,
  1231. work_center_type_db,
  1232. work_center_type,
  1233. average_capacity,
  1234. efficiency,
  1235. utilization,
  1236. capacity_type_db,
  1237. capacity_type,
  1238. um_id,
  1239. active,
  1240. remark,
  1241. pro_line_no,
  1242. can_create_new_roll_flag,
  1243. need_setup_flag,
  1244. ifs_row_version
  1245. from work_center
  1246. where site in
  1247. <foreach collection="arr" close=")" open="(" item="item" separator=",">
  1248. #{item}
  1249. </foreach>
  1250. </select>
  1251. <!-- 批量删除 -->
  1252. <delete id="syncDeleteWorkCenter" parameterType="java.util.List">
  1253. DELETE FROM work_center WHERE
  1254. <foreach item="item" index="index" collection="list" open="(" separator=") OR (" close=")">
  1255. work_center_no = #{item.workCenterNo} AND site = #{item.site}
  1256. </foreach>
  1257. </delete>
  1258. <!-- 批量新增 -->
  1259. <insert id="syncSaveWorkCenter">
  1260. INSERT INTO work_center (site, work_center_no, work_center_desc, work_center_type_db, work_center_type, average_capacity, efficiency, utilization, capacity_type_db, capacity_type,
  1261. um_id, active, remark, pro_line_no, can_create_new_roll_flag, need_setup_flag, ifs_row_version)
  1262. VALUES
  1263. <foreach item="item" collection="list" separator=",">
  1264. (#{item.site}, #{item.workCenterNo}, #{item.workCenterDesc}, #{item.workCenterTypeDB}, #{item.workCenterType}, #{item.averageCapacity,jdbcType=DECIMAL}, #{item.efficiency,jdbcType=DECIMAL}, #{item.utilization,jdbcType=DECIMAL}, #{item.capacityTypeDB}, #{item.capacityType},
  1265. #{item.umId}, #{item.active}, #{item.remark}, #{item.proLineNo}, #{item.canCreateNewRollFlag}, #{item.needSetupFlag}, #{item.ifsRowVersion})
  1266. </foreach>
  1267. </insert>
  1268. <!-- 批量更新 -->
  1269. <update id="syncUpdateWorkCenter" parameterType="java.util.List">
  1270. UPDATE work_center
  1271. SET
  1272. work_center_desc = CASE work_center_no
  1273. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1274. WHEN #{item.workCenterNo} THEN #{item.workCenterDesc}
  1275. </foreach>
  1276. ELSE work_center_desc
  1277. END,
  1278. work_center_type_db = CASE work_center_no
  1279. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1280. WHEN #{item.workCenterNo} THEN #{item.workCenterTypeDB}
  1281. </foreach>
  1282. ELSE work_center_type_db
  1283. END,
  1284. work_center_type = CASE work_center_no
  1285. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1286. WHEN #{item.workCenterNo} THEN #{item.workCenterType}
  1287. </foreach>
  1288. ELSE work_center_type
  1289. END,
  1290. average_capacity = CASE work_center_no
  1291. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1292. WHEN #{item.workCenterNo} THEN #{item.averageCapacity,jdbcType=DECIMAL}
  1293. </foreach>
  1294. ELSE average_capacity
  1295. END,
  1296. efficiency = CASE work_center_no
  1297. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1298. WHEN #{item.workCenterNo} THEN #{item.efficiency,jdbcType=DECIMAL}
  1299. </foreach>
  1300. ELSE efficiency
  1301. END,
  1302. utilization = CASE work_center_no
  1303. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1304. WHEN #{item.workCenterNo} THEN #{item.utilization,jdbcType=DECIMAL}
  1305. </foreach>
  1306. ELSE utilization
  1307. END,
  1308. capacity_type_db = CASE work_center_no
  1309. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1310. WHEN #{item.workCenterNo} THEN #{item.capacityTypeDB}
  1311. </foreach>
  1312. ELSE capacity_type_db
  1313. END,
  1314. capacity_type = CASE work_center_no
  1315. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1316. WHEN #{item.workCenterNo} THEN #{item.capacityType}
  1317. </foreach>
  1318. ELSE capacity_type
  1319. END,
  1320. um_id = CASE work_center_no
  1321. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1322. WHEN #{item.workCenterNo} THEN #{item.umId}
  1323. </foreach>
  1324. ELSE um_id
  1325. END,
  1326. active = CASE work_center_no
  1327. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1328. WHEN #{item.workCenterNo} THEN #{item.active}
  1329. </foreach>
  1330. ELSE active
  1331. END,
  1332. remark = CASE work_center_no
  1333. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1334. WHEN #{item.workCenterNo} THEN #{item.remark}
  1335. </foreach>
  1336. ELSE remark
  1337. END,
  1338. pro_line_no = CASE work_center_no
  1339. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1340. WHEN #{item.workCenterNo} THEN #{item.proLineNo}
  1341. </foreach>
  1342. ELSE pro_line_no
  1343. END,
  1344. can_create_new_roll_flag = CASE work_center_no
  1345. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1346. WHEN #{item.workCenterNo} THEN #{item.canCreateNewRollFlag}
  1347. </foreach>
  1348. ELSE can_create_new_roll_flag
  1349. END,
  1350. need_setup_flag = CASE work_center_no
  1351. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1352. WHEN #{item.workCenterNo} THEN #{item.needSetupFlag}
  1353. </foreach>
  1354. ELSE need_setup_flag
  1355. END,
  1356. ifs_row_version = CASE work_center_no
  1357. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1358. WHEN #{item.workCenterNo} THEN #{item.ifsRowVersion}
  1359. </foreach>
  1360. ELSE ifs_row_version
  1361. END
  1362. WHERE work_center_no IN
  1363. <foreach item="item" index="index" collection="list" open="(" close=")" separator=",">
  1364. #{item.workCenterNo}
  1365. </foreach>
  1366. AND site = #{list[0].site}
  1367. </update>
  1368. <select id="getPLMWorkCenterCosts" resultType="WorkCenterCost">
  1369. select
  1370. site,
  1371. work_center_no,
  1372. item_no,
  1373. unit_cost,
  1374. overhead1_cost,
  1375. overhead2_cost,
  1376. um_id,
  1377. begin_date,
  1378. end_date,
  1379. remark,
  1380. current_work_center_cost,
  1381. ifs_row_id,
  1382. ifs_row_version,
  1383. cost_set,
  1384. cost_set_desc,
  1385. wc_rate,
  1386. wc_cost_code,
  1387. overhead1_fac,
  1388. overhead2_fac,
  1389. overhead1_appl,
  1390. overhead2_appl
  1391. from work_center_cost
  1392. where site in
  1393. <foreach collection="arr" close=")" open="(" item="item" separator=",">
  1394. #{item}
  1395. </foreach>
  1396. </select>
  1397. <!-- 批量新增 -->
  1398. <insert id="syncSaveWorkCenterCost">
  1399. INSERT INTO work_center_cost (site, work_center_no, item_no, unit_cost, overhead1_cost, overhead2_cost, um_id, begin_date, end_date, remark,
  1400. current_work_center_cost, ifs_row_id, ifs_row_version, cost_set, cost_set_desc, wc_rate, wc_cost_code, overhead1_fac, overhead2_fac, overhead1_appl, overhead2_appl)
  1401. VALUES
  1402. <foreach item="item" collection="list" separator=",">
  1403. (#{item.site}, #{item.workCenterNo}, #{item.itemNo,jdbcType=FLOAT}, #{item.unitCost,jdbcType=FLOAT}, #{item.overhead1Cost,jdbcType=FLOAT}, #{item.overhead2Cost,jdbcType=FLOAT}, #{item.umId}, #{item.beginDate}, #{item.endDate}, #{item.remark},
  1404. #{item.currentWorkCenterCost,jdbcType=DECIMAL}, #{item.ifsRowId}, #{item.ifsRowVersion}, #{item.costSet}, #{item.costSetDesc}, #{item.wcRate}, #{item.wcCostCode}, #{item.overhead1Fac}, #{item.overhead2Fac}, #{item.overhead1Appl}, #{item.overhead2Appl})
  1405. </foreach>
  1406. </insert>
  1407. <!-- 批量更新 -->
  1408. <update id="syncUpdateWorkCenterCost" parameterType="java.util.List">
  1409. UPDATE work_center_cost
  1410. SET
  1411. item_no = CASE ifs_row_id
  1412. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1413. WHEN #{item.ifsRowId} THEN #{item.itemNo,jdbcType=FLOAT}
  1414. </foreach>
  1415. ELSE item_no
  1416. END,
  1417. unit_cost = CASE ifs_row_id
  1418. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1419. WHEN #{item.ifsRowId} THEN #{item.unitCost,jdbcType=FLOAT}
  1420. </foreach>
  1421. ELSE unit_cost
  1422. END,
  1423. overhead1_cost = CASE ifs_row_id
  1424. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1425. WHEN #{item.ifsRowId} THEN #{item.overhead1Cost,jdbcType=FLOAT}
  1426. </foreach>
  1427. ELSE overhead1_cost
  1428. END,
  1429. overhead2_cost = CASE ifs_row_id
  1430. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1431. WHEN #{item.ifsRowId} THEN #{item.overhead2Cost,jdbcType=FLOAT}
  1432. </foreach>
  1433. ELSE overhead2_cost
  1434. END,
  1435. um_id = CASE ifs_row_id
  1436. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1437. WHEN #{item.ifsRowId} THEN #{item.umId}
  1438. </foreach>
  1439. ELSE um_id
  1440. END,
  1441. begin_date = CASE ifs_row_id
  1442. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1443. WHEN #{item.ifsRowId} THEN #{item.beginDate}
  1444. </foreach>
  1445. ELSE begin_date
  1446. END,
  1447. end_date = CASE ifs_row_id
  1448. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1449. WHEN #{item.ifsRowId} THEN #{item.endDate}
  1450. </foreach>
  1451. ELSE end_date
  1452. END,
  1453. remark = CASE ifs_row_id
  1454. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1455. WHEN #{item.ifsRowId} THEN #{item.remark}
  1456. </foreach>
  1457. ELSE remark
  1458. END,
  1459. current_work_center_cost = CASE ifs_row_id
  1460. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1461. WHEN #{item.ifsRowId} THEN #{item.currentWorkCenterCost}
  1462. </foreach>
  1463. ELSE current_work_center_cost
  1464. END,
  1465. ifs_row_version = CASE ifs_row_id
  1466. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1467. WHEN #{item.ifsRowId} THEN #{item.ifsRowVersion}
  1468. </foreach>
  1469. ELSE ifs_row_version
  1470. END,
  1471. cost_set = CASE ifs_row_id
  1472. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1473. WHEN #{item.ifsRowId} THEN #{item.costSet}
  1474. </foreach>
  1475. ELSE cost_set
  1476. END,
  1477. cost_set_desc = CASE ifs_row_id
  1478. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1479. WHEN #{item.ifsRowId} THEN #{item.costSetDesc}
  1480. </foreach>
  1481. ELSE cost_set_desc
  1482. END,
  1483. wc_rate = CASE ifs_row_id
  1484. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1485. WHEN #{item.ifsRowId} THEN #{item.wcRate}
  1486. </foreach>
  1487. ELSE wc_rate
  1488. END,
  1489. wc_cost_code = CASE ifs_row_id
  1490. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1491. WHEN #{item.ifsRowId} THEN #{item.wcCostCode}
  1492. </foreach>
  1493. ELSE wc_cost_code
  1494. END,
  1495. overhead1_fac = CASE ifs_row_id
  1496. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1497. WHEN #{item.ifsRowId} THEN #{item.overhead1Fac}
  1498. </foreach>
  1499. ELSE overhead1_fac
  1500. END,
  1501. overhead2_fac = CASE ifs_row_id
  1502. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1503. WHEN #{item.ifsRowId} THEN #{item.overhead2Fac}
  1504. </foreach>
  1505. ELSE overhead2_fac
  1506. END,
  1507. overhead1_appl = CASE ifs_row_id
  1508. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1509. WHEN #{item.ifsRowId} THEN #{item.overhead1Appl}
  1510. </foreach>
  1511. ELSE overhead1_appl
  1512. END,
  1513. overhead2_appl = CASE ifs_row_id
  1514. <foreach item="item" index="index" collection="list" open="" close="" separator=" ">
  1515. WHEN #{item.ifsRowId} THEN #{item.overhead2Appl}
  1516. </foreach>
  1517. ELSE overhead2_appl
  1518. END
  1519. WHERE ifs_row_id IN
  1520. <foreach item="item" index="index" collection="list" open="(" close=")" separator=",">
  1521. #{item.ifsRowId}
  1522. </foreach>
  1523. </update>
  1524. <select id="getRoutingComponentRowKeyAndVersion" resultType="RoutingComponentEntity">
  1525. select
  1526. site,
  1527. part_no,
  1528. routing_revision,
  1529. routing_type,
  1530. alternative_no,
  1531. operation_no,
  1532. operation_name,
  1533. operation_id,
  1534. ifs_row_id,
  1535. ifs_row_version
  1536. from plm_routing_component
  1537. where operation_id = #{operationId}
  1538. </select>
  1539. <select id="getMaxLocationRowVersion" resultType="java.lang.String">
  1540. select
  1541. isnull(max(ifs_row_version),'')
  1542. from location
  1543. </select>
  1544. <select id="getMaxLaborClassRowVersion" resultType="java.lang.String">
  1545. select
  1546. isnull(max(ifs_row_version),'')
  1547. from labor_class
  1548. </select>
  1549. <select id="getMaxWorkCenterRowVersion" resultType="java.lang.String">
  1550. select
  1551. isnull(max(ifs_row_version),'')
  1552. from work_center
  1553. </select>
  1554. <select id="getMaxWorkCenterCostRowVersion" resultType="java.lang.String">
  1555. select
  1556. isnull(max(ifs_row_version),'')
  1557. from work_center_cost
  1558. </select>
  1559. <select id="selectRoutingHeaderByPartNo" resultType="com.spring.modules.part.vo.RoutingHeaderVo">
  1560. SELECT
  1561. site,
  1562. part_no,
  1563. routing_revision,
  1564. routing_type,
  1565. note_text,
  1566. phase_in_date,
  1567. phase_out_date,
  1568. official_flag
  1569. FROM plm_routing_header
  1570. where site = #{site} and part_no = #{partNo}
  1571. </select>
  1572. <select id="selectRoutingDetailByPartNo" resultType="com.spring.modules.part.vo.RoutingDetailVo">
  1573. SELECT
  1574. site,
  1575. part_no,
  1576. routing_type,
  1577. routing_revision,
  1578. alternative_no,
  1579. alternative_description,
  1580. rout_template_id,
  1581. plan_date,
  1582. fixed_lead_time_day,
  1583. fixed_lead_time_hour,
  1584. variable_lead_time_day,
  1585. variable_lead_time_hour,
  1586. for_std_lot_by_day,
  1587. for_lot_by_day,
  1588. min_lot_qty,
  1589. note_text as detailNoteText,
  1590. 'Tentative' as status,
  1591. official_flag
  1592. FROM plm_routing_detail
  1593. where site = #{site} and part_no = #{partNo}
  1594. </select>
  1595. <select id="selectRoutingComponentByPartNo" resultType="com.spring.modules.part.vo.RoutingComponentVo">
  1596. SELECT
  1597. site,
  1598. part_no,
  1599. routing_type,
  1600. routing_revision,
  1601. alternative_no,
  1602. operation_id,
  1603. operation_no,
  1604. operation_name,
  1605. efficiency_factor,
  1606. mach_run_factor,
  1607. mach_setup_time,
  1608. run_time_code,
  1609. labor_run_factor,
  1610. labor_setup_time,
  1611. crew_size,
  1612. setup_crew_size,
  1613. outside_op_item,
  1614. machine_no,
  1615. work_center_no,
  1616. labor_class_no,
  1617. setup_labor_class_no,
  1618. overlap,
  1619. note_text
  1620. FROM plm_routing_component
  1621. where site = #{site} and part_no = #{partNo}
  1622. </select>
  1623. <insert id="saveRoutingHeaderList">
  1624. INSERT INTO plm_routing_header
  1625. (site, part_no, routing_revision, routing_type, note_text, phase_in_date, phase_out_date, create_date, create_by, official_flag) VALUES
  1626. <foreach collection="list" item="item" index="index" separator=",">
  1627. (#{item.site}, #{item.partNo}, #{item.routingRevision}, #{item.routingType}, #{item.noteText}, #{item.phaseInDate}, #{item.phaseOutDate}, getDate(), #{item.createBy}, #{item.officialFlag})
  1628. </foreach>
  1629. </insert>
  1630. <insert id="saveRoutingDetailList">
  1631. INSERT INTO plm_routing_detail
  1632. (site, part_no, routing_revision, routing_type, alternative_no, alternative_description, fixed_lead_time_day, fixed_lead_time_hour, variable_lead_time_day, variable_lead_time_hour, for_std_lot_by_day, for_lot_by_day, min_lot_qty, note_text, create_date, create_by, status, official_flag) VALUES
  1633. <foreach collection="list" item="item" index="index" separator=",">
  1634. (#{item.site}, #{item.partNo}, #{item.routingRevision}, #{item.routingType}, #{item.alternativeNo}, #{item.alternativeDescription}, #{item.fixedLeadTimeDay}, #{item.fixedLeadTimeHour}, #{item.variableLeadTimeDay}, #{item.variableLeadTimeHour}, #{item.forStdLotByDay}, #{item.forLotByDay}, #{item.minLotQty}, #{item.detailNoteText}, getDate(), #{item.createBy}, #{item.status}, #{item.officialFlag})
  1635. </foreach>
  1636. </insert>
  1637. <select id="selectRoutingToolByPartNo" resultType="RoutingToolEntity">
  1638. SELECT
  1639. site,
  1640. part_no,
  1641. routing_type,
  1642. routing_revision,
  1643. alternative_no,
  1644. operation_id,
  1645. tool_id,
  1646. tool_qty,
  1647. remark
  1648. FROM routing_tool
  1649. where site = #{site} and part_no = #{partNo}
  1650. </select>
  1651. <select id="selectRoutingGuidelineByPartNo" resultType="WorkGuidelineEntity">
  1652. SELECT
  1653. site,
  1654. part_no,
  1655. routing_type,
  1656. routing_revision,
  1657. alternative_no,
  1658. guideline_seq,
  1659. guideline_desc,
  1660. guideline_text,
  1661. guideline_type,
  1662. sign_off_required,
  1663. inspection_sign_off_required,
  1664. operation_id
  1665. FROM plm_routing_work_guide
  1666. where site = #{site} and part_no = #{partNo}
  1667. </select>
  1668. <!-- 查工具列表 -->
  1669. <select id="queryToolList" parameterType="ToolHeader" resultType="ToolHeader">
  1670. SELECT
  1671. site,
  1672. tool_id,
  1673. tool_description
  1674. FROM tool_header
  1675. <where>
  1676. site = #{query.site} and active = 'Y'
  1677. <if test = "query.toolId != null and query.toolId != ''">
  1678. AND tool_id like #{query.toolId}
  1679. </if>
  1680. <if test = "query.toolDescription != null and query.toolDescription != ''">
  1681. AND tool_description like #{query.toolDescription}
  1682. </if>
  1683. </where>
  1684. </select>
  1685. </mapper>