wanshenmean
2026-03-30 1f15dd43b334e31189c4580b98f57d2cc71935d8
Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs
@@ -2,6 +2,7 @@
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
using WIDESEA_DTO.Stock;
using WIDESEA_IBasicService;
using WIDESEA_IStockService;
using WIDESEA_Model.Models;
@@ -18,11 +19,23 @@
        public IRepository<Dt_StockInfo> Repository => BaseDal;
        /// <summary>
        /// 货位信息服务接口(用于获取仓库货位信息)
        /// </summary>
        private readonly ILocationInfoService _locationInfoService;
        /// <summary>
        /// 仓库信息服务接口(用于获取仓库基本信息)
        /// </summary>
        private readonly IWarehouseService _warehouseService;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="baseDal">基础数据访问对象</param>
        public StockInfoService(IRepository<Dt_StockInfo> baseDal) : base(baseDal)
        public StockInfoService(IRepository<Dt_StockInfo> baseDal, ILocationInfoService locationInfoService, IWarehouseService warehouseService) : base(baseDal)
        {
            _locationInfoService = locationInfoService;
            _warehouseService = warehouseService;
        }
        /// <summary>
@@ -88,13 +101,13 @@
        public async Task<Stock3DLayoutDTO> Get3DLayoutAsync(int warehouseId)
        {
            // 1. 查询仓库信息
            var warehouse = await Repository.Change<Dt_Warehouse>().GetFirstAsync(x => x.Id == warehouseId);
            var warehouse = await _warehouseService.Repository.QueryFirstAsync(x => x.WarehouseId == warehouseId);
            // 2. 查询该仓库所有货位
            var locations = await Repository.Change<Dt_LocationInfo>().GetListAsync(x => x.WarehouseId == warehouseId);
            var locations = await _locationInfoService.Repository.QueryDataAsync(x => x.WarehouseId == warehouseId);
            // 3. 查询该仓库所有库存信息(包含Details导航属性)
            var stockInfos = await Repository.Change<Dt_StockInfo>().Includes(x => x.Details).GetListAsync(x => x.WarehouseId == warehouseId);
            var stockInfos = await Repository.QueryDataNavAsync(x => x.WarehouseId == warehouseId);
            // 4. 提取物料编号和批次号列表(去重)
            var materielCodeList = stockInfos