|
|
|
|
@ -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
|
|
|
|
|
|