O
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.

644 lines
27 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
  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. dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
  10. a.part_no,
  11. dbo.qc_get_part_desc(a.site, a.bu_no, a.part_no) as partDesc,
  12. a.routing_revision,
  13. a.routing_type,
  14. a.note_text,
  15. a.phase_in_date,
  16. a.phase_out_date,
  17. a.create_date,
  18. a.create_by,
  19. a.update_date,
  20. a.update_by,
  21. b.umid2 as printUnit,
  22. dbo.qc_get_um_name(a.site, b.umid2) as printUnitName
  23. FROM plm_routing_header as a
  24. left join part as b on a.site = b.site and a.bu_no = b.sourceBu and a.part_no = b.part_no
  25. <where>
  26. a.site in (select site from eam_access_site where username = #{query.userName})
  27. and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName}))
  28. <if test="query.buNo != null and query.buNo != ''">
  29. AND a.bu_no = #{query.buNo}
  30. </if>
  31. <if test = "query.partNo != null and query.partNo != ''">
  32. AND a.part_no like '%' + #{query.partNo} + '%'
  33. </if>
  34. <if test = "query.partDesc != null and query.partDesc != ''">
  35. AND dbo.qc_get_part_desc(a.site, a.bu_no, a.part_no) like '%' + #{query.partDesc} + '%'
  36. </if>
  37. <if test = "query.routingType != null and query.routingType != ''">
  38. AND a.routing_type like '%' + #{query.routingType} + '%'
  39. </if>
  40. <if test = "query.routingRevision != null and query.routingRevision != ''">
  41. AND a.routing_revision = #{query.routingRevision}
  42. </if>
  43. </where>
  44. </select>
  45. <!-- 查询物料清单 -->
  46. <select id="queryPartList" parameterType="PartInformationEntity" resultType="RoutingAllFieldEntity">
  47. SELECT
  48. site,
  49. sourceBu as buNo,
  50. part_no,
  51. part_desc,
  52. spec,
  53. umid2 as printUnit,
  54. dbo.qc_get_um_name(site, umid2) as printUnitName,
  55. part_type2,
  56. case when part_type2 = 'Manufactured' then '成品' when part_type2 = 'Manufactured Recipe' then '半成品' when part_type2 = 'Purchased (raw)' then '原材料' end as partType2Desc
  57. FROM part
  58. <where>
  59. site = #{query.site}
  60. and sourceBu = #{query.buNo}
  61. and (part_type2 not in ('Purchased', 'Purchased (raw)') or part_type2 is null)
  62. and active = 'Y'
  63. <if test = "query.partNo != null and query.partNo != ''">
  64. AND part_no = #{query.partNo}
  65. </if>
  66. <if test = "query.partDesc != null and query.partDesc != ''">
  67. AND part_desc like '%' + #{query.partDesc} + '%'
  68. </if>
  69. </where>
  70. </select>
  71. <!-- 查出可创建Routing的物料 -->
  72. <select id="queryPartListRouting" parameterType="PartInformationEntity" resultType="RoutingAllFieldEntity">
  73. SELECT
  74. site,
  75. sourceBu as buNo,
  76. part_no,
  77. part_desc,
  78. spec,
  79. umid2 as printUnit,
  80. dbo.qc_get_um_name(site, umid2) as printUnitName,
  81. part_type2,
  82. case when part_type2 = 'Manufactured' then '成品' when part_type2 = 'Manufactured Recipe' then '半成品' when part_type2 = 'Purchased (raw)' then '原材料' end as partType2Desc
  83. FROM part
  84. <where>
  85. site = #{query.site}
  86. and sourceBu = #{query.buNo}
  87. and active = 'Y'
  88. and (part_type2 not in ('Purchased', 'Purchased (raw)') or part_type2 is null)
  89. <if test = "query.partNo != null and query.partNo != ''">
  90. AND part_no like '%' + #{query.partNo} + '%'
  91. </if>
  92. <if test = "query.partDesc != null and query.partDesc != ''">
  93. AND part_desc like '%' + #{query.partDesc} + '%'
  94. </if>
  95. </where>
  96. </select>
  97. <!-- 新增Routing主表内容 -->
  98. <insert id="saveRoutingHeader" parameterType="RoutingHeaderEntity">
  99. INSERT INTO plm_routing_header
  100. (site, bu_no, part_no, routing_revision, routing_type, note_text, phase_in_date, phase_out_date, create_date, create_by)
  101. VALUES
  102. (#{site}, #{buNo}, #{partNo}, #{routingRevision}, #{routingType}, #{noteText}, #{phaseInDate}, #{phaseOutDate}, getDate(), #{createBy})
  103. </insert>
  104. <!-- routing明细新增 -->
  105. <insert id="routingDetailSave" parameterType="RoutingDetailEntity">
  106. INSERT INTO plm_routing_detail
  107. (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)
  108. VALUES
  109. (#{site}, #{buNo}, #{partNo}, #{routingRevision}, #{routingType}, #{alternativeNo}, #{alternativeDescription}, #{fixedLeadTimeDay}, #{fixedLeadTimeHour}, #{variableLeadTimeDay}, #{variableLeadTimeHour}, #{forStdLotByDay}, #{forLotByDay}, #{minLotQty}, #{detailNoteText}, getDate(), #{createBy}, #{status})
  110. </insert>
  111. <!-- 新增Routing子明细表内容 -->
  112. <insert id="saveRoutingComponent" parameterType="RoutingComponentEntity" useGeneratedKeys="true" keyProperty="operationId">
  113. INSERT INTO plm_routing_component
  114. (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)
  115. VALUES
  116. (#{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})
  117. </insert>
  118. <!-- 查routing明细 -->
  119. <select id="queryRoutingDetail" parameterType="RoutingHeaderEntity" resultType="RoutingDetailEntity">
  120. SELECT
  121. site,
  122. bu_no,
  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. FROM plm_routing_detail
  140. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision}
  141. </select>
  142. <!-- 查routing明细对象 -->
  143. <select id="queryDetailDataByNo" parameterType="RoutingDetailEntity" resultType="RoutingDetailEntity">
  144. SELECT
  145. site,
  146. bu_no,
  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. FROM plm_routing_detail
  164. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo}
  165. </select>
  166. <!-- 查routing子明细 -->
  167. <select id="queryRoutingComponent" parameterType="RoutingDetailEntity" resultType="com.xujie.sys.modules.part.vo.RoutingComponentVo">
  168. SELECT
  169. a.site,
  170. a.bu_no,
  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.mach_cycle_time,
  202. a.labor_cycle_time
  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.bu_no = #{buNo} 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 bu_no = #{buNo} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  236. </update>
  237. <!-- 删除routing子明细 -->
  238. <delete id="deleteRoutingComponent">
  239. delete from plm_routing_component
  240. where site = #{site} and bu_no = #{buNo} 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 bu_no = #{buNo} 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.xujie.sys.modules.part.vo.RoutingHeaderVo">
  249. SELECT
  250. site,
  251. bu_no,
  252. part_no,
  253. dbo.qc_get_part_desc(site, bu_no, part_no) as partDesc,
  254. routing_type,
  255. routing_revision,
  256. phase_in_date,
  257. phase_out_date,
  258. note_text
  259. FROM plm_routing_header
  260. where site = #{site} and bu_no = #{buNo} 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. bu_no,
  267. part_no,
  268. routing_type,
  269. routing_revision,
  270. alternative_no,
  271. alternative_description,
  272. rout_template_id,
  273. plan_date,
  274. fixed_lead_time_day,
  275. fixed_lead_time_hour,
  276. variable_lead_time_day,
  277. variable_lead_time_hour,
  278. for_std_lot_by_day,
  279. for_lot_by_day,
  280. min_lot_qty,
  281. note_text as detailNoteText,
  282. status
  283. FROM plm_routing_detail
  284. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo}
  285. </select>
  286. <!-- 批量删除子明细物料 -->
  287. <delete id="deleteRoutingComponents" parameterType="RoutingComponentEntity">
  288. delete from plm_routing_component
  289. where site = #{site}
  290. and bu_no = #{buNo}
  291. and part_no = #{partNo}
  292. and routing_revision = #{routingRevision}
  293. and routing_type = #{routingType}
  294. and alternative_no = #{alternativeNo}
  295. and operation_id = #{operationId}
  296. </delete>
  297. <!-- 删除routing子明细 -->
  298. <delete id="deleteRoutingComponentByPartNo" parameterType="RoutingHeaderEntity">
  299. delete from plm_routing_component
  300. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  301. </delete>
  302. <!-- 删除routing明细 -->
  303. <delete id="deleteRoutingDetailByPartNo" parameterType="RoutingHeaderEntity">
  304. delete from plm_routing_detail
  305. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  306. </delete>
  307. <!-- 删除routing主记录 -->
  308. <delete id="deleteRoutingHeaderByPartNo" parameterType="RoutingHeaderEntity">
  309. delete from plm_routing_header
  310. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  311. </delete>
  312. <!-- routing明细查重 -->
  313. <select id="checkRoutingComponentOnlyOne" parameterType="RoutingComponentEntity" resultType="RoutingComponentEntity">
  314. SELECT
  315. site,
  316. bu_no,
  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 bu_no = #{buNo} 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,jdbcType=FLOAT},
  336. setup_crew_size = #{setupCrewSize,jdbcType=FLOAT},
  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. mach_cycle_time = #{machCycleTime},
  349. labor_cycle_time = #{laborCycleTime}
  350. 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}
  351. </update>
  352. <!-- 判断是否已有该物料的 routing -->
  353. <select id="queryPartRouting" parameterType="RoutingAllFieldEntity" resultType="com.xujie.sys.modules.part.vo.RoutingHeaderVo">
  354. SELECT top 1
  355. site,
  356. bu_no,
  357. part_no,
  358. routing_type,
  359. routing_revision,
  360. phase_in_date,
  361. phase_out_date,
  362. note_text
  363. FROM plm_routing_header
  364. WHERE site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_type = #{routingType} order by routing_revision desc
  365. </select>
  366. <!-- 判断该 routing 是否有 Buildable Obsolete 状态的替代 -->
  367. <select id="queryAlternativeStatus" parameterType="RoutingHeaderEntity" resultType="com.xujie.sys.modules.part.vo.RoutingDetailVo">
  368. SELECT
  369. site,
  370. part_no,
  371. routing_revision,
  372. routing_type,
  373. alternative_no,
  374. status
  375. FROM plm_routing_detail
  376. WHERE site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and (status = 'Buildable' or status = 'Obsolete')
  377. </select>
  378. <!-- 判断 routing 是否存在子料 -->
  379. <select id="queryComponentPart" parameterType="RoutingHeaderEntity" resultType="com.xujie.sys.modules.part.vo.RoutingComponentVo">
  380. SELECT
  381. site,
  382. part_no,
  383. routing_revision,
  384. routing_type,
  385. alternative_no,
  386. operation_id
  387. FROM plm_routing_component
  388. WHERE site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  389. </select>
  390. <!-- 判断工序是否被引用 -->
  391. <select id="checkOperatorIsUse" parameterType="RoutingComponentEntity" resultType="com.xujie.sys.modules.part.vo.BomComponentVo">
  392. SELECT
  393. site,
  394. bu_no,
  395. part_no,
  396. eng_chg_level,
  397. bom_type,
  398. alternative_no,
  399. component_part
  400. FROM plm_bom_component
  401. WHERE site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and operation_id = #{operationId}
  402. </select>
  403. <!-- 获取routing header 对象-->
  404. <select id="queryRoutingHeader" parameterType="RoutingHeaderEntity" resultType="RoutingHeaderEntity">
  405. SELECT
  406. site,
  407. bu_no,
  408. part_no,
  409. routing_revision,
  410. routing_type,
  411. note_text,
  412. phase_in_date,
  413. phase_out_date
  414. FROM plm_routing_header
  415. WHERE site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  416. </select>
  417. <!-- 判断替代是否为正式 -->
  418. <select id="queryRoutingDetailOfficialFlag" parameterType="RoutingComponentEntity" resultType="RoutingDetailEntity">
  419. SELECT
  420. site,
  421. part_no,
  422. routing_type,
  423. routing_revision,
  424. alternative_no,
  425. alternative_description,
  426. rout_template_id,
  427. plan_date,
  428. fixed_lead_time_day,
  429. fixed_lead_time_hour,
  430. variable_lead_time_day,
  431. variable_lead_time_hour,
  432. for_std_lot_by_day,
  433. for_lot_by_day,
  434. min_lot_qty,
  435. note_text as detailNoteText,
  436. status,
  437. official_flag
  438. FROM plm_routing_detail
  439. where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo}
  440. </select>
  441. <!-- 根据替代删除RoutingTool -->
  442. <delete id="deleteRoutingToolByAlternative" parameterType="RoutingDetailEntity">
  443. delete from routing_tool
  444. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  445. </delete>
  446. <!-- 根据替代删除guideLine -->
  447. <delete id="deleteGuideLineByAlternative" parameterType="RoutingDetailEntity">
  448. delete from plm_routing_work_guide
  449. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  450. </delete>
  451. <!-- 查询最大工序号 -->
  452. <select id="queryMaxOperationNo" parameterType="RoutingDetailEntity" resultType="RoutingComponentEntity">
  453. SELECT top 1
  454. site,
  455. bu_no,
  456. part_no,
  457. routing_revision,
  458. routing_type,
  459. alternative_no,
  460. operation_no
  461. FROM plm_routing_component
  462. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  463. order by operation_no desc
  464. </select>
  465. <!-- 查routing子明细 -->
  466. <select id="queryComponent" parameterType="RoutingDetailEntity" resultType="RoutingComponentEntity">
  467. SELECT
  468. site,
  469. bu_no,
  470. part_no,
  471. routing_type,
  472. routing_revision,
  473. alternative_no,
  474. operation_id,
  475. operation_no,
  476. operation_name,
  477. efficiency_factor,
  478. mach_run_factor,
  479. mach_setup_time,
  480. run_time_code,
  481. labor_run_factor,
  482. labor_setup_time,
  483. crew_size,
  484. setup_crew_size,
  485. outside_op_item,
  486. machine_no,
  487. work_center_no,
  488. labor_class_no,
  489. setup_labor_class_no,
  490. overlap,
  491. note_text,
  492. mach_cycle_time,
  493. labor_cycle_time
  494. FROM plm_routing_component
  495. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo}
  496. </select>
  497. <!-- 修改替代状态 -->
  498. <update id="updateAlternativeStatus" parameterType="RoutingDetailEntity">
  499. update plm_routing_detail
  500. set status = #{status},
  501. update_date = getDate(),
  502. update_by = #{updateBy}
  503. where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
  504. </update>
  505. <!-- 校验日期是否冲突-->
  506. <select id="queryHeaderPhaseDate" parameterType="RoutingHeaderEntity" resultType="RoutingHeaderEntity">
  507. SELECT
  508. site,
  509. bu_no,
  510. part_no,
  511. routing_revision,
  512. routing_type,
  513. note_text,
  514. phase_in_date,
  515. phase_out_date
  516. FROM plm_routing_header
  517. <where>
  518. site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_type = #{routingType}
  519. <if test = "phaseOutDate == null">
  520. and phase_in_date = #{phaseInDate}
  521. </if>
  522. <if test = "phaseOutDate != null">
  523. and #{phaseInDate} >= phase_in_date and phase_out_date >= #{phaseOutDate}
  524. </if>
  525. </where>
  526. </select>
  527. <!-- routing主表编辑 -->
  528. <update id="updateInDate" parameterType="RoutingHeaderEntity">
  529. update plm_routing_header
  530. set phase_out_date = #{phaseOutDate},
  531. update_date = getDate(),
  532. update_by = #{createBy}
  533. where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
  534. </update>
  535. <select id="getStandardRoutingOperationByProductGroupId" resultType="com.xujie.sys.modules.part.vo.RoutingComponentVo">
  536. SELECT
  537. a.site,
  538. a.bu_no,
  539. b.operation_no,
  540. b.operation_name,
  541. b.work_center_no,
  542. dbo.get_workCenter_desc(a.site, b.work_center_no) as workCenterDesc,
  543. b.labor_class_no,
  544. dbo.get_labor_class_desc(a.site, b.labor_class_no) as laborClassDesc,
  545. b.setup_labor_class_no,
  546. dbo.get_labor_class_desc(a.site, b.setup_labor_class_no) as setupLaborClassDesc,
  547. 'Units/Hour' as runTimeCode,
  548. 100 as efficiencyFactor,
  549. crew_size,
  550. setup_crew_size,
  551. 0 as machSetupTime,
  552. 0 as laborSetupTime,
  553. b.ref_daily_production,
  554. b.ref_speed,
  555. b.ref_time,
  556. b.ref_efficiency
  557. FROM part_group_std_operations as a
  558. left join standard_routing_operation as b on a.operation_id = b.id
  559. where a.site = #{site} and a.bu_no = #{buNo} and a.product_group_id = #{productGroupId}
  560. </select>
  561. <!-- 获取的商品组的属性 -->
  562. <select id="getPtmCondition" resultType="PgPtmConditionEntity">
  563. SELECT
  564. site,
  565. bu_no,
  566. condition_id,
  567. condition_desc,
  568. seq_no,
  569. condition_desc,
  570. product_group_id
  571. FROM pg_ptm_condition
  572. where site = #{site} and bu_no = #{buNo} and product_group_id = #{productGroupId}
  573. </select>
  574. <!-- 查维护的属性集 -->
  575. <select id="getConditionItemList" resultType="PtmConditionItemEntity">
  576. SELECT
  577. id,
  578. site,
  579. bu_no,
  580. condition_id,
  581. item_no,
  582. text_value,
  583. num_value,
  584. record_type
  585. FROM ptm_condition_item
  586. where site = #{site} and bu_no = #{buNo} and condition_id = #{conditionId}
  587. </select>
  588. <select id="getConditionOperationsInfo" resultType="com.xujie.sys.modules.part.vo.RoutingComponentVo">
  589. SELECT
  590. a.site,
  591. a.bu_no,
  592. a.labor_run_factor,
  593. a.mach_run_factor,
  594. a.labor_cycle_time,
  595. a.mach_cycle_time,
  596. c.operation_no,
  597. c.operation_name
  598. FROM ptm_condition_process as a
  599. left join part_group_std_operations as b on a.part_group_std_operations_id = b.id
  600. left join standard_routing_operation as c on b.operation_id = c.id
  601. where a.condition_id = #{conditionId}
  602. </select>
  603. </mapper>