增加接口
This commit is contained in:
@@ -50,6 +50,16 @@ namespace WMS.Web.Repositories.Configuration
|
||||
ent.ToTable("t_wms_movebox_record");
|
||||
ent.HasKey(x => x.Id);
|
||||
});
|
||||
//移箱明细
|
||||
builder.Entity<MoveBoxRecordDetails>(ent =>
|
||||
{
|
||||
ent.ToTable("t_wms_movebox_record_details");
|
||||
ent.HasKey(x => x.Id);
|
||||
|
||||
ent.Property(f => f.SerialNumbers).HasConversion(
|
||||
v => JsonConvert.SerializeObject(v),
|
||||
v => JsonConvert.DeserializeObject<List<string>>(v));
|
||||
});
|
||||
|
||||
//序列号
|
||||
builder.Entity<SerialNumbers>(ent =>
|
||||
|
||||
@@ -7,6 +7,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WMS.Web.Core;
|
||||
using WMS.Web.Core.Dto;
|
||||
using WMS.Web.Core.Dto.MoveBoxRecord;
|
||||
using WMS.Web.Core.Help;
|
||||
using WMS.Web.Domain.Entitys;
|
||||
@@ -26,9 +27,12 @@ namespace WMS.Web.Repositories
|
||||
private readonly ISingleDataService _singleDataService;
|
||||
private readonly ILoginRepositories _loginRepositories;
|
||||
private readonly IBasicsRepositories _basicsRepositories;
|
||||
private readonly IErpService _erpService;
|
||||
private readonly IErpBasicDataExtendService _erpBasicDataExtendService;
|
||||
|
||||
public MoveBoxRecordRepositories(RepositoryDbContext context, IMapper mapper, IServiceProvider serviceProvider,
|
||||
ISingleDataService singleDataService, ILoginRepositories loginRepositories, IBasicsRepositories basicsRepositories)
|
||||
ISingleDataService singleDataService, ILoginRepositories loginRepositories, IBasicsRepositories basicsRepositories,
|
||||
IErpService erpService, IErpBasicDataExtendService erpBasicDataExtendService)
|
||||
{
|
||||
_context = context;
|
||||
_mapper = mapper;
|
||||
@@ -36,6 +40,8 @@ namespace WMS.Web.Repositories
|
||||
_singleDataService = singleDataService;
|
||||
_loginRepositories = loginRepositories;
|
||||
_basicsRepositories = basicsRepositories;
|
||||
_erpBasicDataExtendService = erpBasicDataExtendService;
|
||||
_erpService = erpService;
|
||||
}
|
||||
/// <summary>
|
||||
/// 新增
|
||||
@@ -103,6 +109,35 @@ namespace WMS.Web.Repositories
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<BoxDetailResponse>> GetDetailsByBoxId(int boxId)
|
||||
{
|
||||
var res = await _context.MoveBoxRecord
|
||||
.Include(s => s.Details)
|
||||
.Where(f => f.BoxId==boxId)
|
||||
.OrderByDescending(o => o.Id)
|
||||
.ToListAsync();
|
||||
List<BoxDetailResponse> details = new List<BoxDetailResponse>();
|
||||
if (res.Count() == 0) return details;
|
||||
|
||||
var materials_result = await _erpService.BillQueryForMaterial();
|
||||
if (!materials_result.IsSuccess)
|
||||
return new List<BoxDetailResponse>();
|
||||
var materials = materials_result.Data.ToList();
|
||||
|
||||
foreach (var d in res.First().Details)
|
||||
{
|
||||
BoxDetailResponse detail = new BoxDetailResponse();
|
||||
detail.MaterialName = _erpBasicDataExtendService.GetMaterialName(materials, d.MaterialId);
|
||||
detail.MaterialNumber = _erpBasicDataExtendService.GetMaterialNumber(materials, d.MaterialId);
|
||||
detail.Specifications = _erpBasicDataExtendService.GetMaterialSpecifications(materials, d.MaterialId);
|
||||
detail.SerialNumbers = d.SerialNumbers;
|
||||
detail.MaterialId = d.MaterialId;
|
||||
detail.Qty = d.Qty;
|
||||
details.Add(detail);
|
||||
}
|
||||
return details;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 列表
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user