ActAllocationDetailsMapper.xml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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.order.mapper.ActAllocationDetailsMapper">
  6. <resultMap type="ActAllocationDetails" id="ActAllocationDetailsResult">
  7. <result property="allocationId" column="allocation_id"/>
  8. <result property="orderNo" column="order_no"/>
  9. <result property="lineNo" column="line_no"/>
  10. <result property="material" column="material"/>
  11. <result property="locationId" column="location_id"/>
  12. <result property="callTransactionId" column="call_transaction_id"/>
  13. <result property="status" column="status"/>
  14. <result property="lotnum" column="lotnum"/>
  15. <result property="qty" column="qty"/>
  16. <result property="pickTransactionId" column="pick_transaction_id"/>
  17. <result property="pickToLocation" column="pick_to_location"/>
  18. <result property="pickQty" column="pick_qty"/>
  19. <result property="createBy" column="create_by"/>
  20. <result property="createTime" column="create_time"/>
  21. <result property="updateBy" column="update_by"/>
  22. <result property="updateTime" column="update_time"/>
  23. <result property="userdefine1" column="userdefine1"/>
  24. <result property="userdefine2" column="userdefine2"/>
  25. <result property="userdefine3" column="userdefine3"/>
  26. <result property="userdefine4" column="userdefine4"/>
  27. <result property="lotatt01" column="lotatt01"/>
  28. <result property="lotatt02" column="lotatt02"/>
  29. <result property="lotatt03" column="lotatt03"/>
  30. <result property="lotatt04" column="lotatt04"/>
  31. <result property="lotatt05" column="lotatt05"/>
  32. <result property="lotatt06" column="lotatt06"/>
  33. <result property="lotatt07" column="lotatt07"/>
  34. <result property="lotatt08" column="lotatt08"/>
  35. <result property="lotatt09" column="lotatt09"/>
  36. <result property="lotatt10" column="lotatt10"/>
  37. <result property="lotatt11" column="lotatt11"/>
  38. <result property="lotatt12" column="lotatt12"/>
  39. <result property="lotatt13" column="lotatt13"/>
  40. <result property="lotatt14" column="lotatt14"/>
  41. <result property="lotatt15" column="lotatt15"/>
  42. <result property="lotatt16" column="lotatt16"/>
  43. <result property="lotatt17" column="lotatt17"/>
  44. <result property="lotatt18" column="lotatt18"/>
  45. </resultMap>
  46. <resultMap type="com.ruoyi.ams.order.form.ActAllocationDetailsFrom" id="ActAllocationDetailsInvLotAttResult">
  47. <result property="allocationId" column="allocation_id"/>
  48. <result property="orderNo" column="order_no"/>
  49. <result property="lineNo" column="line_no"/>
  50. <result property="material" column="material"/>
  51. <result property="locationId" column="location_id"/>
  52. <result property="callTransactionId" column="call_transaction_id"/>
  53. <result property="status" column="status"/>
  54. <result property="lotnum" column="lotnum"/>
  55. <result property="qty" column="qty"/>
  56. <result property="pickTransactionId" column="pick_transaction_id"/>
  57. <result property="pickToLocation" column="pick_to_location"/>
  58. <result property="pickQty" column="pick_qty"/>
  59. <result property="createBy" column="create_by"/>
  60. <result property="createTime" column="create_time"/>
  61. <result property="updateBy" column="update_by"/>
  62. <result property="updateTime" column="update_time"/>
  63. <result property="userdefine1" column="userdefine1"/>
  64. <result property="userdefine2" column="userdefine2"/>
  65. <result property="userdefine3" column="userdefine3"/>
  66. <result property="userdefine4" column="userdefine4"/>
  67. <result property="lotatt01" column="lotatt01"/>
  68. <result property="lotatt02" column="lotatt02"/>
  69. <result property="lotatt03" column="lotatt04"/>
  70. <result property="lotatt04" column="lotatt04"/>
  71. <result property="lotatt05" column="lotatt05"/>
  72. <result property="lotatt06" column="lotatt06"/>
  73. <result property="lotatt07" column="lotatt07"/>
  74. <result property="lotatt08" column="lotatt08"/>
  75. <result property="lotatt09" column="lotatt09"/>
  76. <result property="lotatt10" column="lotatt10"/>
  77. <result property="lotatt11" column="lotatt11"/>
  78. <result property="lotatt12" column="lotatt12"/>
  79. <result property="lotatt13" column="lotatt13"/>
  80. <result property="lotatt14" column="lotatt14"/>
  81. <result property="lotatt15" column="lotatt15"/>
  82. <result property="lotatt16" column="lotatt16"/>
  83. <result property="lotatt17" column="lotatt17"/>
  84. <result property="lotatt18" column="lotatt18"/>
  85. </resultMap>
  86. <sql id="selectActAllocationDetailsVo">
  87. select allocation_id,
  88. order_no,
  89. line_no,
  90. material,
  91. location_id,
  92. call_transaction_id,
  93. status,
  94. lotnum,
  95. qty,
  96. pick_transaction_id,
  97. pick_to_location,
  98. pick_qty,
  99. create_by,
  100. create_time,
  101. update_by,
  102. update_time,
  103. userdefine1,
  104. userdefine2,
  105. userdefine3,
  106. userdefine4
  107. from act_allocation_details
  108. </sql>
  109. <select id="selectActAllocationDetailsList" parameterType="ActAllocationDetails" resultMap="ActAllocationDetailsResult">
  110. select t1.*
  111. ,t2.lotatt01,t2.lotatt02,t2.lotatt03,t2.lotatt04,t2.lotatt05,t2.lotatt06
  112. ,t2.lotatt07,t2.lotatt08,t2.lotatt09,t2.lotatt10,t2.lotatt11,t2.lotatt12
  113. ,t2.lotatt13,t2.lotatt14,t2.lotatt15,t2.lotatt16,t2.lotatt17,t2.lotatt18
  114. from act_allocation_details t1
  115. LEFT JOIN inv_lot_att t2 on t2.lotnum = t1.lotnum
  116. <where>
  117. <if test="allocationId != null and allocationId != ''"> and allocation_id = #{allocationId}</if>
  118. <if test="orderNo != null and orderNo != ''"> and order_no like concat('%', #{orderNo}, '%')</if>
  119. <if test="material != null and material != ''"> and material = #{material}</if>
  120. <if test="status != null and status != ''"> and status = #{status}</if>
  121. <if test="params.beginTime != null and params.beginTime != ''">
  122. AND date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
  123. </if>
  124. <if test="params.endTime != null and params.endTime != ''">
  125. AND date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
  126. </if>
  127. </where>
  128. </select>
  129. <select id="selectActAllocationDetailsInvLotAttList" parameterType="object" resultMap="ActAllocationDetailsInvLotAttResult">
  130. select t1.*
  131. ,t2.lotatt01,t2.lotatt02,t2.lotatt03,t2.lotatt04,t2.lotatt05,t2.lotatt06
  132. ,t2.lotatt07,t2.lotatt08,t2.lotatt09,t2.lotatt10,t2.lotatt11,t2.lotatt12
  133. ,t2.lotatt13,t2.lotatt14,t2.lotatt15,t2.lotatt16,t2.lotatt17,t2.lotatt18
  134. from act_allocation_details t1
  135. left join inv_lot_att t2 ON t2.lotnum = t1.lotnum
  136. <where>
  137. <if test="allocationId != null and allocationId != ''"> and allocation_id = #{allocationId}</if>
  138. <if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
  139. <if test="material != null and material != ''"> and material = #{material}</if>
  140. <if test="lotnum != null and lotnum != ''"> and lotnum = #{lotnum}</if>
  141. <if test="userdefine1 != null and userdefine1 != ''"> and userdefine1 = #{userdefine1}</if>
  142. <if test="status != null and status != ''"> and status = #{status}</if>
  143. <if test="lotatt01 != null and lotatt01 != ''"> and lotatt01 = #{lotatt01}</if>
  144. <if test="lotatt02 != null and lotatt02 != ''"> and lotatt02 = #{lotatt02}</if>
  145. </where>
  146. </select>
  147. <select id="selectActAllocationDetailsByAllocationId" parameterType="String" resultMap="ActAllocationDetailsResult">
  148. <include refid="selectActAllocationDetailsVo"/>
  149. where allocation_id = #{allocationId}
  150. </select>
  151. <select id="selectselectActAllocationDetailsBy" resultMap="ActAllocationDetailsResult">
  152. <include refid="selectActAllocationDetailsVo"/>
  153. where order_no = #{orderNo} and line_no = #{orderLineNo} and material = #{sku} and lotnum = #{lotnum}
  154. </select>
  155. <insert id="insertActAllocationDetails" parameterType="ActAllocationDetails">
  156. insert into act_allocation_details
  157. <trim prefix="(" suffix=")" suffixOverrides=",">
  158. <if test="allocationId != null">allocation_id,</if>
  159. <if test="orderNo != null and orderNo != ''">order_no,</if>
  160. <if test="lineNo != null">line_no,</if>
  161. <if test="material != null and material != ''">material,</if>
  162. <if test="locationId != null">location_id,</if>
  163. <if test="callTransactionId != null">call_transaction_id,</if>
  164. <if test="status != null">status,</if>
  165. <if test="lotnum != null">lotnum,</if>
  166. <if test="qty != null">qty,</if>
  167. <if test="pickTransactionId != null">pick_transaction_id,</if>
  168. <if test="pickToLocation != null">pick_to_location,</if>
  169. <if test="pickQty != null">pick_qty,</if>
  170. <if test="createBy != null">create_by,</if>
  171. <if test="createTime != null">create_time,</if>
  172. <if test="updateBy != null">update_by,</if>
  173. <if test="updateTime != null">update_time,</if>
  174. <if test="userdefine1 != null">userdefine1,</if>
  175. <if test="userdefine2 != null">userdefine2,</if>
  176. <if test="userdefine3 != null">userdefine3,</if>
  177. <if test="userdefine4 != null">userdefine4,</if>
  178. </trim>
  179. <trim prefix="values (" suffix=")" suffixOverrides=",">
  180. <if test="allocationId != null">#{allocationId},</if>
  181. <if test="orderNo != null and orderNo != ''">#{orderNo},</if>
  182. <if test="lineNo != null">#{lineNo},</if>
  183. <if test="material != null and material != ''">#{material},</if>
  184. <if test="locationId != null">#{locationId},</if>
  185. <if test="callTransactionId != null">#{callTransactionId},</if>
  186. <if test="status != null">#{status},</if>
  187. <if test="lotnum != null">#{lotnum},</if>
  188. <if test="qty != null">#{qty},</if>
  189. <if test="pickTransactionId != null">#{pickTransactionId},</if>
  190. <if test="pickToLocation != null">#{pickToLocation},</if>
  191. <if test="pickQty != null">#{pickQty},</if>
  192. <if test="createBy != null">#{createBy},</if>
  193. <if test="createTime != null">#{createTime},</if>
  194. <if test="updateBy != null">#{updateBy},</if>
  195. <if test="updateTime != null">#{updateTime},</if>
  196. <if test="userdefine1 != null">#{userdefine1},</if>
  197. <if test="userdefine2 != null">#{userdefine2},</if>
  198. <if test="userdefine3 != null">#{userdefine3},</if>
  199. <if test="userdefine4 != null">#{userdefine4},</if>
  200. </trim>
  201. </insert>
  202. <update id="updateActAllocationDetails" parameterType="ActAllocationDetails">
  203. update act_allocation_details
  204. <trim prefix="SET" suffixOverrides=",">
  205. <if test="orderNo != null and orderNo != ''">order_no = #{orderNo},</if>
  206. <if test="lineNo != null">line_no = #{lineNo},</if>
  207. <if test="material != null and material != ''">material = #{material},</if>
  208. <if test="locationId != null">location_id = #{locationId},</if>
  209. <if test="callTransactionId != null">call_transaction_id = #{callTransactionId},</if>
  210. <if test="status != null">status = #{status},</if>
  211. <if test="lotnum != null">lotnum = #{lotnum},</if>
  212. <if test="qty != null">qty = #{qty},</if>
  213. <if test="pickTransactionId != null">pick_transaction_id = #{pickTransactionId},</if>
  214. <if test="pickToLocation != null">pick_to_location = #{pickToLocation},</if>
  215. <if test="pickQty != null">pick_qty = #{pickQty},</if>
  216. <if test="createBy != null">create_by = #{createBy},</if>
  217. <if test="createTime != null">create_time = #{createTime},</if>
  218. <if test="updateBy != null">update_by = #{updateBy},</if>
  219. <if test="updateTime != null">update_time = #{updateTime},</if>
  220. <if test="userdefine1 != null">userdefine1 = #{userdefine1},</if>
  221. <if test="userdefine2 != null">userdefine2 = #{userdefine2},</if>
  222. <if test="userdefine3 != null">userdefine3 = #{userdefine3},</if>
  223. <if test="userdefine4 != null">userdefine4 = #{userdefine4},</if>
  224. </trim>
  225. where allocation_id = #{allocationId}
  226. </update>
  227. <delete id="deleteActAllocationDetailsByAllocationId" parameterType="String">
  228. delete
  229. from act_allocation_details
  230. where allocation_id = #{allocationId}
  231. </delete>
  232. <delete id="deleteActAllocationDetailsByAllocationIds" parameterType="String">
  233. delete from act_allocation_details where allocation_id in
  234. <foreach item="allocationId" collection="array" open="(" separator="," close=")">
  235. #{allocationId}
  236. </foreach>
  237. </delete>
  238. <select id="queryAllocationDetailsByPalletNo" parameterType="String" resultMap="ActAllocationDetailsResult">
  239. select al.*
  240. from act_allocation_details al
  241. where al.userdefine1 = #{palletNo}
  242. </select>
  243. <select id="queryAllocationDetailsToPickByPalletNo" parameterType="String" resultMap="ActAllocationDetailsResult">
  244. select al.*
  245. from act_allocation_details al
  246. where al.userdefine1 = #{palletNo} and status = '20'
  247. </select>
  248. <select id="queryAllocationDetailsByOrderNo" parameterType="String" resultMap="ActAllocationDetailsResult">
  249. select al.*
  250. from act_allocation_details al
  251. where al.order_no = #{orderNo}
  252. and status in (10, 20, 30, 40)
  253. </select>
  254. <update id="updateAllocationDetailsLocationIdByPalletNo">
  255. update act_allocation_details set location_id = #{locationId} where userdefine1 = #{palletNo}
  256. </update>
  257. </mapper>