CollectMapper.xml 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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.dk.mdm.mapper.pdm.CollectMapper">
  4. <resultMap id="Result" type="com.dk.mdm.model.response.pdm.CollectCheckResponse">
  5. <result column="resultJson" property="resultJson" typeHandler="JsonTypeHandler"/>
  6. </resultMap>
  7. <!-- 验证工序的操作、生产工号-->
  8. <select id="checkUserNodeStation" resultMap="Result">
  9. select pdm.f_check_user_node_station(#{ftyId}, #{opnUserId}, #{prodUserId}, #{flowNodeId}::uuid,
  10. #{stationId}) as resultJson
  11. </select>
  12. <!-- 验证载具条码是否能在当前工序扫码-->
  13. <select id="checkCarCodeFlow" resultMap="Result">
  14. select pdm.f_check_carcode_flow(#{ftyId}, #{opnUserId}, #{prodUserId}, #{flowNodeId}::uuid, #{stationId},
  15. #{carCode}) as resultJson
  16. </select>
  17. <!-- 验证产品条码是否能在当前工序扫码-->
  18. <select id="checkBarCodeFlow" resultMap="Result">
  19. select pdm.f_check_barcode_flow(#{ftyId}, #{opnUserId}, #{prodUserId}, #{flowNodeId}::uuid, #{stationId},
  20. #{barCode}) as resultJson
  21. </select>
  22. <!-- 在装车功能(非工序)时,验证载具是否运行装车-->
  23. <select id="checkCarCodeLoad" resultMap="Result">
  24. select pdm.f_check_carcode_load(#{ftyId}, #{carCode}, #{opnUserId}) as resultJson
  25. </select>
  26. <!-- 验证载具是否可以装车-->
  27. <select id="checkBarCodeLoad" resultMap="Result">
  28. select pdm.f_check_barcode_load(#{param.ftyId}, #{param.barCode}, #{param.carrierId}, #{param.flowNodeId}::uuid,
  29. #{carLoadQty}) as resultJson
  30. </select>
  31. <!-- 工序的操作模式是卸载具、换载具时,操作完条码的计件数据后,调用函数 pdm.f_car_unload_node_all 删除载具产品-->
  32. <select id="carUnloadNodeAll" resultType="Object">
  33. select pdm.f_car_unload_node_all(#{param.ftyId}, #{param.carrierId}, #{param.opnUserId}, #{param.prodUserId},
  34. #{param.clockId}, #{opnBatch}::uuid, #{param.flowNodeId}::uuid,
  35. #{param.stationId})
  36. </select>
  37. <!-- 根据 产品型号 验证 缺陷位置 是不是能输入-->
  38. <select id="checkPlaceCode" resultMap="Result">
  39. select pdm.f_check_place_code(#{ftyId}, #{pdtModelId}, #{placeCode}) as resultJson
  40. </select>
  41. <!-- 验证缺陷编码能不能在这个检验工序 输入,会返回一个扣罚list,后续页面上要选择扣罚、扣除数用-->
  42. <select id="checkNodeDefectCode" resultMap="Result">
  43. select pdm.f_check_node_defect_code(#{ftyId}, #{nodeId}::uuid, #{defectCode}) as resultJson
  44. </select>
  45. <resultMap id="BlameResult" type="com.dk.mdm.model.response.pdm.BlameNodeResponse">
  46. <result column="nodeId" property="nodeId"/>
  47. <result column="nodeName" property="nodeName"/>
  48. <result column="userId" property="userId"/>
  49. <result column="userName" property="userName"/>
  50. <result column="jobId" property="jobId"/>
  51. <result column="jobName" property="jobName"/>
  52. <collection property="clockList" resultMap="ClockResult"/>
  53. </resultMap>
  54. <resultMap id="ClockResult" type="Map">
  55. <result column="clockJobId" property="jobId"/>
  56. <result column="clockJobName" property="jobName"/>
  57. <result column="clockStaffId" property="staffId"/>
  58. <result column="clockStaffName" property="staffName"/>
  59. </resultMap>
  60. <!-- 查询责任工序、工号、工种-->
  61. <select id="getBlameNode" resultMap="BlameResult">
  62. SELECT n.node_id as nodeId,
  63. n.node_name as nodeName,
  64. tu.user_id as userId,
  65. tu.user_name as userName,
  66. tj.job_id as jobId,
  67. tj.job_name as jobName,
  68. twci.job_id as clockJobId,
  69. tj2.job_name as clockJobName,
  70. twci.staff_id as clockStaffId,
  71. ts.staff_name as clockStaffName
  72. FROM (SELECT pp.flow_node_id, pp.prod_clock_id, pp.prod_user_id
  73. FROM pdm.t_production pp
  74. WHERE pp.flg_valid
  75. AND NOT pp.flg_undo
  76. AND pp.pdt_unique_id = #{barCodeId}
  77. ) P
  78. INNER JOIN pdm.t_process_node n ON n.node_id = P.flow_node_id
  79. left join core.t_user tu on tu.user_id = P.prod_user_id
  80. left join pdm.t_process_node_job_defect tpnjd
  81. on tpnjd.node_id = n.node_id and tpnjd.pdt_defect_id = #{pdtDefectId}
  82. left join core.t_job tj on tj.job_id = tpnjd.job_id
  83. left join pdm.t_ws_clock_item twci on twci.clock_id = P.prod_clock_id
  84. left join core.t_job tj2 on tj2.job_id = twci.job_id
  85. left join core.t_staff ts on ts.staff_id = twci.staff_id
  86. WHERE (
  87. n.cnt_job_defect = 0
  88. OR EXISTS(SELECT 1
  89. FROM pdm.t_process_node_job_defect T
  90. WHERE T.node_id = n.node_id
  91. AND T.pdt_defect_id = #{pdtDefectId})
  92. )
  93. </select>
  94. <resultMap id="PlaceResult" type="Map">
  95. <result column="data" property="data" typeHandler="JsonTypeHandler"/>
  96. </resultMap>
  97. <select id="getPdtPlaceByModel" resultMap="PlaceResult">
  98. select pdm.f_get_pdt_place_by_model(#{ftyId}, #{modelId}) as data
  99. </select>
  100. <select id="checkPdtProdUndo" resultMap="Result">
  101. select pdm.f_check_pdt_prod_undo(#{ftyId}, #{opnUserId}, #{barCode}) as resultJson
  102. </select>
  103. <select id="checkPdtScrap" resultMap="Result">
  104. select pdm.f_check_pdt_scrap(#{ftyId}, #{opnUserId}, #{barCode}) as resultJson
  105. </select>
  106. <select id="checkPdtScrapUndo" resultMap="Result">
  107. select pdm.f_check_pdt_scrap_undo(#{ftyId}, #{opnUserId}, #{barCode}) as resultJson
  108. </select>
  109. </mapper>