InvLotLocIdMapper.xml 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  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="lotnumTo != null">lotnum = #{lotnumTo},</if>
  196. <if test="locationId != null">location_id = #{locationId},</if>
  197. <if test="traceid != null">traceid = #{traceid},</if>
  198. <if test="customerId != null">customer_id = #{customerId},</if>
  199. <if test="sku != null">sku = #{sku},</if>
  200. <if test="qty != null">qty = #{qty},</if>
  201. <if test="qtyEach != null">qty_each = #{qtyEach},</if>
  202. <if test="qtyallocated != null">qtyallocated = #{qtyallocated},</if>
  203. <if test="qtyallocatedEach != null">qtyallocated_each = #{qtyallocatedEach},</if>
  204. <if test="qtypa != null">qtypa = #{qtypa},</if>
  205. <if test="qtyrpin != null">qtyrpin = #{qtyrpin},</if>
  206. <if test="qtyrpout != null">qtyrpout = #{qtyrpout},</if>
  207. <if test="qtymvin != null">qtymvin = #{qtymvin},</if>
  208. <if test="qtymvout != null">qtymvout = #{qtymvout},</if>
  209. <if test="qtyonhold != null">qtyonhold = #{qtyonhold},</if>
  210. <if test="createBy != null">create_by = #{createBy},</if>
  211. <if test="createTime != null">create_time = #{createTime},</if>
  212. <if test="updateBy != null">update_by = #{updateBy},</if>
  213. <if test="updateTime != null">update_time = #{updateTime},</if>
  214. <if test="remark != null">remark = #{remark},</if>
  215. </trim>
  216. where lotnum = #{lotnum}
  217. and location_id = #{locationId}
  218. and customer_id = #{customerId}
  219. and sku = #{sku}
  220. </update>
  221. <delete id="deleteInvLotLocIdByLotnum" parameterType="String">
  222. delete from inv_lot_loc_id where lotnum = #{lotnum}
  223. </delete>
  224. <delete id="deleteInvLotLocIdBy">
  225. delete from inv_lot_loc_id
  226. where lotnum = #{lotnum} and sku = #{sku} and location_id = #{locationId} and customer_id = #{customerId}
  227. </delete>
  228. <delete id="deleteInvLotLocIdByLotnums" parameterType="String">
  229. delete from inv_lot_loc_id where lotnum in
  230. <foreach item="lotnum" collection="array" open="(" separator="," close=")">
  231. #{lotnum}
  232. </foreach>
  233. </delete>
  234. <select id="selectInvLocationList" resultMap="BaseLocationInfoLotattResult">
  235. select
  236. 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,
  237. 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,
  238. b.userdefine1, b.userdefine2, b.userdefine3, b.userdefine4, b.userdefine5, b.userdefine6, b.userdefine7, b.userdefine8,
  239. b.userdefine9, b.userdefine10, b.create_by, b.create_time, b.update_by, b.update_time, b.remark, inv.sku, inv.qty, att.*
  240. from inv_lot_loc_id inv
  241. left join inv_lot_att att on inv.lotnum = att.lotnum
  242. left join base_location_info b on inv.location_id = b.id
  243. left join base_sku sk on inv.sku = sk.sku
  244. left join base_sku_type skt on sk.sku_type = skt.item_code
  245. <where>
  246. <if test="zoneId != null and zoneId != ''"> and b.zone_id = #{zoneId}</if>
  247. <if test="sku != null and sku != ''"> and sk.sku = #{sku}</if>
  248. <if test="skuType != null and skuType != ''"> and skt.item_code = #{skuType}</if>
  249. </where>
  250. 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
  251. </select>
  252. <select id="selectInvZoneBySkuLotatt" resultMap="BaseLocationInfoLotattResult">
  253. select
  254. b.zone_id
  255. from inv_lot_loc_id inv
  256. left join inv_lot_att att on inv.lotnum = att.lotnum
  257. left join base_location_info b on inv.location_id = b.id
  258. left join base_sku sk on inv.sku = sk.sku
  259. left join base_sku_type skt on sk.sku_type = skt.item_code
  260. left join base_location_zone bz on b.zone_id = bz.zone_id
  261. <where>
  262. <if test="sku != null and sku != ''"> and sk.sku = #{sku}</if>
  263. <if test="skuType != null and skuType != ''"> and skt.item_code = #{skuType}</if>
  264. <if test="lotattDTO != null">
  265. <if test="lotattDTO.lotatt01 != null and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
  266. <if test="lotattDTO.lotatt02 != null and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
  267. <if test="lotattDTO.lotatt03 != null and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
  268. <if test="lotattDTO.lotatt04 != null and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
  269. <if test="lotattDTO.lotatt05 != null and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
  270. <if test="lotattDTO.lotatt06 != null and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
  271. <if test="lotattDTO.lotatt07 != null and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
  272. <if test="lotattDTO.lotatt08 != null and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
  273. <if test="lotattDTO.lotatt09 != null and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
  274. <if test="lotattDTO.lotatt10 != null and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
  275. <if test="lotattDTO.lotatt11 != null and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
  276. <if test="lotattDTO.lotatt12 != null and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
  277. <if test="lotattDTO.lotatt13 != null and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
  278. <if test="lotattDTO.lotatt14 != null and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
  279. <if test="lotattDTO.lotatt15 != null and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
  280. <if test="lotattDTO.lotatt16 != null and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
  281. <if test="lotattDTO.lotatt17 != null and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
  282. <if test="lotattDTO.lotatt18 != null and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
  283. </if>
  284. </where>
  285. and bz.userdefine1 = 'INV'
  286. </select>
  287. <select id="selectInvLocIdLotattListGroupBy" resultMap="InvLotLocIdLotattResult">
  288. select
  289. att.lotatt01
  290. from inv_lot_loc_id inv
  291. left join inv_lot_att att on inv.lotnum = att.lotnum
  292. left join base_location_info b on inv.location_id = b.id
  293. left join base_location_zone z on b.zone_id = z.zone_id
  294. left join base_sku sk on inv.sku = sk.sku
  295. <where>
  296. 1=1
  297. <if test="zoneId != null and zoneId != ''"> and b.zone_id = #{zoneId}</if>
  298. </where>
  299. group by att.lotatt01
  300. order by att.lotatt01
  301. </select>
  302. <select id="selectInvLocIdLotattList" resultMap="InvLotLocIdLotattResult">
  303. select
  304. inv.location_id,sk.sku,sk.desc1 sku_name,skt.item_name sku_type_name,b.location_no,inv.qty,inv.qtyallocated
  305. ,att.lotnum, att.customer_id,w.box_no,w.is_full,z.zone_name
  306. ,lotatt01, lotatt02, lotatt03, lotatt04,lot05_dict.dict_label lotatt05, supp.supplier_name lotatt06
  307. ,lotatt07, lotatt08, lotatt09, lotatt10, lotatt11, lotatt12, lotatt13, lotatt14, lotatt15, lotatt16, lotatt17
  308. ,lotatt18
  309. from inv_lot_loc_id inv
  310. left join inv_lot_att att on inv.lotnum = att.lotnum
  311. left join base_location_info b on inv.location_id = b.id
  312. left join base_location_zone z on b.zone_id = z.zone_id
  313. left join base_sku sk on inv.sku = sk.sku
  314. left join base_sku_type skt on sk.sku_type = skt.item_code
  315. 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
  316. left join (select * from base_supplier) supp on att.lotatt06 = supp.supplier_id
  317. left join (SELECT * from wms_box_info where location_id not in('99997','99998','99999')) w on inv.location_id = w.location_id
  318. <where>
  319. <if test="zoneId != null and zoneId != ''"> and b.zone_id = #{zoneId}</if>
  320. <if test="sku != null and sku != ''"> and (sk.sku like concat('%', #{sku}, '%') or sk.desc1 like concat('%', #{sku}, '%'))</if>
  321. <if test="locationNo != null and locationNo != ''"> and b.location_no like concat('%', #{locationNo}, '%')</if>
  322. <if test="isFull != null and isFull != ''"> and w.is_full = #{isFull}</if>
  323. <if test="lotattDTO != null">
  324. <if test="lotattDTO.lotatt01 != null and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
  325. <if test="lotattDTO.lotatt02 != null and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
  326. <if test="lotattDTO.lotatt03 != null and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
  327. <if test="lotattDTO.lotatt04 != null and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
  328. <if test="lotattDTO.lotatt05 != null and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
  329. <if test="lotattDTO.lotatt06 != null and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
  330. <if test="lotattDTO.lotatt07 != null and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
  331. <if test="lotattDTO.lotatt08 != null and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
  332. <if test="lotattDTO.lotatt09 != null and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
  333. <if test="lotattDTO.lotatt10 != null and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
  334. <if test="lotattDTO.lotatt11 != null and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
  335. <if test="lotattDTO.lotatt12 != null and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
  336. <if test="lotattDTO.lotatt13 != null and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
  337. <if test="lotattDTO.lotatt14 != null and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
  338. <if test="lotattDTO.lotatt15 != null and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
  339. <if test="lotattDTO.lotatt16 != null and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
  340. <if test="lotattDTO.lotatt17 != null and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
  341. <if test="lotattDTO.lotatt18 != null and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
  342. </if>
  343. </where>
  344. 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
  345. </select>
  346. <select id="selectInvLocIdLotattByLocationId" resultMap="InvLotLocIdLotattResult">
  347. select
  348. inv.location_id,sk.sku,sk.desc1 sku_name,b.location_no,inv.qty,inv.qtyallocated
  349. ,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
  350. from inv_lot_loc_id inv
  351. left join inv_lot_att att on inv.lotnum = att.lotnum
  352. left join base_location_info b on inv.location_id = b.id
  353. left join base_sku sk on inv.sku = sk.sku
  354. left join base_sku_type skt on sk.sku_type = skt.item_code
  355. left join (select dict_value,dict_label from sys_dict_data where dict_type = 'ams_inv_quality') qua on att.lotatt05 = qua.dict_value
  356. where inv.location_id = #{locationId}
  357. </select>
  358. <delete id="deleteInvLotLocIdByLocationId" parameterType="Long">
  359. delete from inv_lot_loc_id where location_id = #{locationId}
  360. </delete>
  361. <delete id="deleteInvLotLocIdByPrimaryKey" parameterType="object">
  362. delete from inv_lot_loc_id
  363. where lotnum = #{lotnum}
  364. and location_id = #{locationId}
  365. and customer_id = #{customerId}
  366. and sku = #{sku}
  367. </delete>
  368. <update id="updateInvLotLocIdLocationId">
  369. update inv_lot_loc_id set location_id = #{locationTo}
  370. where location_id = #{locationFrom}
  371. </update>
  372. <update id="moveInvByLocationId" parameterType="Object">
  373. update inv_lot_loc_id
  374. set location_id = #{locationTo},traceid = #{traceid}
  375. where location_id = #{locationFrom}
  376. </update>
  377. <update id="moveInvByTraceId" parameterType="Object">
  378. update inv_lot_loc_id
  379. set location_id = #{locationTo}
  380. where location_id = #{locationFrom} and traceid = #{traceid}
  381. </update>
  382. <update id="updateInvLotLocIdLotnum">
  383. update inv_lot_loc_id set location_id = #{locationTo}
  384. where location_id = #{locationFrom} and lotnum = #{lotnum}
  385. </update>
  386. <update id="updateInvLotLocIdToByLotnum">
  387. update inv_lot_loc_id set location_id = #{locationTo}
  388. where lotnum = #{lotnum}
  389. and location_id = #{locationId}
  390. and customer_id = #{customerId}
  391. and sku = #{sku}
  392. </update>
  393. <update id="clearInvByLocationId">
  394. delete from inv_lot_loc_id where location_id = #{locationId}
  395. </update>
  396. <select id="queryInvBySku" resultType="double">
  397. select
  398. sum(inv.qty) qty
  399. from inv_lot_loc_id inv
  400. left join inv_lot_att att on inv.lotnum = att.lotnum
  401. left join base_location_info b on inv.location_id = b.id
  402. left join base_sku sk on inv.sku = sk.sku
  403. left join base_sku_type skt on sk.sku_type = skt.item_code
  404. left join base_location_zone bz on b.zone_id = bz.zone_id
  405. <where>
  406. <if test="sku != null and sku != ''"> and sk.sku = #{sku}</if>
  407. <if test="lotattDTO != null">
  408. <if test="lotattDTO.lotatt01 != null and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
  409. <if test="lotattDTO.lotatt02 != null and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
  410. <if test="lotattDTO.lotatt03 != null and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
  411. <if test="lotattDTO.lotatt04 != null and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
  412. <if test="lotattDTO.lotatt05 != null and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
  413. <if test="lotattDTO.lotatt06 != null and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
  414. <if test="lotattDTO.lotatt07 != null and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
  415. <if test="lotattDTO.lotatt08 != null and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
  416. <if test="lotattDTO.lotatt09 != null and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
  417. <if test="lotattDTO.lotatt10 != null and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
  418. <if test="lotattDTO.lotatt11 != null and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
  419. <if test="lotattDTO.lotatt12 != null and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
  420. <if test="lotattDTO.lotatt13 != null and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
  421. <if test="lotattDTO.lotatt14 != null and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
  422. <if test="lotattDTO.lotatt15 != null and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
  423. <if test="lotattDTO.lotatt16 != null and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
  424. <if test="lotattDTO.lotatt17 != null and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
  425. <if test="lotattDTO.lotatt18 != null and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
  426. </if>
  427. and bz.zone_id in
  428. <foreach item="item" index="index" collection="zoneIdList" open="(" separator="," close=" )">
  429. #{item}
  430. </foreach>
  431. group by sk.sku
  432. </where>
  433. </select>
  434. <select id="queryInvBySkuLocationId" resultType="double">
  435. select
  436. sum(inv.qty) qty
  437. from inv_lot_loc_id inv
  438. left join inv_lot_att att on inv.lotnum = att.lotnum
  439. left join base_location_info b on inv.location_id = b.id
  440. left join base_sku sk on inv.sku = sk.sku
  441. left join base_sku_type skt on sk.sku_type = skt.item_code
  442. left join base_location_zone bz on b.zone_id = bz.zone_id
  443. <where>
  444. <if test="sku != null and sku != ''"> and sk.sku = #{sku}</if>
  445. <if test="lotattDTO != null">
  446. <if test="lotattDTO.lotatt01 != null and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
  447. <if test="lotattDTO.lotatt02 != null and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
  448. <if test="lotattDTO.lotatt03 != null and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
  449. <if test="lotattDTO.lotatt04 != null and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
  450. <if test="lotattDTO.lotatt05 != null and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
  451. <if test="lotattDTO.lotatt06 != null and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
  452. <if test="lotattDTO.lotatt07 != null and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
  453. <if test="lotattDTO.lotatt08 != null and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
  454. <if test="lotattDTO.lotatt09 != null and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
  455. <if test="lotattDTO.lotatt10 != null and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
  456. <if test="lotattDTO.lotatt11 != null and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
  457. <if test="lotattDTO.lotatt12 != null and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
  458. <if test="lotattDTO.lotatt13 != null and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
  459. <if test="lotattDTO.lotatt14 != null and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
  460. <if test="lotattDTO.lotatt15 != null and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
  461. <if test="lotattDTO.lotatt16 != null and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
  462. <if test="lotattDTO.lotatt17 != null and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
  463. <if test="lotattDTO.lotatt18 != null and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
  464. </if>
  465. and b.id = #{locationId}
  466. group by sk.sku
  467. </where>
  468. </select>
  469. <select id="queryInvOrderBy" parameterType="InvLotLocId" resultMap="InvLotLocIdResult">
  470. select inv.*
  471. from inv_lot_loc_id inv
  472. left join base_location_info b on inv.location_id = b.id
  473. left join inv_lot_att att on inv.lotnum = att.lotnum
  474. <where>
  475. <if test="lotnum != null and lotnum != ''"> and inv.lotnum = #{lotnum}</if>
  476. <if test="sku != null and sku != ''"> and inv.sku = #{sku}</if>
  477. <if test="location != null and location != ''"> and inv.location_id = #{location}</if>
  478. <if test="customerId != null and customerId != ''"> and inv.customer_id = #{customerId}</if>
  479. <if test="lotattDTO != null">
  480. <if test="lotattDTO.lotatt01 != null and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
  481. <if test="lotattDTO.lotatt02 != null and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
  482. <if test="lotattDTO.lotatt03 != null and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
  483. <if test="lotattDTO.lotatt04 != null and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
  484. <if test="lotattDTO.lotatt05 != null and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
  485. <if test="lotattDTO.lotatt06 != null and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
  486. <if test="lotattDTO.lotatt07 != null and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
  487. <if test="lotattDTO.lotatt08 != null and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
  488. <if test="lotattDTO.lotatt09 != null and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
  489. <if test="lotattDTO.lotatt10 != null and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
  490. <if test="lotattDTO.lotatt11 != null and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
  491. <if test="lotattDTO.lotatt12 != null and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
  492. <if test="lotattDTO.lotatt13 != null and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
  493. <if test="lotattDTO.lotatt14 != null and lotattDTO.lotatt14 != ''"> and (att.lotatt14 = #{lotattDTO.lotatt14} or att.lotatt14 is null)</if>
  494. <if test="lotattDTO.lotatt15 != null and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
  495. <if test="lotattDTO.lotatt16 != null and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
  496. <if test="lotattDTO.lotatt17 != null and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
  497. <if test="lotattDTO.lotatt18 != null and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
  498. </if>
  499. and b.stock_status = '00' and b.zone_id = '2'
  500. </where>
  501. 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
  502. </select>
  503. <select id="queryInvByInvLotatt" resultMap="InvLotLocIdResult">
  504. select li.*
  505. from inv_lot_loc_id li
  506. left join inv_lot_att att on li.lotnum = att.lotnum
  507. <where>
  508. <if test="lotattDTO != null">
  509. <if test="lotattDTO.lotatt01 != null and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
  510. <if test="lotattDTO.lotatt02 != null and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
  511. <if test="lotattDTO.lotatt03 != null and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
  512. <if test="lotattDTO.lotatt04 != null and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
  513. <if test="lotattDTO.lotatt05 != null and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
  514. <if test="lotattDTO.lotatt06 != null and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
  515. <if test="lotattDTO.lotatt07 != null and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
  516. <if test="lotattDTO.lotatt08 != null and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
  517. <if test="lotattDTO.lotatt09 != null and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
  518. <if test="lotattDTO.lotatt10 != null and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
  519. <if test="lotattDTO.lotatt11 != null and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
  520. <if test="lotattDTO.lotatt12 != null and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
  521. <if test="lotattDTO.lotatt13 != null and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
  522. <if test="lotattDTO.lotatt14 != null and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
  523. <if test="lotattDTO.lotatt15 != null and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
  524. <if test="lotattDTO.lotatt16 != null and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
  525. <if test="lotattDTO.lotatt17 != null and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
  526. <if test="lotattDTO.lotatt18 != null and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
  527. </if>
  528. </where>
  529. </select>
  530. <select id="queryInvLotattByInvLotatt" resultMap="InvLotLocIdLotattResult">
  531. select li.*,att.lotatt01,att.lotatt02,att.lotatt03,att.lotatt04,att.lotatt05,att.lotatt06,att.lotatt07,att.lotatt08,att.lotatt09
  532. ,att.lotatt10,att.lotatt11,att.lotatt12,att.lotatt13,att.lotatt14,att.lotatt15,att.lotatt16,att.lotatt17,att.lotatt18
  533. from inv_lot_loc_id li
  534. left join inv_lot_att att on li.lotnum = att.lotnum
  535. <where>
  536. <if test="lotattDTO != null">
  537. <if test="lotattDTO.lotatt01 != null and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
  538. <if test="lotattDTO.lotatt02 != null and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
  539. <if test="lotattDTO.lotatt03 != null and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
  540. <if test="lotattDTO.lotatt04 != null and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
  541. <if test="lotattDTO.lotatt05 != null and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
  542. <if test="lotattDTO.lotatt06 != null and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
  543. <if test="lotattDTO.lotatt07 != null and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
  544. <if test="lotattDTO.lotatt08 != null and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
  545. <if test="lotattDTO.lotatt09 != null and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
  546. <if test="lotattDTO.lotatt10 != null and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
  547. <if test="lotattDTO.lotatt11 != null and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
  548. <if test="lotattDTO.lotatt12 != null and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
  549. <if test="lotattDTO.lotatt13 != null and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
  550. <if test="lotattDTO.lotatt14 != null and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
  551. <if test="lotattDTO.lotatt15 != null and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
  552. <if test="lotattDTO.lotatt16 != null and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
  553. <if test="lotattDTO.lotatt17 != null and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
  554. <if test="lotattDTO.lotatt18 != null and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
  555. </if>
  556. </where>
  557. </select>
  558. <select id="queryInvByFull" resultMap="InvLotLocIdResult">
  559. select inv.*
  560. from inv_lot_loc_id inv
  561. left join inv_lot_att att on inv.lotnum = att.lotnum
  562. where att.lotatt14 = #{orderNo} and inv.sku = #{sku}
  563. </select>
  564. <delete id="unlockInv">
  565. delete from inv_lot_loc_id where location_id = #{locationId} and sku = #{sku} and customer_id = #{customerId}
  566. </delete>
  567. <select id="getQualityInspectionList" resultMap="InvLotLocIdLotattResult">
  568. select
  569. t2.lotatt01
  570. from inv_lot_loc_id t1
  571. left join inv_lot_att t2 on t2.lotnum = t1.lotnum
  572. where t2.lotatt05 = 'DJ'
  573. group by t2.lotatt01
  574. order by t2.lotatt01
  575. </select>
  576. <select id="getQualityLocationListByLotNumber" resultMap="InvLotLocIdLotattResult">
  577. select
  578. t3.location_no
  579. from inv_lot_loc_id t1
  580. left join inv_lot_att t2 on t2.lotnum = t1.lotnum
  581. left join base_location_info t3 on t3.id = t1.location_id
  582. where t2.lotatt01 = #{lotNumber} and t2.lotatt05 = 'DJ'
  583. group by t1.location_id
  584. order by t1.location_id
  585. </select>
  586. <update id="updateQualityStatusByLotNumber" parameterType="String">
  587. UPDATE inv_lot_att t1
  588. SET t1.lotatt05 = #{qualityStatus}
  589. WHERE
  590. t1.lotatt01 = #{lotNumber}
  591. AND t1.lotnum IN ( SELECT lotnum FROM inv_lot_loc_id )
  592. </update>
  593. <update id="updateAllocationBy">
  594. update inv_lot_loc_id set qtyallocated = qtyallocated + #{qty},qtyallocated_each = qtyallocated_each + #{qty}
  595. where lotnum = #{lotnum} and location_id = #{locationId}
  596. </update>
  597. <update id="updateLocation">
  598. update inv_lot_loc_id set location_id = #{toLocationId}, update_time = now()
  599. where location_id = #{fromLocationId} and location_id not in (99997, 99998, 99999)
  600. </update>
  601. <select id="querySameTypeByPalletNo" resultMap="InvLotLocIdResult">
  602. select inv.*
  603. from inv_lot_loc_id inv
  604. left join inv_lot_att att on inv.lotnum = att.lotnum
  605. left join base_sku sk on inv.sku = sk.sku
  606. where
  607. att.lotatt07 = #{palletNo} and sk.sku_type <![CDATA[ <> ]]> #{skuType}
  608. </select>
  609. <select id="selectInvLotLocIdBySkuLocationSort" resultMap="InvLotLocIdResult">
  610. select *,(qtyallocated - qty) qty from inv_lot_loc_id
  611. <where>
  612. <if test="locationId != null and locationId != ''"> and location_id = #{locationId}</if>
  613. <if test="sku != null and sku != ''"> and sku = #{sku}</if>
  614. </where>
  615. order by (qtyallocated - qty)
  616. </select>
  617. </mapper>