From 25cc5dcc79d646d2a38891d40f0a22183622cfd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=B8=85?= Date: Fri, 5 Sep 2025 21:04:15 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=87=BA=E5=BA=93=E6=97=B6=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D=202.?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ErpMaterialInventoryRecordServiceImpl.java | 2 +- .../ErpMaterialInventoryRecordMapper.xml | 85 +++++++------------ .../src/views/business/material/index.vue | 2 +- .../views/business/materialPicking/add.vue | 2 +- .../views/business/materialPicking/index.vue | 15 ++-- .../views/business/materialReturns/index.vue | 4 +- .../views/business/materialStock/index.vue | 2 +- 7 files changed, 49 insertions(+), 63 deletions(-) diff --git a/maintain-business/src/main/java/com/maintain/business/service/impl/ErpMaterialInventoryRecordServiceImpl.java b/maintain-business/src/main/java/com/maintain/business/service/impl/ErpMaterialInventoryRecordServiceImpl.java index 7794f8a..164ceb4 100644 --- a/maintain-business/src/main/java/com/maintain/business/service/impl/ErpMaterialInventoryRecordServiceImpl.java +++ b/maintain-business/src/main/java/com/maintain/business/service/impl/ErpMaterialInventoryRecordServiceImpl.java @@ -87,7 +87,7 @@ public class ErpMaterialInventoryRecordServiceImpl implements IErpMaterialInvent .eq("t.type", 1) .like(StringUtils.isNotBlank(bo.getMaterialName()),"t.material_name", bo.getMaterialName()) .like(StringUtils.isNotBlank(bo.getMaterialCode()),"t.material_code", bo.getMaterialCode()) - .like(null != bo.getVendorId(),"t.vendor_id", bo.getVendorId()) + .eq(null != bo.getVendorId(),"t.vendor_id", bo.getVendorId()) .like(null != bo.getWarehouseId(), "t.warehouse_id", bo.getWarehouseId()) .in(null != bo.getWarehouseIdList(), "t.warehouse_id", bo.getWarehouseIdList()) .ge(null != bo.getInventory(), "t.inventory", bo.getInventory()) diff --git a/maintain-business/src/main/resources/mapper/ErpMaterialInventoryRecordMapper.xml b/maintain-business/src/main/resources/mapper/ErpMaterialInventoryRecordMapper.xml index 30dd083..e67617b 100644 --- a/maintain-business/src/main/resources/mapper/ErpMaterialInventoryRecordMapper.xml +++ b/maintain-business/src/main/resources/mapper/ErpMaterialInventoryRecordMapper.xml @@ -83,58 +83,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ) t - SELECT t.* FROM (SELECT - r.id as recordId, - r.info_id, - r.material_id, - r.warehouse_id, - r.vendor_id, - r.price, - r.type, - r.create_time, - IFNULL(put.put_number, 0) - IFNULL(ret.ret_number, 0) - IFNULL(pic.out_number, 0) + IFNULL(back.back_number, 0) AS inventory, - m.material_code, - m.material_name, - m.material_specifications, - m.material_unit, - m.material_brand, - m.procurement_subject, - m.compatible_with, - m.material_warranty_period, - m.reference_price, - m.selling_price, - m.material_url, - v.vendor_name, - w.name as warehouseName - FROM erp_material_inventory_record r - LEFT JOIN erp_material m ON r.material_id = m.id - LEFT JOIN erp_warehouse w ON r.warehouse_id = w.id - LEFT JOIN erp_material_vendor v ON r.vendor_id = v.id - LEFT JOIN ( - SELECT material_id, warehouse_id, vendor_id, SUM(number) AS put_number - FROM erp_material_inventory_record - WHERE type = '1' - GROUP BY material_id, warehouse_id, vendor_id - ) put ON r.material_id = put.material_id AND r.warehouse_id = put.warehouse_id AND r.vendor_id = put.vendor_id - LEFT JOIN ( - SELECT material_id, warehouse_id, vendor_id, SUM(number) AS ret_number - FROM erp_material_inventory_record - WHERE type = '2' - GROUP BY material_id, warehouse_id, vendor_id - ) ret ON r.material_id = ret.material_id AND r.warehouse_id = ret.warehouse_id AND r.vendor_id = ret.vendor_id - LEFT JOIN ( - SELECT material_id, warehouse_id, vendor_id, SUM(number) AS out_number - FROM erp_material_inventory_record - WHERE type = '3' - GROUP BY material_id, warehouse_id, vendor_id - ) pic ON r.material_id = pic.material_id AND r.warehouse_id = pic.warehouse_id AND r.vendor_id = pic.vendor_id - LEFT JOIN ( - SELECT material_id, warehouse_id, vendor_id, SUM(number) AS back_number - FROM erp_material_inventory_record - WHERE type = '4' - GROUP BY material_id, warehouse_id, vendor_id - ) back ON r.material_id = back.material_id AND r.warehouse_id = back.warehouse_id AND r.vendor_id = back.vendor_id - ) t + SELECT + t.* + FROM + ( + SELECT + r.id AS recordId, + r.info_id, + r.material_id, + r.warehouse_id, + r.vendor_id, + r.price, + r.type, + r.create_time, + IFNULL( put.putaway_number, 0 ) - IFNULL( put.issued_number, 0 ) - IFNULL( put.returned_number, 0 ) AS inventory,m.material_code, + m.material_name, + m.material_specifications, + m.material_unit, + m.material_brand, + m.procurement_subject, + m.compatible_with, + m.material_warranty_period, + m.reference_price, + m.selling_price, + m.material_url, + v.vendor_name, + w.NAME AS warehouseName + FROM + erp_material_inventory_record r + LEFT JOIN erp_material m ON r.material_id = m.id + LEFT JOIN erp_warehouse w ON r.warehouse_id = w.id + LEFT JOIN erp_material_vendor v ON r.vendor_id = v.id + LEFT JOIN erp_material_putaway_info put ON r.info_id = put.id + ) t