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

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>

View File

@@ -111,7 +111,8 @@
<el-table-column label="产品型号" align="center" prop="spec" width="260"/>
<el-table-column label="产品分类" align="center" prop="parentId" />
<el-table-column label="价格" align="center" prop="price" />
<el-table-column label="单位id" align="center" prop="unit" />
<el-table-column label="单位" align="center" prop="spare6" />
<!-- 中unit为原项目单位 spare6为对方接口中的units,包含单位和辅助单位的json -->
<el-table-column label="单位名称" align="center" prop="spare1" />
<!-- <el-table-column label="url" align="center" prop="spare3" />
<el-table-column label="btnurl" align="center" prop="spare4" />

View File

@@ -88,7 +88,7 @@
<dict-tag :options="dict.type.stock_status" :value="scope.row.stockStatus"/>
</template>
</el-table-column>
<el-table-column label="库位编码" align="center" prop="cargoSpaceId" width="160"/>
<el-table-column label="货位名称" align="center" prop="cargoSpaceName" width="160"/>
<el-table-column label="托盘" align="center" prop="trayCode"/>
<el-table-column label="物料编码" align="center" prop="productId"/>
<el-table-column label="物料名称" align="center" prop="productName" width="160" />
@@ -258,6 +258,7 @@
v-loading="cargoSpaceLoading"
:data="cargoSpaceList"
@row-click="handleCargoSpaceRowClick"
:row-class-name="cargoSpaceRowClassName"
highlight-current-row
max-height="400">
<el-table-column label="货位编码" align="center" prop="cargoSpaceId" />
@@ -654,11 +655,21 @@ export default {
},
/** 货位选择行点击 */
handleCargoSpaceRowClick(row) {
this.selectedCargoSpace = row
// 仅允许选择状态为 '1' 的空库位
if (row && row.status === '1') {
this.selectedCargoSpace = row
} else {
this.selectedCargoSpace = null
this.$modal.msgWarning('只能选择空库位)')
}
},
/** 确认选择货位 */
confirmCargoSpaceSelect() {
if (this.selectedCargoSpace) {
if (this.selectedCargoSpace.status !== '1') {
this.$modal.msgWarning('只能选择空库位')
return
}
this.form.cargoSpaceId = this.selectedCargoSpace.cargoSpaceId
this.form.cargoSpaceName = this.selectedCargoSpace.cargoSpaceName
this.cargoSpaceSelectVisible = false
@@ -667,6 +678,14 @@ export default {
this.$modal.msgWarning("请选择一个货位")
}
}
,
cargoSpaceRowClassName({row, rowIndex}) {
if (row && row.status !== '1') {
return 'cargo-space-disabled'
}
return ''
},
}
}
</script>
@@ -675,4 +694,9 @@ export default {
.no-wrap {
white-space: nowrap;
}
.cargo-space-disabled {
color: #999 !important;
background-color: #fbfbfb !important;
}
</style>