回退保存请求对象优化

This commit is contained in:
tongfei
2023-11-13 16:13:18 +08:00
parent 42f8a6c049
commit 2eb5a89cf6
2 changed files with 19 additions and 13 deletions

View File

@@ -35,6 +35,6 @@ namespace WMS.Web.Core.Dto.BackRecord
/// 序列号集
/// </summary>
[Required(ErrorMessage = "序列号不能为空")]
public string SerialNumbers { get; set; }
public List<string> SerialNumbers { get; set; } = new List<string>();
}
}

View File

@@ -13,6 +13,7 @@ using WMS.Web.Core.Internal.Results;
using WMS.Web.Domain.Entitys;
using WMS.Web.Domain.Infrastructure;
using WMS.Web.Domain.IService.Public;
using WMS.Web.Domain.Values.Single;
using WMS.Web.Repositories.Configuration;
namespace WMS.Web.Repositories
@@ -26,15 +27,20 @@ namespace WMS.Web.Repositories
private readonly IServiceProvider _serviceProvider;
private readonly ILoginRepositories _loginRepositories;
private readonly RepositoryDbContext _context;
private readonly IErpService _erpService;
private readonly ISingleDataService _singleDataService;
private readonly IErpBasicDataExtendService _erpBasicDataExtendService;
public BackRecordRepositories(RepositoryDbContext context,
IMapper mapper,
IErpService erpService,
ILoginRepositories loginRepositories,
IServiceProvider serviceProvider,
ISingleDataService singleDataService)
ISingleDataService singleDataService,
IErpBasicDataExtendService erpBasicDataExtendService)
{
_erpService = erpService;
_context = context;
_mapper = mapper;
_serviceProvider = serviceProvider;
@@ -49,17 +55,17 @@ namespace WMS.Web.Repositories
/// <returns></returns>
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
.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 })
.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)
query = query.Where(w => w.detail.SubStockId == dto.SubStockId.Value);
@@ -77,13 +83,13 @@ namespace WMS.Web.Repositories
Id = s.order.Id,
DetailsId = s.detail.Id,
BillNo=s.order.BillNo,
BoxBillNo = "",
BoxBillNo ="",
Type = s.order.Type.GetRemark(),
Creator = "",
Creator = _singleDataService.GetSingleData(SingleAction.Staffs, _loginRepositories.CompanyId, s.order.CreatorId),
CreateTime =s.order.CreateTime,
MaterialName = "",
MaterialNumber = "",
Specifications = "",
MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, s.detail.MaterialId),
MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, s.detail.MaterialId),
Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, s.detail.MaterialId),
Qty = s.detail.Qty,
SubStock = "",
SerialNumbers = JsonConvert.SerializeObject(s.detail.SerialNumbers),