Commit e9e044a2 by chuishuo

页面调优,库位,仓库字典调整

parent 883b7c52
......@@ -387,6 +387,7 @@ export default {
handleConfirm(row) {
this.reset();
const id = row.id || this.ids
this.buttonShow = true
this.confirmTitle = '盘点确认'
getStocktakes(id,'confirm').then(response => {
this.form = response.data
......
......@@ -63,9 +63,9 @@
<div class="table-container">
<el-table v-loading="loading" :data="stocktakesList" @selection-change="handleSelectionChange">
<el-table-column label="计划日期" align="center" prop="plannedDates" width="180" fixed/>
<el-table-column label="计划日期" align="center" prop="plannedDates" width="180" />
<el-table-column label="物料" prop="materialId" >
<el-table-column label="物料" prop="materialId" fixed>
<template slot-scope="scope">
{{ getDictLabel(materialDict, scope.row.materialId, 'sap_no', 'material_name') }}
</template>
......@@ -137,7 +137,7 @@
<el-dialog title="统计详情查看" :visible.sync="viewOpen" width="800px" append-to-body>
<el-table :data="detailList" border stripe size="small" style="width: 100%;">
<el-table-column label="计划日期" prop="plannedDates" />
<el-table-column label="物料" prop="materialId">
<el-table-column label="物料" prop="materialId" fixed>
<template slot-scope="scope">
{{ getDictLabel(materialDict, scope.row.materialId, 'sap_no', 'material_name') || '无' }}
</template>
......@@ -238,13 +238,10 @@ export default {
this.detailList = []; // 清空旧数据
// 接口请求添加try/catch和空值判断
getCountInfo(row).then(response => {
console.log('接口返回完整数据:', response); // 打印1
console.log('接口返回的rows数组:', response.rows); // 打印2
if (response && response.rows) {
this.detailList = response.rows; // 直接赋值数组给detailList
console.log('赋值后的detailList:', this.detailList); // 打印3
} else {
this.$message.warning('暂无详情数据');
}
this.viewOpen = true;
}).catch(error => {
......
......@@ -3,6 +3,7 @@ package com.ruoyi.inventory.domain;
import java.util.List;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
......@@ -71,7 +72,7 @@ public class Stocktakes extends BaseEntity
private String updateUserCode;
/** 盘点单明细信息 */
private List<StocktakeItems> stocktakeItemsList;
private List<StocktakeItemsTo> stocktakeItemsList;
public void setId(String id)
{
......@@ -203,12 +204,12 @@ public class Stocktakes extends BaseEntity
return updateUserCode;
}
public List<StocktakeItems> getStocktakeItemsList()
public List<StocktakeItemsTo> getStocktakeItemsList()
{
return stocktakeItemsList;
}
public void setStocktakeItemsList(List<StocktakeItems> stocktakeItemsList)
public void setStocktakeItemsList(List<StocktakeItemsTo> stocktakeItemsList)
{
this.stocktakeItemsList = stocktakeItemsList;
}
......
package com.ruoyi.inventory.domain.TO;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import com.ruoyi.inventory.domain.StocktakeItems;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
/**
* 盘点单明细对象 stocktake_items
*
* @author ruoyi
* @date 2025-12-02
*/
public class StocktakeItemsTo extends StocktakeItems
{
private String warehouseName;
private String locationName;
public String getWarehouseName() {
return warehouseName;
}
public void setWarehouseName(String warehouseName) {
this.warehouseName = warehouseName;
}
public String getLocationName() {
return locationName;
}
public void setLocationName(String locationName) {
this.locationName = locationName;
}
}
......@@ -5,6 +5,7 @@ import java.util.List;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.inventory.domain.Inventory;
import com.ruoyi.inventory.domain.StocktakeItems;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
/**
* 库存Mapper接口
......@@ -79,11 +80,11 @@ public interface InventoryMapper
* @date 2025/12/3
* @version 1.0
*/
List<StocktakeItems> selectstocktakeItemsList();
List<StocktakeItemsTo> selectstocktakeItemsList();
/**
* 按物料汇总统计库存
*
*
* @param inventory 库存查询条件
* @return 库存汇总统计集合
*/
......@@ -91,7 +92,7 @@ public interface InventoryMapper
/**
* 查询库存明细列表(根据物料标识及检索条件)
*
*
* @param inventory 库存查询条件
* @return 库存明细集合
*/
......
......@@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map;
import com.ruoyi.inventory.domain.StocktakeItems;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
import com.ruoyi.inventory.domain.TO.StocktakesVo;
/**
......@@ -63,7 +64,7 @@ public interface StocktakeItemsMapper
public int deleteStocktakeItemsByIds(String[] ids);
// 主表调用获取子表信息
public List<StocktakeItems> selectStocktakeItemsByMain(Map<String, Object> query);
public List<StocktakeItemsTo> selectStocktakeItemsByMain(Map<String, Object> query);
// 查询处理统计-详情
public List<StocktakesVo> selectStocktakesCountInfo(StocktakesVo stocktakes);
......
......@@ -7,18 +7,19 @@ import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.inventory.domain.Inventory;
import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.StocktakeItems;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
/**
* 库存Service接口
*
*
* @author ruoyi
* @date 2025-12-03
*/
public interface IInventoryService
public interface IInventoryService
{
/**
* 查询库存
*
*
* @param id 库存主键
* @return 库存
*/
......@@ -26,7 +27,7 @@ public interface IInventoryService
/**
* 查询库存列表
*
*
* @param inventory 库存
* @return 库存集合
*/
......@@ -36,7 +37,7 @@ public interface IInventoryService
/**
* 新增库存
*
*
* @param inventory 库存
* @return 结果
*/
......@@ -51,7 +52,7 @@ public interface IInventoryService
public int insertInventoryList(List<Inventory> inventoryList);
/**
* 修改库存
*
*
* @param inventory 库存
* @return 结果
*/
......@@ -67,7 +68,7 @@ public interface IInventoryService
/**
* 批量删除库存
*
*
* @param ids 需要删除的库存主键集合
* @return 结果
*/
......@@ -75,7 +76,7 @@ public interface IInventoryService
/**
* 删除库存信息
*
*
* @param id 库存主键
* @return 结果
*/
......@@ -88,11 +89,11 @@ public interface IInventoryService
* @date 2025/12/3
* @version 1.0
*/
public List<StocktakeItems> selectstocktakeItemsList();
public List<StocktakeItemsTo> selectstocktakeItemsList();
/**
* 按物料汇总统计库存
*
*
* @param inventory 库存查询条件
* @return 库存汇总统计集合
*/
......@@ -100,7 +101,7 @@ public interface IInventoryService
/**
* 查询库存明细列表(根据物料标识及检索条件)
*
*
* @param inventory 库存查询条件
* @return 库存明细集合
*/
......
......@@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map;
import com.ruoyi.inventory.domain.StocktakeItems;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
import com.ruoyi.inventory.domain.TO.StocktakesVo;
/**
......@@ -23,7 +24,7 @@ public interface IStocktakeItemsService
public StocktakeItems selectStocktakeItemsById(String id);
// 主表调用
public List<StocktakeItems> selectStocktakeItemsByMain(Map<String,Object> query);
public List<StocktakeItemsTo> selectStocktakeItemsByMain(Map<String,Object> query);
/**
* 查询盘点单明细列表
......
......@@ -10,6 +10,7 @@ import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.inventory.domain.OutboundOrderItems;
import com.ruoyi.inventory.domain.OutboundOrderLog;
import com.ruoyi.inventory.domain.StocktakeItems;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
import com.ruoyi.inventory.mapper.OutboundOrderLogMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.SystemUtils;
......@@ -21,7 +22,7 @@ import com.ruoyi.inventory.service.IInventoryService;
/**
* 库存Service业务层处理
*
*
* @author ruoyi
* @date 2025-12-03
*/
......@@ -35,7 +36,7 @@ public class InventoryServiceImpl implements IInventoryService
/**
* 查询库存
*
*
* @param id 库存主键
* @return 库存
*/
......@@ -47,7 +48,7 @@ public class InventoryServiceImpl implements IInventoryService
/**
* 查询库存列表
*
*
* @param inventory 库存
* @return 库存
*/
......@@ -66,7 +67,7 @@ public class InventoryServiceImpl implements IInventoryService
/**
* 新增库存
*
*
* @param inventory 库存
* @return 结果
*/
......@@ -90,7 +91,7 @@ public class InventoryServiceImpl implements IInventoryService
}
/**
* 修改库存
*
*
* @param inventory 库存
* @return 结果
*/
......@@ -161,7 +162,7 @@ public class InventoryServiceImpl implements IInventoryService
}
/**
* 批量删除库存
*
*
* @param ids 需要删除的库存主键
* @return 结果
*/
......@@ -173,7 +174,7 @@ public class InventoryServiceImpl implements IInventoryService
/**
* 删除库存信息
*
*
* @param id 库存主键
* @return 结果
*/
......@@ -202,13 +203,13 @@ public class InventoryServiceImpl implements IInventoryService
* @date 2025/12/3
* @version 1.0
*/
public List<StocktakeItems> selectstocktakeItemsList(){
public List<StocktakeItemsTo> selectstocktakeItemsList(){
return inventoryMapper.selectstocktakeItemsList();
}
/**
* 按物料汇总统计库存
*
*
* @param inventory 库存查询条件
* @return 库存汇总统计集合
*/
......@@ -220,7 +221,7 @@ public class InventoryServiceImpl implements IInventoryService
/**
* 查询库存明细列表(根据物料标识及检索条件)
*
*
* @param inventory 库存查询条件
* @return 库存明细集合
*/
......
......@@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
import com.ruoyi.inventory.domain.TO.StocktakesVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -41,7 +42,7 @@ public class StocktakeItemsServiceImpl implements IStocktakeItemsService
* @date 2025/12/5
* @version 1.0
*/
public List<StocktakeItems> selectStocktakeItemsByMain(Map<String,Object> query){
public List<StocktakeItemsTo> selectStocktakeItemsByMain(Map<String,Object> query){
return stocktakeItemsMapper.selectStocktakeItemsByMain(query);
}
/**
......
......@@ -9,6 +9,7 @@ import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import com.ruoyi.inventory.domain.Inventory;
import com.ruoyi.inventory.domain.InventoryTransactions;
import com.ruoyi.inventory.domain.TO.StocktakeItemsTo;
import com.ruoyi.inventory.domain.TO.StocktakesTO;
import com.ruoyi.inventory.domain.TO.StocktakesVo;
import com.ruoyi.inventory.mapper.StocktakeItemsMapper;
......@@ -64,7 +65,7 @@ public class StocktakesServiceImpl implements IStocktakesService
// 盘点确认时只查看 变更的
query.put("adjusted",1);
}
List<StocktakeItems> stocktakeItems = stocktakeItemsService.selectStocktakeItemsByMain(query);
List<StocktakeItemsTo> stocktakeItems = stocktakeItemsService.selectStocktakeItemsByMain(query);
stocktakes.setStocktakeItemsList(stocktakeItems);
return stocktakes;
......@@ -107,7 +108,7 @@ public class StocktakesServiceImpl implements IStocktakesService
Inventory inventory = new Inventory();
inventory.setInventoryStatus(1L);
inventory.setIsUsed(1L);
List<StocktakeItems> stocktakeItemsList = inventoryService.selectstocktakeItemsList();
List<StocktakeItemsTo> stocktakeItemsList = inventoryService.selectstocktakeItemsList();
stocktakes.setStocktakeItemsList(stocktakeItemsList);
insertStocktakeItems(stocktakes);
return rows;
......@@ -136,8 +137,8 @@ public class StocktakesServiceImpl implements IStocktakesService
Date nowDate = DateUtils.getNowDate();//统一调整时间
if("check".equals(operationType)){
// 盘点提交
List<StocktakeItems> stocktakeItemsList = stocktakes.getStocktakeItemsList();
for (StocktakeItems stocktakeItems : stocktakeItemsList) {
List<StocktakeItemsTo> stocktakeItemsList = stocktakes.getStocktakeItemsList();
for (StocktakeItemsTo stocktakeItems : stocktakeItemsList) {
stocktakeItems.setAdjustedBy(loginUserId);//调整人
stocktakeItems.setAdjustedAt(nowDate);//调整时间
stocktakeItems.setUpdateUserCode(loginUserId);//更新人
......@@ -164,8 +165,8 @@ public class StocktakesServiceImpl implements IStocktakesService
if("confirm".equals(operationType)){
// 确认盘点 提交
// 库存表根据子表数据更新库存量 --因为盘点确认时查询的就是有调整的子表数据,又因为库存操作表需要的货主id子表中没有,所以需要根据id查询库存表
List<StocktakeItems> stocktakeItemsList = stocktakes.getStocktakeItemsList();
for (StocktakeItems stocktakeItems : stocktakeItemsList) {
List<StocktakeItemsTo> stocktakeItemsList = stocktakes.getStocktakeItemsList();
for (StocktakeItemsTo stocktakeItems : stocktakeItemsList) {
// 获取实际数量
Long actualQuantity = stocktakeItems.getActualQuantity();
// 库存表id
......@@ -251,7 +252,7 @@ public class StocktakesServiceImpl implements IStocktakesService
*/
public void insertStocktakeItems(Stocktakes stocktakes)
{
List<StocktakeItems> stocktakeItemsList = stocktakes.getStocktakeItemsList();
List<StocktakeItemsTo> stocktakeItemsList = stocktakes.getStocktakeItemsList();
String stocktakeid = stocktakes.getId(); // 盘点单号
String createUserCode = stocktakes.getCreateUserCode();// 创建人
Date createTime = stocktakes.getCreateTime();// 创建日期
......@@ -268,6 +269,7 @@ public class StocktakesServiceImpl implements IStocktakesService
stocktakeItems.setCreateUserCode(createUserCode);
stocktakeItems.setCreateTime(createTime);
list.add(stocktakeItems);
}
if (list.size() > 0)
{
......
......@@ -32,13 +32,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="warehousesId" column="warehouses_id" />
</resultMap>
<resultMap type="StocktakeItems" id="StocktakeItemsResult">
<resultMap type="com.ruoyi.inventory.domain.TO.StocktakeItemsTo" id="StocktakeItemsResult">
<result property="id" column="id" />
<result property="stocktakeId" column="stocktake_id" />
<result property="materialId" column="material_id" />
<result property="batchCode" column="batch_code" />
<result property="warehouseId" column="warehouse_id" />
<result property="locationId" column="location_id" />
<result property="warehouseName" column="warehouse_name" />
<result property="locationName" column="location_name" />
<result property="systemQuantity" column="system_quantity" />
<result property="actualQuantity" column="actual_quantity" />
<result property="varianceQuantity" column="variance_quantity" />
......@@ -52,7 +54,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="adjustedAt" column="adjusted_at" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="materialRange" column="material_range" />
<result property="locationRange" column="location_range" />
<result property="remark" column="remark" />
<result property="isUsed" column="is_used" />
<result property="sortNo" column="sort_no" />
<result property="createTime" column="create_time" />
<result property="createUserCode" column="create_user_code" />
<result property="updateTime" column="update_time" />
<result property="updateUserCode" column="update_user_code" />
<result property="inventoryId" column="inventory_id" />
<result property="unitPrice" column="unit_price" />
</resultMap>
<resultMap type="com.ruoyi.inventory.domain.vo.InventorySummaryVO" id="InventorySummaryResult">
......@@ -189,7 +201,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectstocktakeItemsList" resultMap="StocktakeItemsResult">
select id as inventory_id,material_id, batch_id, location_id, warehouse_id, quantity as system_quantity
select id as inventory_id,material_id, batch_id, location_id, warehouses_id as warehouse_id, quantity as system_quantity
from inventory
where is_used = 1 and inventory_status = 1
order by warehouse_id,location_id,material_id
......
......@@ -4,13 +4,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.inventory.mapper.StocktakeItemsMapper">
<resultMap type="StocktakeItems" id="StocktakeItemsResult">
<resultMap type="com.ruoyi.inventory.domain.TO.StocktakeItemsTo" id="StocktakeItemsResult">
<result property="id" column="id" />
<result property="stocktakeId" column="stocktake_id" />
<result property="materialId" column="material_id" />
<result property="batchCode" column="batch_code" />
<result property="warehouseId" column="warehouse_id" />
<result property="locationId" column="location_id" />
<result property="warehouseName" column="warehouse_name" />
<result property="locationName" column="location_name" />
<result property="systemQuantity" column="system_quantity" />
<result property="actualQuantity" column="actual_quantity" />
<result property="varianceQuantity" column="variance_quantity" />
......@@ -78,8 +80,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="selectStocktakeItemsByMain" parameterType="java.util.Map" resultMap="StocktakeItemsResult">
select id, inventory_id,unit_price, stocktake_id, material_id, batch_code, warehouse_id, location_id, system_quantity, actual_quantity, variance_quantity, variance_amount, stocktake_status, counted_by, counted_at, adjusted, adjustment_reason, adjusted_by, adjusted_at, start_time, end_time, material_range, location_range, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code
from stocktake_items
select st_it.id
, st_it.inventory_id
,st_it.unit_price
, st_it.stocktake_id
, st_it.material_id
, st_it.batch_code
, st_it.warehouse_id
, st_it.location_id
, st_it.system_quantity
, st_it.actual_quantity
, st_it.variance_quantity
, st_it.variance_amount
, st_it.stocktake_status
, st_it.counted_by
, st_it.counted_at
, st_it.adjusted
, st_it.adjustment_reason
, st_it.adjusted_by
, st_it.adjusted_at
, st_it.start_time
, st_it.end_time
, st_it.material_range
, st_it.location_range
,(select w.warehouses_name from warehouses w where st_it.warehouse_id = w.warehouses_code and w.is_used = 1) as warehouse_name
,(select sl.location_name from storage_locations sl where st_it.location_id = sl.location_code and sl.is_used = 1) as location_name
from stocktake_items st_it
where stocktake_id = #{stocktake_id} and is_used = 1
<if test="adjusted != null and adjusted != ''"> and adjusted = #{adjusted}</if>
</select>
......
......@@ -50,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sortNo != null "> and sort_no = #{sortNo}</if>
<if test="createUserCode != null and createUserCode != ''"> and create_user_code = #{createUserCode}</if>
<if test="updateUserCode != null and updateUserCode != ''"> and update_user_code = #{updateUserCode}</if>
order by create_time,planned_date,update_time desc
<!-- 数据范围过滤 -->
${params.dataScope}
</select>
......@@ -186,7 +187,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="batchStocktakeItems">
insert into stocktake_items( id, stocktake_id, inventory_id, material_id, batch_code, warehouse_id, location_id, system_quantity, actual_quantity, variance_quantity, variance_amount, stocktake_status, counted_by, counted_at, adjusted, adjustment_reason, adjusted_by, adjusted_at, start_time, end_time, material_range, location_range, remark, is_used, sort_no, create_time, create_user_code, update_time, update_user_code) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.id}, #{item.stocktakeId}, #{inventoryId}, #{item.materialId}, #{item.batchCode}, #{item.warehouseId}, #{item.locationId}, #{item.systemQuantity}, #{item.actualQuantity}, #{item.varianceQuantity}, #{item.varianceAmount}, #{item.stocktakeStatus}, #{item.countedBy}, #{item.countedAt}, #{item.adjusted}, #{item.adjustmentReason}, #{item.adjustedBy}, #{item.adjustedAt}, #{item.startTime}, #{item.endTime}, #{item.materialRange}, #{item.locationRange}, #{item.remark}, #{item.isUsed}, #{item.sortNo}, #{item.createTime}, #{item.createUserCode}, #{item.updateTime}, #{item.updateUserCode})
( #{item.id}, #{item.stocktakeId}, #{item.inventoryId}, #{item.materialId}, #{item.batchCode}, #{item.warehouseId}, #{item.locationId}, #{item.systemQuantity}, #{item.actualQuantity}, #{item.varianceQuantity}, #{item.varianceAmount}, #{item.stocktakeStatus}, #{item.countedBy}, #{item.countedAt}, #{item.adjusted}, #{item.adjustmentReason}, #{item.adjustedBy}, #{item.adjustedAt}, #{item.startTime}, #{item.endTime}, #{item.materialRange}, #{item.locationRange}, #{item.remark}, #{item.isUsed}, #{item.sortNo}, #{item.createTime}, #{item.createUserCode}, #{item.updateTime}, #{item.updateUserCode})
</foreach>
</insert>
</mapper>
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论