InvLotLocIdMapper.xml 43 KB

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