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.

636 lines
26 KiB

  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.xujie.sys.modules.part.mapper.RoutingManagementMapper">
  4. <!-- 材料信息列表 -->
  5. <select id="routingManagementSearch" parameterType="com.xujie.sys.modules.part.vo.RoutingHeaderVo" resultType="com.xujie.sys.modules.part.vo.RoutingHeaderVo">
  6. SELECT
  7. a.site,
  8. a.bu_no,
  9. a.part_no,
  10. dbo.qc_get_part_desc(a.site, a.bu_no, a.part_no) as partDesc,
  11. a.routing_revision,
  12. a.routing_type,
  13. a.note_text,
  14. a.phase_in_date,
  15. a.phase_out_date,
  16. a.create_date,
  17. a.create_by,
  18. a.update_date,
  19. a.update_by,
  20. b.umid as printUnit,
  21. dbo.qc_get_um_name(a.site, b.umid) as printUnitName
  22. FROM plm_routing_header as a
  23. left join part as b on a.site = b.site and a.bu_no = b.sourceBu and a.part_no = b.part_no
  24. <where>
  25. a.site in (select site from eam_access_site where username = #{query.userName})
  26. and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
  27. <if test="query.buNo != null and query.buNo != ''">
  28. AND a.bu_no = #{query.buNo}
  29. </if>
  30. <if test = "query.partNo != null and query.partNo != ''">
  31. AND a.part_no like '%' + #{query.partNo} + '%'
  32. </if>
  33. <if test = "query.partDesc != null and query.partDesc != ''">
  34. AND dbo.qc_get_part_desc(a.site, a.bu_no, a.part_no) like '%' + #{query.partDesc} + '%'
  35. </if>
  36. <if test = "query.routingType != null and query.routingType != ''">
  37. AND a.routing_type like '%' + #{query.routingType} + '%'
  38. </if>
  39. <if test = "query.routingRevision != null and query.routingRevision != ''">
  40. AND a.routing_revision like '%' + #{query.routingRevision} + '%'
  41. </if>
  42. </where>
  43. </select>
  44. <!-- 查询物料清单 -->
  45. <select id="queryPartList" parameterType="PartInformationEntity" resultType="RoutingAllFieldEntity">
  46. SELECT
  47. site,
  48. sourceBu as buNo,
  49. part_no,
  50. part_desc,
  51. spec,
  52. umid as printUnit,
  53. dbo.qc_get_um_name(site, umid) as printUnitName,
  54. part_type
  55. FROM part
  56. <where>
  57. site = #{query.site}
  58. and sourceBu = #{query.buNo}
  59. and part_type not in ('Purchased', 'Purchased (raw)')
  60. and active = 'Y'
  61. <if test = "query.partNo != null and query.partNo != ''">
  62. AND part_no = #{query.partNo}
  63. </if>
  64. <if test = "query.partDesc != null and query.partDesc != ''">
  65. AND part_desc like '%' + #{query.partDesc} + '%'
  66. </if>
  67. </where>
  68. </select>
  69. <!-- 查出可创建Routing的物料 -->
  70. <select id="queryPartListRouting" parameterType="PartInformationEntity" resultType="RoutingAllFieldEntity">
  71. SELECT
  72. site,
  73. sourceBu as buNo,
  74. part_no,
  75. part_desc,
  76. spec,
  77. umid as printUnit,
  78. dbo.qc_get_um_name(site, umid) as printUnitName,
  79. part_type
  80. FROM part
  81. <where>
  82. site = #{query.site}
  83. and sourceBu = #{query.buNo}
  84. and active = 'Y'
  85. and part_type not in ('Purchased', 'Purchased (raw)')
  86. <if test = "query.partNo != null and query.partNo != ''">
  87. AND part_no like '%' + #{query.partNo} + '%'
  88. </if>
  89. <if test = "query.partDesc != null and query.partDesc != ''">
  90. AND part_desc like '%' + #{query.partDesc} + '%'
  91. </if>
  92. </where>
  93. </select>
  94. <!-- 新增Routing主表内容 -->
  95. <insert id="saveRoutingHeader" parameterType="RoutingHeaderEntity">
  96. INSERT INTO plm_routing_header
  97. (site, bu_no, part_no, routing_revision, routing_type, note_text, phase_in_date, phase_out_date, create_date, create_by)
  98. VALUES
  99. (#{site}, #{buNo}, #{partNo}, #{routingRevision}, #{routingType}, #{noteText}, #{phaseInDate}, #{phaseOutDate}, getDate(), #{createBy})
  100. </insert>
  101. <!-- routing明细新增 -->
  102. <insert id="routingDetailSave" parameterType="RoutingDetailEntity">
  103. INSERT INTO plm_routing_detail
  104. (site, bu_no, 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)
  105. VALUES
  106. (#{site}, #{buNo}, #{partNo}, #{routingRevision}, #{routingType}, #{alternativeNo}, #{alternativeDescription}, #{fixedLeadTimeDay}, #{fixedLeadTimeHour}, #{variableLeadTimeDay}, #{variableLeadTimeHour}, #{forStdLotByDay}, #{forLotByDay}, #{minLotQty}, #{detailNoteText}, getDate(), #{createBy}, #{status})
  107. </insert>
  108. <!-- 新增Routing子明细表内容 -->
  109. <insert id="saveRoutingComponent" parameterType="RoutingComponentEntity" useGeneratedKeys="true" keyProperty="operationId">
  110. INSERT INTO plm_routing_component
  111. (site, bu_no, 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, mach_cycle_time, labor_cycle_time)
  112. VALUES
  113. (#{site}, #{buNo}, #{partNo}, #{routingRevision}, #{routingType}, #{alternativeNo}, #{operationName}, #{operationNo}, #{efficiencyFactor}, #{machRunFactor}, #{machSetupTime}, #{runTimeCode}, #{laborRunFactor}, #{laborSetupTime}, #{crewSize,jdbcType=FLOAT}, #{setupCrewSize,jdbcType=FLOAT}, #{outsideOpItem}, #{machineNo}, #{workCenterNo}, #{laborClassNo}, #{setupLaborClassNo}, #{overlap}, #{noteText}, getDate(), #{createBy}, #{machCycleTime}, #{laborCycleTime})
  114. </insert>
  115. <!-- 查routing明细 -->
  116. <select id="queryRoutingDetail" parameterType="RoutingHeaderEntity" resultType="RoutingDetailEntity">
  117. SELECT
  118. site,
  119. bu_no,
  120. part_no,
  121. routing_type,
  122. routing_revision,
  123. alternative_no,
  124. alternative_description,
  125. rout_template_id,
  126. plan_date,
  127. fixed_lead_time_day,
  128. fixed_lead_time_hour,
  129. variable_lead_time_day,
  130. variable_lead_time_hour,
  131. for_std_lot_by_day,
  132. for_lot_by_day,
  133. min_lot_qty,
  134. note_text as detailNoteText,
  135. status
  136. FROM plm_routing_detail
  137. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision}
  138. </select>
  139. <!-- 查routing明细对象 -->
  140. <select id="queryDetailDataByNo" parameterType="RoutingDetailEntity" resultType="RoutingDetailEntity">
  141. SELECT
  142. site,
  143. bu_no,
  144. part_no,
  145. routing_type,
  146. routing_revision,
  147. alternative_no,
  148. alternative_description,
  149. rout_template_id,
  150. plan_date,
  151. fixed_lead_time_day,
  152. fixed_lead_time_hour,
  153. variable_lead_time_day,
  154. variable_lead_time_hour,
  155. for_std_lot_by_day,
  156. for_lot_by_day,
  157. min_lot_qty,
  158. note_text as detailNoteText,
  159. status
  160. FROM plm_routing_detail
  161. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo}
  162. </select>
  163. <!-- 查routing子明细 -->
  164. <select id="queryRoutingComponent" parameterType="RoutingDetailEntity" resultType="com.xujie.sys.modules.part.vo.RoutingComponentVo">
  165. SELECT
  166. a.site,
  167. a.bu_no,
  168. a.part_no,
  169. a.routing_type,
  170. a.routing_revision,
  171. a.alternative_no,
  172. a.operation_id,
  173. a.operation_no,
  174. a.operation_name,
  175. a.efficiency_factor,
  176. a.mach_run_factor,
  177. a.mach_setup_time,
  178. a.run_time_code,
  179. case when a.run_time_code = 'Units/Hour' then '单位/小时'
  180. when a.run_time_code = 'Hours/Unit' then '小时/单位'
  181. when a.run_time_code = 'Hours' then '小时'
  182. else '' end as runTimeCodeDesc,
  183. a.labor_run_factor,
  184. a.labor_setup_time,
  185. a.crew_size,
  186. a.setup_crew_size,
  187. a.outside_op_item,
  188. a.machine_no,
  189. a.work_center_no,
  190. b.work_center_desc,
  191. b.work_center_type,
  192. a.labor_class_no,
  193. dbo.get_labor_class_desc(a.site, a.bu_no, a.labor_class_no) as laborClassDesc,
  194. a.setup_labor_class_no,
  195. dbo.get_labor_class_desc(a.site, a.bu_no, a.setup_labor_class_no) as setupLaborClassDesc,
  196. a.overlap,
  197. a.note_text,
  198. a.mach_cycle_time,
  199. a.labor_cycle_time
  200. FROM plm_routing_component as a
  201. LEFT JOIN work_center as b on a.site = b.site and a.bu_no = b.bu_no and a.work_center_no = b.work_center_no
  202. where a.site = #{site} and a.bu_no = #{buNo} and a.part_no = #{partNo} and a.routing_type = #{routingType} and a.routing_revision = #{routingRevision} and a.alternative_no = #{alternativeNo}
  203. order by a.operation_no
  204. </select>
  205. <!-- routing主表编辑 -->
  206. <update id="updateRoutingHeader" parameterType="RoutingAllFieldEntity">
  207. update plm_routing_header
  208. set phase_in_date = #{phaseInDate},
  209. phase_out_date = #{phaseOutDate},
  210. note_text = #{noteText},
  211. update_date = getDate(),
  212. update_by = #{updateBy}
  213. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  214. </update>
  215. <!-- routing明细表编辑 -->
  216. <update id="updateRoutingDetail" parameterType="RoutingDetailEntity">
  217. update plm_routing_detail
  218. set alternative_description = #{alternativeDescription},
  219. rout_template_id = #{routTemplateId},
  220. plan_date = #{planDate},
  221. fixed_lead_time_day = #{fixedLeadTimeDay},
  222. fixed_lead_time_hour = #{fixedLeadTimeHour},
  223. variable_lead_time_day = #{variableLeadTimeDay},
  224. variable_lead_time_hour = #{variableLeadTimeHour},
  225. for_std_lot_by_day = #{forStdLotByDay},
  226. for_lot_by_day = #{forLotByDay},
  227. min_lot_qty = #{minLotQty},
  228. note_text = #{detailNoteText},
  229. update_date = getDate(),
  230. update_by = #{updateBy},
  231. status = #{status}
  232. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  233. </update>
  234. <!-- 删除routing子明细 -->
  235. <delete id="deleteRoutingComponent">
  236. delete from plm_routing_component
  237. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  238. </delete>
  239. <!-- 删除替代 -->
  240. <delete id="routingDetailDelete" parameterType="RoutingDetailEntity">
  241. delete from plm_routing_detail
  242. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  243. </delete>
  244. <!-- routing主表查重 -->
  245. <select id="checkRoutingOnlyOne" parameterType="RoutingAllFieldEntity" resultType="com.xujie.sys.modules.part.vo.RoutingHeaderVo">
  246. SELECT
  247. site,
  248. bu_no,
  249. part_no,
  250. dbo.qc_get_part_desc(site, bu_no, part_no) as partDesc,
  251. routing_type,
  252. routing_revision,
  253. phase_in_date,
  254. phase_out_date,
  255. note_text
  256. FROM plm_routing_header
  257. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision}
  258. </select>
  259. <!-- routing明细查重 -->
  260. <select id="checkRoutingDetailOnlyOne" parameterType="RoutingDetailEntity" resultType="RoutingDetailEntity">
  261. SELECT
  262. site,
  263. bu_no,
  264. part_no,
  265. routing_type,
  266. routing_revision,
  267. alternative_no,
  268. alternative_description,
  269. rout_template_id,
  270. plan_date,
  271. fixed_lead_time_day,
  272. fixed_lead_time_hour,
  273. variable_lead_time_day,
  274. variable_lead_time_hour,
  275. for_std_lot_by_day,
  276. for_lot_by_day,
  277. min_lot_qty,
  278. note_text as detailNoteText,
  279. status
  280. FROM plm_routing_detail
  281. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo}
  282. </select>
  283. <!-- 批量删除子明细物料 -->
  284. <delete id="deleteRoutingComponents" parameterType="RoutingComponentEntity">
  285. delete from plm_routing_component
  286. where site = #{site}
  287. and bu_no = #{buNo}
  288. and part_no = #{partNo}
  289. and routing_revision = #{routingRevision}
  290. and routing_type = #{routingType}
  291. and alternative_no = #{alternativeNo}
  292. and operation_id = #{operationId}
  293. </delete>
  294. <!-- 删除routing子明细 -->
  295. <delete id="deleteRoutingComponentByPartNo" parameterType="RoutingHeaderEntity">
  296. delete from plm_routing_component
  297. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  298. </delete>
  299. <!-- 删除routing明细 -->
  300. <delete id="deleteRoutingDetailByPartNo" parameterType="RoutingHeaderEntity">
  301. delete from plm_routing_detail
  302. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  303. </delete>
  304. <!-- 删除routing主记录 -->
  305. <delete id="deleteRoutingHeaderByPartNo" parameterType="RoutingHeaderEntity">
  306. delete from plm_routing_header
  307. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  308. </delete>
  309. <!-- routing明细查重 -->
  310. <select id="checkRoutingComponentOnlyOne" parameterType="RoutingComponentEntity" resultType="RoutingComponentEntity">
  311. SELECT
  312. site,
  313. bu_no,
  314. part_no,
  315. routing_type,
  316. routing_revision,
  317. alternative_no,
  318. operation_id,
  319. operation_no
  320. FROM plm_routing_component
  321. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo} and operation_no = #{operationNo}
  322. </select>
  323. <!-- 修改routing子明细 -->
  324. <update id="updateRoutingComponent" parameterType="RoutingComponentEntity">
  325. update plm_routing_component
  326. set efficiency_factor = #{efficiencyFactor},
  327. mach_run_factor = #{machRunFactor},
  328. mach_setup_time = #{machSetupTime},
  329. run_time_code = #{runTimeCode},
  330. labor_run_factor = #{laborRunFactor},
  331. labor_setup_time = #{laborSetupTime},
  332. crew_size = #{crewSize,jdbcType=FLOAT},
  333. setup_crew_size = #{setupCrewSize,jdbcType=FLOAT},
  334. outside_op_item = #{outsideOpItem},
  335. machine_no = #{machineNo},
  336. work_center_no = #{workCenterNo},
  337. labor_class_no = #{laborClassNo},
  338. setup_labor_class_no = #{setupLaborClassNo},
  339. overlap = #{overlap},
  340. note_text = #{noteText},
  341. update_date = getDate(),
  342. update_by = #{updateBy},
  343. operation_no = #{operationNo},
  344. operation_name = #{operationName},
  345. mach_cycle_time = #{machCycleTime},
  346. labor_cycle_time = #{laborCycleTime}
  347. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo} and operation_id = #{operationId}
  348. </update>
  349. <!-- 判断是否已有该物料的 routing -->
  350. <select id="queryPartRouting" parameterType="RoutingAllFieldEntity" resultType="com.xujie.sys.modules.part.vo.RoutingHeaderVo">
  351. SELECT top 1
  352. site,
  353. bu_no,
  354. part_no,
  355. routing_type,
  356. routing_revision,
  357. phase_in_date,
  358. phase_out_date,
  359. note_text
  360. FROM plm_routing_header
  361. WHERE site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_type = #{routingType} order by routing_revision desc
  362. </select>
  363. <!-- 判断该 routing 是否有 Buildable Obsolete 状态的替代 -->
  364. <select id="queryAlternativeStatus" parameterType="RoutingHeaderEntity" resultType="com.xujie.sys.modules.part.vo.RoutingDetailVo">
  365. SELECT
  366. site,
  367. part_no,
  368. routing_revision,
  369. routing_type,
  370. alternative_no,
  371. status
  372. FROM plm_routing_detail
  373. WHERE site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and (status = 'Buildable' or status = 'Obsolete')
  374. </select>
  375. <!-- 判断 routing 是否存在子料 -->
  376. <select id="queryComponentPart" parameterType="RoutingHeaderEntity" resultType="com.xujie.sys.modules.part.vo.RoutingComponentVo">
  377. SELECT
  378. site,
  379. part_no,
  380. routing_revision,
  381. routing_type,
  382. alternative_no,
  383. operation_id
  384. FROM plm_routing_component
  385. WHERE site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  386. </select>
  387. <!-- 判断工序是否被引用 -->
  388. <select id="checkOperatorIsUse" parameterType="RoutingComponentEntity" resultType="com.xujie.sys.modules.part.vo.BomComponentVo">
  389. SELECT
  390. site,
  391. bu_no,
  392. part_no,
  393. eng_chg_level,
  394. bom_type,
  395. alternative_no,
  396. component_part
  397. FROM plm_bom_component
  398. WHERE site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and operation_id = #{operationId}
  399. </select>
  400. <!-- 获取routing header 对象-->
  401. <select id="queryRoutingHeader" parameterType="RoutingHeaderEntity" resultType="RoutingHeaderEntity">
  402. SELECT
  403. site,
  404. bu_no,
  405. part_no,
  406. routing_revision,
  407. routing_type,
  408. note_text,
  409. phase_in_date,
  410. phase_out_date
  411. FROM plm_routing_header
  412. WHERE site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  413. </select>
  414. <!-- 判断替代是否为正式 -->
  415. <select id="queryRoutingDetailOfficialFlag" parameterType="RoutingComponentEntity" resultType="RoutingDetailEntity">
  416. SELECT
  417. site,
  418. part_no,
  419. routing_type,
  420. routing_revision,
  421. alternative_no,
  422. alternative_description,
  423. rout_template_id,
  424. plan_date,
  425. fixed_lead_time_day,
  426. fixed_lead_time_hour,
  427. variable_lead_time_day,
  428. variable_lead_time_hour,
  429. for_std_lot_by_day,
  430. for_lot_by_day,
  431. min_lot_qty,
  432. note_text as detailNoteText,
  433. status,
  434. official_flag
  435. FROM plm_routing_detail
  436. where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo}
  437. </select>
  438. <!-- 根据替代删除RoutingTool -->
  439. <delete id="deleteRoutingToolByAlternative" parameterType="RoutingDetailEntity">
  440. delete from routing_tool
  441. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  442. </delete>
  443. <!-- 根据替代删除guideLine -->
  444. <delete id="deleteGuideLineByAlternative" parameterType="RoutingDetailEntity">
  445. delete from plm_routing_work_guide
  446. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  447. </delete>
  448. <!-- 查询最大工序号 -->
  449. <select id="queryMaxOperationNo" parameterType="RoutingDetailEntity" resultType="RoutingComponentEntity">
  450. SELECT top 1
  451. site,
  452. bu_no,
  453. part_no,
  454. routing_revision,
  455. routing_type,
  456. alternative_no,
  457. operation_no
  458. FROM plm_routing_component
  459. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  460. order by operation_no desc
  461. </select>
  462. <!-- 查routing子明细 -->
  463. <select id="queryComponent" parameterType="RoutingDetailEntity" resultType="RoutingComponentEntity">
  464. SELECT
  465. site,
  466. bu_no,
  467. part_no,
  468. routing_type,
  469. routing_revision,
  470. alternative_no,
  471. operation_id,
  472. operation_no,
  473. operation_name,
  474. efficiency_factor,
  475. mach_run_factor,
  476. mach_setup_time,
  477. run_time_code,
  478. labor_run_factor,
  479. labor_setup_time,
  480. crew_size,
  481. setup_crew_size,
  482. outside_op_item,
  483. machine_no,
  484. work_center_no,
  485. labor_class_no,
  486. setup_labor_class_no,
  487. overlap,
  488. note_text,
  489. mach_cycle_time,
  490. labor_cycle_time
  491. FROM plm_routing_component
  492. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo}
  493. </select>
  494. <!-- 修改替代状态 -->
  495. <update id="updateAlternativeStatus" parameterType="RoutingDetailEntity">
  496. update plm_routing_detail
  497. set status = #{status},
  498. update_date = getDate(),
  499. update_by = #{updateBy}
  500. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  501. </update>
  502. <!-- 校验日期是否冲突-->
  503. <select id="queryHeaderPhaseDate" parameterType="RoutingHeaderEntity" resultType="RoutingHeaderEntity">
  504. SELECT
  505. site,
  506. part_no,
  507. routing_revision,
  508. routing_type,
  509. note_text,
  510. phase_in_date,
  511. phase_out_date
  512. FROM plm_routing_header
  513. <where>
  514. site = #{site} and part_no = #{partNo} and routing_type = #{routingType}
  515. <if test = "phaseOutDate == null">
  516. and phase_in_date >= #{phaseInDate}
  517. </if>
  518. <if test = "phaseOutDate != null">
  519. and #{phaseInDate} >= phase_in_date and phase_out_date >= #{phaseOutDate}
  520. </if>
  521. </where>
  522. </select>
  523. <!-- routing主表编辑 -->
  524. <update id="updateInDate" parameterType="RoutingHeaderEntity">
  525. update plm_routing_header
  526. set phase_out_date = #{phaseOutDate},
  527. update_date = getDate(),
  528. update_by = #{createBy}
  529. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  530. </update>
  531. <select id="getStandardRoutingOperationByProductGroupId" resultType="com.xujie.sys.modules.part.vo.RoutingComponentVo">
  532. SELECT
  533. a.site,
  534. a.bu_no,
  535. b.operation_no,
  536. b.operation_name,
  537. b.work_center_no,
  538. dbo.get_workCenter_desc(a.site, a.bu_no, b.work_center_no) as workCenterDesc,
  539. b.labor_class_no,
  540. dbo.get_labor_class_desc(a.site, a.bu_no, b.labor_class_no) as laborClassDesc,
  541. b.setup_labor_class_no,
  542. dbo.get_labor_class_desc(a.site, a.bu_no, b.setup_labor_class_no) as setupLaborClassDesc,
  543. 'Units/Hour' as runTimeCode,
  544. 100 as efficiencyFactor,
  545. crew_size,
  546. setup_crew_size,
  547. 0 as machSetupTime,
  548. 0 as laborSetupTime
  549. FROM part_group_std_operations as a
  550. left join standard_routing_operation as b on a.operation_id = b.id
  551. where a.site = #{site} and a.bu_no = #{buNo} and a.product_group_id = #{productGroupId}
  552. </select>
  553. <!-- 获取的商品组的属性 -->
  554. <select id="getPtmCondition" resultType="PgPtmConditionEntity">
  555. SELECT
  556. site,
  557. bu_no,
  558. condition_id,
  559. condition_desc,
  560. seq_no,
  561. condition_desc,
  562. product_group_id
  563. FROM pg_ptm_condition
  564. where site = #{site} and bu_no = #{buNo} and product_group_id = #{productGroupId}
  565. </select>
  566. <!-- 查维护的属性集 -->
  567. <select id="getConditionItemList" resultType="PtmConditionItemEntity">
  568. SELECT
  569. id,
  570. site,
  571. bu_no,
  572. condition_id,
  573. item_no,
  574. text_value,
  575. num_value,
  576. record_type
  577. FROM ptm_condition_item
  578. where site = #{site} and bu_no = #{buNo} and condition_id = #{conditionId}
  579. </select>
  580. <select id="getConditionOperationsInfo" resultType="com.xujie.sys.modules.part.vo.RoutingComponentVo">
  581. SELECT
  582. a.site,
  583. a.bu_no,
  584. a.labor_run_factor,
  585. a.mach_run_factor,
  586. a.labor_cycle_time,
  587. a.mach_cycle_time,
  588. c.operation_no,
  589. c.operation_name
  590. FROM ptm_condition_process as a
  591. left join part_group_std_operations as b on a.part_group_std_operations_id = b.id
  592. left join standard_routing_operation as c on b.operation_id = c.id
  593. where a.condition_id = #{conditionId}
  594. </select>
  595. </mapper>