123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper
- PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.ruoyi.ams.inv.mapper.InvLotLocIdMapper">
- <resultMap type="InvLotLocId" id="InvLotLocIdResult">
- <result property="lotnum" column="lotnum" />
- <result property="locationId" column="location_id" />
- <result property="traceid" column="traceid" />
- <result property="customerId" column="customer_id" />
- <result property="sku" column="sku" />
- <result property="qty" column="qty" />
- <result property="qtyEach" column="qty_each" />
- <result property="qtyallocated" column="qtyallocated" />
- <result property="qtyallocatedEach" column="qtyallocated_each" />
- <result property="qtypa" column="qtypa" />
- <result property="qtyrpin" column="qtyrpin" />
- <result property="qtyrpout" column="qtyrpout" />
- <result property="qtymvin" column="qtymvin" />
- <result property="qtymvout" column="qtymvout" />
- <result property="qtyonhold" column="qtyonhold" />
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
- <result property="remark" column="remark" />
- </resultMap>
- <resultMap type="invLotLocIdLotattVO" id="InvLotLocIdLotattResult">
- <result property="lotnum" column="lotnum" />
- <result property="locationNo" column="location_no" />
- <result property="locationId" column="location_id" />
- <result property="zoneName" column="zone_name" />
- <result property="customerId" column="customer_id" />
- <result property="sku" column="sku" />
- <result property="skuName" column="sku_name" />
- <result property="skuTypeName" column="sku_type_name" />
- <result property="qty" column="qty" />
- <result property="qtyallocated" column="qtyallocated" />
- <result property="palletNo" column="box_no" />
- <result property="isFull" column="is_full" />
- <result property="lotnum" column="lotnum" />
- <result property="lotatt01" column="lotatt01" />
- <result property="lotatt02" column="lotatt02" />
- <result property="lotatt03" column="lotatt03" />
- <result property="lotatt04" column="lotatt04" />
- <result property="lotatt05" column="lotatt05" />
- <result property="lotatt06" column="lotatt06" />
- <result property="lotatt07" column="lotatt07" />
- <result property="lotatt08" column="lotatt08" />
- <result property="lotatt09" column="lotatt09" />
- <result property="lotatt10" column="lotatt10" />
- <result property="lotatt11" column="lotatt11" />
- <result property="lotatt12" column="lotatt12" />
- <result property="lotatt13" column="lotatt13" />
- <result property="lotatt14" column="lotatt14" />
- <result property="lotatt15" column="lotatt15" />
- <result property="lotatt16" column="lotatt16" />
- <result property="lotatt17" column="lotatt17" />
- <result property="lotatt18" column="lotatt18" />
- </resultMap>
- <resultMap type="BaseLocationLotattVO" id="BaseLocationInfoLotattResult">
- <result property="id" column="id" />
- <result property="warehouseId" column="warehouse_id" />
- <result property="zoneId" column="zone_id" />
- <result property="locationNo" column="location_no" />
- <result property="locationBarcode" column="location_barcode" />
- <result property="rowNo" column="row_no" />
- <result property="rowIndex" column="row_index" />
- <result property="colNo" column="col_no" />
- <result property="colIndex" column="col_index" />
- <result property="shiftNo" column="shift_no" />
- <result property="shiftIndex" column="shift_index" />
- <result property="stockStatus" column="stock_status" />
- <result property="isEmpty" column="is_empty" />
- <result property="bindSku" column="bind_sku" />
- <result property="locationType" column="location_type" />
- <result property="rackId" column="rack_id" />
- <result property="agvStation" column="agv_station" />
- <result property="foldedTag" column="folded_tag" />
- <result property="foldedCount" column="folded_count" />
- <result property="userdefine1" column="userdefine1" />
- <result property="userdefine2" column="userdefine2" />
- <result property="userdefine3" column="userdefine3" />
- <result property="userdefine4" column="userdefine4" />
- <result property="userdefine5" column="userdefine5" />
- <result property="userdefine6" column="userdefine6" />
- <result property="userdefine7" column="userdefine7" />
- <result property="userdefine8" column="userdefine8" />
- <result property="userdefine9" column="userdefine9" />
- <result property="userdefine10" column="userdefine10" />
- <result property="createBy" column="create_by" />
- <result property="createTime" column="create_time" />
- <result property="updateBy" column="update_by" />
- <result property="updateTime" column="update_time" />
- <result property="remark" column="remark" />
- <result property="sku" column="sku" />
- <result property="qty" column="qty" />
- <result property="lotattVO.lotatt01" column="lotatt01" />
- <result property="lotattVO.lotatt02" column="lotatt02" />
- <result property="lotattVO.lotatt03" column="lotatt03" />
- <result property="lotattVO.lotatt04" column="lotatt04" />
- <result property="lotattVO.lotatt05" column="lotatt05" />
- <result property="lotattVO.lotatt06" column="lotatt06" />
- <result property="lotattVO.lotatt07" column="lotatt07" />
- <result property="lotattVO.lotatt08" column="lotatt08" />
- <result property="lotattVO.lotatt09" column="lotatt09" />
- <result property="lotattVO.lotatt10" column="lotatt10" />
- <result property="lotattVO.lotatt11" column="lotatt11" />
- <result property="lotattVO.lotatt12" column="lotatt12" />
- <result property="lotattVO.lotatt13" column="lotatt13" />
- <result property="lotattVO.lotatt14" column="lotatt14" />
- <result property="lotattVO.lotatt15" column="lotatt15" />
- <result property="lotattVO.lotatt16" column="lotatt16" />
- <result property="lotattVO.lotatt17" column="lotatt17" />
- <result property="lotattVO.lotatt18" column="lotatt18" />
- </resultMap>
- <sql id="selectInvLotLocIdVo">
- 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
- </sql>
- <select id="selectInvLotLocIdList" parameterType="InvLotLocId" resultMap="InvLotLocIdResult">
- <include refid="selectInvLotLocIdVo"/>
- <where>
- <if test="locationId != null and locationId != ''"> and location_id = #{locationId}</if>
- <if test="customerId != null and customerId != ''"> and customer_id = #{customerId}</if>
- <if test="sku != null and sku != ''"> and sku = #{sku}</if>
- <if test="lotnum != null and lotnum != ''"> and lotnum = #{lotnum}</if>
- <if test="traceid != null and traceid != ''"> and traceid = #{traceid}</if>
- </where>
- </select>
- <select id="selectInvLotLocIdByLotnum" parameterType="String" resultMap="InvLotLocIdResult">
- <include refid="selectInvLotLocIdVo"/>
- where lotnum = #{lotnum}
- </select>
- <select id="selectInvLotLocIdByKey" resultMap="InvLotLocIdResult">
- <include refid="selectInvLotLocIdVo"/>
- where lotnum = #{lotnum} and location_id = #{locationId} and customer_id = #{customerId} and sku = #{sku}
- </select>
- <select id="queryById" parameterType="InvLotLocId" resultMap="InvLotLocIdResult">
- <include refid="selectInvLotLocIdVo"/>
- where lotnum = #{lotnum}
- and location_id = #{location}
- and customer_id = #{customerId}
- and sku = #{sku}
- </select>
- <insert id="insertInvLotLocId" parameterType="InvLotLocId">
- insert into inv_lot_loc_id
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="lotnum != null">lotnum,</if>
- <if test="locationId != null">location_id,</if>
- <if test="traceid != null">traceid,</if>
- <if test="customerId != null">customer_id,</if>
- <if test="sku != null">sku,</if>
- <if test="qty != null">qty,</if>
- <if test="qtyEach != null">qty_each,</if>
- <if test="qtyallocated != null">qtyallocated,</if>
- <if test="qtyallocatedEach != null">qtyallocated_each,</if>
- <if test="qtypa != null">qtypa,</if>
- <if test="qtyrpin != null">qtyrpin,</if>
- <if test="qtyrpout != null">qtyrpout,</if>
- <if test="qtymvin != null">qtymvin,</if>
- <if test="qtymvout != null">qtymvout,</if>
- <if test="qtyonhold != null">qtyonhold,</if>
- <if test="createBy != null">create_by,</if>
- <if test="createTime != null">create_time,</if>
- <if test="updateBy != null">update_by,</if>
- <if test="updateTime != null">update_time,</if>
- <if test="remark != null">remark,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="lotnum != null">#{lotnum},</if>
- <if test="locationId != null">#{locationId},</if>
- <if test="traceid != null">#{traceid},</if>
- <if test="customerId != null">#{customerId},</if>
- <if test="sku != null">#{sku},</if>
- <if test="qty != null">#{qty},</if>
- <if test="qtyEach != null">#{qtyEach},</if>
- <if test="qtyallocated != null">#{qtyallocated},</if>
- <if test="qtyallocatedEach != null">#{qtyallocatedEach},</if>
- <if test="qtypa != null">#{qtypa},</if>
- <if test="qtyrpin != null">#{qtyrpin},</if>
- <if test="qtyrpout != null">#{qtyrpout},</if>
- <if test="qtymvin != null">#{qtymvin},</if>
- <if test="qtymvout != null">#{qtymvout},</if>
- <if test="qtyonhold != null">#{qtyonhold},</if>
- <if test="createBy != null">#{createBy},</if>
- <if test="createTime != null">#{createTime},</if>
- <if test="updateBy != null">#{updateBy},</if>
- <if test="updateTime != null">#{updateTime},</if>
- <if test="remark != null">#{remark},</if>
- </trim>
- </insert>
- <update id="updateInvLotLocId" parameterType="InvLotLocId">
- update inv_lot_loc_id
- <trim prefix="SET" suffixOverrides=",">
- <if test="lotnumTo != null">lotnum = #{lotnumTo},</if>
- <if test="locationId != null">location_id = #{locationId},</if>
- <if test="traceid != null">traceid = #{traceid},</if>
- <if test="customerId != null">customer_id = #{customerId},</if>
- <if test="sku != null">sku = #{sku},</if>
- <if test="qty != null">qty = #{qty},</if>
- <if test="qtyEach != null">qty_each = #{qtyEach},</if>
- <if test="qtyallocated != null">qtyallocated = #{qtyallocated},</if>
- <if test="qtyallocatedEach != null">qtyallocated_each = #{qtyallocatedEach},</if>
- <if test="qtypa != null">qtypa = #{qtypa},</if>
- <if test="qtyrpin != null">qtyrpin = #{qtyrpin},</if>
- <if test="qtyrpout != null">qtyrpout = #{qtyrpout},</if>
- <if test="qtymvin != null">qtymvin = #{qtymvin},</if>
- <if test="qtymvout != null">qtymvout = #{qtymvout},</if>
- <if test="qtyonhold != null">qtyonhold = #{qtyonhold},</if>
- <if test="createBy != null">create_by = #{createBy},</if>
- <if test="createTime != null">create_time = #{createTime},</if>
- <if test="updateBy != null">update_by = #{updateBy},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="remark != null">remark = #{remark},</if>
- </trim>
- where lotnum = #{lotnum}
- and location_id = #{locationId}
- and customer_id = #{customerId}
- and sku = #{sku}
- </update>
- <delete id="deleteInvLotLocIdByLotnum" parameterType="String">
- delete from inv_lot_loc_id where lotnum = #{lotnum}
- </delete>
- <delete id="deleteInvLotLocIdBy">
- delete from inv_lot_loc_id
- where lotnum = #{lotnum} and sku = #{sku} and location_id = #{locationId} and customer_id = #{customerId}
- </delete>
- <delete id="deleteInvLotLocIdByLotnums" parameterType="String">
- delete from inv_lot_loc_id where lotnum in
- <foreach item="lotnum" collection="array" open="(" separator="," close=")">
- #{lotnum}
- </foreach>
- </delete>
- <select id="selectInvLocationList" resultMap="BaseLocationInfoLotattResult">
- select
- 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,
- 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,
- b.userdefine1, b.userdefine2, b.userdefine3, b.userdefine4, b.userdefine5, b.userdefine6, b.userdefine7, b.userdefine8,
- b.userdefine9, b.userdefine10, b.create_by, b.create_time, b.update_by, b.update_time, b.remark, inv.sku, inv.qty, att.*
- from inv_lot_loc_id inv
- left join inv_lot_att att on inv.lotnum = att.lotnum
- left join base_location_info b on inv.location_id = b.id
- left join base_sku sk on inv.sku = sk.sku
- left join base_sku_type skt on sk.sku_type = skt.item_code
- <where>
- <if test="zoneId != null and zoneId != ''"> and b.zone_id = #{zoneId}</if>
- <if test="sku != null and sku != ''"> and sk.sku = #{sku}</if>
- <if test="skuType != null and skuType != ''"> and skt.item_code = #{skuType}</if>
- </where>
- 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
- </select>
- <select id="selectInvZoneBySkuLotatt" resultMap="BaseLocationInfoLotattResult">
- select
- b.zone_id
- from inv_lot_loc_id inv
- left join inv_lot_att att on inv.lotnum = att.lotnum
- left join base_location_info b on inv.location_id = b.id
- left join base_sku sk on inv.sku = sk.sku
- left join base_sku_type skt on sk.sku_type = skt.item_code
- left join base_location_zone bz on b.zone_id = bz.zone_id
- <where>
- <if test="sku != null and sku != ''"> and sk.sku = #{sku}</if>
- <if test="skuType != null and skuType != ''"> and skt.item_code = #{skuType}</if>
- <if test="lotattDTO != null">
- <if test="lotattDTO.lotatt01 != null and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
- <if test="lotattDTO.lotatt02 != null and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
- <if test="lotattDTO.lotatt03 != null and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
- <if test="lotattDTO.lotatt04 != null and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
- <if test="lotattDTO.lotatt05 != null and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
- <if test="lotattDTO.lotatt06 != null and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
- <if test="lotattDTO.lotatt07 != null and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
- <if test="lotattDTO.lotatt08 != null and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
- <if test="lotattDTO.lotatt09 != null and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
- <if test="lotattDTO.lotatt10 != null and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
- <if test="lotattDTO.lotatt11 != null and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
- <if test="lotattDTO.lotatt12 != null and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
- <if test="lotattDTO.lotatt13 != null and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
- <if test="lotattDTO.lotatt14 != null and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
- <if test="lotattDTO.lotatt15 != null and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
- <if test="lotattDTO.lotatt16 != null and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
- <if test="lotattDTO.lotatt17 != null and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
- <if test="lotattDTO.lotatt18 != null and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
- </if>
- </where>
- and bz.userdefine1 = 'INV'
- </select>
- <select id="selectInvLocIdLotattListGroupBy" resultMap="InvLotLocIdLotattResult">
- select
- att.lotatt01
- from inv_lot_loc_id inv
- left join inv_lot_att att on inv.lotnum = att.lotnum
- left join base_location_info b on inv.location_id = b.id
- left join base_location_zone z on b.zone_id = z.zone_id
- left join base_sku sk on inv.sku = sk.sku
- <where>
- 1=1
- <if test="zoneId != null and zoneId != ''"> and b.zone_id = #{zoneId}</if>
- </where>
- group by att.lotatt01
- order by att.lotatt01
- </select>
- <select id="selectInvLocIdLotattList" resultMap="InvLotLocIdLotattResult">
- select
- inv.location_id,sk.sku,sk.desc1 sku_name,skt.item_name sku_type_name,b.location_no,inv.qty,inv.qtyallocated
- ,att.lotnum, att.customer_id,w.box_no,w.is_full,z.zone_name
- ,lotatt01, lotatt02, lotatt03, lotatt04,lot05_dict.dict_label lotatt05, supp.supplier_name lotatt06
- ,lotatt07, lotatt08, lotatt09, lotatt10, lotatt11, lotatt12, lotatt13, lotatt14, lotatt15, lotatt16, lotatt17
- ,lotatt18
- from inv_lot_loc_id inv
- left join inv_lot_att att on inv.lotnum = att.lotnum
- left join base_location_info b on inv.location_id = b.id
- left join base_location_zone z on b.zone_id = z.zone_id
- left join base_sku sk on inv.sku = sk.sku
- left join base_sku_type skt on sk.sku_type = skt.item_code
- 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
- left join (select * from base_supplier) supp on att.lotatt06 = supp.supplier_id
- left join (SELECT * from wms_box_info where location_id not in('99997','99998','99999')) w on inv.location_id = w.location_id
- <where>
- <if test="zoneId != null and zoneId != ''"> and b.zone_id = #{zoneId}</if>
- <if test="sku != null and sku != ''"> and (sk.sku like concat('%', #{sku}, '%') or sk.desc1 like concat('%', #{sku}, '%'))</if>
- <if test="locationNo != null and locationNo != ''"> and b.location_no like concat('%', #{locationNo}, '%')</if>
- <if test="isFull != null and isFull != ''"> and w.is_full = #{isFull}</if>
- <if test="lotattDTO != null">
- <if test="lotattDTO.lotatt01 != null and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
- <if test="lotattDTO.lotatt02 != null and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
- <if test="lotattDTO.lotatt03 != null and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
- <if test="lotattDTO.lotatt04 != null and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
- <if test="lotattDTO.lotatt05 != null and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
- <if test="lotattDTO.lotatt06 != null and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
- <if test="lotattDTO.lotatt07 != null and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
- <if test="lotattDTO.lotatt08 != null and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
- <if test="lotattDTO.lotatt09 != null and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
- <if test="lotattDTO.lotatt10 != null and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
- <if test="lotattDTO.lotatt11 != null and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
- <if test="lotattDTO.lotatt12 != null and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
- <if test="lotattDTO.lotatt13 != null and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
- <if test="lotattDTO.lotatt14 != null and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
- <if test="lotattDTO.lotatt15 != null and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
- <if test="lotattDTO.lotatt16 != null and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
- <if test="lotattDTO.lotatt17 != null and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
- <if test="lotattDTO.lotatt18 != null and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
- </if>
- </where>
- 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
- </select>
- <select id="selectInvLocIdLotattByLocationId" resultMap="InvLotLocIdLotattResult">
- select
- inv.location_id,sk.sku,sk.desc1 sku_name,b.location_no,inv.qty,inv.qtyallocated
- ,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
- from inv_lot_loc_id inv
- left join inv_lot_att att on inv.lotnum = att.lotnum
- left join base_location_info b on inv.location_id = b.id
- left join base_sku sk on inv.sku = sk.sku
- left join base_sku_type skt on sk.sku_type = skt.item_code
- left join (select dict_value,dict_label from sys_dict_data where dict_type = 'ams_inv_quality') qua on att.lotatt05 = qua.dict_value
- where inv.location_id = #{locationId}
- </select>
- <delete id="deleteInvLotLocIdByLocationId" parameterType="Long">
- delete from inv_lot_loc_id where location_id = #{locationId}
- </delete>
- <delete id="deleteInvLotLocIdByPrimaryKey" parameterType="object">
- delete from inv_lot_loc_id
- where lotnum = #{lotnum}
- and location_id = #{locationId}
- and customer_id = #{customerId}
- and sku = #{sku}
- </delete>
- <update id="updateInvLotLocIdLocationId">
- update inv_lot_loc_id set location_id = #{locationTo}
- where location_id = #{locationFrom}
- </update>
- <update id="moveInvByLocationId" parameterType="Object">
- update inv_lot_loc_id
- set location_id = #{locationTo},traceid = #{traceid}
- where location_id = #{locationFrom}
- </update>
- <update id="moveInvByTraceId" parameterType="Object">
- update inv_lot_loc_id
- set location_id = #{locationTo}
- where location_id = #{locationFrom} and traceid = #{traceid}
- </update>
- <update id="updateInvLotLocIdLotnum">
- update inv_lot_loc_id set location_id = #{locationTo}
- where location_id = #{locationFrom} and lotnum = #{lotnum}
- </update>
- <update id="updateInvLotLocIdToByLotnum">
- update inv_lot_loc_id set location_id = #{locationTo}
- where lotnum = #{lotnum}
- and location_id = #{locationId}
- and customer_id = #{customerId}
- and sku = #{sku}
- </update>
- <update id="clearInvByLocationId">
- delete from inv_lot_loc_id where location_id = #{locationId}
- </update>
- <select id="queryInvBySku" resultType="double">
- select
- sum(inv.qty) qty
- from inv_lot_loc_id inv
- left join inv_lot_att att on inv.lotnum = att.lotnum
- left join base_location_info b on inv.location_id = b.id
- left join base_sku sk on inv.sku = sk.sku
- left join base_sku_type skt on sk.sku_type = skt.item_code
- left join base_location_zone bz on b.zone_id = bz.zone_id
- <where>
- <if test="sku != null and sku != ''"> and sk.sku = #{sku}</if>
- <if test="lotattDTO != null">
- <if test="lotattDTO.lotatt01 != null and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
- <if test="lotattDTO.lotatt02 != null and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
- <if test="lotattDTO.lotatt03 != null and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
- <if test="lotattDTO.lotatt04 != null and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
- <if test="lotattDTO.lotatt05 != null and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
- <if test="lotattDTO.lotatt06 != null and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
- <if test="lotattDTO.lotatt07 != null and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
- <if test="lotattDTO.lotatt08 != null and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
- <if test="lotattDTO.lotatt09 != null and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
- <if test="lotattDTO.lotatt10 != null and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
- <if test="lotattDTO.lotatt11 != null and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
- <if test="lotattDTO.lotatt12 != null and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
- <if test="lotattDTO.lotatt13 != null and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
- <if test="lotattDTO.lotatt14 != null and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
- <if test="lotattDTO.lotatt15 != null and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
- <if test="lotattDTO.lotatt16 != null and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
- <if test="lotattDTO.lotatt17 != null and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
- <if test="lotattDTO.lotatt18 != null and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
- </if>
- and bz.zone_id in
- <foreach item="item" index="index" collection="zoneIdList" open="(" separator="," close=" )">
- #{item}
- </foreach>
- group by sk.sku
- </where>
- </select>
- <select id="queryInvBySkuLocationId" resultType="double">
- select
- sum(inv.qty) qty
- from inv_lot_loc_id inv
- left join inv_lot_att att on inv.lotnum = att.lotnum
- left join base_location_info b on inv.location_id = b.id
- left join base_sku sk on inv.sku = sk.sku
- left join base_sku_type skt on sk.sku_type = skt.item_code
- left join base_location_zone bz on b.zone_id = bz.zone_id
- <where>
- <if test="sku != null and sku != ''"> and sk.sku = #{sku}</if>
- <if test="lotattDTO != null">
- <if test="lotattDTO.lotatt01 != null and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
- <if test="lotattDTO.lotatt02 != null and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
- <if test="lotattDTO.lotatt03 != null and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
- <if test="lotattDTO.lotatt04 != null and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
- <if test="lotattDTO.lotatt05 != null and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
- <if test="lotattDTO.lotatt06 != null and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
- <if test="lotattDTO.lotatt07 != null and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
- <if test="lotattDTO.lotatt08 != null and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
- <if test="lotattDTO.lotatt09 != null and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
- <if test="lotattDTO.lotatt10 != null and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
- <if test="lotattDTO.lotatt11 != null and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
- <if test="lotattDTO.lotatt12 != null and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
- <if test="lotattDTO.lotatt13 != null and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
- <if test="lotattDTO.lotatt14 != null and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
- <if test="lotattDTO.lotatt15 != null and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
- <if test="lotattDTO.lotatt16 != null and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
- <if test="lotattDTO.lotatt17 != null and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
- <if test="lotattDTO.lotatt18 != null and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
- </if>
- and b.id = #{locationId}
- group by sk.sku
- </where>
- </select>
- <select id="queryInvOrderBy" parameterType="InvLotLocId" resultMap="InvLotLocIdResult">
- select inv.*
- from inv_lot_loc_id inv
- left join base_location_info b on inv.location_id = b.id
- left join inv_lot_att att on inv.lotnum = att.lotnum
- <where>
- <if test="lotnum != null and lotnum != ''"> and inv.lotnum = #{lotnum}</if>
- <if test="sku != null and sku != ''"> and inv.sku = #{sku}</if>
- <if test="location != null and location != ''"> and inv.location_id = #{location}</if>
- <if test="customerId != null and customerId != ''"> and inv.customer_id = #{customerId}</if>
- <if test="lotattDTO != null">
- <if test="lotattDTO.lotatt01 != null and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
- <if test="lotattDTO.lotatt02 != null and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
- <if test="lotattDTO.lotatt03 != null and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
- <if test="lotattDTO.lotatt04 != null and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
- <if test="lotattDTO.lotatt05 != null and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
- <if test="lotattDTO.lotatt06 != null and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
- <if test="lotattDTO.lotatt07 != null and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
- <if test="lotattDTO.lotatt08 != null and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
- <if test="lotattDTO.lotatt09 != null and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
- <if test="lotattDTO.lotatt10 != null and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
- <if test="lotattDTO.lotatt11 != null and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
- <if test="lotattDTO.lotatt12 != null and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
- <if test="lotattDTO.lotatt13 != null and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
- <if test="lotattDTO.lotatt14 != null and lotattDTO.lotatt14 != ''"> and (att.lotatt14 = #{lotattDTO.lotatt14} or att.lotatt14 is null)</if>
- <if test="lotattDTO.lotatt15 != null and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
- <if test="lotattDTO.lotatt16 != null and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
- <if test="lotattDTO.lotatt17 != null and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
- <if test="lotattDTO.lotatt18 != null and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
- </if>
- and b.stock_status = '00' and b.zone_id = '2'
- </where>
- 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
- </select>
- <select id="queryInvByInvLotatt" resultMap="InvLotLocIdResult">
- select li.*
- from inv_lot_loc_id li
- left join inv_lot_att att on li.lotnum = att.lotnum
- <where>
- <if test="lotattDTO != null">
- <if test="lotattDTO.lotatt01 != null and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
- <if test="lotattDTO.lotatt02 != null and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
- <if test="lotattDTO.lotatt03 != null and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
- <if test="lotattDTO.lotatt04 != null and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
- <if test="lotattDTO.lotatt05 != null and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
- <if test="lotattDTO.lotatt06 != null and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
- <if test="lotattDTO.lotatt07 != null and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
- <if test="lotattDTO.lotatt08 != null and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
- <if test="lotattDTO.lotatt09 != null and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
- <if test="lotattDTO.lotatt10 != null and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
- <if test="lotattDTO.lotatt11 != null and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
- <if test="lotattDTO.lotatt12 != null and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
- <if test="lotattDTO.lotatt13 != null and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
- <if test="lotattDTO.lotatt14 != null and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
- <if test="lotattDTO.lotatt15 != null and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
- <if test="lotattDTO.lotatt16 != null and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
- <if test="lotattDTO.lotatt17 != null and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
- <if test="lotattDTO.lotatt18 != null and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
- </if>
- </where>
- </select>
- <select id="queryInvLotattByInvLotatt" resultMap="InvLotLocIdLotattResult">
- select li.*,att.lotatt01,att.lotatt02,att.lotatt03,att.lotatt04,att.lotatt05,att.lotatt06,att.lotatt07,att.lotatt08,att.lotatt09
- ,att.lotatt10,att.lotatt11,att.lotatt12,att.lotatt13,att.lotatt14,att.lotatt15,att.lotatt16,att.lotatt17,att.lotatt18
- from inv_lot_loc_id li
- left join inv_lot_att att on li.lotnum = att.lotnum
- <where>
- <if test="lotattDTO != null">
- <if test="lotattDTO.lotatt01 != null and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
- <if test="lotattDTO.lotatt02 != null and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
- <if test="lotattDTO.lotatt03 != null and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
- <if test="lotattDTO.lotatt04 != null and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
- <if test="lotattDTO.lotatt05 != null and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
- <if test="lotattDTO.lotatt06 != null and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
- <if test="lotattDTO.lotatt07 != null and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
- <if test="lotattDTO.lotatt08 != null and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
- <if test="lotattDTO.lotatt09 != null and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
- <if test="lotattDTO.lotatt10 != null and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
- <if test="lotattDTO.lotatt11 != null and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
- <if test="lotattDTO.lotatt12 != null and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
- <if test="lotattDTO.lotatt13 != null and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
- <if test="lotattDTO.lotatt14 != null and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
- <if test="lotattDTO.lotatt15 != null and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
- <if test="lotattDTO.lotatt16 != null and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
- <if test="lotattDTO.lotatt17 != null and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
- <if test="lotattDTO.lotatt18 != null and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
- </if>
- </where>
- </select>
- <select id="queryInvByFull" resultMap="InvLotLocIdResult">
- select inv.*
- from inv_lot_loc_id inv
- left join inv_lot_att att on inv.lotnum = att.lotnum
- where att.lotatt14 = #{orderNo} and inv.sku = #{sku}
- </select>
- <delete id="unlockInv">
- delete from inv_lot_loc_id where location_id = #{locationId} and sku = #{sku} and customer_id = #{customerId}
- </delete>
- <select id="getQualityInspectionList" resultMap="InvLotLocIdLotattResult">
- select
- t2.lotatt01
- from inv_lot_loc_id t1
- left join inv_lot_att t2 on t2.lotnum = t1.lotnum
- where t2.lotatt05 = 'DJ'
- group by t2.lotatt01
- order by t2.lotatt01
- </select>
- <select id="getQualityLocationListByLotNumber" resultMap="InvLotLocIdLotattResult">
- select
- t3.location_no
- from inv_lot_loc_id t1
- left join inv_lot_att t2 on t2.lotnum = t1.lotnum
- left join base_location_info t3 on t3.id = t1.location_id
- where t2.lotatt01 = #{lotNumber} and t2.lotatt05 = 'DJ'
- group by t1.location_id
- order by t1.location_id
- </select>
- <update id="updateQualityStatusByLotNumber" parameterType="String">
- UPDATE inv_lot_att t1
- SET t1.lotatt05 = #{qualityStatus}
- WHERE
- t1.lotatt01 = #{lotNumber}
- AND t1.lotnum IN ( SELECT lotnum FROM inv_lot_loc_id )
- </update>
- <update id="updateAllocationBy">
- update inv_lot_loc_id set qtyallocated = qtyallocated + #{qty},qtyallocated_each = qtyallocated_each + #{qty}
- where lotnum = #{lotnum} and location_id = #{locationId}
- </update>
- <update id="updateLocation">
- update inv_lot_loc_id set location_id = #{toLocationId}, update_time = now()
- where location_id = #{fromLocationId} and location_id not in (99997, 99998, 99999)
- </update>
- <select id="querySameTypeByPalletNo" resultMap="InvLotLocIdResult">
- select inv.*
- from inv_lot_loc_id inv
- left join inv_lot_att att on inv.lotnum = att.lotnum
- left join base_sku sk on inv.sku = sk.sku
- where
- att.lotatt07 = #{palletNo} and sk.sku_type <![CDATA[ <> ]]> #{skuType}
- </select>
- <select id="selectInvLotLocIdBySkuLocationSort" resultMap="InvLotLocIdResult">
- select *,(qtyallocated - qty) qty from inv_lot_loc_id
- <where>
- <if test="locationId != null and locationId != ''"> and location_id = #{locationId}</if>
- <if test="sku != null and sku != ''"> and sku = #{sku}</if>
- </where>
- order by (qtyallocated - qty)
- </select>
- </mapper>
|