WcsTaskMapper.xml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.ams.task.mapper.WcsTaskMapper">
  6. <resultMap type="WcsTask" id="WcsTaskResult">
  7. <result property="taskNo" column="task_no" />
  8. <result property="businessType" column="business_type" />
  9. <result property="whTypeFrom" column="wh_type_from" />
  10. <result property="whNoFrom" column="wh_no_from" />
  11. <result property="whTypeTo" column="wh_type_to" />
  12. <result property="whNoTo" column="wh_no_to" />
  13. <result property="sysName" column="sys_name" />
  14. <result property="deviceName" column="device_name" />
  15. <result property="batchNo" column="batch_no" />
  16. <result property="batchOrderNo" column="batch_order_no" />
  17. <result property="locationFrom" column="location_from" />
  18. <result property="areaFrom" column="area_from" />
  19. <result property="locationTo" column="location_to" />
  20. <result property="areaTo" column="area_to" />
  21. <result property="priority" column="priority" />
  22. <result property="state" column="state" />
  23. <result property="remark" column="remark" />
  24. <result property="createUser" column="create_user" />
  25. <result property="createDate" column="create_date" />
  26. <result property="updateUser" column="update_user" />
  27. <result property="updateDate" column="update_date" />
  28. <result property="taskType" column="task_type" />
  29. <result property="shopId" column="shop_id" />
  30. <result property="startTime" column="start_time" />
  31. <result property="endTime" column="end_time" />
  32. <result property="parentTask" column="parent_task" />
  33. <result property="extParam" column="ext_param" />
  34. <result property="ext1" column="ext1" />
  35. <result property="ext2" column="ext2" />
  36. <result property="ext3" column="ext3" />
  37. <result property="ext4" column="ext4" />
  38. <result property="ext5" column="ext5" />
  39. <result property="ext6" column="ext6" />
  40. <result property="ext7" column="ext7" />
  41. <result property="ext8" column="ext8" />
  42. <result property="agvNo" column="agv_no" />
  43. <result property="beforeTask" column="before_task" />
  44. </resultMap>
  45. <resultMap type="com.ruoyi.ams.task.dto.WcsTaskLocationDTO" id="WcsTaskDTOResult">
  46. <result property="taskNo" column="task_no" />
  47. <result property="businessType" column="business_type" />
  48. <result property="whTypeFrom" column="wh_type_from" />
  49. <result property="whNoFrom" column="wh_no_from" />
  50. <result property="whTypeTo" column="wh_type_to" />
  51. <result property="whNoTo" column="wh_no_to" />
  52. <result property="sysName" column="sys_name" />
  53. <result property="deviceName" column="device_name" />
  54. <result property="batchNo" column="batch_no" />
  55. <result property="batchOrderNo" column="batch_order_no" />
  56. <result property="locationFrom" column="location_from" />
  57. <result property="areaFrom" column="area_from" />
  58. <result property="locationTo" column="location_to" />
  59. <result property="areaTo" column="area_to" />
  60. <result property="priority" column="priority" />
  61. <result property="state" column="state" />
  62. <result property="remark" column="remark" />
  63. <result property="createUser" column="create_user" />
  64. <result property="createDate" column="create_date" />
  65. <result property="updateUser" column="update_user" />
  66. <result property="updateDate" column="update_date" />
  67. <result property="taskType" column="task_type" />
  68. <result property="shopId" column="shop_id" />
  69. <result property="startTime" column="start_time" />
  70. <result property="endTime" column="end_time" />
  71. <result property="parentTask" column="parent_task" />
  72. <result property="extParam" column="ext_param" />
  73. <result property="ext1" column="ext1" />
  74. <result property="ext2" column="ext2" />
  75. <result property="ext3" column="ext3" />
  76. <result property="ext4" column="ext4" />
  77. <result property="ext5" column="ext5" />
  78. <result property="ext6" column="ext6" />
  79. <result property="ext7" column="ext7" />
  80. <result property="ext8" column="ext8" />
  81. <result property="agvNo" column="agv_no" />
  82. <result property="colNo" column="col_no" />
  83. <result property="colIndex" column="col_index" />
  84. </resultMap>
  85. <sql id="selectWcsTaskVo">
  86. select task_no, business_type, wh_type_from, wh_no_from, wh_type_to, wh_no_to, sys_name, device_name, batch_no, batch_order_no, location_from, area_from, location_to, area_to, priority, state, remark, create_user, create_date, update_user, update_date, task_type, shop_id, start_time, end_time, parent_task, ext_param, ext1, ext2, ext3, ext4, ext5, ext6, ext7, ext8, agv_no, before_task from wcs_task
  87. </sql>
  88. <select id="selectWcsTaskList" parameterType="WcsTask" resultMap="WcsTaskResult">
  89. <include refid="selectWcsTaskVo"/>
  90. <where>
  91. <if test="locationFrom != null and locationFrom != ''"> and location_from = #{locationFrom}</if>
  92. <if test="areaFrom != null and areaFrom != ''"> and area_from = #{areaFrom}</if>
  93. <if test="locationTo != null and locationTo != ''"> and location_to = #{locationTo}</if>
  94. <if test="areaTo != null and areaTo != ''"> and area_to = #{areaTo}</if>
  95. <if test="priority != null "> and priority = #{priority}</if>
  96. <if test="state != null "> and state = #{state}</if>
  97. <if test="createUser != null and createUser != ''"> and create_user = #{createUser}</if>
  98. <if test="createDate != null "> and create_date = #{createDate}</if>
  99. <if test="taskType != null and taskType != ''"> and task_type = #{taskType}</if>
  100. <if test="shopId != null and shopId != ''"> and shop_id = #{shopId}</if>
  101. <if test="startTime != null "> and start_time = #{startTime}</if>
  102. <if test="endTime != null "> and end_time = #{endTime}</if>
  103. <if test="parentTask != null and parentTask != ''"> and parent_task = #{parentTask}</if>
  104. <if test="agvNo != null and agvNo != ''"> and agv_no like concat('%', #{agvNo}, '%')</if>
  105. </where>
  106. </select>
  107. <select id="selectWcsTaskListVO" parameterType="WcsTask" resultMap="WcsTaskResult">
  108. select t.task_no, t.business_type,bf.location_no location_from,fz.zone_name area_from,bt.location_no location_to,tz.zone_name area_to,
  109. t.state,t.create_date,t.task_type, t.start_time, t.end_time,t.remark, t.device_name, t.agv_no
  110. from wcs_task t
  111. left join base_location_info bf on t.location_from = bf.id
  112. left join base_location_info bt on t.location_to = bt.id
  113. left join base_location_zone fz on t.area_from = fz.zone_id
  114. left join base_location_zone tz on t.area_to = tz.zone_id
  115. <where>
  116. <if test="locationFrom != null and locationFrom != ''"> and bf.location_no like concat('%', #{locationFrom}, '%') </if>
  117. <if test="taskNo != null and taskNo != ''"> and t.task_no like concat('%', #{taskNo}, '%') </if>
  118. <if test="areaFrom != null and areaFrom != ''"> and t.area_from = #{areaFrom}</if>
  119. <if test="locationTo != null and locationTo != ''"> and bt.location_no like concat('%', #{locationTo}, '%')</if>
  120. <if test="areaTo != null and areaTo != ''"> and t.area_to = #{areaTo}</if>
  121. <if test="priority != null "> and t.priority = #{priority}</if>
  122. <if test="state != null "> and t.state = #{state}</if>
  123. <if test="createUser != null and createUser != ''"> and t.create_user = #{createUser}</if>
  124. <!-- <if test="createDate != null "> and t.create_date = #{createDate}</if>-->
  125. <if test="taskType != null and taskType != ''"> and t.task_type = #{taskType}</if>
  126. <if test="shopId != null and shopId != ''"> and t.shop_id = #{shopId}</if>
  127. <!-- <if test="startTime != null "> and t.start_time = #{startTime}</if>-->
  128. <!-- <if test="endTime != null "> and t.end_time = #{endTime}</if>-->
  129. <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
  130. AND date_format(t.create_date,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
  131. </if>
  132. <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
  133. AND date_format(t.create_date,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
  134. </if>
  135. <if test="parentTask != null and parentTask != ''"> and t.parent_task = #{parentTask}</if>
  136. <if test="agvNo != null and agvNo != ''"> and t.agv_no like concat('%', #{agvNo}, '%')</if>
  137. </where>
  138. order by t.create_date desc
  139. </select>
  140. <select id="selectWcsTaskByTaskNo" parameterType="String" resultMap="WcsTaskResult">
  141. <include refid="selectWcsTaskVo"/>
  142. where task_no = #{taskNo}
  143. </select>
  144. <select id="selectWcsTaskByTsIndex" parameterType="String" resultMap="WcsTaskResult">
  145. <include refid="selectWcsTaskVo"/>
  146. where device_name = #{tsIndex} or task_no = #{tsIndex}
  147. ORDER BY create_date DESC
  148. LIMIT 1
  149. </select>
  150. <select id="selectWcsTaskByAgvNo" parameterType="String" resultMap="WcsTaskResult">
  151. <include refid="selectWcsTaskVo"/>
  152. where agv_no = #{tsIndex} and state in(1,3,4,5,6,9,10)
  153. ORDER BY create_date DESC
  154. LIMIT 1
  155. </select>
  156. <insert id="insertWcsTask" parameterType="WcsTask">
  157. insert into wcs_task
  158. <trim prefix="(" suffix=")" suffixOverrides=",">
  159. <if test="taskNo != null">task_no,</if>
  160. <if test="businessType != null">business_type,</if>
  161. <if test="whTypeFrom != null">wh_type_from,</if>
  162. <if test="whNoFrom != null">wh_no_from,</if>
  163. <if test="whTypeTo != null">wh_type_to,</if>
  164. <if test="whNoTo != null">wh_no_to,</if>
  165. <if test="sysName != null">sys_name,</if>
  166. <if test="deviceName != null">device_name,</if>
  167. <if test="batchNo != null">batch_no,</if>
  168. <if test="batchOrderNo != null">batch_order_no,</if>
  169. <if test="locationFrom != null">location_from,</if>
  170. <if test="areaFrom != null">area_from,</if>
  171. <if test="locationTo != null">location_to,</if>
  172. <if test="areaTo != null">area_to,</if>
  173. <if test="priority != null">priority,</if>
  174. <if test="state != null">state,</if>
  175. <if test="remark != null">remark,</if>
  176. <if test="createUser != null">create_user,</if>
  177. <if test="createDate != null">create_date,</if>
  178. <if test="updateUser != null">update_user,</if>
  179. <if test="updateDate != null">update_date,</if>
  180. <if test="taskType != null">task_type,</if>
  181. <if test="shopId != null">shop_id,</if>
  182. <if test="startTime != null">start_time,</if>
  183. <if test="endTime != null">end_time,</if>
  184. <if test="parentTask != null">parent_task,</if>
  185. <if test="extParam != null">ext_param,</if>
  186. <if test="ext1 != null">ext1,</if>
  187. <if test="ext2 != null">ext2,</if>
  188. <if test="ext3 != null">ext3,</if>
  189. <if test="ext4 != null">ext4,</if>
  190. <if test="ext5 != null">ext5,</if>
  191. <if test="ext6 != null">ext6,</if>
  192. <if test="ext7 != null">ext7,</if>
  193. <if test="ext8 != null">ext8,</if>
  194. <if test="agvNo != null">agv_no,</if>
  195. <if test="beforeTask != null">before_task,</if>
  196. </trim>
  197. <trim prefix="values (" suffix=")" suffixOverrides=",">
  198. <if test="taskNo != null">#{taskNo},</if>
  199. <if test="businessType != null">#{businessType},</if>
  200. <if test="whTypeFrom != null">#{whTypeFrom},</if>
  201. <if test="whNoFrom != null">#{whNoFrom},</if>
  202. <if test="whTypeTo != null">#{whTypeTo},</if>
  203. <if test="whNoTo != null">#{whNoTo},</if>
  204. <if test="sysName != null">#{sysName},</if>
  205. <if test="deviceName != null">#{deviceName},</if>
  206. <if test="batchNo != null">#{batchNo},</if>
  207. <if test="batchOrderNo != null">#{batchOrderNo},</if>
  208. <if test="locationFrom != null">#{locationFrom},</if>
  209. <if test="areaFrom != null">#{areaFrom},</if>
  210. <if test="locationTo != null">#{locationTo},</if>
  211. <if test="areaTo != null">#{areaTo},</if>
  212. <if test="priority != null">#{priority},</if>
  213. <if test="state != null">#{state},</if>
  214. <if test="remark != null">#{remark},</if>
  215. <if test="createUser != null">#{createUser},</if>
  216. <if test="createDate != null">#{createDate},</if>
  217. <if test="updateUser != null">#{updateUser},</if>
  218. <if test="updateDate != null">#{updateDate},</if>
  219. <if test="taskType != null">#{taskType},</if>
  220. <if test="shopId != null">#{shopId},</if>
  221. <if test="startTime != null">#{startTime},</if>
  222. <if test="endTime != null">#{endTime},</if>
  223. <if test="parentTask != null">#{parentTask},</if>
  224. <if test="extParam != null">#{extParam},</if>
  225. <if test="ext1 != null">#{ext1},</if>
  226. <if test="ext2 != null">#{ext2},</if>
  227. <if test="ext3 != null">#{ext3},</if>
  228. <if test="ext4 != null">#{ext4},</if>
  229. <if test="ext5 != null">#{ext5},</if>
  230. <if test="ext6 != null">#{ext6},</if>
  231. <if test="ext7 != null">#{ext7},</if>
  232. <if test="ext8 != null">#{ext8},</if>
  233. <if test="agvNo != null">#{agvNo},</if>
  234. <if test="beforeTask != null">#{beforeTask},</if>
  235. </trim>
  236. </insert>
  237. <update id="updateWcsTask" parameterType="WcsTask">
  238. update wcs_task
  239. <trim prefix="SET" suffixOverrides=",">
  240. <if test="businessType != null">business_type = #{businessType},</if>
  241. <if test="whTypeFrom != null">wh_type_from = #{whTypeFrom},</if>
  242. <if test="whNoFrom != null">wh_no_from = #{whNoFrom},</if>
  243. <if test="whTypeTo != null">wh_type_to = #{whTypeTo},</if>
  244. <if test="whNoTo != null">wh_no_to = #{whNoTo},</if>
  245. <if test="sysName != null">sys_name = #{sysName},</if>
  246. <if test="deviceName != null">device_name = #{deviceName},</if>
  247. <if test="batchNo != null">batch_no = #{batchNo},</if>
  248. <if test="batchOrderNo != null">batch_order_no = #{batchOrderNo},</if>
  249. <if test="locationFrom != null">location_from = #{locationFrom},</if>
  250. <if test="areaFrom != null">area_from = #{areaFrom},</if>
  251. <if test="locationTo != null">location_to = #{locationTo},</if>
  252. <if test="areaTo != null">area_to = #{areaTo},</if>
  253. <if test="priority != null">priority = #{priority},</if>
  254. <if test="state != null">state = #{state},</if>
  255. <if test="remark != null">remark = #{remark},</if>
  256. <if test="createUser != null">create_user = #{createUser},</if>
  257. <if test="createDate != null">create_date = #{createDate},</if>
  258. <if test="updateUser != null">update_user = #{updateUser},</if>
  259. <if test="updateDate != null">update_date = #{updateDate},</if>
  260. <if test="taskType != null">task_type = #{taskType},</if>
  261. <if test="shopId != null">shop_id = #{shopId},</if>
  262. <if test="startTime != null">start_time = #{startTime},</if>
  263. <if test="endTime != null">end_time = #{endTime},</if>
  264. <if test="parentTask != null">parent_task = #{parentTask},</if>
  265. <if test="extParam != null">ext_param = #{extParam},</if>
  266. <if test="ext1 != null">ext1 = #{ext1},</if>
  267. <if test="ext2 != null">ext2 = #{ext2},</if>
  268. <if test="ext3 != null">ext3 = #{ext3},</if>
  269. <if test="ext4 != null">ext4 = #{ext4},</if>
  270. <if test="ext5 != null">ext5 = #{ext5},</if>
  271. <if test="ext6 != null">ext6 = #{ext6},</if>
  272. <if test="ext7 != null">ext7 = #{ext7},</if>
  273. <if test="ext8 != null">ext8 = #{ext8},</if>
  274. <if test="agvNo != null">agv_no = #{agvNo},</if>
  275. <if test="beforeTask != null">before_task = #{beforeTask},</if>
  276. </trim>
  277. where task_no = #{taskNo}
  278. </update>
  279. <delete id="deleteWcsTaskByTaskNo" parameterType="String">
  280. delete from wcs_task where task_no = #{taskNo}
  281. </delete>
  282. <delete id="deleteWcsTaskByTaskNos" parameterType="String">
  283. delete from wcs_task where task_no in
  284. <foreach item="taskNo" collection="array" open="(" separator="," close=")">
  285. #{taskNo}
  286. </foreach>
  287. </delete>
  288. <select id="selectCurrentPriority" resultType="java.lang.Integer">
  289. select IFNULL(min(priority),0) priority from wcs_task where state = 9
  290. </select>
  291. <select id="selectWcsUnallocated" resultMap="WcsTaskResult" parameterType="Long">
  292. select *
  293. from wcs_task
  294. where state = 9
  295. order by priority desc,create_date
  296. </select>
  297. <select id="selectTaskByColNo" resultMap="WcsTaskDTOResult">
  298. select w.*,i.col_no,i.col_index from wcs_task w left join base_location_info i on w.location_to = i.id
  299. where w.state = 9
  300. <if test="colNo != null and colNo != ''">
  301. and i.col_no = #{colNo}
  302. </if>
  303. <if test="colIndex != null and colIndex != ''">
  304. and i.col_index <![CDATA[ < ]]> #{colIndex}
  305. </if>
  306. <if test=" warehouseId!= null and warehouseId != ''">
  307. and w.shop_id = #{warehouseId}
  308. </if>
  309. <if test="zoneId != null and zoneId != ''">
  310. and i.zone_id = #{zoneId}
  311. </if>
  312. and w.location_to is not null
  313. order by priority
  314. </select>
  315. <select id="selectTaskByColNoAfter" resultMap="WcsTaskDTOResult">
  316. select w.*,i.col_no,i.col_index from wcs_task w left join base_location_info i on w.location_to = i.id
  317. where w.state = 9
  318. <if test="colNo != null and colNo != ''">
  319. and i.col_no = #{colNo}
  320. </if>
  321. <if test="colIndex != null and colIndex != ''">
  322. and i.col_index <![CDATA[ > ]]> #{colIndex}
  323. </if>
  324. <if test=" warehouseId!= null and warehouseId != ''">
  325. and w.shop_id = #{warehouseId}
  326. </if>
  327. <if test="zoneId != null and zoneId != ''">
  328. and i.zone_id = #{zoneId}
  329. </if>
  330. and w.location_to is not null
  331. order by priority
  332. </select>
  333. <select id="selectBeforeTask" resultMap="WcsTaskResult">
  334. select * from wcs_task
  335. where task_no = #{taskNo} and state not in (2,7,4,11,12)
  336. </select>
  337. <select id="getTasking" parameterType="WcsTask" resultMap="WcsTaskResult">
  338. <include refid="selectWcsTaskVo"/>
  339. <where>
  340. <if test="locationFrom != null and locationFrom != ''"> and location_from = #{locationFrom}</if>
  341. <if test="areaFrom != null and areaFrom != ''"> and area_from = #{areaFrom}</if>
  342. <if test="locationTo != null and locationTo != ''"> and location_to = #{locationTo}</if>
  343. <if test="areaTo != null and areaTo != ''"> and area_to = #{areaTo}</if>
  344. <if test="priority != null "> and priority = #{priority}</if>
  345. <if test="createUser != null and createUser != ''"> and create_user = #{createUser}</if>
  346. <if test="createDate != null "> and create_date = #{createDate}</if>
  347. <if test="taskType != null and taskType != ''"> and task_type = #{taskType}</if>
  348. <if test="shopId != null and shopId != ''"> and shop_id = #{shopId}</if>
  349. <if test="startTime != null "> and start_time = #{startTime}</if>
  350. <if test="endTime != null "> and end_time = #{endTime}</if>
  351. <if test="parentTask != null and parentTask != ''"> and parent_task = #{parentTask}</if>
  352. <if test="agvNo != null and agvNo != ''"> and agv_no like concat('%', #{agvNo}, '%')</if>
  353. </where>
  354. and state in(1,3,4,5,6,8,9,10)
  355. </select>
  356. </mapper>