InvLotLocIdMapper.xml 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  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.inv.mapper.InvLotLocIdMapper">
  6. <resultMap type="InvLotLocId" id="InvLotLocIdResult">
  7. <result property="lotnum" column="lotnum" />
  8. <result property="locationId" column="location_id" />
  9. <result property="traceid" column="traceid" />
  10. <result property="customerId" column="customer_id" />
  11. <result property="sku" column="sku" />
  12. <result property="qty" column="qty" />
  13. <result property="qtyEach" column="qty_each" />
  14. <result property="qtyallocated" column="qtyallocated" />
  15. <result property="qtyallocatedEach" column="qtyallocated_each" />
  16. <result property="qtypa" column="qtypa" />
  17. <result property="qtyrpin" column="qtyrpin" />
  18. <result property="qtyrpout" column="qtyrpout" />
  19. <result property="qtymvin" column="qtymvin" />
  20. <result property="qtymvout" column="qtymvout" />
  21. <result property="qtyonhold" column="qtyonhold" />
  22. <result property="createBy" column="create_by" />
  23. <result property="createTime" column="create_time" />
  24. <result property="updateBy" column="update_by" />
  25. <result property="updateTime" column="update_time" />
  26. <result property="remark" column="remark" />
  27. </resultMap>
  28. <resultMap type="invLotLocIdLotattVO" id="InvLotLocIdLotattResult">
  29. <result property="lotnum" column="lotnum" />
  30. <result property="locationNo" column="location_no" />
  31. <result property="locationId" column="location_id" />
  32. <result property="zoneName" column="zone_name" />
  33. <result property="customerId" column="customer_id" />
  34. <result property="sku" column="sku" />
  35. <result property="skuName" column="sku_name" />
  36. <result property="skuTypeName" column="sku_type_name" />
  37. <result property="qty" column="qty" />
  38. <result property="qtyallocated" column="qtyallocated" />
  39. <result property="palletNo" column="box_no" />
  40. <result property="isFull" column="is_full" />
  41. <result property="lotnum" column="lotnum" />
  42. <result property="lotatt01" column="lotatt01" />
  43. <result property="lotatt02" column="lotatt02" />
  44. <result property="lotatt03" column="lotatt03" />
  45. <result property="lotatt04" column="lotatt04" />
  46. <result property="lotatt05" column="lotatt05" />
  47. <result property="lotatt06" column="lotatt06" />
  48. <result property="lotatt07" column="lotatt07" />
  49. <result property="lotatt08" column="lotatt08" />
  50. <result property="lotatt09" column="lotatt09" />
  51. <result property="lotatt10" column="lotatt10" />
  52. <result property="lotatt11" column="lotatt11" />
  53. <result property="lotatt12" column="lotatt12" />
  54. <result property="lotatt13" column="lotatt13" />
  55. <result property="lotatt14" column="lotatt14" />
  56. <result property="lotatt15" column="lotatt15" />
  57. <result property="lotatt16" column="lotatt16" />
  58. <result property="lotatt17" column="lotatt17" />
  59. <result property="lotatt18" column="lotatt18" />
  60. </resultMap>
  61. <resultMap type="BaseLocationLotattVO" id="BaseLocationInfoLotattResult">
  62. <result property="id" column="id" />
  63. <result property="warehouseId" column="warehouse_id" />
  64. <result property="zoneId" column="zone_id" />
  65. <result property="locationNo" column="location_no" />
  66. <result property="locationBarcode" column="location_barcode" />
  67. <result property="rowNo" column="row_no" />
  68. <result property="rowIndex" column="row_index" />
  69. <result property="colNo" column="col_no" />
  70. <result property="colIndex" column="col_index" />
  71. <result property="shiftNo" column="shift_no" />
  72. <result property="shiftIndex" column="shift_index" />
  73. <result property="stockStatus" column="stock_status" />
  74. <result property="isEmpty" column="is_empty" />
  75. <result property="bindSku" column="bind_sku" />
  76. <result property="locationType" column="location_type" />
  77. <result property="rackId" column="rack_id" />
  78. <result property="agvStation" column="agv_station" />
  79. <result property="foldedTag" column="folded_tag" />
  80. <result property="foldedCount" column="folded_count" />
  81. <result property="userdefine1" column="userdefine1" />
  82. <result property="userdefine2" column="userdefine2" />
  83. <result property="userdefine3" column="userdefine3" />
  84. <result property="userdefine4" column="userdefine4" />
  85. <result property="userdefine5" column="userdefine5" />
  86. <result property="userdefine6" column="userdefine6" />
  87. <result property="userdefine7" column="userdefine7" />
  88. <result property="userdefine8" column="userdefine8" />
  89. <result property="userdefine9" column="userdefine9" />
  90. <result property="userdefine10" column="userdefine10" />
  91. <result property="createBy" column="create_by" />
  92. <result property="createTime" column="create_time" />
  93. <result property="updateBy" column="update_by" />
  94. <result property="updateTime" column="update_time" />
  95. <result property="remark" column="remark" />
  96. <result property="sku" column="sku" />
  97. <result property="qty" column="qty" />
  98. <result property="lotattVO.lotatt01" column="lotatt01" />
  99. <result property="lotattVO.lotatt02" column="lotatt02" />
  100. <result property="lotattVO.lotatt03" column="lotatt03" />
  101. <result property="lotattVO.lotatt04" column="lotatt04" />
  102. <result property="lotattVO.lotatt05" column="lotatt05" />
  103. <result property="lotattVO.lotatt06" column="lotatt06" />
  104. <result property="lotattVO.lotatt07" column="lotatt07" />
  105. <result property="lotattVO.lotatt08" column="lotatt08" />
  106. <result property="lotattVO.lotatt09" column="lotatt09" />
  107. <result property="lotattVO.lotatt10" column="lotatt10" />
  108. <result property="lotattVO.lotatt11" column="lotatt11" />
  109. <result property="lotattVO.lotatt12" column="lotatt12" />
  110. <result property="lotattVO.lotatt13" column="lotatt13" />
  111. <result property="lotattVO.lotatt14" column="lotatt14" />
  112. <result property="lotattVO.lotatt15" column="lotatt15" />
  113. <result property="lotattVO.lotatt16" column="lotatt16" />
  114. <result property="lotattVO.lotatt17" column="lotatt17" />
  115. <result property="lotattVO.lotatt18" column="lotatt18" />
  116. </resultMap>
  117. <sql id="selectInvLotLocIdVo">
  118. select lotnum, location_id, traceid, customer_id, sku, qty, qty_each, qtyallocated, qtyallocated_each, qtypa, qtyrpin, qtyrpout, qtymvin, qtymvout, qtyonhold, create_by, create_time, update_by, update_time, remark from inv_lot_loc_id
  119. </sql>
  120. <select id="selectInvLotLocIdList" parameterType="InvLotLocId" resultMap="InvLotLocIdResult">
  121. <include refid="selectInvLotLocIdVo"/>
  122. <where>
  123. <if test="locationId != null and locationId != ''"> and location_id = #{locationId}</if>
  124. <if test="customerId != null and customerId != ''"> and customer_id = #{customerId}</if>
  125. <if test="sku != null and sku != ''"> and sku = #{sku}</if>
  126. <if test="lotnum != null and lotnum != ''"> and lotnum = #{lotnum}</if>
  127. <if test="traceid != null and traceid != ''"> and traceid = #{traceid}</if>
  128. </where>
  129. </select>
  130. <select id="selectInvLotLocIdByLotnum" parameterType="String" resultMap="InvLotLocIdResult">
  131. <include refid="selectInvLotLocIdVo"/>
  132. where lotnum = #{lotnum}
  133. </select>
  134. <select id="selectInvLotLocIdByKey" resultMap="InvLotLocIdResult">
  135. <include refid="selectInvLotLocIdVo"/>
  136. where lotnum = #{lotnum} and location_id = #{locationId} and customer_id = #{customerId} and sku = #{sku}
  137. </select>
  138. <select id="queryById" parameterType="InvLotLocId" resultMap="InvLotLocIdResult">
  139. <include refid="selectInvLotLocIdVo"/>
  140. where lotnum = #{lotnum}
  141. and location_id = #{location}
  142. and customer_id = #{customerId}
  143. and sku = #{sku}
  144. </select>
  145. <insert id="insertInvLotLocId" parameterType="InvLotLocId">
  146. insert into inv_lot_loc_id
  147. <trim prefix="(" suffix=")" suffixOverrides=",">
  148. <if test="lotnum != null">lotnum,</if>
  149. <if test="locationId != null">location_id,</if>
  150. <if test="traceid != null">traceid,</if>
  151. <if test="customerId != null">customer_id,</if>
  152. <if test="sku != null">sku,</if>
  153. <if test="qty != null">qty,</if>
  154. <if test="qtyEach != null">qty_each,</if>
  155. <if test="qtyallocated != null">qtyallocated,</if>
  156. <if test="qtyallocatedEach != null">qtyallocated_each,</if>
  157. <if test="qtypa != null">qtypa,</if>
  158. <if test="qtyrpin != null">qtyrpin,</if>
  159. <if test="qtyrpout != null">qtyrpout,</if>
  160. <if test="qtymvin != null">qtymvin,</if>
  161. <if test="qtymvout != null">qtymvout,</if>
  162. <if test="qtyonhold != null">qtyonhold,</if>
  163. <if test="createBy != null">create_by,</if>
  164. <if test="createTime != null">create_time,</if>
  165. <if test="updateBy != null">update_by,</if>
  166. <if test="updateTime != null">update_time,</if>
  167. <if test="remark != null">remark,</if>
  168. </trim>
  169. <trim prefix="values (" suffix=")" suffixOverrides=",">
  170. <if test="lotnum != null">#{lotnum},</if>
  171. <if test="locationId != null">#{locationId},</if>
  172. <if test="traceid != null">#{traceid},</if>
  173. <if test="customerId != null">#{customerId},</if>
  174. <if test="sku != null">#{sku},</if>
  175. <if test="qty != null">#{qty},</if>
  176. <if test="qtyEach != null">#{qtyEach},</if>
  177. <if test="qtyallocated != null">#{qtyallocated},</if>
  178. <if test="qtyallocatedEach != null">#{qtyallocatedEach},</if>
  179. <if test="qtypa != null">#{qtypa},</if>
  180. <if test="qtyrpin != null">#{qtyrpin},</if>
  181. <if test="qtyrpout != null">#{qtyrpout},</if>
  182. <if test="qtymvin != null">#{qtymvin},</if>
  183. <if test="qtymvout != null">#{qtymvout},</if>
  184. <if test="qtyonhold != null">#{qtyonhold},</if>
  185. <if test="createBy != null">#{createBy},</if>
  186. <if test="createTime != null">#{createTime},</if>
  187. <if test="updateBy != null">#{updateBy},</if>
  188. <if test="updateTime != null">#{updateTime},</if>
  189. <if test="remark != null">#{remark},</if>
  190. </trim>
  191. </insert>
  192. <update id="updateInvLotLocId" parameterType="InvLotLocId">
  193. update inv_lot_loc_id
  194. <trim prefix="SET" suffixOverrides=",">
  195. <if test="locationId != null">location_id = #{locationId},</if>
  196. <if test="traceid != null">traceid = #{traceid},</if>
  197. <if test="customerId != null">customer_id = #{customerId},</if>
  198. <if test="sku != null">sku = #{sku},</if>
  199. <if test="qty != null">qty = #{qty},</if>
  200. <if test="qtyEach != null">qty_each = #{qtyEach},</if>
  201. <if test="qtyallocated != null">qtyallocated = #{qtyallocated},</if>
  202. <if test="qtyallocatedEach != null">qtyallocated_each = #{qtyallocatedEach},</if>
  203. <if test="qtypa != null">qtypa = #{qtypa},</if>
  204. <if test="qtyrpin != null">qtyrpin = #{qtyrpin},</if>
  205. <if test="qtyrpout != null">qtyrpout = #{qtyrpout},</if>
  206. <if test="qtymvin != null">qtymvin = #{qtymvin},</if>
  207. <if test="qtymvout != null">qtymvout = #{qtymvout},</if>
  208. <if test="qtyonhold != null">qtyonhold = #{qtyonhold},</if>
  209. <if test="createBy != null">create_by = #{createBy},</if>
  210. <if test="createTime != null">create_time = #{createTime},</if>
  211. <if test="updateBy != null">update_by = #{updateBy},</if>
  212. <if test="updateTime != null">update_time = #{updateTime},</if>
  213. <if test="remark != null">remark = #{remark},</if>
  214. </trim>
  215. where lotnum = #{lotnum}
  216. and location_id = #{locationId}
  217. and customer_id = #{customerId}
  218. and sku = #{sku}
  219. </update>
  220. <delete id="deleteInvLotLocIdByLotnum" parameterType="String">
  221. delete from inv_lot_loc_id where lotnum = #{lotnum}
  222. </delete>
  223. <delete id="deleteInvLotLocIdBy">
  224. delete from inv_lot_loc_id
  225. where lotnum = #{lotnum} and sku = #{sku} and location_id = #{locationId} and customer_id = #{customerId}
  226. </delete>
  227. <delete id="deleteInvLotLocIdByLotnums" parameterType="String">
  228. delete from inv_lot_loc_id where lotnum in
  229. <foreach item="lotnum" collection="array" open="(" separator="," close=")">
  230. #{lotnum}
  231. </foreach>
  232. </delete>
  233. <select id="selectInvLocationList" resultMap="BaseLocationInfoLotattResult">
  234. select
  235. b.id, b.warehouse_id, b.zone_id, b.location_no, b.location_barcode, b.row_no, b.row_index, b.col_no, b.col_index, b.shift_no,
  236. b.shift_index, b.stock_status, b.is_empty, b.bind_sku, b.location_type, b.rack_id, b.agv_station, b.folded_tag, b.folded_count,
  237. b.userdefine1, b.userdefine2, b.userdefine3, b.userdefine4, b.userdefine5, b.userdefine6, b.userdefine7, b.userdefine8,
  238. b.userdefine9, b.userdefine10, b.create_by, b.create_time, b.update_by, b.update_time, b.remark, inv.sku, inv.qty, att.*
  239. from inv_lot_loc_id inv
  240. left join inv_lot_att att on inv.lotnum = att.lotnum
  241. left join base_location_info b on inv.location_id = b.id
  242. left join base_sku sk on inv.sku = sk.sku
  243. left join base_sku_type skt on sk.sku_type = skt.item_code
  244. <where>
  245. <if test="zoneId != null and zoneId != ''"> and b.zone_id = #{zoneId}</if>
  246. <if test="sku != null and sku != ''"> and sk.sku = #{sku}</if>
  247. <if test="skuType != null and skuType != ''"> and skt.item_code = #{skuType}</if>
  248. </where>
  249. order by lpad(b.row_no, 11, '0'),b.row_index,lpad(b.shift_no, 11, '0'),b.shift_index,lpad(b.col_no, 11, '0'),b.col_index desc
  250. </select>
  251. <select id="selectInvZoneBySkuLotatt" resultMap="BaseLocationInfoLotattResult">
  252. select
  253. b.zone_id
  254. from inv_lot_loc_id inv
  255. left join inv_lot_att att on inv.lotnum = att.lotnum
  256. left join base_location_info b on inv.location_id = b.id
  257. left join base_sku sk on inv.sku = sk.sku
  258. left join base_sku_type skt on sk.sku_type = skt.item_code
  259. left join base_location_zone bz on b.zone_id = bz.zone_id
  260. <where>
  261. <if test="sku != null and sku != ''"> and sk.sku = #{sku}</if>
  262. <if test="skuType != null and skuType != ''"> and skt.item_code = #{skuType}</if>
  263. <if test="lotattDTO != null">
  264. <if test="lotattDTO.lotatt01 != null and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
  265. <if test="lotattDTO.lotatt02 != null and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
  266. <if test="lotattDTO.lotatt03 != null and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
  267. <if test="lotattDTO.lotatt04 != null and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
  268. <if test="lotattDTO.lotatt05 != null and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
  269. <if test="lotattDTO.lotatt06 != null and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
  270. <if test="lotattDTO.lotatt07 != null and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
  271. <if test="lotattDTO.lotatt08 != null and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
  272. <if test="lotattDTO.lotatt09 != null and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
  273. <if test="lotattDTO.lotatt10 != null and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
  274. <if test="lotattDTO.lotatt11 != null and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
  275. <if test="lotattDTO.lotatt12 != null and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
  276. <if test="lotattDTO.lotatt13 != null and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
  277. <if test="lotattDTO.lotatt14 != null and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
  278. <if test="lotattDTO.lotatt15 != null and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
  279. <if test="lotattDTO.lotatt16 != null and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
  280. <if test="lotattDTO.lotatt17 != null and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
  281. <if test="lotattDTO.lotatt18 != null and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
  282. </if>
  283. </where>
  284. and bz.userdefine1 = 'INV'
  285. </select>
  286. <select id="selectInvLocIdLotattListGroupBy" resultMap="InvLotLocIdLotattResult">
  287. select
  288. att.lotatt01
  289. from inv_lot_loc_id inv
  290. left join inv_lot_att att on inv.lotnum = att.lotnum
  291. left join base_location_info b on inv.location_id = b.id
  292. left join base_location_zone z on b.zone_id = z.zone_id
  293. left join base_sku sk on inv.sku = sk.sku
  294. <where>
  295. 1=1
  296. <if test="zoneId != null and zoneId != ''"> and b.zone_id = #{zoneId}</if>
  297. </where>
  298. group by att.lotatt01
  299. order by att.lotatt01
  300. </select>
  301. <select id="selectInvLocIdLotattList" resultMap="InvLotLocIdLotattResult">
  302. select
  303. inv.location_id,sk.sku,sk.desc1 sku_name,skt.item_name sku_type_name,b.location_no,inv.qty,inv.qtyallocated
  304. ,att.lotnum, att.customer_id,w.box_no,w.is_full,z.zone_name
  305. ,lotatt01, lotatt02, lotatt03, lotatt04,lot05_dict.dict_label lotatt05, supp.supplier_name lotatt06
  306. ,lotatt07, lotatt08, lotatt09, lotatt10, lotatt11, lotatt12, lotatt13, lotatt14, lotatt15, lotatt16, lotatt17
  307. ,lotatt18
  308. from inv_lot_loc_id inv
  309. left join inv_lot_att att on inv.lotnum = att.lotnum
  310. left join base_location_info b on inv.location_id = b.id
  311. left join base_location_zone z on b.zone_id = z.zone_id
  312. left join base_sku sk on inv.sku = sk.sku
  313. left join base_sku_type skt on sk.sku_type = skt.item_code
  314. left join (select dict_label,dict_value from sys_dict_data where dict_type = 'ams_inv_quality') lot05_dict on att.lotatt05 = lot05_dict.dict_value
  315. left join (select * from base_supplier) supp on att.lotatt06 = supp.supplier_id
  316. left join (SELECT * from wms_box_info where location_id not in('99997','99998','99999')) w on inv.location_id = w.location_id
  317. <where>
  318. <if test="zoneId != null and zoneId != ''"> and b.zone_id = #{zoneId}</if>
  319. <if test="sku != null and sku != ''"> and (sk.sku like concat('%', #{sku}, '%') or sk.desc1 like concat('%', #{sku}, '%'))</if>
  320. <if test="locationNo != null and locationNo != ''"> and b.location_no like concat('%', #{locationNo}, '%')</if>
  321. <if test="isFull != null and isFull != ''"> and w.is_full = #{isFull}</if>
  322. <if test="lotattDTO != null">
  323. <if test="lotattDTO.lotatt01 != null and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
  324. <if test="lotattDTO.lotatt02 != null and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
  325. <if test="lotattDTO.lotatt03 != null and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
  326. <if test="lotattDTO.lotatt04 != null and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
  327. <if test="lotattDTO.lotatt05 != null and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
  328. <if test="lotattDTO.lotatt06 != null and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
  329. <if test="lotattDTO.lotatt07 != null and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
  330. <if test="lotattDTO.lotatt08 != null and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
  331. <if test="lotattDTO.lotatt09 != null and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
  332. <if test="lotattDTO.lotatt10 != null and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
  333. <if test="lotattDTO.lotatt11 != null and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
  334. <if test="lotattDTO.lotatt12 != null and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
  335. <if test="lotattDTO.lotatt13 != null and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
  336. <if test="lotattDTO.lotatt14 != null and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
  337. <if test="lotattDTO.lotatt15 != null and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
  338. <if test="lotattDTO.lotatt16 != null and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
  339. <if test="lotattDTO.lotatt17 != null and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
  340. <if test="lotattDTO.lotatt18 != null and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
  341. </if>
  342. </where>
  343. order by lpad(b.row_no, 11, '0'),b.row_index,lpad(b.shift_no, 11, '0'),b.shift_index,lpad(b.col_no, 11, '0'),b.col_index desc
  344. </select>
  345. <select id="selectInvLocIdLotattByLocationId" resultMap="InvLotLocIdLotattResult">
  346. select
  347. inv.location_id,sk.sku,sk.desc1 sku_name,b.location_no,inv.qty,inv.qtyallocated
  348. ,att.lotnum, att.customer_id, lotatt01, lotatt02, lotatt03, lotatt04,qua.dict_label lotatt05, lotatt06, lotatt07, lotatt08, lotatt09, lotatt10, lotatt11, lotatt12, lotatt13, lotatt14, lotatt15, lotatt16, lotatt17, lotatt18
  349. from inv_lot_loc_id inv
  350. left join inv_lot_att att on inv.lotnum = att.lotnum
  351. left join base_location_info b on inv.location_id = b.id
  352. left join base_sku sk on inv.sku = sk.sku
  353. left join base_sku_type skt on sk.sku_type = skt.item_code
  354. left join (select dict_value,dict_label from sys_dict_data where dict_type = 'ams_inv_quality') qua on att.lotatt05 = qua.dict_value
  355. where inv.location_id = #{locationId}
  356. </select>
  357. <delete id="deleteInvLotLocIdByLocationId" parameterType="Long">
  358. delete from inv_lot_loc_id where location_id = #{locationId}
  359. </delete>
  360. <delete id="deleteInvLotLocIdByPrimaryKey" parameterType="Long">
  361. delete from inv_lot_loc_id
  362. where lotnum = #{lotnum}
  363. and location_id = #{locationId}
  364. and customer_id = #{customerId}
  365. and sku = #{sku}
  366. </delete>
  367. <update id="updateInvLotLocIdLocationId">
  368. update inv_lot_loc_id set location_id = #{locationTo}
  369. where location_id = #{locationFrom}
  370. </update>
  371. <update id="moveInvByLocationId" parameterType="Object">
  372. update inv_lot_loc_id
  373. set location_id = #{locationTo},traceid = #{traceid}
  374. where location_id = #{locationFrom}
  375. </update>
  376. <update id="moveInvByTraceId" parameterType="Object">
  377. update inv_lot_loc_id
  378. set location_id = #{locationTo}
  379. where location_id = #{locationFrom} and traceid = #{traceid}
  380. </update>
  381. <update id="updateInvLotLocIdLotnum">
  382. update inv_lot_loc_id set location_id = #{locationTo}
  383. where location_id = #{locationFrom} and lotnum = #{lotnum}
  384. </update>
  385. <update id="updateInvLotLocIdToByLotnum">
  386. update inv_lot_loc_id set location_id = #{locationTo}
  387. where lotnum = #{lotnum}
  388. </update>
  389. <update id="clearInvByLocationId">
  390. delete from inv_lot_loc_id where location_id = #{locationId}
  391. </update>
  392. <select id="queryInvBySku" resultType="double">
  393. select
  394. sum(inv.qty) qty
  395. from inv_lot_loc_id inv
  396. left join inv_lot_att att on inv.lotnum = att.lotnum
  397. left join base_location_info b on inv.location_id = b.id
  398. left join base_sku sk on inv.sku = sk.sku
  399. left join base_sku_type skt on sk.sku_type = skt.item_code
  400. left join base_location_zone bz on b.zone_id = bz.zone_id
  401. <where>
  402. <if test="sku != null and sku != ''"> and sk.sku = #{sku}</if>
  403. <if test="lotattDTO != null">
  404. <if test="lotattDTO.lotatt01 != null and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
  405. <if test="lotattDTO.lotatt02 != null and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
  406. <if test="lotattDTO.lotatt03 != null and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
  407. <if test="lotattDTO.lotatt04 != null and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
  408. <if test="lotattDTO.lotatt05 != null and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
  409. <if test="lotattDTO.lotatt06 != null and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
  410. <if test="lotattDTO.lotatt07 != null and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
  411. <if test="lotattDTO.lotatt08 != null and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
  412. <if test="lotattDTO.lotatt09 != null and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
  413. <if test="lotattDTO.lotatt10 != null and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
  414. <if test="lotattDTO.lotatt11 != null and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
  415. <if test="lotattDTO.lotatt12 != null and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
  416. <if test="lotattDTO.lotatt13 != null and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
  417. <if test="lotattDTO.lotatt14 != null and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
  418. <if test="lotattDTO.lotatt15 != null and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
  419. <if test="lotattDTO.lotatt16 != null and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
  420. <if test="lotattDTO.lotatt17 != null and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
  421. <if test="lotattDTO.lotatt18 != null and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
  422. </if>
  423. and bz.zone_id in
  424. <foreach item="item" index="index" collection="zoneIdList" open="(" separator="," close=" )">
  425. #{item}
  426. </foreach>
  427. group by sk.sku
  428. </where>
  429. </select>
  430. <select id="queryInvBySkuLocationId" resultType="double">
  431. select
  432. sum(inv.qty) qty
  433. from inv_lot_loc_id inv
  434. left join inv_lot_att att on inv.lotnum = att.lotnum
  435. left join base_location_info b on inv.location_id = b.id
  436. left join base_sku sk on inv.sku = sk.sku
  437. left join base_sku_type skt on sk.sku_type = skt.item_code
  438. left join base_location_zone bz on b.zone_id = bz.zone_id
  439. <where>
  440. <if test="sku != null and sku != ''"> and sk.sku = #{sku}</if>
  441. <if test="lotattDTO != null">
  442. <if test="lotattDTO.lotatt01 != null and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
  443. <if test="lotattDTO.lotatt02 != null and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
  444. <if test="lotattDTO.lotatt03 != null and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
  445. <if test="lotattDTO.lotatt04 != null and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
  446. <if test="lotattDTO.lotatt05 != null and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
  447. <if test="lotattDTO.lotatt06 != null and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
  448. <if test="lotattDTO.lotatt07 != null and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
  449. <if test="lotattDTO.lotatt08 != null and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
  450. <if test="lotattDTO.lotatt09 != null and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
  451. <if test="lotattDTO.lotatt10 != null and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
  452. <if test="lotattDTO.lotatt11 != null and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
  453. <if test="lotattDTO.lotatt12 != null and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
  454. <if test="lotattDTO.lotatt13 != null and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
  455. <if test="lotattDTO.lotatt14 != null and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
  456. <if test="lotattDTO.lotatt15 != null and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
  457. <if test="lotattDTO.lotatt16 != null and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
  458. <if test="lotattDTO.lotatt17 != null and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
  459. <if test="lotattDTO.lotatt18 != null and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
  460. </if>
  461. and b.id = #{locationId}
  462. group by sk.sku
  463. </where>
  464. </select>
  465. <select id="queryInvOrderBy" parameterType="InvLotLocId" resultMap="InvLotLocIdResult">
  466. select inv.* from inv_lot_loc_id inv
  467. left join base_location_info b on inv.location_id = b.id
  468. left join inv_lot_att att on inv.lotnum = att.lotnum
  469. <where>
  470. <if test="lotnum != null and lotnum != ''"> and inv.lotnum = #{lotnum}</if>
  471. <if test="sku != null and sku != ''"> and inv.sku = #{sku}</if>
  472. <if test="location != null and location != ''"> and inv.location_id = #{location}</if>
  473. <if test="customerId != null and customerId != ''"> and inv.customer_id = #{customerId}</if>
  474. <if test="lotattDTO != null">
  475. <if test="lotattDTO.lotatt01 != null and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
  476. <if test="lotattDTO.lotatt02 != null and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
  477. <if test="lotattDTO.lotatt03 != null and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
  478. <if test="lotattDTO.lotatt04 != null and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
  479. <if test="lotattDTO.lotatt05 != null and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
  480. <if test="lotattDTO.lotatt06 != null and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
  481. <if test="lotattDTO.lotatt07 != null and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
  482. <if test="lotattDTO.lotatt08 != null and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
  483. <if test="lotattDTO.lotatt09 != null and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
  484. <if test="lotattDTO.lotatt10 != null and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
  485. <if test="lotattDTO.lotatt11 != null and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
  486. <if test="lotattDTO.lotatt12 != null and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
  487. <if test="lotattDTO.lotatt13 != null and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
  488. <if test="lotattDTO.lotatt14 != null and lotattDTO.lotatt14 != ''"> and (att.lotatt14 = #{lotattDTO.lotatt14} or att.lotatt14 is null)</if>
  489. <if test="lotattDTO.lotatt15 != null and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
  490. <if test="lotattDTO.lotatt16 != null and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
  491. <if test="lotattDTO.lotatt17 != null and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
  492. <if test="lotattDTO.lotatt18 != null and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
  493. </if>
  494. and b.stock_status = '00'
  495. </where>
  496. order by inv.qty,att.create_time,lpad(b.row_no, 11, '0'),b.row_index,lpad(b.shift_no, 11, '0'),b.shift_index,lpad(b.col_no, 11, '0'),b.col_index desc
  497. </select>
  498. <select id="queryInvByInvLotatt" resultMap="InvLotLocIdResult">
  499. select li.* from inv_lot_loc_id li
  500. left join inv_lot_att att on li.lotnum = att.lotnum
  501. <where>
  502. <if test="lotattDTO != null">
  503. <if test="lotattDTO.lotatt01 != null and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
  504. <if test="lotattDTO.lotatt02 != null and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
  505. <if test="lotattDTO.lotatt03 != null and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
  506. <if test="lotattDTO.lotatt04 != null and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
  507. <if test="lotattDTO.lotatt05 != null and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
  508. <if test="lotattDTO.lotatt06 != null and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
  509. <if test="lotattDTO.lotatt07 != null and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
  510. <if test="lotattDTO.lotatt08 != null and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
  511. <if test="lotattDTO.lotatt09 != null and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
  512. <if test="lotattDTO.lotatt10 != null and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
  513. <if test="lotattDTO.lotatt11 != null and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
  514. <if test="lotattDTO.lotatt12 != null and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
  515. <if test="lotattDTO.lotatt13 != null and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
  516. <if test="lotattDTO.lotatt14 != null and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
  517. <if test="lotattDTO.lotatt15 != null and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
  518. <if test="lotattDTO.lotatt16 != null and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
  519. <if test="lotattDTO.lotatt17 != null and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
  520. <if test="lotattDTO.lotatt18 != null and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
  521. </if>
  522. </where>
  523. </select>
  524. <select id="queryInvLotattByInvLotatt" resultMap="InvLotLocIdLotattResult">
  525. select li.*,att.lotatt01,att.lotatt02,att.lotatt03,att.lotatt04,att.lotatt05,att.lotatt06,att.lotatt07,att.lotatt08,att.lotatt09
  526. ,att.lotatt10,att.lotatt11,att.lotatt12,att.lotatt13,att.lotatt14,att.lotatt15,att.lotatt16,att.lotatt17,att.lotatt18
  527. from inv_lot_loc_id li
  528. left join inv_lot_att att on li.lotnum = att.lotnum
  529. <where>
  530. <if test="lotattDTO != null">
  531. <if test="lotattDTO.lotatt01 != null and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
  532. <if test="lotattDTO.lotatt02 != null and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
  533. <if test="lotattDTO.lotatt03 != null and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
  534. <if test="lotattDTO.lotatt04 != null and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
  535. <if test="lotattDTO.lotatt05 != null and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
  536. <if test="lotattDTO.lotatt06 != null and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
  537. <if test="lotattDTO.lotatt07 != null and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
  538. <if test="lotattDTO.lotatt08 != null and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
  539. <if test="lotattDTO.lotatt09 != null and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
  540. <if test="lotattDTO.lotatt10 != null and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
  541. <if test="lotattDTO.lotatt11 != null and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
  542. <if test="lotattDTO.lotatt12 != null and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
  543. <if test="lotattDTO.lotatt13 != null and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
  544. <if test="lotattDTO.lotatt14 != null and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
  545. <if test="lotattDTO.lotatt15 != null and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
  546. <if test="lotattDTO.lotatt16 != null and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
  547. <if test="lotattDTO.lotatt17 != null and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
  548. <if test="lotattDTO.lotatt18 != null and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
  549. </if>
  550. </where>
  551. </select>
  552. <select id="queryInvByFull" resultMap="InvLotLocIdResult">
  553. select inv.*
  554. from inv_lot_loc_id inv
  555. left join inv_lot_att att on inv.lotnum = att.lotnum
  556. where att.lotatt14 = #{orderNo} and inv.sku = #{sku}
  557. </select>
  558. <delete id="unlockInv">
  559. delete from inv_lot_loc_id where location_id = #{locationId} and sku = #{sku} and customer_id = #{customerId}
  560. </delete>
  561. <select id="getQualityInspectionList" resultMap="InvLotLocIdLotattResult">
  562. select
  563. t2.lotatt01
  564. from inv_lot_loc_id t1
  565. left join inv_lot_att t2 on t2.lotnum = t1.lotnum
  566. where t2.lotatt05 = 'DJ'
  567. group by t2.lotatt01
  568. order by t2.lotatt01
  569. </select>
  570. <select id="getQualityLocationListByLotNumber" resultMap="InvLotLocIdLotattResult">
  571. select
  572. t3.location_no
  573. from inv_lot_loc_id t1
  574. left join inv_lot_att t2 on t2.lotnum = t1.lotnum
  575. left join base_location_info t3 on t3.id = t1.location_id
  576. where t2.lotatt01 = #{lotNumber} and t2.lotatt05 = 'DJ'
  577. group by t1.location_id
  578. order by t1.location_id
  579. </select>
  580. <update id="updateQualityStatusByLotNumber" parameterType="String">
  581. UPDATE inv_lot_att t1
  582. SET t1.lotatt05 = #{qualityStatus}
  583. WHERE
  584. t1.lotatt01 = #{lotNumber}
  585. AND t1.lotnum IN ( SELECT lotnum FROM inv_lot_loc_id )
  586. </update>
  587. <update id="updateAllocationBy">
  588. update inv_lot_loc_id set qtyallocated = qtyallocated + #{qty},qtyallocated_each = qtyallocated_each + #{qty}
  589. where lotnum = #{lotnum} and location_id = #{locationId}
  590. </update>
  591. <update id="updateLocation">
  592. update inv_lot_loc_id set location_id = #{toLocationId}, update_time = now()
  593. where location_id = #{fromLocationId} and location_id not in (99997, 99998, 99999)
  594. </update>
  595. <select id="querySameTypeByPalletNo" resultMap="InvLotLocIdResult">
  596. select inv.*
  597. from inv_lot_loc_id inv
  598. left join inv_lot_att att on inv.lotnum = att.lotnum
  599. left join base_sku sk on inv.sku = sk.sku
  600. where
  601. att.lotatt07 = #{palletNo} and sk.sku_type <![CDATA[ <> ]]> #{skuType}
  602. </select>
  603. <select id="selectInvLotLocIdBySkuLocationSort" resultMap="InvLotLocIdResult">
  604. select *,(qtyallocated - qty) qty from inv_lot_loc_id
  605. <where>
  606. <if test="locationId != null and locationId != ''"> and location_id = #{locationId}</if>
  607. <if test="sku != null and sku != ''"> and sku = #{sku}</if>
  608. </where>
  609. order by (qtyallocated - qty)
  610. </select>
  611. </mapper>