优化
This commit is contained in:
@@ -31,14 +31,17 @@ namespace WMS.Web.Api.Controllers
|
||||
private readonly IInStockService _inStockService;
|
||||
private readonly IInStockTaskService _inStockTaskService;
|
||||
private readonly IInStockTaskRepositories _inStockTaskRepositories;
|
||||
private readonly IInventoryDetailsRepositories _inventoryDetailsRepositories;
|
||||
public InStockTaskController(
|
||||
IOptions<QiniuOptions> option,
|
||||
IExportExcelService exportExcelService,
|
||||
ILoginService loginService,
|
||||
IInStockTaskService inStockTaskService,
|
||||
IInStockTaskRepositories inStockTaskRepositories,
|
||||
IInventoryDetailsRepositories inventoryDetailsRepositories,
|
||||
IInStockService inStockService)
|
||||
{
|
||||
_inventoryDetailsRepositories = inventoryDetailsRepositories;
|
||||
this._option = option?.Value;
|
||||
this._exportExcelService = exportExcelService;
|
||||
this._loginService = loginService;
|
||||
@@ -170,6 +173,16 @@ namespace WMS.Web.Api.Controllers
|
||||
return ResultList<SourceBillNoQueryResponse>.ReFailure(ResultCodes.Token_Invalid_Error);
|
||||
|
||||
var list= await _inStockTaskRepositories.GetListBy(new InStockTaskBillNoQueryRequest() { SourceBillNo = sourceBillNo});
|
||||
|
||||
//获取物料对应的仓位
|
||||
var materialNumbers = list.GroupBy(x => x.MaterialNumber).Select(x => x.Key).ToList();
|
||||
var stockCodes = list.GroupBy(x => x.StockCode).Select(x => x.Key).ToList();
|
||||
var materialSubStocks= await _inventoryDetailsRepositories.GetMaterialSubStocks(materialNumbers, stockCodes, loginInfo.UserInfo.CompanyId);
|
||||
list.ForEach(x =>
|
||||
{
|
||||
x.MaterialSubStocks = materialSubStocks.Where(t => t.MaterialNumber == x.MaterialNumber).ToList();
|
||||
});
|
||||
|
||||
return ResultList<SourceBillNoQueryResponse>.ReSuccess(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,11 @@ namespace WMS.Web.Core.Dto
|
||||
/// </summary>
|
||||
public class MaterialSubStock
|
||||
{
|
||||
/// <summary>
|
||||
/// 物料编码
|
||||
/// </summary>
|
||||
public string MaterialNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 仓位编码
|
||||
/// </summary>
|
||||
@@ -17,6 +22,6 @@ namespace WMS.Web.Core.Dto
|
||||
/// <summary>
|
||||
/// 仓位名称
|
||||
/// </summary>
|
||||
public string SubStockName { get; set; }
|
||||
public string SubStock { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Core.Dto.Inventory;
|
||||
using WMS.Web.Core.Internal.Results;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
@@ -55,5 +56,14 @@ namespace WMS.Web.Domain.Infrastructure
|
||||
/// <param name="orgCodes"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<InventoryDetails>> GetListBy(List<string> materialNumbers, List<string> stockCodes, List<string> orgCodes);
|
||||
|
||||
/// <summary>
|
||||
/// 获取物料对应的仓位集合
|
||||
/// </summary>
|
||||
/// <param name="materialNumbers"></param>
|
||||
/// <param name="stockCodes"></param>
|
||||
/// <param name="companyId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<MaterialSubStock>> GetMaterialSubStocks(List<string> materialNumbers, List<string> stockCodes, int companyId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Core.Dto.Erp;
|
||||
using WMS.Web.Core.Dto.Erp.Org;
|
||||
using WMS.Web.Core.Dto.Inventory;
|
||||
@@ -224,5 +225,23 @@ namespace WMS.Web.Repositories
|
||||
stockCodes.Contains(x.StockCode) &&
|
||||
orgCodes.Contains(x.OrgCode)).ToListAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取物料对应的仓位集合
|
||||
/// </summary>
|
||||
/// <param name="materialNumbers"></param>
|
||||
/// <param name="stockCodes"></param>
|
||||
/// <param name="companyId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<MaterialSubStock>> GetMaterialSubStocks(List<string> materialNumbers, List<string> stockCodes,int companyId)
|
||||
{
|
||||
return await _context.InventoryDetails.Where(x => materialNumbers.Contains(x.MaterialNumber) &&
|
||||
stockCodes.Contains(x.StockCode)).Select(x=>new MaterialSubStock()
|
||||
{
|
||||
MaterialNumber=x.MaterialNumber,
|
||||
SubStockCode=x.SubStockCode,
|
||||
SubStock = _singleDataService.GetSingleData(SingleAction.SubStocksJoinOrgCode, companyId, x.SubStockCode + x.StockCode + x.OrgCode),
|
||||
}).ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user