feat(wms): 添加库存告警列表接口

- 在 IWmsInventoryService 中新增 getListInventoryAlarm 方法- 在 WmsInventoryController 中添加 getListInventoryAlarm 接口
- 在 WmsInventoryMapper 中增加 getListInventoryAlarm 方法
- 在 WmsInventoryMapper.xml 中实现 getListInventoryAlarm 的 SQL 查询
- 在 WmsInventoryServiceImpl 中实现 getListInventoryAlarm 方法

此改动用于查询库存告警列表,支持按仓库、锁定状态、物料分类、库存状态等条件筛选。
master
zangch@mesnac.com 3 months ago
parent 1d0fe2f860
commit 06957a151f

@ -18,8 +18,8 @@ import org.dromara.common.web.core.BaseController;
import org.dromara.wms.domain.WmsInventory;
import org.dromara.wms.domain.bo.WmsInventoryBo;
import org.dromara.wms.domain.bo.WmsInventoryLedgerBo;
import org.dromara.wms.domain.vo.WmsInventoryVo;
import org.dromara.wms.domain.vo.WmsInventoryLedgerVo;
import org.dromara.wms.domain.vo.WmsInventoryVo;
import org.dromara.wms.service.IWmsInventoryService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -158,4 +158,16 @@ public class WmsInventoryController extends BaseController {
List<WmsInventoryLedgerVo> list = wmsInventoryService.queryInventoryLedgerList(bo);
ExcelUtil.exportExcel(list, "库存台账", WmsInventoryLedgerVo.class, response);
}
/**
*
* @param bo
* @return
*/
@GetMapping("/getListInventoryAlarm")
public R<List<WmsInventoryVo> >getListInventoryAlarm(WmsInventoryBo bo) {
List<WmsInventoryVo> listInventoryAlarm = wmsInventoryService.getListInventoryAlarm(bo);
return R.ok(listInventoryAlarm);
}
}

@ -25,6 +25,8 @@ public interface WmsInventoryMapper extends BaseMapperPlus<WmsInventory, WmsInve
List<WmsInventoryVo> listInventoryAlarm(@Param("entity")WmsInventoryBo bo);
List<WmsInventoryVo> getListInventoryAlarm(@Param("entity")WmsInventoryBo bo);
List<WmsInventoryVo> selectInventoryMaterialInfoList(@Param("entity")WmsInventoryBo bo);
List<WmsInventoryVo> selectSemiInventoryListByLocation(@Param("locationCode") String locationCode);

@ -118,4 +118,12 @@ public interface IWmsInventoryService {
* @return
*/
List<WmsInventoryLedgerVo> queryInventoryLedgerList(WmsInventoryLedgerBo bo);
/**
*
*
* @param bo
* @return
*/
List<WmsInventoryVo> getListInventoryAlarm(WmsInventoryBo bo);
}

@ -189,6 +189,18 @@ public class WmsInventoryServiceImpl implements IWmsInventoryService {
return TableDataInfo.build(page);
}
/**
*
*
*
* @param bo
* @return
*/
@Override
public List<WmsInventoryVo> getListInventoryAlarm(WmsInventoryBo bo) {
return baseMapper.getListInventoryAlarm(bo);
}
@Override
public int deletePlanList(ArrayList<Long> ids) {
return baseMapper.deleteByIds(ids);

@ -58,6 +58,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
x.material_id
</select>
<select id="getListInventoryAlarm" resultType="org.dromara.wms.domain.vo.WmsInventoryVo"
parameterType="org.dromara.wms.domain.bo.WmsInventoryBo">
SELECT
x.material_id,
SUM(x.inventory_qty) inventory_qty,
CASE when SUM(x.inventory_qty) > MAX(b.max_stock_amount) then '0'
when MIN(b.min_stock_amount) > SUM(x.inventory_qty) then '0'
ELSE '1' END as inventory_status,
MAX(b.min_stock_amount) min_stock_amount,
MAX(b.max_stock_amount) max_stock_amount,
MAX(b.material_code) material_code,
MAX(b.material_name) material_name,
-- MAX(x.material_categories) material_categories,
-- MAX(bmc.material_category_name) material_category_name,
MAX(x.lock_state) lock_state
FROM
hwmom.dbo.wms_inventory x
left join base_material_info_copy1 b on
x.material_id = b.material_id
-- left join base_material_category bmc on
-- x.material_categories = bmc.material_category_id
<where>
<!-- 可按物料、仓库等条件筛选,但最终只按物料聚合 -->
<!-- <if test="entity.materialId != null ">and x.material_id = #{entity.materialId}</if> -->
<if test="entity.warehouseId != null and entity.warehouseId != ''">and x.warehouse_id = #{entity.warehouseId}</if>
<if test="entity.lockState != null and entity.lockState != ''">and x.lock_state = #{entity.lockState}</if>
<if test="entity.materialCategoryId != null and entity.materialCategoryId != ''">and x.material_categories = #{entity.materialCategoryId}</if>
<if test="entity.inventoryStatus != null and entity.inventoryStatus != ''">and x.inventory_status = #{entity.inventoryStatus}</if>
<!-- 由于按物料聚合locationCode/batchCode不参与聚合展示这里去除模糊条件避免产生非预期聚合 -->
<!-- <if test="entity.locationCode != null and entity.locationCode != ''">and x.location_code like concat('%',#{entity.locationCode},'%')</if> -->
<!-- <if test="entity.batchCode != null and entity.batchCode != ''">and x.batch_code like concat('%',#{entity.batchCode},'%')</if> -->
<if test="entity.materialCode != null and entity.materialCode != ''">and b.material_code like concat('%',#{entity.materialCode},'%')</if>
<if test="entity.storeId != null and entity.storeId != ''">and x.store_id = #{entity.storeId}</if>
</where>
group by
x.material_id
</select>
<select id="selectInventoryMaterialInfoList" resultType="org.dromara.wms.domain.vo.WmsInventoryVo"
parameterType="org.dromara.wms.domain.bo.WmsInventoryBo">
SELECT

Loading…
Cancel
Save