ActAllocationDetailsMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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. <sql id="selectActAllocationDetailsVo">
  47. select allocation_id,
  48. order_no,
  49. line_no,
  50. material,
  51. location_id,
  52. call_transaction_id,
  53. status,
  54. lotnum,
  55. qty,
  56. pick_transaction_id,
  57. pick_to_location,
  58. pick_qty,
  59. create_by,
  60. create_time,
  61. update_by,
  62. update_time,
  63. userdefine1,
  64. userdefine2,
  65. userdefine3,
  66. userdefine4
  67. from act_allocation_details
  68. </sql>
  69. <select id="selectActAllocationDetailsList" parameterType="ActAllocationDetails" resultMap="ActAllocationDetailsResult">
  70. select t1.*
  71. ,t2.lotatt01,t2.lotatt02,t2.lotatt03,t2.lotatt04,t2.lotatt05,t2.lotatt06
  72. ,t2.lotatt07,t2.lotatt08,t2.lotatt09,t2.lotatt10,t2.lotatt11,t2.lotatt12
  73. ,t2.lotatt13,t2.lotatt14,t2.lotatt15,t2.lotatt16,t2.lotatt17,t2.lotatt18
  74. from act_allocation_details t1
  75. LEFT JOIN inv_lot_att t2 on t2.lotnum = t1.lotnum
  76. <where>
  77. <if test="allocationId != null and allocationId != ''"> and allocation_id = #{allocationId}</if>
  78. <if test="orderNo != null and orderNo != ''"> and order_no like concat('%', #{orderNo}, '%')</if>
  79. <if test="material != null and material != ''"> and material = #{material}</if>
  80. <if test="status != null and status != ''"> and status = #{status}</if>
  81. <if test="params.beginTime != null and params.beginTime != ''">
  82. AND date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
  83. </if>
  84. <if test="params.endTime != null and params.endTime != ''">
  85. AND date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
  86. </if>
  87. </where>
  88. </select>
  89. <select id="selectActAllocationDetailsByAllocationId" parameterType="String" resultMap="ActAllocationDetailsResult">
  90. <include refid="selectActAllocationDetailsVo"/>
  91. where allocation_id = #{allocationId}
  92. </select>
  93. <select id="selectselectActAllocationDetailsBy" resultMap="ActAllocationDetailsResult">
  94. <include refid="selectActAllocationDetailsVo"/>
  95. where order_no = #{orderNo} and line_no = #{orderLineNo} and material = #{sku} and lotnum = #{lotnum}
  96. </select>
  97. <insert id="insertActAllocationDetails" parameterType="ActAllocationDetails">
  98. insert into act_allocation_details
  99. <trim prefix="(" suffix=")" suffixOverrides=",">
  100. <if test="allocationId != null">allocation_id,</if>
  101. <if test="orderNo != null and orderNo != ''">order_no,</if>
  102. <if test="lineNo != null">line_no,</if>
  103. <if test="material != null and material != ''">material,</if>
  104. <if test="locationId != null">location_id,</if>
  105. <if test="callTransactionId != null">call_transaction_id,</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">pick_transaction_id,</if>
  110. <if test="pickToLocation != null">pick_to_location,</if>
  111. <if test="pickQty != null">pick_qty,</if>
  112. <if test="createBy != null">create_by,</if>
  113. <if test="createTime != null">create_time,</if>
  114. <if test="updateBy != null">update_by,</if>
  115. <if test="updateTime != null">update_time,</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. <trim prefix="values (" suffix=")" suffixOverrides=",">
  122. <if test="allocationId != null">#{allocationId},</if>
  123. <if test="orderNo != null and orderNo != ''">#{orderNo},</if>
  124. <if test="lineNo != null">#{lineNo},</if>
  125. <if test="material != null and material != ''">#{material},</if>
  126. <if test="locationId != null">#{locationId},</if>
  127. <if test="callTransactionId != null">#{callTransactionId},</if>
  128. <if test="status != null">#{status},</if>
  129. <if test="lotnum != null">#{lotnum},</if>
  130. <if test="qty != null">#{qty},</if>
  131. <if test="pickTransactionId != null">#{pickTransactionId},</if>
  132. <if test="pickToLocation != null">#{pickToLocation},</if>
  133. <if test="pickQty != null">#{pickQty},</if>
  134. <if test="createBy != null">#{createBy},</if>
  135. <if test="createTime != null">#{createTime},</if>
  136. <if test="updateBy != null">#{updateBy},</if>
  137. <if test="updateTime != null">#{updateTime},</if>
  138. <if test="userdefine1 != null">#{userdefine1},</if>
  139. <if test="userdefine2 != null">#{userdefine2},</if>
  140. <if test="userdefine3 != null">#{userdefine3},</if>
  141. <if test="userdefine4 != null">#{userdefine4},</if>
  142. </trim>
  143. </insert>
  144. <update id="updateActAllocationDetails" parameterType="ActAllocationDetails">
  145. update act_allocation_details
  146. <trim prefix="SET" suffixOverrides=",">
  147. <if test="orderNo != null and orderNo != ''">order_no = #{orderNo},</if>
  148. <if test="lineNo != null">line_no = #{lineNo},</if>
  149. <if test="material != null and material != ''">material = #{material},</if>
  150. <if test="locationId != null">location_id = #{locationId},</if>
  151. <if test="callTransactionId != null">call_transaction_id = #{callTransactionId},</if>
  152. <if test="status != null">status = #{status},</if>
  153. <if test="lotnum != null">lotnum = #{lotnum},</if>
  154. <if test="qty != null">qty = #{qty},</if>
  155. <if test="pickTransactionId != null">pick_transaction_id = #{pickTransactionId},</if>
  156. <if test="pickToLocation != null">pick_to_location = #{pickToLocation},</if>
  157. <if test="pickQty != null">pick_qty = #{pickQty},</if>
  158. <if test="createBy != null">create_by = #{createBy},</if>
  159. <if test="createTime != null">create_time = #{createTime},</if>
  160. <if test="updateBy != null">update_by = #{updateBy},</if>
  161. <if test="updateTime != null">update_time = #{updateTime},</if>
  162. <if test="userdefine1 != null">userdefine1 = #{userdefine1},</if>
  163. <if test="userdefine2 != null">userdefine2 = #{userdefine2},</if>
  164. <if test="userdefine3 != null">userdefine3 = #{userdefine3},</if>
  165. <if test="userdefine4 != null">userdefine4 = #{userdefine4},</if>
  166. </trim>
  167. where allocation_id = #{allocationId}
  168. </update>
  169. <delete id="deleteActAllocationDetailsByAllocationId" parameterType="String">
  170. delete
  171. from act_allocation_details
  172. where allocation_id = #{allocationId}
  173. </delete>
  174. <delete id="deleteActAllocationDetailsByAllocationIds" parameterType="String">
  175. delete from act_allocation_details where allocation_id in
  176. <foreach item="allocationId" collection="array" open="(" separator="," close=")">
  177. #{allocationId}
  178. </foreach>
  179. </delete>
  180. <select id="queryAllocationDetailsByPalletNo" parameterType="String" resultMap="ActAllocationDetailsResult">
  181. select al.*
  182. from act_allocation_details al
  183. where al.userdefine1 = #{palletNo}
  184. </select>
  185. <select id="queryAllocationDetailsByOrderNo" parameterType="String" resultMap="ActAllocationDetailsResult">
  186. select al.*
  187. from act_allocation_details al
  188. where al.order_no = #{orderNo}
  189. and status in (10, 20, 30, 40)
  190. </select>
  191. <update id="updateAllocationDetailsLocationIdByPalletNo">
  192. update act_allocation_details set location_id = #{locationId} where userdefine1 = #{palletNo}
  193. </update>
  194. </mapper>