出库任务单显示仓位
This commit is contained in:
@@ -33,9 +33,11 @@ namespace WMS.Web.Api.Controllers
|
||||
private readonly IOutStockTaskService _outStockTaskService;
|
||||
private readonly QiniuOptions _option;
|
||||
private readonly IExportExcelService _exportExcelService;
|
||||
private readonly IInventoryDetailsRepositories _inventoryDetailsRepositories;
|
||||
public OutStockTaskController(IMapper mapper, ILoginService loginService,
|
||||
IOutStockTaskRepositories repositories, IOutStockService outStockService,
|
||||
IOutStockTaskService outStockTaskService, IOptions<QiniuOptions> option, IExportExcelService exportExcelServic)
|
||||
IOutStockTaskService outStockTaskService, IOptions<QiniuOptions> option, IExportExcelService exportExcelServic,
|
||||
IInventoryDetailsRepositories inventoryDetailsRepositories)
|
||||
{
|
||||
_mapper = mapper;
|
||||
_loginService = loginService;
|
||||
@@ -44,6 +46,7 @@ namespace WMS.Web.Api.Controllers
|
||||
_outStockTaskService = outStockTaskService;
|
||||
_option = option?.Value;
|
||||
_exportExcelService = exportExcelServic;
|
||||
_inventoryDetailsRepositories = inventoryDetailsRepositories;
|
||||
}
|
||||
/// <summary>
|
||||
/// 列表
|
||||
@@ -136,6 +139,20 @@ namespace WMS.Web.Api.Controllers
|
||||
//var res2 = await _repositories.GetListBySourceBillNo(str);
|
||||
var res = await _repositories.GetOutStockTaskListByNo(billNo);
|
||||
|
||||
//获取物料对应的仓位
|
||||
var materialNumbers = res.SelectMany(s => s.details).GroupBy(x => x.MaterialNumber).Select(x => x.Key).ToList();
|
||||
var stockCodes = res.Select(s => s.StockCode).ToList();
|
||||
var materialSubStocks = await _inventoryDetailsRepositories.GetMaterialSubStocks(materialNumbers, stockCodes, loginInfo.UserInfo.CompanyId);
|
||||
|
||||
foreach (var r in res)
|
||||
{
|
||||
r.details.ForEach(x =>
|
||||
{
|
||||
x.MaterialSubStocks = materialSubStocks.Where(t => t.MaterialNumber == x.MaterialNumber).ToList();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (res == null || res.Count() == 0) return ResultList<GetOutStockTaskByNoResponse>.ReFailure(ResultCodes.OutStockTaskNoData);
|
||||
return ResultList<GetOutStockTaskByNoResponse>.ReSuccess(res);
|
||||
}
|
||||
@@ -180,6 +197,16 @@ namespace WMS.Web.Api.Controllers
|
||||
var res = await _repositories.GetOutStockTaskByNo(billNo);
|
||||
res.details = res.details.Where(w => w.AccruedQty > w.RealityQty).ToList();
|
||||
if (res == null) return Result<GetOutStockTaskByNoResponse>.ReFailure(ResultCodes.OutStockTaskNoData);
|
||||
|
||||
//获取物料对应的仓位
|
||||
var materialNumbers = res.details.GroupBy(x => x.MaterialNumber).Select(x => x.Key).ToList();
|
||||
var stockCodes = new List<string>() { res.StockCode };
|
||||
var materialSubStocks = await _inventoryDetailsRepositories.GetMaterialSubStocks(materialNumbers, stockCodes, loginInfo.UserInfo.CompanyId);
|
||||
res.details.ForEach(x =>
|
||||
{
|
||||
x.MaterialSubStocks = materialSubStocks.Where(t => t.MaterialNumber == x.MaterialNumber).ToList();
|
||||
});
|
||||
|
||||
return Result<GetOutStockTaskByNoResponse>.ReSuccess(res);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user