查询统计-库存

This commit is contained in:
liuhanqing
2025-10-27 13:22:19 +08:00
parent 2e760e7a3e
commit 89c47306ce
8 changed files with 433 additions and 508 deletions

View File

@@ -34,7 +34,7 @@ server:
# 日志配置
logging:
level:
com.ruoyi: info
com.ruoyi: debug
org.springframework: warn
# 用户配置

View File

@@ -5,114 +5,117 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.ruoyi.search.ViewStockDetail.mapper.ViewStockDetailMapper">
<resultMap type="ViewStockDetail" id="ViewStockDetailResult">
<result property="onlyIdentity" column="only_identity" />
<result property="stockId" column="stock_id" />
<result property="cargoSpaceId" column="cargo_space_id" />
<result property="trayCode" column="tray_code" />
<result property="quantity" column="quantity" />
<result property="jobId" column="job_id" />
<result property="lotNo" column="lot_no" />
<result property="stockinDetailId" column="stockin_detail_id" />
<result property="inDate" column="in_date" />
<result property="warehouseId" column="warehouse_id" />
<result property="stackingId" column="stacking_id" />
<result property="cargoSpaceName" column="cargo_space_name" />
<result property="roadwayId" column="roadway_id" />
<result property="cargoSpaceStatus" column="cargo_space_status" />
<result property="locked" column="locked" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="spec" column="spec" />
<result property="unit" column="unit" />
<result property="price" column="price" />
<result property="spare1" column="spare1" />
<result property="spare2" column="spare2" />
<result property="spare5" column="spare5" />
<result property="spare6" column="spare6" />
<result property="spare7" column="spare7" />
<result property="spare8" column="spare8" />
<result property="remark" column="remark" />
<result property="warehouseName" column="warehouse_name" />
<result property="stockStatus" column="stock_status" />
<result property="productStatus" column="product_status" />
<result property="orderId" column="order_id" />
<result property="spare3" column="spare3" />
<result property="cargoSpaceId" column="cargo_space_id" />
<result property="trayCode" column="tray_code" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="spec" column="spec" />
<result property="quantity" column="quantity" />
<result property="spare6" column="spare6" />
<result property="price" column="price" />
<result property="spare1" column="spare1" />
<result property="unit" column="unit" />
<result property="cargoNo" column="cargo_no" />
<result property="orderId" column="order_id" />
<result property="spare5" column="spare5" />
<result property="power" column="power" />
<result property="spare8" column="spare8" />
<result property="parentId" column="parent_id" />
<result property="stockinId" column="stockin_id" />
<result property="supplierName" column="supplier_name" />
<result property="supplierNo" column="supplier_no" />
<result property="warehouseId" column="warehouse_id" />
<result property="warehouseName" column="warehouse_name" />
<result property="inDate" column="in_date" />
<result property="stackingId" column="stacking_id" />
<result property="spare7" column="spare7" />
<result property="backDate" column="back_date" />
<result property="remark" column="remark" />
<result property="stockId" column="stock_id" />
<result property="stockStatus" column="stock_status" />
<result property="lotNo" column="lot_no" />
<result property="outQuantity" column="out_quantity" />
</resultMap>
<sql id="selectViewStockDetailVo">
SELECT
ROW_NUMBER() OVER (ORDER BY s.stock_id ASC) AS only_identity,
s.stock_id,
s.cargo_space_id,
s.tray_code,
s.quantity,
s.job_id,
s.lot_no,
s.stockin_detail_id,
s.in_date,
s.warehouse_id,
s.stacking_id,
s.order_id,
cs.cargo_space_name,
cs.roadway_id,
cs.status AS cargo_space_status,
s.stock_status AS stock_status,
s.product_status AS product_status,
cs.locked,
p.product_guid,
p.product_id,
p.product_name,
p.spec,
p.unit,
p.price,
p.spare1,
p.spare2,
p.spare5,
p.spare6,
p.spare7,
p.spare8,
p.remark,
bw.warehouse_name
FROM
bas_stock s
LEFT JOIN bas_cargo_space cs ON cs.cargo_space_id = s.cargo_space_id
LEFT JOIN bas_product p ON p.product_guid = s.product_guid
LEFT JOIN bas_warehouse bw on s.warehouse_id = bw.warehouse_id
WHERE
cs.status = '2'
select bs.spare3, --账套
bs.cargo_space_id, --库位编码
bs.tray_code, --托盘
bs.product_id, --产品编码
bs.product_name,--产品名称
bp.spec, -- 规格
bs.quantity, -- 数量
bs.spare6, -- 金额
bp.price, --单价
bp.spare1, --产品状态
bp.unit, -- 单位
bp.cargo_no, --图号
bs.order_id, --合同号
bs.spare5, --台次
bs.power, --件次
bs.spare8, --质量
bp.parent_id, --常用编码
bs.stockin_id, --入库单号
bs2.supplier_name, --供应商名称
bs2.supplier_no, --供应商编号
bw.warehouse_id, --仓库编码
bw.warehouse_name, --仓库名称
bs.in_date, --入库时间
bs.stacking_id, --出库时间
bs.spare7, --盘点标识
bs.back_date, --盘点时间
bp.remark, --备注
bs.stock_id, --库存编码
bs.stock_status, --库存状态
bs.lot_no, --批次号
bs.out_quantity
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
left join bas_supplier bs2 on bs.phase = bs2.supplier_no
</sql>
<select id="selectViewStockDetailList" parameterType="ViewStockDetail" resultMap="ViewStockDetailResult">
<include refid="selectViewStockDetailVo"/>
<if test="stockId != null and stockId != ''"> and s.stock_id like concat('%',#{stockId}, '%')</if>
<if test="cargoSpaceId != null and cargoSpaceId != ''"> and s.cargo_space_id = #{cargoSpaceId}</if>
<if test="trayCode != null and trayCode != ''"> and s.tray_code like concat('%',#{trayCode}, '%')</if>
<if test="quantity != null and quantity != ''"> and s.quantity = #{quantity}</if>
<if test="jobId != null and jobId != ''"> and s.job_id = #{jobId}</if>
<if test="lotNo != null and lotNo != ''"> and s.lot_no = #{lotNo}</if>
<if test="stockinDetailId != null and stockinDetailId != ''"> and s.stockin_detail_id = #{stockinDetailId}</if>
<if test="inDate != null and inDate != ''"> and s.in_date = #{inDate}</if>
<if test="warehouseId != null and warehouseId != ''"> and s.warehouse_id = #{warehouseId}</if>
<if test="warehouseName != null and warehouseName != ''"> and bw.warehouse_name like concat('%', #{warehouseName}, '%')</if>
<if test="stackingId != null and stackingId != ''"> and s.stacking_id = #{stackingId}</if>
<if test="cargoSpaceName != null and cargoSpaceName != ''"> and cs.cargo_space_name = #{cargoSpaceName}</if>
<if test="roadwayId != null and roadwayId != ''"> and cs.roadway_id = #{roadwayId}</if>
<if test="cargoSpaceStatus != null and cargoSpaceStatus != ''"> and cs.status = #{cargoSpaceStatus}</if>
<if test="stockStatus != null and stockStatus != ''"> and s.stock_status = #{stockStatus}</if>
<if test="productStatus != null and productStatus != ''"> and s.product_status = #{productStatus}</if>
<if test="locked != null and locked != ''"> and cs.locked = #{locked}</if>
<if test="productId != null and productId != ''"> and p.product_id like concat('%',#{productId}, '%')</if>
<if test="productName != null and productName != ''"> and p.product_name like concat('%', #{productName}, '%')</if>
<if test="spec != null and spec != ''"> and p.spec = #{spec}</if>
<if test="unit != null and unit != ''"> and p.unit = #{unit}</if>
<if test="price != null and price != ''"> and p.price = #{price}</if>
<if test="spare1 != null and spare1 != ''"> and p.spare1 = #{spare1}</if>
<if test="spare2 != null and spare2 != ''"> and p.spare2 = #{spare2}</if>
<if test="spare5 != null and spare5 != ''"> and p.spare5 = #{spare5}</if>
<if test="spare6 != null and spare6 != ''"> and p.spare6 = #{spare6}</if>
<if test="spare7 != null and spare7 != ''"> and p.spare7 = #{spare7}</if>
<if test="spare8 != null and spare8 != ''"> and p.spare8 = #{spare8}</if>
<if test="remark != null and remark != ''"> and p.remark = #{remark}</if>
<if test="orderId != null and orderId != ''"> and s.order_id like concat('%',#{orderId}, '%')</if>
<where>
<if test="stockId != null and stockId != ''"> and bs.stock_id = #{stockId}</if>
<if test="cargoSpaceId != null and cargoSpaceId != ''"> and bs.cargo_space_id = #{cargoSpaceId}</if>
<if test="stockStatus != null and stockStatus != ''"> and bs.stock_status = #{stockStatus}</if>
<if test="lotNo != null and lotNo != ''"> and bs.lot_no = #{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 = #{backDate}</if>
<if test="productName != null and productName != ''"> and bs.product_name like concat('%', #{productName}, '%')</if>
<if test="quantity != null and quantity != ''"> and bs.quantity = #{quantity}</if>
<if test="trayCode != null and trayCode != ''"> and bs.tray_code = #{trayCode}</if>
<if test="outQuantity != null and outQuantity != ''"> and bs.out_quantity = #{outQuantity}</if>
<if test="stockinId != null and stockinId != ''"> and bs.stockin_id = #{stockinId}</if>
<if test="warehouseId != null and warehouseId != ''"> and bs.warehouse_id = #{warehouseId}</if>
<if test="stackingId != null and stackingId != ''"> and bs.stacking_id = #{stackingId}</if>
<if test="spare1 != null and spare1 != ''"> and bs.spare1 = #{spare1}</if>
<if test="spare3 != null and spare3 != ''"> and bs.spare3 = #{spare3}</if>
<if test="spare4 != null and spare4 != ''"> and bs.spare4 = #{spare4}</if>
<if test="spare5 != null and spare5 != ''"> and bs.spare5 = #{spare5}</if>
<if test="spare6 != null and spare6 != ''"> and bs.spare6 = #{spare6}</if>
<if test="voltage != null and voltage != ''"> and bs.voltage = #{voltage}</if>
<if test="power != null and power != ''"> and bs.power = #{power}</if>
<if test="orderId != null and orderId != ''"> and bs.order_id = #{orderId}</if>
<if test="productId != null and productId != ''"> and bs.product_id = #{productId}</if>
<if test="roadwayId != null and roadwayId != ''"> and bcs.roadway_id = #{roadwayId}</if>
<if test="theFloor != null and theFloor != ''"> and bcs.the_floor = #{theFloor}</if>
<if test="thePlatoon != null and thePlatoon != ''"> and bcs.the_platoon = #{thePlatoon}</if>
<if test="theColumn != null and theColumn != ''"> and bcs.the_column = #{theColumn}</if>
<if test="spec != null and spec != ''"> and bp.spec = #{spec}</if>
<if test="parentId != null and parentId != ''"> and bp.parent_id = #{parentId}</if>
<if test="supplierId != null and supplierId != ''"> and bs2.supplier_no = #{supplierId}</if>
<if test="supplierName != null and supplierName != ''"> and bs2.supplier_name = #{supplierName}</if>
<if test="price != null and price != ''"> and bp.price = #{price}</if>
<if test="inDateStart != null and inDateStart != ''"> and bs.in_date &gt;= #{inDateStart}</if>
<if test="inDateEnd != null and inDateEnd != ''"> and bs.in_date &lt;= #{inDateEnd}</if>
<if test="productType != null and productType != ''"> and bp.spare1 = #{productType}</if>
</where>
</select>
<select id="selectViewStockDetailByOnlyIdentity" parameterType="Long" resultMap="ViewStockDetailResult">

View File

@@ -101,42 +101,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectBasStockList" parameterType="BasStock" resultMap="BasStockResult">
<include refid="selectBasStockVo"/>
<where>
<if test="stockId != null and stockId != ''"> and bs.stock_id = #{stockId}</if>
<if test="cargoSpaceId != null and cargoSpaceId != ''"> and bs.cargo_space_id = #{cargoSpaceId}</if>
<if test="cargoSpaceName != null and cargoSpaceName != ''"> and bs.cargo_space_name like concat('%', #{cargoSpaceName}, '%')</if>
<if test="stockStatus != null and stockStatus != ''"> and bs.stock_status = #{stockStatus}</if>
<if test="productStatus != null and productStatus != ''"> and bs.product_status = #{productStatus}</if>
<if test="lotNo != null and lotNo != ''"> and bs.lot_no = #{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 = #{backDate}</if>
<if test="productGuid != null and productGuid != ''"> and bs.product_guid = #{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 = #{quantity}</if>
<if test="jobId != null and jobId != ''"> and bs.job_id = #{jobId}</if>
<if test="trayCode != null and trayCode != ''"> and bs.tray_code = #{trayCode}</if>
<if test="outQuantity != null and outQuantity != ''"> and bs.out_quantity = #{outQuantity}</if>
<if test="stockinDetailId != null and stockinDetailId != ''"> and bs.stockin_detail_id = #{stockinDetailId}</if>
<if test="stockinId != null and stockinId != ''"> and bs.stockin_id = #{stockinId}</if>
<if test="inType != null and inType != ''"> and bs.in_type = #{inType}</if>
<if test="inClassId != null and inClassId != ''"> and bs.in_class_id = #{inClassId}</if>
<if test="warehouseId != null and warehouseId != ''"> and bs.warehouse_id = #{warehouseId}</if>
<if test="stackingId != null and stackingId != ''"> and bs.stacking_id = #{stackingId}</if>
<if test="spare1 != null and spare1 != ''"> and bs.spare1 = #{spare1}</if>
<if test="spare2 != null and spare2 != ''"> and bs.spare2 = #{spare2}</if>
<if test="spare3 != null and spare3 != ''"> and bs.spare3 = #{spare3}</if>
<if test="spare4 != null and spare4 != ''"> and bs.spare4 = #{spare4}</if>
<if test="spare5 != null and spare5 != ''"> and bs.spare5 = #{spare5}</if>
<if test="spare6 != null and spare6 != ''"> and bs.spare6 = #{spare6}</if>
<if test="voltage != null and voltage != ''"> and bs.voltage = #{voltage}</if>
<if test="power != null and power != ''"> and bs.power = #{power}</if>
<if test="phase != null and phase != ''"> and bs.phase = #{phase}</if>
<if test="netWeight != null and netWeight != ''"> and bs.net_weight = #{netWeight}</if>
<if test="grossWeight != null and grossWeight != ''"> and bs.gross_weight = #{grossWeight}</if>
<if test="distribution != null and distribution != ''"> and bs.distribution = #{distribution}</if>
<if test="model != null and model != ''"> and bs.model = #{model}</if>
<if test="orderId != null and orderId != ''"> and bs.order_id = #{orderId}</if>
<if test="productId != null and productId != ''"> and bs.product_id = #{productId}</if>
<if test="cargoSpaceStockStatus != null and cargoSpaceStockStatus != ''"> and bcs.status = #{cargoSpaceStockStatus}</if>
<if test="roadwayId != null and roadwayId != ''"> and bcs.roadway_id = #{roadwayId}</if>
<if test="theFloor != null and theFloor != ''"> and bcs.the_floor = #{theFloor}</if>
<if test="thePlatoon != null and thePlatoon != ''"> and bcs.the_platoon = #{thePlatoon}</if>