diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseMaterialInfoMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseMaterialInfoMapper.xml index 846cd6f6..1c8b82a8 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseMaterialInfoMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesBaseMaterialInfoMapper.xml @@ -59,7 +59,7 @@ bmi.material_categories, bmi.material_subclass, bmi.material_type_id, - bmt.type_name material_type_name, + bmt.type_name material_type_name, bmi.batch_flag, bmi.batch_amount, bmi.material_unit_id, @@ -91,12 +91,12 @@ bmi.erp_modify_date, bmi.safe_stock_amount, mbui.unit_name, - wst.availableAmount, - IF(wst.availableAmount >= bmi.safe_stock_amount, '1', '0') isExceeded + IF(wst.availableAmount IS NULL, 0, wst.availableAmount) availableAmount, + IF(bmi.safe_stock_amount > IF(wst.availableAmount IS NULL, 0, wst.availableAmount) , '1', '0') isExceeded from mes_base_material_info bmi left join mes_base_material_type bmt on bmt.matrial_type_id = bmi.material_type_id left join mes_base_unit_info mbui on bmi.material_unit_id = mbui.erp_id - left join (select material_id, SUM(total_amount - occupy_amount) availableAmount + left join (select material_id, SUM(total_amount) availableAmount from wms_stock_total GROUP BY material_id) wst on bmi.material_id = wst.material_id @@ -142,7 +142,7 @@ and bmi.accessories_flag = #{accessoriesFlag} and bmi.low_value_consumable_flag = #{lowValueConsumableFlag} and bmi.always_flag = #{alwaysFlag} - and IF(wst.availableAmount >= bmi.safe_stock_amount, '1', '0') = #{isExceeded} + and IF(bmi.safe_stock_amount > IF(wst.availableAmount IS NULL, 0, wst.availableAmount) , '1', '0') = #{isExceeded} and exists (select 1 from wms_warehouse_material wwm where wwm.storage_type='1' and wwm.warehouse_id=511 and wwm.storage_id=bmi.material_id) and exists (select 1 from (select m1.material_id, m1.material_name, m2.material_id prod_id, m2.material_name prod_name diff --git a/hw-ui/src/views/mes/materialinfo/index.vue b/hw-ui/src/views/mes/materialinfo/index.vue index 43e70bea..730ebcc6 100644 --- a/hw-ui/src/views/mes/materialinfo/index.vue +++ b/hw-ui/src/views/mes/materialinfo/index.vue @@ -109,8 +109,8 @@ /> - - + +