mahao
1 year ago
8 changed files with 158 additions and 268 deletions
@ -0,0 +1,102 @@ |
|||
using System; |
|||
using System.Diagnostics; |
|||
using System.Threading.Tasks; |
|||
using Coravel.Invocable; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using SettleAccount.Domain.BQ; |
|||
using Volo.Abp.Application.Services; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
using System.Linq; |
|||
using DocumentFormat.OpenXml.Office2010.ExcelAc; |
|||
using System.Collections.Generic; |
|||
using Microsoft.Extensions.DependencyInjection; |
|||
using Volo.Abp.Application; |
|||
using System.Runtime.Intrinsics.X86; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; |
|||
|
|||
/// <summary>
|
|||
/// JisHBPO 发运数据与EDI数据对比
|
|||
/// </summary>
|
|||
[ApiExplorerSettings(IgnoreApi = true)] |
|||
public class JisHBPOSeEdiCompareAppService : ApplicationService, IInvocable |
|||
{ |
|||
private readonly IServiceProvider _serviceProvider; |
|||
|
|||
/// <summary>
|
|||
/// HBPO发运数据仓储
|
|||
/// </summary>
|
|||
private readonly INormalEfCoreRepository<HBPO_SE_DETAIL, Guid> _hbpoSeDetailRepository; |
|||
|
|||
/// <summary>
|
|||
/// HBPOEDI数据仓储
|
|||
/// </summary>
|
|||
private readonly INormalEfCoreRepository<HBPO_SE_EDI, Guid> _hbpoSeEdiRepository; |
|||
|
|||
public JisHBPOSeEdiCompareAppService( |
|||
IServiceProvider serviceProvider, |
|||
INormalEfCoreRepository<HBPO_SE_DETAIL, Guid> hbpoSeDetailRepository, INormalEfCoreRepository<HBPO_SE_EDI, Guid> hbpoSeEdiRepository) |
|||
{ |
|||
_serviceProvider = serviceProvider; |
|||
_hbpoSeDetailRepository = hbpoSeDetailRepository; |
|||
_hbpoSeEdiRepository = hbpoSeEdiRepository; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 执行
|
|||
/// </summary>
|
|||
public async Task Invoke() |
|||
{ |
|||
await Task.CompletedTask; |
|||
Debug.WriteLine($"执行了 {this.GetType()}"); |
|||
|
|||
using var serviceScope = _serviceProvider.CreateScope(); |
|||
var db = serviceScope.ServiceProvider.GetRequiredService<SettleAccountDbContext>(); |
|||
|
|||
//List<HBPO_SE_DETAIL> hbpoSeDetails = await _hbpoSeDetailRepository.GetListAsync(t => t.IsHaveEdiData == false);
|
|||
|
|||
//var hbpoSeDetails = db.Set<HBPO_SE_DETAIL>().Where(t => t.IsHaveEdiData == false).OrderBy(t => t.BillTime);
|
|||
|
|||
//var hbpoSeEdis = db.Set<HBPO_SE_EDI>().Where(t => t.IsHaveSeData == false && hbpoSeDetails.Any(w => w.PN.Equals(t.PN) && w.LU.Equals(t.LU) && w.Qty.Equals(t.Qty)));
|
|||
|
|||
var query = from se in db.Set<HBPO_SE_DETAIL>() |
|||
join edi in db.Set<HBPO_SE_EDI>() on new |
|||
{ |
|||
se.LU, |
|||
se.PN, |
|||
se.Qty |
|||
} equals new |
|||
{ |
|||
edi.LU, |
|||
edi.PN, |
|||
edi.Qty |
|||
} |
|||
where se.IsHaveEdiData == false && edi.IsHaveSeData == false |
|||
//select new
|
|||
//{
|
|||
// SeID = se.Id,
|
|||
// se.PN,
|
|||
// se.LU,
|
|||
// se.Qty,
|
|||
// EdiID = edi.Id
|
|||
//};
|
|||
select new |
|||
{ |
|||
se, |
|||
edi |
|||
}; |
|||
|
|||
query.ForEach(item => |
|||
{ |
|||
Debug.WriteLine($"{Newtonsoft.Json.JsonConvert.SerializeObject(item)}"); |
|||
}); |
|||
//var ses = query.SelectMany(t => t.se);
|
|||
//var edis = query.SelectMany(t => t.edi);
|
|||
|
|||
//hbpoSeEdis.ForEach(hbpoSeEdi =>
|
|||
//{
|
|||
// Debug.WriteLine($"{hbpoSeEdi.Id}");
|
|||
//});
|
|||
|
|||
} |
|||
} |
Loading…
Reference in new issue