优化货位和库存查询排序逻辑,调整表格字段显示,增加空库位选择限制

This commit is contained in:
escapemoon
2025-12-16 10:44:51 +08:00
parent e11dd7ceeb
commit e8010857e6
5 changed files with 46 additions and 18 deletions

View File

@@ -71,8 +71,8 @@ public class BasProduct extends BaseEntity
@Excel(name = "库存上限")
private String spare5;
/** 功率 */
@Excel(name = "库存下限")
/** 单位units */
@Excel(name = "单位名")
private String spare6;
/** 物料名称 */

View File

@@ -80,7 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
${params.warehouseDataScope}
</if>
</where>
order by the_platoon,the_floor,the_column
order by case when bcs.status='1' then 0 else 1 end asc, bcs.the_platoon asc, bcs.the_column asc, bcs.the_floor asc
</select>
<select id="selectBasCargoSpaceListByGroupCodingNo" parameterType="string" resultMap="BasCargoSpaceResult">

View File

@@ -82,20 +82,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="pdLoader" column="pd_loader" />
<!-- 以下为非 bas_stock 表字段(保留注释,按要求不删除) -->
<!--
<result property="warehouseName" column="warehouse_name" />
<!-- <result property="warehouseName" column="warehouse_name" />
<result property="cargoSpaceStatus" column="locked" />
<result property="cargoSpaceStockStatus" column="cargoSpaceStockStatus" />
<result property="cargoSpaceStockStatus" column="cargoSpaceStockStatus" /> -->
<result property="cargoSpaceName" column="cargo_space_name" />
<result property="spec" column="spec" />
<!-- <result property="spec" column="spec" />
<result property="price" column="price" />
<result property="unit" column="unit" />
<result property="cargoNo" column="cargo_no" />
<result property="parentId" column="parent_id" />
<result property="remark" column="remark" />
<result property="productModel" column="productModel" />
<result property="productType" column="productType" />
-->
<result property="productType" column="productType" /> -->
</resultMap>
<sql id="selectBasStockVo">
@@ -150,12 +150,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
bs.stock_id, -- 库存编码(bas_stock)
bs.stock_status, -- 库存状态(bas_stock)
bs.lot_no, -- 批次号(bas_stock)
bs.out_quantity
bs.out_quantity,
-- bp.unit, -- 单位(非 bas_stock,已注释保留)
-- bp.model as productModel, -- 非 bas_stock,已注释保留
-- bcs.locked as locked, -- 非 bas_stock,已注释保留
-- bcs.status as cargoSpaceStockStatus, -- 非 bas_stock,已注释保留
-- bcs.cargo_space_name as cargo_space_name -- 非 bas_stock,已注释保留
bcs.cargo_space_name as cargo_space_name
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
@@ -513,14 +513,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</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
<!-- 使用 bas_cargo_space.status 判断库位是否为空:1=空,2=满,3=入库分配,... -->
<!-- 要求:空库位优先,空/满组内按 the_platoon,the_column,the_floor 的数值段升序排列;不按产品过滤 -->
select b.cargo_space_name, b.cargo_space_id, b.status
from 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'
b.warehouse_id = #{warehouseId}
and b.status in ('1','2','3','4','5','6')
<if test="params.warehouseDataScope != null and params.warehouseDataScope !=''">
${params.warehouseDataScope}
</if>
</where>
order by b.the_platoon,b.the_floor,b.the_column asc
order by case when b.status='1' then 0 else 1 end asc, b.the_platoon asc, b.the_column asc, b.the_floor asc
</select>
</mapper>