wanggang 1 year ago
parent
commit
1a616a2941
  1. 9
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs
  2. 38
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BeiSeSyncAppService.cs
  3. 14
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs
  4. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/SeSyncConfig.cs
  5. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/YinDuSeSyncAppService.cs
  6. 3
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongHBPOSeSyncAppService.cs

9
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs

@ -26,6 +26,9 @@ public class Startup
services.AddTransient<HBPOSeSyncAppService>();
services.AddTransient<BBACSeSyncAppService>();
services.AddTransient<ZhiGongBBACSeSyncAppService>();
services.AddTransient<ZhiGongHBPOSeSyncAppService>();
services.AddTransient<BeiSeSyncAppService>();
services.AddTransient<YinDuSeSyncAppService>();
services.AddRouting(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer));
services.AddMvc(options => options.Conventions.Add(new RouteTokenTransformerConvention(new SlugifyParameterTransformer())));
services.AddApplication<SettleAccountHttpApiHostModule>();
@ -48,6 +51,12 @@ public class Startup
app.UseEndpoints(endpoints => endpoints.MapHub<PageHub>("/api/hub"));
app.ApplicationServices.UseScheduler(scheduler =>
{
//scheduler.Schedule<HBPOSeSyncAppService>().EveryMinute();
//scheduler.Schedule<BBACSeSyncAppService>().EveryMinute();
scheduler.Schedule<ZhiGongBBACSeSyncAppService>().EveryMinute();
scheduler.Schedule<ZhiGongHBPOSeSyncAppService>().EveryMinute();
scheduler.Schedule<BeiSeSyncAppService>().EveryMinute();
scheduler.Schedule<YinDuSeSyncAppService>().EveryMinute();
});
var contentTypeProvider = new FileExtensionContentTypeProvider();
contentTypeProvider.Mappings.Add(".mjs", "text/javascript");

38
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BeiSeSyncAppService.cs

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.Shared.RepositoryBase;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// <summary>
/// 备件发运同步
/// </summary>
[AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")]
public class BeiSeSyncAppService : JitSeSyncAppService
{
/// <summary>
/// 构造
/// </summary>
public BeiSeSyncAppService(
WMSBJBMPTDbContext wmsBJBMPTContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository,
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository
) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository)
{
base.SeSyncConfigInfo = new SeSyncConfig()
{
SyncTableName = "BeiSeSync",
SyncDeliverBillType = EnumDeliverBjBmpBillType.4S备件,
SyncDeliverSubBillTypes = new List<EnumDeliverSubBillType>
{
EnumDeliverSubBillType.
},
BusinessType = EnumBusinessType.BeiJian
};
}
}

14
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
@ -15,6 +15,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// <summary>
/// Jit发运数据同步
/// </summary>
[ApiExplorerSettings(IgnoreApi = true)]
public class JitSeSyncAppService : ApplicationService, IInvocable
{
/// <summary>
@ -68,10 +69,10 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
{
predicate = (t) => t.DeliverBillType == deliverBillType && t.UID > int.Parse(syncPositionFlag.Position) && (!deliverSubBillTypes.Any() || deliverSubBillTypes.Contains(t.DeliverSubBillType));
}
//WMS发运记录
var wmsSeRecords = _wmsBJBMPTContext.TM_BJBMPT_OTHER_RECORD.Where(predicate).OrderBy(b => b.UID).ToList();
var jitRecords = _wmsBJBMPTContext.TM_BJBMPT_OTHER_RECORD.Where(predicate).OrderBy(b => b.UID).ToList();
var pubSeDetails = ObjectMapper.Map<List<TM_BJBMPT_OTHER_RECORD>, List<PUB_SE_DETAIL>>(jitRecords);
var pubSeDetails = ObjectMapper.Map<List<TM_BJBMPT_OTHER_RECORD>, List<PUB_SE_DETAIL>>(wmsSeRecords);
if (pubSeDetails.Any())
{
pubSeDetails.ForEach(t => t.BusinessType = businessType);
@ -79,7 +80,7 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
if (syncPositionFlag != null)
{
syncPositionFlag.Position = jitRecords.Last().UID.ToString();
syncPositionFlag.Position = wmsSeRecords.Last().UID.ToString();
await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag);
}
else
@ -87,11 +88,10 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
syncPositionFlag = new SyncPositionFlag()
{
TableName = syncTableName,
Position = jitRecords.Last().UID.ToString()
Position = wmsSeRecords.Last().UID.ToString()
};
await _syncPositionFlagRepository.InsertAsync(syncPositionFlag);
}
}
await Task.CompletedTask;
}
}

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/SeSyncConfig.cs

@ -1,6 +1,4 @@
using System.Collections.Generic;
using System.ComponentModel;
using DocumentFormat.OpenXml.Office2010.ExcelAc;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;

3
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/YinDuSeSyncAppService.cs

@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;

3
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongHBPOSeSyncAppService.cs

@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;

Loading…
Cancel
Save