回退保存请求对象优化
This commit is contained in:
@@ -35,6 +35,6 @@ namespace WMS.Web.Core.Dto.BackRecord
|
|||||||
/// 序列号集
|
/// 序列号集
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required(ErrorMessage = "序列号不能为空")]
|
[Required(ErrorMessage = "序列号不能为空")]
|
||||||
public string SerialNumbers { get; set; }
|
public List<string> SerialNumbers { get; set; } = new List<string>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ using WMS.Web.Core.Internal.Results;
|
|||||||
using WMS.Web.Domain.Entitys;
|
using WMS.Web.Domain.Entitys;
|
||||||
using WMS.Web.Domain.Infrastructure;
|
using WMS.Web.Domain.Infrastructure;
|
||||||
using WMS.Web.Domain.IService.Public;
|
using WMS.Web.Domain.IService.Public;
|
||||||
|
using WMS.Web.Domain.Values.Single;
|
||||||
using WMS.Web.Repositories.Configuration;
|
using WMS.Web.Repositories.Configuration;
|
||||||
|
|
||||||
namespace WMS.Web.Repositories
|
namespace WMS.Web.Repositories
|
||||||
@@ -26,15 +27,20 @@ namespace WMS.Web.Repositories
|
|||||||
private readonly IServiceProvider _serviceProvider;
|
private readonly IServiceProvider _serviceProvider;
|
||||||
private readonly ILoginRepositories _loginRepositories;
|
private readonly ILoginRepositories _loginRepositories;
|
||||||
private readonly RepositoryDbContext _context;
|
private readonly RepositoryDbContext _context;
|
||||||
|
private readonly IErpService _erpService;
|
||||||
private readonly ISingleDataService _singleDataService;
|
private readonly ISingleDataService _singleDataService;
|
||||||
|
private readonly IErpBasicDataExtendService _erpBasicDataExtendService;
|
||||||
|
|
||||||
|
|
||||||
public BackRecordRepositories(RepositoryDbContext context,
|
public BackRecordRepositories(RepositoryDbContext context,
|
||||||
IMapper mapper,
|
IMapper mapper,
|
||||||
|
IErpService erpService,
|
||||||
ILoginRepositories loginRepositories,
|
ILoginRepositories loginRepositories,
|
||||||
IServiceProvider serviceProvider,
|
IServiceProvider serviceProvider,
|
||||||
ISingleDataService singleDataService)
|
ISingleDataService singleDataService,
|
||||||
|
IErpBasicDataExtendService erpBasicDataExtendService)
|
||||||
{
|
{
|
||||||
|
_erpService = erpService;
|
||||||
_context = context;
|
_context = context;
|
||||||
_mapper = mapper;
|
_mapper = mapper;
|
||||||
_serviceProvider = serviceProvider;
|
_serviceProvider = serviceProvider;
|
||||||
@@ -49,17 +55,17 @@ namespace WMS.Web.Repositories
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<ResultPagedList<BackRecordQueryResponse>> GetPagedList(BackRecordQueryRequest dto)
|
public async Task<ResultPagedList<BackRecordQueryResponse>> GetPagedList(BackRecordQueryRequest dto)
|
||||||
{
|
{
|
||||||
|
//1.获取物料集合和组织集合和供应商的集合
|
||||||
|
var materials_result = await _erpService.BillQueryForMaterial();
|
||||||
|
if (!materials_result.IsSuccess)
|
||||||
|
return ResultPagedList<BackRecordQueryResponse>.ReFailure(materials_result);
|
||||||
|
var materials = materials_result.Data.ToList();
|
||||||
|
|
||||||
var query = _context.BackRecordDetails
|
var query = _context.BackRecordDetails
|
||||||
.GroupJoin(_context.BackRecord, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
|
.GroupJoin(_context.BackRecord, detail => detail.Fid, order => order.Id, (detail, orders) => new { detail, orders })
|
||||||
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
|
.SelectMany(x => x.orders.DefaultIfEmpty(), (p, order) => new { p.detail, order })
|
||||||
.Where(adv => 1 == 1);
|
.Where(adv => 1 == 1);
|
||||||
|
|
||||||
//if (!string.IsNullOrEmpty(dto.BoxBillNo))
|
|
||||||
// query = query.Where(w => EF.Functions.Like(w.order.BoxBillNo, "%" + dto.BoxBillNo + "%"));
|
|
||||||
|
|
||||||
//if (!string.IsNullOrEmpty(dto.MaterialNumber))
|
|
||||||
// query = query.Where(w => EF.Functions.Like(w.detail.BillNo, "%" + dto.BillNo + "%"));
|
|
||||||
|
|
||||||
if (dto.SubStockId.HasValue)
|
if (dto.SubStockId.HasValue)
|
||||||
query = query.Where(w => w.detail.SubStockId == dto.SubStockId.Value);
|
query = query.Where(w => w.detail.SubStockId == dto.SubStockId.Value);
|
||||||
|
|
||||||
@@ -77,13 +83,13 @@ namespace WMS.Web.Repositories
|
|||||||
Id = s.order.Id,
|
Id = s.order.Id,
|
||||||
DetailsId = s.detail.Id,
|
DetailsId = s.detail.Id,
|
||||||
BillNo=s.order.BillNo,
|
BillNo=s.order.BillNo,
|
||||||
BoxBillNo = "",
|
BoxBillNo ="",
|
||||||
Type = s.order.Type.GetRemark(),
|
Type = s.order.Type.GetRemark(),
|
||||||
Creator = "",
|
Creator = _singleDataService.GetSingleData(SingleAction.Staffs, _loginRepositories.CompanyId, s.order.CreatorId),
|
||||||
CreateTime =s.order.CreateTime,
|
CreateTime =s.order.CreateTime,
|
||||||
MaterialName = "",
|
MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialId),
|
||||||
MaterialNumber = "",
|
MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.detail.MaterialId),
|
||||||
Specifications = "",
|
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId),
|
||||||
Qty = s.detail.Qty,
|
Qty = s.detail.Qty,
|
||||||
SubStock = "",
|
SubStock = "",
|
||||||
SerialNumbers = JsonConvert.SerializeObject(s.detail.SerialNumbers),
|
SerialNumbers = JsonConvert.SerializeObject(s.detail.SerialNumbers),
|
||||||
|
|||||||
Reference in New Issue
Block a user