查询统计与KPI仓库权限添加,库存汇总修改

This commit is contained in:
猫猫guowen
2025-06-19 15:57:55 +08:00
parent e738779974
commit 7bab82f217
27 changed files with 477 additions and 140 deletions

View File

@@ -16,7 +16,7 @@ public class StockSummary extends BaseEntity
private static final long serialVersionUID = 1L;
/** 序号 */
@Excel(name = "序号")
// @Excel(name = "序号")
private Long onlyIdentity;
/** 物料编码 */

View File

@@ -2,6 +2,8 @@ package com.ruoyi.search.ViewFlatWarehouseInFlow.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.common.core.domain.BaseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -114,7 +116,7 @@ public class ViewFlatWarehouseInFlowController extends BaseController
@GetMapping("/warehouseList")
public TableDataInfo warehouseList()
{
startPage();
// startPage();
BasWarehouse basWarehouse = new BasWarehouse();
basWarehouse.setWarehouseType("3");
List<BasWarehouse> list = basWarehouseService.selectBasWarehouseList(basWarehouse);

View File

@@ -20,6 +20,10 @@ public class ViewStockoutHistory extends BaseEntity
@Excel(name = "出库单号")
private String stockoutId;
/** 仓库ID */
@Excel(name = "仓库ID")
private String warehouseId;
/** 出库类型 */
@Excel(name = "出库类型")
private String outType;
@@ -124,6 +128,14 @@ public class ViewStockoutHistory extends BaseEntity
@Excel(name = "备注")
private String remark;
public String getWarehouseId() {
return warehouseId;
}
public void setWarehouseId(String warehouseId) {
this.warehouseId = warehouseId;
}
public String getPrice() {
return price;
}
@@ -384,6 +396,7 @@ public class ViewStockoutHistory extends BaseEntity
public String toString() {
return "ViewStockoutHistory{" +
"stockoutId='" + stockoutId + '\'' +
", warehouseId='" + warehouseId + '\'' +
", outType='" + outType + '\'' +
", createDate='" + createDate + '\'' +
", createManId='" + createManId + '\'' +

View File

@@ -44,7 +44,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="groupByRoadwayId != null and groupByRoadwayId">s.cargo_space_id as roadway_id,</if>
SUM(CAST(s.quantity AS DECIMAL(18,2))) as quantity
FROM bas_stock s
LEFT JOIN bas_product p ON s.product_guid = p.product_guid
LEFT JOIN bas_product p ON s.product_id = p.product_id
<where>
<if test="productId != null and productId != ''"> AND p.product_id like concat('%', #{productId}, '%')</if>
<if test="productName != null and productName != ''"> AND p.product_name like concat('%', #{productName}, '%')</if>
<if test="spec != null and spec != ''"> AND p.spec like concat('%', #{spec}, '%')</if>
<if test="unit != null and unit != ''"> AND p.unit like concat('%', #{unit}, '%')</if>
<if test="price != null and price != ''"> AND p.price like concat('%', #{price}, '%')</if>
<if test="spare1 != null and spare1 != ''"> AND p.spare1 like concat('%', #{spare1}, '%')</if>
<if test="spare2 != null and spare2 != ''"> AND p.spare2 like concat('%', #{spare2}, '%')</if>
<if test="spare5 != null and spare5 != ''"> AND p.spare5 like concat('%', #{spare5}, '%')</if>
<if test="spare6 != null and spare6 != ''"> AND p.spare6 like concat('%', #{spare6}, '%')</if>
<if test="spare8 != null and spare8 != ''"> AND p.spare8 like concat('%', #{spare8}, '%')</if>
<if test="spare7 != null and spare7 != ''"> AND p.spare7 like concat('%', #{spare7}, '%')</if>
<if test="remark != null and remark != ''"> AND p.spare7 like concat('%', #{remark}, '%')}</if>
<if test="lotNo != null and lotNo != ''"> AND s.lot_no like concat('%', #{lotNo}, '%')</if>
<if test="warehouseId != null and warehouseId != ''"> AND s.warehouse_id like concat('%', #{warehouseId}, '%')</if>
<if test="roadwayId != null and roadwayId != ''"> AND s.cargo_space_id like concat('%', #{roadwayId}, '%')</if>
<if test="params.warehouseDataScope != null and params.warehouseDataScope !=''">
${params.warehouseDataScope}
</if>
</where>
GROUP BY
<trim prefixOverrides=",">
<if test="groupByProductId != null and groupByProductId">,p.product_id</if>
@@ -52,12 +72,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="groupBySpec != null and groupBySpec">,p.spec</if>
<if test="groupByUnit != null and groupByUnit">,p.unit</if>
<if test="groupByPrice != null and groupByPrice">,p.price</if>
<if test="groupBySpare1 != null and groupBySpare1">p.spare1,</if>
<if test="groupBySpare2 != null and groupBySpare2">p.spare2,</if>
<if test="groupBySpare5 != null and groupBySpare5">p.spare5,</if>
<if test="groupBySpare6 != null and groupBySpare6">p.spare6,</if>
<if test="groupBySpare8 != null and groupBySpare8">p.spare8,</if>
<if test="groupBySpare7 != null and groupBySpare7">p.spare7,</if>
<if test="groupBySpare1 != null and groupBySpare1">,p.spare1</if>
<if test="groupBySpare2 != null and groupBySpare2">,p.spare2</if>
<if test="groupBySpare5 != null and groupBySpare5">,p.spare5</if>
<if test="groupBySpare6 != null and groupBySpare6">,p.spare6</if>
<if test="groupBySpare8 != null and groupBySpare8">,p.spare8</if>
<if test="groupBySpare7 != null and groupBySpare7">,p.spare7</if>
<if test="groupByLotNo != null and groupByLotNo">,s.lot_no</if>
<if test="groupByWarehouseId != null and groupByWarehouseId">,s.warehouse_id</if>
<if test="groupByRoadwayId != null and groupByRoadwayId">,s.cargo_space_id</if>
@@ -67,30 +87,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
1 as group_all,
SUM(CAST(s.quantity AS DECIMAL(18,2))) as quantity
FROM bas_stock s
LEFT JOIN bas_product p ON s.product_guid = p.product_guid
LEFT JOIN bas_product p ON s.product_id = p.product_id
<where>
<if test="productId != null and productId != ''"> AND p.product_id like concat('%', #{productId}, '%')</if>
<if test="productName != null and productName != ''"> AND p.product_name like concat('%', #{productName}, '%')</if>
<if test="spec != null and spec != ''"> AND p.spec like concat('%', #{spec}, '%')</if>
<if test="unit != null and unit != ''"> AND p.unit like concat('%', #{unit}, '%')</if>
<if test="price != null and price != ''"> AND p.price like concat('%', #{price}, '%')</if>
<if test="spare1 != null and spare1 != ''"> AND p.spare1 like concat('%', #{spare1}, '%')</if>
<if test="spare2 != null and spare2 != ''"> AND p.spare2 like concat('%', #{spare2}, '%')</if>
<if test="spare5 != null and spare5 != ''"> AND p.spare5 like concat('%', #{spare5}, '%')</if>
<if test="spare6 != null and spare6 != ''"> AND p.spare6 like concat('%', #{spare6}, '%')</if>
<if test="spare8 != null and spare8 != ''"> AND p.spare8 like concat('%', #{spare8}, '%')</if>
<if test="spare7 != null and spare7 != ''"> AND p.spare7 like concat('%', #{spare7}, '%')</if>
<if test="remark != null and remark != ''"> AND p.spare7 like concat('%', #{remark}, '%')}</if>
<if test="lotNo != null and lotNo != ''"> AND s.lot_no like concat('%', #{lotNo}, '%')</if>
<if test="warehouseId != null and warehouseId != ''"> AND s.warehouse_id like concat('%', #{warehouseId}, '%')</if>
<if test="roadwayId != null and roadwayId != ''"> AND s.cargo_space_id like concat('%', #{roadwayId}, '%')</if>
<if test="params.warehouseDataScope != null and params.warehouseDataScope !=''">
${params.warehouseDataScope}
</if>
</where>
</otherwise>
</choose>
</sql>
<select id="selectStockSummaryList" parameterType="StockSummary" resultMap="StockSummaryResult">
<include refid="selectStockSummaryVo"/>
<where>
<if test="productId != null and productId != ''"> AND p.product_id = #{productId}</if>
<if test="productName != null and productName != ''"> AND p.product_name like concat('%', #{productName}, '%')</if>
<if test="spec != null and spec != ''"> AND p.spec = #{spec}</if>
<if test="unit != null and unit != ''"> AND p.unit = #{unit}</if>
<if test="price != null and price != ''"> AND p.price = #{price}</if>
<if test="spare1 != null and spare1 != ''"> AND p.spare1 = #{spare1}</if>
<if test="spare2 != null and spare2 != ''"> AND p.spare2 = #{spare2}</if>
<if test="spare5 != null and spare5 != ''"> AND p.spare5 = #{spare5}</if>
<if test="spare6 != null and spare6 != ''"> AND p.spare6 = #{spare6}</if>
<if test="spare8 != null and spare8 != ''"> AND p.spare8 = #{spare8}</if>
<if test="spare7 != null and spare7 != ''"> AND p.spare7 = #{spare7}</if>
<if test="remark != null and remark != ''"> AND p.spare7 = #{remark}</if>
<if test="lotNo != null and lotNo != ''"> AND s.lot_no = #{lotNo}</if>
<if test="warehouseId != null and warehouseId != ''"> AND s.warehouse_id = #{warehouseId}</if>
<if test="roadwayId != null and roadwayId != ''"> AND s.cargo_space_id = #{roadwayId}</if>
</where>
</select>
<select id="selectStockSummaryByOnlyIdentity" parameterType="Long" resultMap="StockSummaryResult">

View File

@@ -65,6 +65,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="spare6 != null and spare6 != ''"> and spare6 like concat('%', #{spare6}, '%')</if>
<if test="spare7 != null and spare7 != ''"> and spare7 like concat('%', #{spare7}, '%')</if>
<if test="spare8 != null and spare8 != ''"> and spare8 like concat('%', #{spare8}, '%')</if>
<if test="params.warehouseDataScope != null and params.warehouseDataScope !=''">
${params.warehouseDataScope}
</if>
</where>
</select>

View File

@@ -65,6 +65,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="spare6 != null and spare6 != ''"> and spare6 like concat('%', #{spare6}, '%')</if>
<if test="spare7 != null and spare7 != ''"> and spare7 like concat('%', #{spare7}, '%')</if>
<if test="spare8 != null and spare8 != ''"> and spare8 like concat('%', #{spare8}, '%')</if>
<if test="params.warehouseDataScope != null and params.warehouseDataScope !=''">
${params.warehouseDataScope}
</if>
</where>
</select>

View File

@@ -87,6 +87,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="spare6 != null and spare6 != ''"> and spare6 like concat('%', #{spare6}, '%')</if>
<if test="spare7 != null and spare7 != ''"> and spare7 like concat('%', #{spare7}, '%')</if>
<if test="spare8 != null and spare8 != ''"> and spare8 like concat('%', #{spare8}, '%')</if>
<if test="params.warehouseDataScope != null and params.warehouseDataScope !=''">
${params.warehouseDataScope}
</if>
</where>
</select>

View File

@@ -91,6 +91,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="spare6 != null and spare6 != ''"> and spare6 like concat('%', #{spare6}, '%')</if>
<if test="spare7 != null and spare7 != ''"> and spare7 like concat('%', #{spare7}, '%')</if>
<if test="spare8 != null and spare8 != ''"> and spare8 like concat('%', #{spare8}, '%')</if>
<if test="params.warehouseDataScope != null and params.warehouseDataScope !=''">
${params.warehouseDataScope}
</if>
</where>
</select>

View File

@@ -67,6 +67,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="spare6 != null and spare6 != ''"> and spare6 like concat('%', #{spare6}, '%')</if>
<if test="spare7 != null and spare7 != ''"> and spare7 like concat('%', #{spare7}, '%')</if>
<if test="spare8 != null and spare8 != ''"> and spare8 like concat('%', #{spare8}, '%')</if>
<if test="params.warehouseDataScope != null and params.warehouseDataScope !=''">
${params.warehouseDataScope}
</if>
</where>
</select>

View File

@@ -118,6 +118,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="thisCargoArea != null and thisCargoArea != ''"> and this_cargo_area like concat('%', #{thisCargoArea}, '%')</if>
<if test="spare7 != null and spare7 != ''"> and spare7 like concat('%', #{spare7}, '%')</if>
<if test="spare8 != null and spare8 != ''"> and spare8 like concat('%', #{spare8}, '%')</if>
<if test="params.warehouseDataScope != null and params.warehouseDataScope !=''">
${params.warehouseDataScope}
</if>
</where>
</select>

View File

@@ -118,6 +118,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="thisCargoArea != null and thisCargoArea != ''"> and this_cargo_area like concat('%', #{thisCargoArea}, '%')</if>
<if test="spare7 != null and spare7 != ''"> and spare7 like concat('%', #{spare7}, '%')</if>
<if test="spare8 != null and spare8 != ''"> and spare8 like concat('%', #{spare8}, '%')</if>
<if test="params.warehouseDataScope != null and params.warehouseDataScope !=''">
${params.warehouseDataScope}
</if>
</where>
</select>

View File

@@ -100,6 +100,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="spare6 != null and spare6 != ''"> and spare6 like concat('%', #{spare6}, '%')</if>
<if test="spare7 != null and spare7 != ''"> and spare7 like concat('%', #{spare7}, '%')</if>
<if test="spare8 != null and spare8 != ''"> and spare8 like concat('%', #{spare8}, '%')</if>
<if test="params.warehouseDataScope != null and params.warehouseDataScope !=''">
${params.warehouseDataScope}
</if>
</where>
</select>

View File

@@ -6,6 +6,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="ViewStockoutHistory" id="ViewStockoutHistoryResult">
<result property="stockoutId" column="stockout_id" />
<result property="warehouseId" column="warehouse_id" />
<result property="outType" column="out_type" />
<result property="createDate" column="create_date" />
<result property="createManId" column="create_man_id" />
@@ -35,13 +36,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectViewStockoutHistoryVo">
select stockout_id, out_type, create_date, create_man_id, status, stockout_source, exit_id, stockout_detail_id, product_id, product_name, lot_no, quantity, allot_quantity, assign_num, erp_stockout_id, entryid, customer_name, spec, unit, price, remark,spare1,spare2,spare5,spare6,spare7,spare8 from view_stockout_history
select stockout_id,warehouse_id, out_type, create_date, create_man_id, status, stockout_source, exit_id, stockout_detail_id, product_id, product_name, lot_no, quantity, allot_quantity, assign_num, erp_stockout_id, entryid, customer_name, spec, unit, price, remark,spare1,spare2,spare5,spare6,spare7,spare8 from view_stockout_history
</sql>
<select id="selectViewStockoutHistoryList" parameterType="ViewStockoutHistory" resultMap="ViewStockoutHistoryResult">
<include refid="selectViewStockoutHistoryVo"/>
<where>
<where>
<if test="stockoutId != null and stockoutId != ''"> and stockout_id like concat('%', #{stockoutId}, '%')</if>
<if test="warehouseId != null and warehouseId != ''"> and warehouse_id like concat('%', #{warehouseId}, '%')</if>
<if test="outType != null and outType != ''"> and out_type = #{outType}</if>
<if test="createDate != null and createDate != ''"> and create_date like concat('%', #{createDate}, '%')</if>
<if test="createManId != null and createManId != ''"> and create_man_id like concat('%', #{createManId}, '%')</if>
@@ -67,6 +69,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="spare6 != null and spare6 != ''"> and spare6 like concat('%', #{spare6}, '%')</if>
<if test="spare7 != null and spare7 != ''"> and spare7 like concat('%', #{spare7}, '%')</if>
<if test="spare8 != null and spare8 != ''"> and spare8 like concat('%', #{spare8}, '%')</if>
<if test="params.warehouseDataScope != null and params.warehouseDataScope !=''">
${params.warehouseDataScope}
</if>
</where>
</select>