ActAllocationDetailsMapper.xml 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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. </resultMap>
  28. <sql id="selectActAllocationDetailsVo">
  29. select allocation_id,
  30. order_no,
  31. line_no,
  32. material,
  33. location_id,
  34. call_transaction_id,
  35. status,
  36. lotnum,
  37. qty,
  38. pick_transaction_id,
  39. pick_to_location,
  40. pick_qty,
  41. create_by,
  42. create_time,
  43. update_by,
  44. update_time,
  45. userdefine1,
  46. userdefine2,
  47. userdefine3,
  48. userdefine4
  49. from act_allocation_details
  50. </sql>
  51. <select id="selectActAllocationDetailsList" parameterType="ActAllocationDetails"
  52. resultMap="ActAllocationDetailsResult">
  53. <include refid="selectActAllocationDetailsVo"/>
  54. <where>
  55. <if test="allocationId != null and allocationId != ''"> and allocation_id = #{allocationId}</if>
  56. <if test="orderNo != null and orderNo != ''"> and order_no like concat('%', #{orderNo}, '%')</if>
  57. <if test="material != null and material != ''"> and material = #{material}</if>
  58. <if test="status != null and status != ''"> and status = #{status}</if>
  59. <if test="params.beginTime != null and params.beginTime != ''">
  60. AND date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
  61. </if>
  62. <if test="params.endTime != null and params.endTime != ''">
  63. AND date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
  64. </if>
  65. </where>
  66. </select>
  67. <select id="selectActAllocationDetailsByAllocationId" parameterType="String" resultMap="ActAllocationDetailsResult">
  68. <include refid="selectActAllocationDetailsVo"/>
  69. where allocation_id = #{allocationId}
  70. </select>
  71. <select id="selectselectActAllocationDetailsBy" resultMap="ActAllocationDetailsResult">
  72. <include refid="selectActAllocationDetailsVo"/>
  73. where order_no = #{orderNo} and line_no = #{orderLineNo} and material = #{sku} and lotnum = #{lotnum}
  74. </select>
  75. <insert id="insertActAllocationDetails" parameterType="ActAllocationDetails">
  76. insert into act_allocation_details
  77. <trim prefix="(" suffix=")" suffixOverrides=",">
  78. <if test="allocationId != null">allocation_id,</if>
  79. <if test="orderNo != null and orderNo != ''">order_no,</if>
  80. <if test="lineNo != null">line_no,</if>
  81. <if test="material != null and material != ''">material,</if>
  82. <if test="locationId != null">location_id,</if>
  83. <if test="callTransactionId != null">call_transaction_id,</if>
  84. <if test="status != null">status,</if>
  85. <if test="lotnum != null">lotnum,</if>
  86. <if test="qty != null">qty,</if>
  87. <if test="pickTransactionId != null">pick_transaction_id,</if>
  88. <if test="pickToLocation != null">pick_to_location,</if>
  89. <if test="pickQty != null">pick_qty,</if>
  90. <if test="createBy != null">create_by,</if>
  91. <if test="createTime != null">create_time,</if>
  92. <if test="updateBy != null">update_by,</if>
  93. <if test="updateTime != null">update_time,</if>
  94. <if test="userdefine1 != null">userdefine1,</if>
  95. <if test="userdefine2 != null">userdefine2,</if>
  96. <if test="userdefine3 != null">userdefine3,</if>
  97. <if test="userdefine4 != null">userdefine4,</if>
  98. </trim>
  99. <trim prefix="values (" suffix=")" suffixOverrides=",">
  100. <if test="allocationId != null">#{allocationId},</if>
  101. <if test="orderNo != null and orderNo != ''">#{orderNo},</if>
  102. <if test="lineNo != null">#{lineNo},</if>
  103. <if test="material != null and material != ''">#{material},</if>
  104. <if test="locationId != null">#{locationId},</if>
  105. <if test="callTransactionId != null">#{callTransactionId},</if>
  106. <if test="status != null">#{status},</if>
  107. <if test="lotnum != null">#{lotnum},</if>
  108. <if test="qty != null">#{qty},</if>
  109. <if test="pickTransactionId != null">#{pickTransactionId},</if>
  110. <if test="pickToLocation != null">#{pickToLocation},</if>
  111. <if test="pickQty != null">#{pickQty},</if>
  112. <if test="createBy != null">#{createBy},</if>
  113. <if test="createTime != null">#{createTime},</if>
  114. <if test="updateBy != null">#{updateBy},</if>
  115. <if test="updateTime != null">#{updateTime},</if>
  116. <if test="userdefine1 != null">#{userdefine1},</if>
  117. <if test="userdefine2 != null">#{userdefine2},</if>
  118. <if test="userdefine3 != null">#{userdefine3},</if>
  119. <if test="userdefine4 != null">#{userdefine4},</if>
  120. </trim>
  121. </insert>
  122. <update id="updateActAllocationDetails" parameterType="ActAllocationDetails">
  123. update act_allocation_details
  124. <trim prefix="SET" suffixOverrides=",">
  125. <if test="orderNo != null and orderNo != ''">order_no = #{orderNo},</if>
  126. <if test="lineNo != null">line_no = #{lineNo},</if>
  127. <if test="material != null and material != ''">material = #{material},</if>
  128. <if test="locationId != null">location_id = #{locationId},</if>
  129. <if test="callTransactionId != null">call_transaction_id = #{callTransactionId},</if>
  130. <if test="status != null">status = #{status},</if>
  131. <if test="lotnum != null">lotnum = #{lotnum},</if>
  132. <if test="qty != null">qty = #{qty},</if>
  133. <if test="pickTransactionId != null">pick_transaction_id = #{pickTransactionId},</if>
  134. <if test="pickToLocation != null">pick_to_location = #{pickToLocation},</if>
  135. <if test="pickQty != null">pick_qty = #{pickQty},</if>
  136. <if test="createBy != null">create_by = #{createBy},</if>
  137. <if test="createTime != null">create_time = #{createTime},</if>
  138. <if test="updateBy != null">update_by = #{updateBy},</if>
  139. <if test="updateTime != null">update_time = #{updateTime},</if>
  140. <if test="userdefine1 != null">userdefine1 = #{userdefine1},</if>
  141. <if test="userdefine2 != null">userdefine2 = #{userdefine2},</if>
  142. <if test="userdefine3 != null">userdefine3 = #{userdefine3},</if>
  143. <if test="userdefine4 != null">userdefine4 = #{userdefine4},</if>
  144. </trim>
  145. where allocation_id = #{allocationId}
  146. </update>
  147. <delete id="deleteActAllocationDetailsByAllocationId" parameterType="String">
  148. delete
  149. from act_allocation_details
  150. where allocation_id = #{allocationId}
  151. </delete>
  152. <delete id="deleteActAllocationDetailsByAllocationIds" parameterType="String">
  153. delete from act_allocation_details where allocation_id in
  154. <foreach item="allocationId" collection="array" open="(" separator="," close=")">
  155. #{allocationId}
  156. </foreach>
  157. </delete>
  158. <select id="queryAllocationDetailsByPalletNo" parameterType="String" resultMap="ActAllocationDetailsResult">
  159. select al.*
  160. from act_allocation_details al
  161. where al.userdefine1 = #{palletNo}
  162. </select>
  163. <select id="queryAllocationDetailsByOrderNo" parameterType="String" resultMap="ActAllocationDetailsResult">
  164. select al.*
  165. from act_allocation_details al
  166. where al.order_no = #{orderNo}
  167. and status in (10, 20, 30, 40)
  168. </select>
  169. <update id="updateAllocationDetailsLocationIdByPalletNo">
  170. update act_allocation_details set location_id = #{locationId} where userdefine1 = #{palletNo}
  171. </update>
  172. </mapper>