You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
269 lines
11 KiB
269 lines
11 KiB
<?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.shkj.wms.mapper.BusinStockInvMapper">
|
|
|
|
<resultMap type="com.shkj.wms.domain.BusinStockInv" id="BusinStockInvResult">
|
|
<result property="id" column="id"/>
|
|
<result property="invOrderNo" column="inv_order_no"/>
|
|
<result property="lineId" column="line_id"/>
|
|
<result property="consignorId" column="consignor_id"/>
|
|
<result property="locationId" column="location_id"/>
|
|
<result property="goodId" column="good_id"/>
|
|
<result property="batchId" column="batch_id"/>
|
|
<result property="quantity" column="quantity"/>
|
|
<result property="invQty" column="inv_qty"/>
|
|
<result property="invCase" column="inv_case"/>
|
|
<result property="invPiece" column="inv_piece"/>
|
|
<result property="orderUser" column="order_user"/>
|
|
<result property="invUser" column="inv_user"/>
|
|
<result property="checkUser" column="check_user"/>
|
|
<result property="recheckUser" column="recheck_user"/>
|
|
<result property="isRecheck" column="is_recheck"/>
|
|
<result property="invStatus" column="inv_status"/>
|
|
<result property="invType" column="inv_type"/>
|
|
<result property="status" column="status"/>
|
|
<result property="branchId" column="branch_id"/>
|
|
<result property="remark" column="remark"/>
|
|
<result property="extend1" column="extend1"/>
|
|
<result property="extend2" column="extend2"/>
|
|
<result property="extend3" column="extend3"/>
|
|
<result property="extend4" column="extend4"/>
|
|
<result property="extend5" column="extend5"/>
|
|
<result property="createTime" column="create_time"/>
|
|
<result property="createBy" column="create_by"/>
|
|
<result property="updateTime" column="update_time"/>
|
|
<result property="updateBy" column="update_by"/>
|
|
</resultMap>
|
|
<select id="queryList" resultType="com.shkj.wms.vo.BusinStockInvVo"
|
|
parameterType="com.shkj.wms.bo.BusinStockInvQueryBo">
|
|
SELECT
|
|
si.id as invId, loc.id as locationId,loc.location_code,goods.vehiche_model,goods.color,loc.location_status, sum(case when stock.goods_no is null then 0 else 1 end ) as goodQty,inv_order_no
|
|
FROM
|
|
busin_stock_inv si
|
|
JOIN base_location loc ON si.location_id = loc.id
|
|
left join sys_stock_detail stock on stock.location_id=loc.id
|
|
left join base_goods_data goods ON stock.goods_no =goods.goods_no
|
|
where si.inv_status in
|
|
<foreach collection="invStatusList" item="invStatus" open="(" separator="," close=")">
|
|
#{invStatus}
|
|
</foreach>
|
|
|
|
<if test="invStatus != null and invStatus != ''">
|
|
and si.inv_status = #{invStatus}
|
|
</if>
|
|
|
|
<if test="tunnel != null and tunnel != ''">
|
|
AND loc.tunnel = #{tunnel}
|
|
</if>
|
|
<if test="locationRow != null and locationRow != ''">
|
|
AND loc.location_row = #{locationRow}
|
|
</if>
|
|
<if test="locationColumn != null and locationColumn != ''">
|
|
AND loc.location_column = #{locationColumn}
|
|
</if>
|
|
<if test="layer !=null and layer !='' ">
|
|
and loc.layer=#{layer}
|
|
</if>
|
|
<if test="locationId !=null and locationId !='' ">
|
|
and loc.id=#{locationId}
|
|
</if>
|
|
|
|
group by si.id,loc.id,loc.location_code,goods.vehiche_model,goods.color,loc.location_status,inv_order_no
|
|
ORDER BY loc.route
|
|
</select>
|
|
<select id="queryListByGoodsGroup" resultType="com.shkj.wms.vo.BusinStockInvVo"
|
|
parameterType="com.shkj.wms.bo.BusinStockInvQueryBo">
|
|
SELECT
|
|
si.good_id,
|
|
g.good_no,
|
|
g.good_name,
|
|
g.specifications,
|
|
g.storage_classify,
|
|
g.storage_conditions,
|
|
g.abc_classify,
|
|
c.consignor_code,
|
|
c.consignor_name,
|
|
bs.storage_name,
|
|
sum(si.quantity) as quantity,
|
|
sum(si.inv_qty) as inv_qty,
|
|
sum(si.difference_qty) as difference_qty,
|
|
bp.package_qty,bp.unit
|
|
FROM
|
|
busin_stock_inv si
|
|
JOIN base_goods g ON si.good_id = g.id
|
|
join base_location l on l.id=si.location_id
|
|
JOIN base_consignor c ON si.consignor_id = c.id
|
|
join sys_batch b on b.id=si.batch_id
|
|
JOIN base_package bp ON bp.id = b.package_id
|
|
JOIN base_area a ON l.area_id = a.id
|
|
JOIN base_storage bs ON a.storage_id = bs.id
|
|
WHERE g.is_del = 0 AND l.is_del = 0
|
|
<if test="orderType!=null and orderType!=''">
|
|
and si.order_type=#{orderType}
|
|
</if>
|
|
<if test="invStatus != null and invStatus != ''">
|
|
and si.inv_status = #{invStatus}
|
|
</if>
|
|
<if test="goodId!=null and goodId!=''">
|
|
and si.good_id=#{goodId}
|
|
</if>
|
|
<if test="invWay != null and invWay != ''">
|
|
and si.inv_way = #{invWay}
|
|
</if>
|
|
<if test="invOrderNo != null and invOrderNo != ''">
|
|
and si.inv_order_no like concat('%', #{invOrderNo},'%')
|
|
</if>
|
|
<if test="locationCode != null and locationCode != ''">
|
|
AND (
|
|
l.location_code LIKE CONCAT('%', #{locationCode}, '%')
|
|
OR l.location_name LIKE CONCAT('%', #{locationCode}, '%')
|
|
)
|
|
</if>
|
|
<if test="goodCode!=null and goodCode!=''">
|
|
AND (
|
|
g.good_no LIKE CONCAT('%', #{goodCode}, '%')
|
|
OR g.good_name LIKE CONCAT('%', #{goodCode}, '%')
|
|
)
|
|
</if>
|
|
${consignorParams.dataScopeConsignor}
|
|
group by si.good_id
|
|
</select>
|
|
|
|
<select id="optionByInvOrderNo" resultType="java.lang.String" parameterType="java.lang.String">
|
|
SELECT DISTINCT l.tunnel
|
|
FROM busin_stock_inv si
|
|
JOIN base_location l ON si.location_id = l.id
|
|
WHERE si.inv_order_no = #{invOrderNo}
|
|
ORDER BY l.tunnel ASC
|
|
|
|
</select>
|
|
|
|
<select id="getBusinStockInvList" parameterType="com.shkj.wms.bo.BusinStockInvQueryBo"
|
|
resultType="com.shkj.wms.vo.BusinStockInvExeVo">
|
|
SELECT inv_order_no,
|
|
l.layer,
|
|
inv_status,
|
|
inv_type,
|
|
GROUP_CONCAT(distinct c.container_code) as container_name,
|
|
GROUP_CONCAT(distinct l.location_name) as location_name,
|
|
s.batch_no,
|
|
sum( s.qty ) AS qty,
|
|
max(s.pt_part) pt_part,
|
|
max(item.pt_name) pt_name ,
|
|
s.create_by,
|
|
s.create_time,
|
|
max(exec_time) exec_time
|
|
|
|
FROM
|
|
busin_stock_inv s
|
|
inner join base_item_data item on s.pt_part=item.pt_part
|
|
INNER JOIN base_container c ON s.container_id = c.id
|
|
INNER JOIN base_location l ON s.location_id = l.id
|
|
<where>
|
|
<if test="invOrderNo != null and invOrderNo != ''">
|
|
and s.inv_order_no like concat('%', #{invOrderNo},'%')
|
|
</if>
|
|
|
|
<if test="invType != null and invType != ''">
|
|
and s.inv_type =#{invType}
|
|
</if>
|
|
|
|
<if test="invStatus != null and invStatus != ''">
|
|
and s.inv_status =#{invStatus}
|
|
</if>
|
|
|
|
<if test="invSDate != null and invSDate != ''">
|
|
and Date(s.create_time) >=#{invSDate}
|
|
</if>
|
|
|
|
<if test="invEDate != null and invEDate != ''">
|
|
and Date(s.create_time) <=#{invEDate}
|
|
</if>
|
|
|
|
<if test="containerCode != null and containerCode != ''">
|
|
and c.container_code =#{containerCode}
|
|
</if>
|
|
|
|
<if test="batchNo != null and batchNo != ''">
|
|
and s.batch_no =#{batchNo}
|
|
</if>
|
|
|
|
<if test="ptPart != null and ptPart != ''">
|
|
and s.pt_part =#{ptPart}
|
|
</if>
|
|
</where>
|
|
|
|
GROUP BY
|
|
inv_order_no,
|
|
l.layer,
|
|
inv_status,
|
|
inv_type,
|
|
s.batch_no,
|
|
s.create_by,
|
|
s.create_time
|
|
order by s.create_time desc
|
|
|
|
</select>
|
|
|
|
<select id="queryLocatonStocklist" resultType="com.shkj.wms.vo.StockLocationInvVo"
|
|
parameterType="com.shkj.wms.bo.BusinStockInvLocQueryBo">
|
|
select loc.id as locationId, loc.location_code,goods.vehiche_model,goods.color,loc.location_status, sum(case when stock.goods_no is null then 0 else 1 end ) as goodQty
|
|
from base_location loc
|
|
left join sys_stock_detail stock on loc.id =stock.location_id
|
|
left join base_goods_data goods on stock.goods_no=goods.goods_no
|
|
|
|
<where>
|
|
<if test="tunnel != null and tunnel != ''">
|
|
AND loc.tunnel = #{tunnel}
|
|
</if>
|
|
<if test="locationRow != null and locationRow != ''">
|
|
AND loc.location_row = #{locationRow}
|
|
</if>
|
|
<if test="locationColumn != null and locationColumn != ''">
|
|
AND loc.location_column = #{locationColumn}
|
|
</if>
|
|
<if test="layer !=null and layer !='' ">
|
|
and loc.layer=#{layer}
|
|
</if>
|
|
|
|
</where>
|
|
GROUP BY loc.id, loc.location_code,goods.vehiche_model,goods.color,loc.location_status
|
|
order by route
|
|
</select>
|
|
|
|
|
|
|
|
<select id="getWaitExecStockInvListByIds" resultType="com.shkj.wms.vo.BusinStockInvVo" parameterType="java.util.List">
|
|
select inv.id,inv_order_no,line_id,inv.location_id,inv.good_id,inv.container_id,inv.quantity,lot.id as stock_id
|
|
from busin_stock_inv inv
|
|
INNER JOIN base_location loc on inv.location_id=loc.id
|
|
left join sys_stock_lot lot on lot.location_id=inv.location_id and lot.branch_id=inv.branch_id
|
|
and lot.good_id=inv.good_id
|
|
where inv_status='init' and inv.id in
|
|
<foreach item="id" collection="ids" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
order by loc.location_group,loc.is_deep
|
|
</select>
|
|
|
|
<select id="queryBusInStockInvByContainerCode" resultType="com.shkj.wms.domain.BusinStockInv"
|
|
parameterType="com.shkj.wms.bo.BusinStockInvQueryBo">
|
|
select * from busin_stock_inv d
|
|
inner join base_container c on d.container_id=c.id
|
|
where 1=1
|
|
<if test="orderType !=null and orderType !=''">
|
|
and d.order_type= #{orderType}
|
|
</if>
|
|
<if test="invStatus !=null and invStatus !=''">
|
|
and d.inv_status= #{invStatus}
|
|
</if>
|
|
<if test="status !=null and status !=''">
|
|
and d.status= #{status}
|
|
</if>
|
|
<if test="containerCode !=null and containerCode !=''">
|
|
and c.container_code= #{containerCode}
|
|
</if>
|
|
</select>
|
|
</mapper>
|
|
|