Files
FT546MWS/ruoyi-admin/src/main/resources/mapper/stock/BasStockMapper.xml

745 lines
39 KiB
XML

<?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.stock.stock.mapper.BasStockMapper">
<resultMap type="BasStock" id="BasStockResult">
<result property="stockId" column="stock_id"/>
<result property="cargoSpaceId" column="cargo_space_id"/>
<result property="stockStatus" column="stock_status"/>
<result property="productStatus" column="product_status"/>
<result property="lotNo" column="lot_no"/>
<result property="inDate" column="in_date"/>
<result property="backDate" column="back_date"/>
<result property="productGuid" column="product_guid"/>
<result property="quantity" column="quantity"/>
<result property="jobId" column="job_id"/>
<result property="trayCode" column="tray_code"/>
<result property="outQuantity" column="out_quantity"/>
<result property="stockinDetailId" column="stockin_detail_id"/>
<result property="stockinId" column="stockin_id"/>
<result property="inType" column="in_type"/>
<result property="inClassId" column="in_class_id"/>
<result property="warehouseId" column="warehouse_id"/>
<result property="stackingId" column="stacking_id"/>
<result property="spare1" column="spare1"/>
<result property="spare2" column="spare2"/>
<result property="spare3" column="spare3"/>
<result property="spare4" column="spare4"/>
<result property="spare5" column="spare5"/>
<result property="spare6" column="spare6"/>
<result property="voltage" column="voltage"/>
<result property="power" column="power"/>
<result property="phase" column="phase"/>
<result property="netWeight" column="net_weight"/>
<result property="grossWeight" column="gross_weight"/>
<result property="distribution" column="distribution"/>
<result property="model" column="model"/>
<result property="orderId" column="order_id"/>
<result property="cargoSpaceStatus" column="locked"/>
<result property="cargoSpaceStockStatus" column="cargoSpaceStockStatus"/>
<result property="warehouseName" column="warehouse_name"/>
<result property="cargoSpaceName" column="cargo_space_name"/>
<result property="productId" column="product_id"/>
<result property="productName" column="product_name"/>
<association property="extraField" javaType="ExtraField">
<result property="productId" column="product_id"/>
<result property="materialDesc" column="product_name"/>
<result property="englishDesc" column="englishDesc"/>
<result property="length" column="length"/>
<result property="width" column="width"/>
<result property="height" column="height"/>
<result property="volume" column="volume"/>
<result property="netWeight" column="netWeight"/>
</association>
</resultMap>
<sql id="selectBasStockVo">
select bs.stock_id,
bs.cargo_space_id,
bs.stock_status,
bs.product_status,
bs.lot_no,
bs.in_date,
bs.back_date,
bs.product_guid,
bs.quantity,
bs.job_id,
bs.tray_code,
bs.out_quantity,
bs.stockin_detail_id,
bs.stockin_id,
bs.in_type,
bs.in_class_id,
bs.warehouse_id,
bs.stacking_id,
bs.spare1,
bs.spare2,
bs.spare3,
bs.spare4,
bs.spare5,
bs.spare6,
bs.voltage,
bs.power,
bs.phase,
bs.net_weight,
bs.gross_weight,
bs.distribution,
bs.model,
bs.order_id,
bs.product_name,
bp.spare1 as englishDesc,
bp.spare2 as netWeight,
bp.spare5 as length,
bp.spare6 as width,
bp.spare7 as height,
bp.spare8 as volume,
bw.warehouse_name,
bs.product_id,
bcs.locked,
bcs.cargo_space_name,
bcs.status as cargoSpaceStockStatus
from bas_stock bs
left join bas_product bp on bs.product_id = bp.product_id
left join bas_warehouse bw on bs.warehouse_id = bw.warehouse_id
left join bas_cargo_space bcs on bs.cargo_space_id = bcs.cargo_space_id
</sql>
<select id="selectBasStockList" parameterType="BasStock" resultMap="BasStockResult">
<include refid="selectBasStockVo"/>
<where>
<if test="stockId != null and stockId != ''">and bs.stock_id like concat('%', #{stockId}, '%')</if>
<if test="cargoSpaceId != null and cargoSpaceId != ''">and bs.cargo_space_id like concat('%',
#{cargoSpaceId}, '%')
</if>
<if test="cargoSpaceName != null and cargoSpaceName != ''">and bcs.cargo_space_name like concat('%',
#{cargoSpaceName}, '%')
</if>
<if test="stockStatus != null and stockStatus != ''">and bs.stock_status like concat('%', #{stockStatus},
'%')
</if>
<if test="productStatus != null and productStatus != ''">and bs.product_status like concat('%',
#{productStatus}, '%')
</if>
<if test="lotNo != null and lotNo != ''">and bs.lot_no like concat('%', #{lotNo}, '%')</if>
<if test="inDate != null and inDate != ''">and bs.in_date like concat('%', #{inDate}, '%')</if>
<if test="backDate != null and backDate != ''">and bs.back_date like concat('%', #{backDate}, '%')</if>
<if test="productGuid != null and productGuid != ''">and bs.product_guid like concat('%', #{productGuid},
'%')
</if>
<if test="productName != null and productName != ''">and bs.product_name like concat('%', #{productName},
'%')
</if>
<if test="quantity != null and quantity != ''">and bs.quantity like concat('%', #{quantity}, '%')</if>
<if test="jobId != null and jobId != ''">and bs.job_id like concat('%', #{jobId}, '%')</if>
<if test="trayCode != null and trayCode != ''">and bs.tray_code like concat('%', #{trayCode}, '%')</if>
<if test="outQuantity != null and outQuantity != ''">and bs.out_quantity like concat('%', #{outQuantity},
'%')
</if>
<if test="stockinDetailId != null and stockinDetailId != ''">and bs.stockin_detail_id like concat('%',
#{stockinDetailId}, '%')
</if>
<if test="stockinId != null and stockinId != ''">and bs.stockin_id like concat('%', #{stockinId}, '%')</if>
<if test="inType != null and inType != ''">and bs.in_type like concat('%', #{inType}, '%')</if>
<if test="inClassId != null and inClassId != ''">and bs.in_class_id like concat('%', #{inClassId}, '%')
</if>
<if test="warehouseId != null and warehouseId != ''">and bs.warehouse_id like concat('%', #{warehouseId},
'%')
</if>
<if test="stackingId != null and stackingId != ''">and bs.stacking_id like concat('%', #{stackingId},
'%')
</if>
<if test="spare1 != null and spare1 != ''">and bs.spare1 like concat('%', #{spare1}, '%')</if>
<if test="spare2 != null and spare2 != ''">and bs.spare2 like concat('%', #{spare2}, '%')</if>
<if test="spare3 != null and spare3 != ''">and bs.spare3 like concat('%', #{spare3}, '%')</if>
<if test="spare4 != null and spare4 != ''">and bs.spare4 like concat('%', #{spare4}, '%')</if>
<if test="spare5 != null and spare5 != ''">and bs.spare5 like concat('%', #{spare5}, '%')</if>
<if test="spare6 != null and spare6 != ''">and bs.spare6 like concat('%', #{spare6}, '%')</if>
<if test="voltage != null and voltage != ''">and bs.voltage like concat('%', #{voltage}, '%')</if>
<if test="power != null and power != ''">and bs.power like concat('%', #{power}, '%')</if>
<if test="phase != null and phase != ''">and bs.phase like concat('%', #{phase}, '%')</if>
<if test="netWeight != null and netWeight != ''">and bs.net_weight like concat('%', #{netWeight}, '%')</if>
<if test="grossWeight != null and grossWeight != ''">and bs.gross_weight like concat('%', #{grossWeight},
'%')
</if>
<if test="distribution != null and distribution != ''">and bs.distribution like concat('%',
#{distribution}, '%')
</if>
<if test="model != null and model != ''">and bs.model like concat('%', #{model}, '%')</if>
<if test="orderId != null and orderId != ''">and bs.order_id like concat('%', #{orderId}, '%')</if>
<if test="productId != null and productId != ''">and bs.product_id like concat('%', #{productId}, '%')</if>
<if test="cargoSpaceStockStatus != null and cargoSpaceStockStatus != ''">and bcs.status like concat('%',
#{cargoSpaceStockStatus}, '%')
</if>
</where>
</select>
<select id="selectBasStockList2" parameterType="BasStock" resultMap="BasStockResult">
<choose>
<when test="warehouseCode !=null and warehouseCode==1">
<include refid="selectBasStockVo"/>
</when>
<when test="warehouseCode !=null and warehouseCode==2">
<include refid="selectBasStockHcVo"/>
</when>
<otherwise>
<include refid="selectBasStockVo"/>
</otherwise>
</choose>
<where>
<if test="stockId != null and stockId != ''">and bs.stock_id like concat('%', #{stockId}, '%')</if>
<if test="cargoSpaceId != null and cargoSpaceId != ''">and bs.cargo_space_id like concat('%',
#{cargoSpaceId}, '%')
</if>
<if test="cargoSpaceName != null and cargoSpaceName != ''">and bcs.cargo_space_name like concat('%',
#{cargoSpaceName}, '%')
</if>
<if test="stockStatus != null and stockStatus != ''">and bs.stock_status like concat('%', #{stockStatus},
'%')
</if>
<if test="productStatus != null and productStatus != ''">and bs.product_status like concat('%',
#{productStatus}, '%')
</if>
<if test="lotNo != null and lotNo != ''">and bs.lot_no like concat('%', #{lotNo}, '%')</if>
<if test="inDate != null and inDate != ''">and bs.in_date like concat('%', #{inDate}, '%')</if>
<if test="backDate != null and backDate != ''">and bs.back_date like concat('%', #{backDate}, '%')</if>
<if test="productGuid != null and productGuid != ''">and bs.product_guid like concat('%', #{productGuid},
'%')
</if>
<if test="productName != null and productName != ''">and bs.product_name like concat('%', #{productName},
'%')
</if>
<if test="quantity != null and quantity != ''">and bs.quantity like concat('%', #{quantity}, '%')</if>
<if test="jobId != null and jobId != ''">and bs.job_id like concat('%', #{jobId}, '%')</if>
<if test="trayCode != null and trayCode != ''">and bs.tray_code like concat('%', #{trayCode}, '%')</if>
<if test="outQuantity != null and outQuantity != ''">and bs.out_quantity like concat('%', #{outQuantity},
'%')
</if>
<if test="stockinDetailId != null and stockinDetailId != ''">and bs.stockin_detail_id like concat('%',
#{stockinDetailId}, '%')
</if>
<if test="stockinId != null and stockinId != ''">and bs.stockin_id like concat('%', #{stockinId}, '%')</if>
<if test="inType != null and inType != ''">and bs.in_type like concat('%', #{inType}, '%')</if>
<if test="inClassId != null and inClassId != ''">and bs.in_class_id like concat('%', #{inClassId}, '%')
</if>
<if test="warehouseId != null and warehouseId != ''">and bs.warehouse_id like concat('%', #{warehouseId},
'%')
</if>
<if test="stackingId != null and stackingId != ''">and bs.stacking_id like concat('%', #{stackingId},
'%')
</if>
<if test="spare1 != null and spare1 != ''">and bs.spare1 like concat('%', #{spare1}, '%')</if>
<if test="spare2 != null and spare2 != ''">and bs.spare2 like concat('%', #{spare2}, '%')</if>
<if test="spare3 != null and spare3 != ''">and bs.spare3 like concat('%', #{spare3}, '%')</if>
<if test="spare4 != null and spare4 != ''">and bs.spare4 like concat('%', #{spare4}, '%')</if>
<if test="spare5 != null and spare5 != ''">and bs.spare5 like concat('%', #{spare5}, '%')</if>
<if test="spare6 != null and spare6 != ''">and bs.spare6 like concat('%', #{spare6}, '%')</if>
<if test="voltage != null and voltage != ''">and bs.voltage like concat('%', #{voltage}, '%')</if>
<if test="power != null and power != ''">and bs.power like concat('%', #{power}, '%')</if>
<if test="phase != null and phase != ''">and bs.phase like concat('%', #{phase}, '%')</if>
<if test="netWeight != null and netWeight != ''">and bs.net_weight like concat('%', #{netWeight}, '%')</if>
<if test="grossWeight != null and grossWeight != ''">and bs.gross_weight like concat('%', #{grossWeight},
'%')
</if>
<if test="distribution != null and distribution != ''">and bs.distribution like concat('%',
#{distribution}, '%')
</if>
<if test="model != null and model != ''">and bs.model like concat('%', #{model}, '%')</if>
<if test="orderId != null and orderId != ''">and bs.order_id like concat('%', #{orderId}, '%')</if>
<if test="productId != null and productId != ''">and bs.product_id like concat('%', #{productId}, '%')</if>
<if test="cargoSpaceStockStatus != null and cargoSpaceStockStatus != ''">and bcs.status like concat('%',
#{cargoSpaceStockStatus}, '%')
</if>
</where>
</select>
<select id="selectBasStockByStockId" parameterType="String" resultMap="BasStockResult">
<include refid="selectBasStockVo"/>
where stock_id = #{stockId}
</select>
<select id="selectBasStockByStockId2" parameterType="String" resultMap="BasStockResult">
<choose>
<when test="warehouseCode !=null and warehouseCode ==1 ">
<include refid="selectBasStockVo"/>
</when>
<when test="warehouseCode !=null and warehouseCode==2">
<include refid="selectBasStockHcVo"/>
</when>
</choose>
where stock_id = #{stockId}
</select>
<insert id="insertBasStock" parameterType="BasStock">
insert into bas_stock
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="stockId != null and stockId != ''">stock_id,</if>
<if test="cargoSpaceId != null">cargo_space_id,</if>
<if test="stockStatus != null">stock_status,</if>
<if test="productStatus != null">product_status,</if>
<if test="lotNo != null">lot_no,</if>
<if test="inDate != null">in_date,</if>
<if test="backDate != null">back_date,</if>
<if test="productGuid != null">product_guid,</if>
<if test="quantity != null">quantity,</if>
<if test="jobId != null">job_id,</if>
<if test="trayCode != null">tray_code,</if>
<if test="outQuantity != null">out_quantity,</if>
<if test="stockinDetailId != null">stockin_detail_id,</if>
<if test="stockinId != null">stockin_id,</if>
<if test="inType != null">in_type,</if>
<if test="inClassId != null">in_class_id,</if>
<if test="warehouseId != null">warehouse_id,</if>
<if test="stackingId != null">stacking_id,</if>
<if test="spare1 != null">spare1,</if>
<if test="spare2 != null">spare2,</if>
<if test="spare3 != null">spare3,</if>
<if test="spare4 != null">spare4,</if>
<if test="spare5 != null">spare5,</if>
<if test="spare6 != null">spare6,</if>
<if test="productId != null">product_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="stockId != null and stockId != ''">#{stockId},</if>
<if test="cargoSpaceId != null">#{cargoSpaceId},</if>
<if test="stockStatus != null">#{stockStatus},</if>
<if test="productStatus != null">#{productStatus},</if>
<if test="lotNo != null">#{lotNo},</if>
<if test="inDate != null">#{inDate},</if>
<if test="backDate != null">#{backDate},</if>
<if test="productGuid != null">#{productGuid},</if>
<if test="quantity != null">#{quantity},</if>
<if test="jobId != null">#{jobId},</if>
<if test="trayCode != null">#{trayCode},</if>
<if test="outQuantity != null">#{outQuantity},</if>
<if test="stockinDetailId != null">#{stockinDetailId},</if>
<if test="stockinId != null">#{stockinId},</if>
<if test="inType != null">#{inType},</if>
<if test="inClassId != null">#{inClassId},</if>
<if test="warehouseId != null">#{warehouseId},</if>
<if test="stackingId != null">#{stackingId},</if>
<if test="spare1 != null">#{spare1},</if>
<if test="spare2 != null">#{spare2},</if>
<if test="spare3 != null">#{spare3},</if>
<if test="spare4 != null">#{spare4},</if>
<if test="spare5 != null">#{spare5},</if>
<if test="spare6 != null">#{spare6},</if>
<if test="productId != null">#{productId},</if>
</trim>
</insert>
<insert id="insertBasStockList">
INSERT INTO bas_stock
(stock_id,cargo_space_id,stock_status,product_status,lot_no,in_date,back_date,product_guid,quantity,job_id,tray_code,out_quantity,stockin_detail_id,stockin_id,in_type,in_class_id,warehouse_id,stacking_id,spare1,spare2,spare3,spare4,spare5,spare6,product_id,product_name,voltage,power,phase,net_weight,gross_weight,distribution,model,order_id,spare7)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.stockId},#{item.cargoSpaceId},#{item.stockStatus},#{item.productStatus},#{item.lotNo},#{item.inDate},#{item.backDate},#{item.productGuid},#{item.quantity},#{item.jobId},#{item.trayCode},#{item.outQuantity},#{item.stockinDetailId},#{item.stockinId},#{item.inType},#{item.inClassId},#{item.warehouseId},#{item.stackingId},#{item.spare1},#{item.spare2},#{item.spare3},#{item.spare4},#{item.spare5},#{item.spare6},#{item.productId}
,#{item.productName},#{item.voltage},#{item.power},#{item.phase},#{item.netWeight},#{item.grossWeight},#{item.distribution},#{item.model},#{item.orderId},#{item.spare7})
</foreach>
</insert>
<update id="updateBasStock2" parameterType="BasStock">
<choose>
<when test="warehouseCode != null and warehouseCode==1">
update bas_stock
</when>
<when test="warehouseCode != null and warehouseCode==2">
update bas_stock_hc
</when>
<otherwise>
update bas_stock
</otherwise>
</choose>
<trim prefix="SET" suffixOverrides=",">
<if test="cargoSpaceId != null">cargo_space_id = #{cargoSpaceId},</if>
<if test="stockStatus != null">stock_status = #{stockStatus},</if>
<if test="productStatus != null">product_status = #{productStatus},</if>
<if test="lotNo != null">lot_no = #{lotNo},</if>
<if test="inDate != null">in_date = #{inDate},</if>
<if test="backDate != null">back_date = #{backDate},</if>
<if test="productGuid != null">product_guid = #{productGuid},</if>
<if test="quantity != null">quantity = #{quantity},</if>
<if test="jobId != null">job_id = #{jobId},</if>
<if test="trayCode != null">tray_code = #{trayCode},</if>
<if test="outQuantity != null">out_quantity = #{outQuantity},</if>
<if test="stockinDetailId != null">stockin_detail_id = #{stockinDetailId},</if>
<if test="stockinId != null">stockin_id = #{stockinId},</if>
<if test="inType != null">in_type = #{inType},</if>
<if test="inClassId != null">in_class_id = #{inClassId},</if>
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="stackingId != null">stacking_id = #{stackingId},</if>
<if test="spare1 != null">spare1 = #{spare1},</if>
<if test="spare2 != null">spare2 = #{spare2},</if>
<if test="spare3 != null">spare3 = #{spare3},</if>
<if test="spare4 != null">spare4 = #{spare4},</if>
<if test="spare5 != null">spare5 = #{spare5},</if>
<if test="spare6 != null">spare6 = #{spare6},</if>
<if test="productId != null">product_id = #{productId},</if>
</trim>
WHERE stock_id = #{stockId}
</update>
<update id="updateBasStock" parameterType="BasStock">
update bas_stock
<trim prefix="SET" suffixOverrides=",">
<if test="cargoSpaceId != null">cargo_space_id = #{cargoSpaceId},</if>
<if test="stockStatus != null">stock_status = #{stockStatus},</if>
<if test="productStatus != null">product_status = #{productStatus},</if>
<if test="lotNo != null">lot_no = #{lotNo},</if>
<if test="inDate != null">in_date = #{inDate},</if>
<if test="backDate != null">back_date = #{backDate},</if>
<if test="productGuid != null">product_guid = #{productGuid},</if>
<if test="quantity != null">quantity = #{quantity},</if>
<if test="jobId != null">job_id = #{jobId},</if>
<if test="trayCode != null">tray_code = #{trayCode},</if>
<if test="outQuantity != null">out_quantity = #{outQuantity},</if>
<if test="stockinDetailId != null">stockin_detail_id = #{stockinDetailId},</if>
<if test="stockinId != null">stockin_id = #{stockinId},</if>
<if test="inType != null">in_type = #{inType},</if>
<if test="inClassId != null">in_class_id = #{inClassId},</if>
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="stackingId != null">stacking_id = #{stackingId},</if>
<if test="spare1 != null">spare1 = #{spare1},</if>
<if test="spare2 != null">spare2 = #{spare2},</if>
<if test="spare3 != null">spare3 = #{spare3},</if>
<if test="spare4 != null">spare4 = #{spare4},</if>
<if test="spare5 != null">spare5 = #{spare5},</if>
<if test="spare6 != null">spare6 = #{spare6},</if>
<if test="productId != null">product_id = #{productId},</if>
</trim>
where stock_id = #{stockId}
</update>
<update id="updateStockStatusByTrayCode">
update bas_stock
set stock_status = #{stockStatus}
where tray_code = #{trayCode}
</update>
<update id="resetPdRecord">
update bas_stock
set spare7 = '0'
</update>
<delete id="deleteBasStockByStockId" parameterType="String">
delete
from bas_stock
where stock_id = #{stockId}
</delete>
<delete id="deleteBasStockByStockIds" parameterType="String">
delete from bas_stock where stock_id in
<foreach item="stockId" collection="array" open="(" separator="," close=")">
#{stockId}
</foreach>
</delete>
<delete id="deleteBasStockByStockIds2" parameterType="String">
<choose>
<when test="warehouseCode !=null and warehouseCode ==1">
delete from bas_stock where stock_id in
</when>
<when test="warehouseCode !=null and warehouseCode ==2">
delete from bas_stock_hc where stock_id in
</when>
<otherwise>
delete from bas_stock where stock_id in
</otherwise>
</choose>
<foreach item="stockId" collection="stockIds" open="(" separator="," close=")">
#{stockId}
</foreach>
</delete>
<select id="selectKtpStock" parameterType="BasStock" resultMap="BasStockResult">
select b.cargo_space_name, b.cargo_space_id from bas_stock s,bas_cargo_space b
<where>
s.warehouse_id=#{warehouseId}
and s.cargo_space_id=b.cargo_space_id and b.warehouse_id= s.warehouse_id and b.status='2' and
s.product_id='KTP0001'
<if test="params.warehouseDataScope != null and params.warehouseDataScope !=''">
${params.warehouseDataScope}
</if>
</where>
order by b.the_platoon,b.the_floor,b.the_column asc
</select>
<select id="getStockBySerial" parameterType="String" resultMap="BasStockResult">
select *
from bas_stock
where tray_code = #{trayCode}
</select>
<select id="selectHasHalfTray" parameterType="InStockinDetail" resultMap="BasStockResult">
select distinct bs.tray_code,bs.cargo_space_id from bas_stock bs left join bas_cargo_space bcs on bs.cargo_space_id=bcs.cargo_space_id where bs.spare4=#{spare4} and bs.product_id like concat('%', #{productId}, '%')
and bs.spare2 like concat('%', #{spare2}, '%')
and bs.model=0 and bcs.status=2
and bcs.group_coding_no not in (select group_coding_no from bas_cargo_space where status=3 group by group_coding_no)
<if test="cargoNo != null and cargoNo != ''">
and bs.order_id = #{cargoNo}
</if>
union
select distinct bs.tray_code,bs.cargo_space_id from bas_stock bs left join bas_cargo_space bcs on bs.cargo_space_id=bcs.cargo_space_id where bs.spare4=#{spare4}
and bs.spare2 like concat('%', #{spare2}, '%')
and bs.model=0 and bcs.status=2
and bcs.group_coding_no not in (select group_coding_no from bas_cargo_space where status=3 group by group_coding_no)
<if test="cargoNo != null and cargoNo != ''">
and bs.order_id = #{cargoNo}
</if>
UNION
select distinct bs.tray_code,bs.cargo_space_id from bas_stock bs left join bas_cargo_space bcs on bs.cargo_space_id=bcs.cargo_space_id where bs.spare4=#{spare4} and bs.model=0 and bcs.status=2
and bcs.group_coding_no not in (select group_coding_no from bas_cargo_space where status=3 group by group_coding_no)
<if test="cargoNo != null and cargoNo != ''">
and bs.order_id = #{cargoNo}
</if>
</select>
<select id="selectBasStockHcs" resultMap="BasStockResult">
<include refid="selectBasStockHcVo"/>
<where>
<if test="out.lotNo != null and out.lotNo != ''">and bs.lot_no like concat('%', #{out.lotNo}, '%')</if>
<if test="trayCode != null and trayCode != ''">and bs.tray_code like concat('%', #{trayCode}, '%')</if>
<if test="out.spare4 != null and out.spare4 != ''">and bs.spare4 like concat('%', #{out.spare4}, '%')</if>
<if test="out.orderId != null and out.orderId != ''">and bs.order_id like concat('%', #{out.orderId}, '%')</if>
<if test="out.productId != null and out.productId != ''">and bs.product_id like concat('%', #{out.productId}, '%')</if>
</where>
</select>
<select id="selectBasStockListTopOne" parameterType="string" resultType="basStock">
select top 1* from bas_stock where tray_code=#{trayCode}
</select>
<select id="selectBasStockListHc" parameterType="BasStock" resultMap="BasStockResult">
<include refid="selectBasStockHcVo"/>
<where>
<if test="stockId != null and stockId != ''">and bs.stock_id like concat('%', #{stockId}, '%')</if>
<if test="cargoSpaceId != null and cargoSpaceId != ''">and bs.cargo_space_id like concat('%',
#{cargoSpaceId}, '%')
</if>
<if test="cargoSpaceName != null and cargoSpaceName != ''">and bcs.cargo_space_name like concat('%',
#{cargoSpaceName}, '%')
</if>
<if test="stockStatus != null and stockStatus != ''">and bs.stock_status like concat('%', #{stockStatus},
'%')
</if>
<if test="productStatus != null and productStatus != ''">and bs.product_status like concat('%',
#{productStatus}, '%')
</if>
<if test="lotNo != null and lotNo != ''">and bs.lot_no like concat('%', #{lotNo}, '%')</if>
<if test="inDate != null and inDate != ''">and bs.in_date like concat('%', #{inDate}, '%')</if>
<if test="backDate != null and backDate != ''">and bs.back_date like concat('%', #{backDate}, '%')</if>
<if test="productGuid != null and productGuid != ''">and bs.product_guid like concat('%', #{productGuid},
'%')
</if>
<if test="productName != null and productName != ''">and bs.product_name like concat('%', #{productName},
'%')
</if>
<if test="quantity != null and quantity != ''">and bs.quantity like concat('%', #{quantity}, '%')</if>
<if test="jobId != null and jobId != ''">and bs.job_id like concat('%', #{jobId}, '%')</if>
<if test="trayCode != null and trayCode != ''">and bs.tray_code like concat('%', #{trayCode}, '%')</if>
<if test="outQuantity != null and outQuantity != ''">and bs.out_quantity like concat('%', #{outQuantity},
'%')
</if>
<if test="stockinDetailId != null and stockinDetailId != ''">and bs.stockin_detail_id like concat('%',
#{stockinDetailId}, '%')
</if>
<if test="stockinId != null and stockinId != ''">and bs.stockin_id like concat('%', #{stockinId}, '%')</if>
<if test="inType != null and inType != ''">and bs.in_type like concat('%', #{inType}, '%')</if>
<if test="inClassId != null and inClassId != ''">and bs.in_class_id like concat('%', #{inClassId}, '%')
</if>
<if test="warehouseId != null and warehouseId != ''">and bs.warehouse_id like concat('%', #{warehouseId},
'%')
</if>
<if test="stackingId != null and stackingId != ''">and bs.stacking_id like concat('%', #{stackingId},
'%')
</if>
<if test="spare1 != null and spare1 != ''">and bs.spare1 like concat('%', #{spare1}, '%')</if>
<if test="spare2 != null and spare2 != ''">and bs.spare2 like concat('%', #{spare2}, '%')</if>
<if test="spare3 != null and spare3 != ''">and bs.spare3 like concat('%', #{spare3}, '%')</if>
<if test="spare4 != null and spare4 != ''">and bs.spare4 like concat('%', #{spare4}, '%')</if>
<if test="spare5 != null and spare5 != ''">and bs.spare5 like concat('%', #{spare5}, '%')</if>
<if test="spare6 != null and spare6 != ''">and bs.spare6 like concat('%', #{spare6}, '%')</if>
<if test="voltage != null and voltage != ''">and bs.voltage like concat('%', #{voltage}, '%')</if>
<if test="power != null and power != ''">and bs.power like concat('%', #{power}, '%')</if>
<if test="phase != null and phase != ''">and bs.phase like concat('%', #{phase}, '%')</if>
<if test="netWeight != null and netWeight != ''">and bs.net_weight like concat('%', #{netWeight}, '%')</if>
<if test="grossWeight != null and grossWeight != ''">and bs.gross_weight like concat('%', #{grossWeight},
'%')
</if>
<if test="distribution != null and distribution != ''">and bs.distribution like concat('%',
#{distribution}, '%')
</if>
<if test="model != null and model != ''">and bs.model like concat('%', #{model}, '%')</if>
<if test="orderId != null and orderId != ''">and bs.order_id like concat('%', #{orderId}, '%')</if>
<if test="productId != null and productId != ''">and bs.product_id like concat('%', #{productId}, '%')</if>
</where>
</select>
<select id="selectBasStockHcCount" parameterType="BasStock" resultMap="BasStockResult">
<include refid="selectBasStockHcVo"/>
<where>
<if test="stockId != null and stockId != ''">
and bs.stock_id like concat('%', #{stockId}, '%')
</if>
<if test="cargoSpaceId != null and cargoSpaceId != ''">
and bs.cargo_space_id like concat('%', #{cargoSpaceId}, '%')
</if>
<if test="cargoSpaceName != null and cargoSpaceName != ''">
and bcs.cargo_space_name like concat('%', #{cargoSpaceName}, '%')
</if>
<if test="stockStatus != null and stockStatus != ''">
and bs.stock_status like concat('%', #{stockStatus}, '%')
</if>
<if test="productStatus != null and productStatus != ''">
and bs.product_status like concat('%', #{productStatus}, '%')
</if>
<if test="lotNo != null and lotNo != ''">
and bs.lot_no like concat('%', #{lotNo}, '%')
</if>
<if test="inDate != null and inDate != ''">
and bs.in_date like concat('%', #{inDate}, '%')
</if>
<if test="backDate != null and backDate != ''">
and bs.back_date like concat('%', #{backDate}, '%')
</if>
<if test="productGuid != null and productGuid != ''">
and bs.product_guid like concat('%', #{productGuid}, '%')
</if>
<if test="productName != null and productName != ''">
and bs.product_name like concat('%', #{productName}, '%')
</if>
<if test="quantity != null and quantity != ''">
and bs.quantity like concat('%', #{quantity}, '%')
</if>
<if test="jobId != null and jobId != ''">
and bs.job_id like concat('%', #{jobId}, '%')
</if>
<if test="trayCode != null and trayCode != ''">
and bs.tray_code like concat('%', #{trayCode}, '%')
</if>
<if test="outQuantity != null and outQuantity != ''">
and bs.out_quantity like concat('%', #{outQuantity}, '%')
</if>
<if test="stockinDetailId != null and stockinDetailId != ''">
and bs.stockin_detail_id like concat('%', #{stockinDetailId}, '%')
</if>
<if test="stockinId != null and stockinId != ''">
and bs.stockin_id like concat('%', #{stockinId}, '%')
</if>
<if test="inType != null and inType != ''">
and bs.in_type like concat('%', #{inType}, '%')
</if>
<if test="inClassId != null and inClassId != ''">
and bs.in_class_id like concat('%', #{inClassId}, '%')
</if>
<if test="warehouseId != null and warehouseId != ''">
and bs.warehouse_id like concat('%', #{warehouseId}, '%')
</if>
<if test="stackingId != null and stackingId != ''">
and bs.stacking_id like concat('%', #{stackingId}, '%')
</if>
<if test="spare1 != null and spare1 != ''">
and bs.spare1 like concat('%', #{spare1}, '%')
</if>
<if test="spare2 != null and spare2 != ''">
and bs.spare2 like concat('%', #{spare2}, '%')
</if>
<if test="spare3 != null and spare3 != ''">
and bs.spare3 like concat('%', #{spare3}, '%')
</if>
<if test="spare4 != null and spare4 != ''">
and bs.spare4 like concat('%', #{spare4}, '%')
</if>
<if test="spare5 != null and spare5 != ''">
and bs.spare5 like concat('%', #{spare5}, '%')
</if>
<if test="spare6 != null and spare6 != ''">
and bs.spare6 like concat('%', #{spare6}, '%')
</if>
<if test="voltage != null and voltage != ''">
and bs.voltage like concat('%', #{voltage}, '%')
</if>
<if test="power != null and power != ''">
and bs.power like concat('%', #{power}, '%')
</if>
<if test="phase != null and phase != ''">
and bs.phase like concat('%', #{phase}, '%')
</if>
<if test="netWeight != null and netWeight != ''">
and bs.net_weight like concat('%', #{netWeight}, '%')
</if>
<if test="grossWeight != null and grossWeight != ''">
and bs.gross_weight like concat('%', #{grossWeight}, '%')
</if>
<if test="distribution != null and distribution != ''">
and bs.distribution like concat('%', #{distribution}, '%')
</if>
<if test="model != null and model != ''">
and bs.model like concat('%', #{model}, '%')
</if>
<if test="orderId != null and orderId != ''">
and bs.order_id like concat('%', #{orderId}, '%')
</if>
<if test="productId != null and productId != ''">
and bs.product_id like concat('%', #{productId}, '%')
</if>
</where>
</select>
<sql id="selectBasStockHcVo">
select bs.stock_id,
bs.cargo_space_id,
bs.stock_status,
bs.product_status,
bs.lot_no,
bs.in_date,
bs.back_date,
bs.product_guid,
bs.quantity,
bs.job_id,
bs.tray_code,
bs.out_quantity,
bs.stockin_detail_id,
bs.stockin_id,
bs.in_type,
bs.in_class_id,
bs.warehouse_id,
bs.stacking_id,
bs.spare1,
bs.spare2,
bs.spare3,
bs.spare4,
bs.spare5,
bs.spare6,
bs.voltage,
bs.power,
bs.phase,
bs.net_weight,
bs.gross_weight,
bs.distribution,
bs.model,
bs.order_id,
bs.product_name,
bs.product_id
from bas_stock_hc bs
</sql>
</mapper>