Browse Source

手动同步接口

master
mahao 1 year ago
parent
commit
49ee5f73c6
  1. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/BeiSeSyncAppService.cs
  2. 42
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HandSeSyncAppService.cs
  3. 35
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs
  4. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/YinDuSeSyncAppService.cs
  5. 7
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongBBACSeSyncAppService.cs
  6. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongHBPOSeSyncAppService.cs
  7. 37
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_SE_DETAIL.cs
  8. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs

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

@ -23,8 +23,9 @@ public class BeiSeSyncAppService : JitSeSyncAppService, IJobService
public BeiSeSyncAppService(
WMSBJBMPTDbContext wmsBJBMPTContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository,
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository
) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository)
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository,
VmiAppService vmiService
) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository, vmiService)
{
base.SeSyncConfigInfo = new SeSyncConfig()
{
@ -38,7 +39,6 @@ public class BeiSeSyncAppService : JitSeSyncAppService, IJobService
};
}
[ApiExplorerSettings(IgnoreApi = true)]
public async Task Invoke(IServiceProvider serviceProvider)
{
await this.Invoke();

42
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HandSeSyncAppService.cs

@ -0,0 +1,42 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Volo.Abp.Application.Services;
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// <summary>
/// 手动同步
/// </summary>
[AllowAnonymous]
[Route("api/settleaccount/[controller]/[action]")]
public class HandSeSyncAppService : ApplicationService
{
private readonly IServiceProvider _applicationServices;
public HandSeSyncAppService(IHost host)
{
_applicationServices = host.Services ?? throw new ArgumentNullException();
}
/// <summary>
/// 同步
/// </summary>
[HttpPost]
public async Task SyncAsync([FromBody] EnumBusinessType businessType)
{
using var scope = this._applicationServices.CreateScope();
JitSeSyncAppService jitSeSyncAppService = businessType switch
{
EnumBusinessType.ZhiGongJianBBAC => scope.ServiceProvider.GetRequiredService<ZhiGongBBACSeSyncAppService>(),
EnumBusinessType.ZhiGongJianHBPO => scope.ServiceProvider.GetRequiredService<ZhiGongBBACSeSyncAppService>(),
EnumBusinessType.BeiJian => scope.ServiceProvider.GetRequiredService<BeiSeSyncAppService>(),
EnumBusinessType.YinDuJian => scope.ServiceProvider.GetRequiredService<YinDuSeSyncAppService>(),
_ => throw new ArgumentOutOfRangeException(nameof(businessType), $"Not expected direction value: {businessType}"),
};
await jitSeSyncAppService.Invoke();
}
}

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

@ -7,6 +7,7 @@ using Coravel.Invocable;
using Microsoft.AspNetCore.Mvc;
using SettleAccount.Domain.BQ;
using Volo.Abp.Application.Services;
using Win.Sfs.SettleAccount.Entities.BQ.Vmi;
using Win.Sfs.SettleAccount.EntityFrameworkCore;
using Win.Sfs.Shared.RepositoryBase;
@ -15,6 +16,7 @@ namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs;
/// <summary>
/// Jit发运数据同步
/// </summary>
[ApiExplorerSettings(IgnoreApi = true)]
public class JitSeSyncAppService : ApplicationService, IInvocable
{
/// <summary>
@ -32,17 +34,21 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
/// </summary>
private readonly INormalEfCoreRepository<PUB_SE_DETAIL, Guid> _pubSeDetailRepository;
private readonly IVmiService _vmiService;
/// <summary>
/// 构造
/// </summary>
public JitSeSyncAppService(
WMSBJBMPTDbContext wmsBJBMPTContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository,
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository)
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository,
VmiAppService vmiService)
{
_wmsBJBMPTContext = wmsBJBMPTContext;
_syncPositionFlagRepository = syncPositionFlagRepository;
_pubSeDetailRepository = pubSeDetailRepository;
_vmiService = vmiService;
}
/// <summary>
@ -99,6 +105,33 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
};
await _syncPositionFlagRepository.InsertAsync(syncPositionFlag);
}
pubSeDetails.ForEach(pubSeDetail =>
{
var vmiBalance = new VmiBalance()
{
PartCode = pubSeDetail.PartCode,
VinCode = pubSeDetail.PN,
CustomerPartCode = default,
CodeType = default,
BillType = pubSeDetail.DeliverBillType,
Qty = pubSeDetail.Qty,
BillTime = pubSeDetail.BillTime,
DeliverTime = pubSeDetail.DnBillTime,
ErpToLoc = pubSeDetail.ToErpLocCode,
Seq = default,
OrderNum = pubSeDetail.DnBillNum,
UniqueCode = default,
MatchNumber = default,
PjsNum = default,
Configcode = default,
factory = default,
SubBillType = pubSeDetail.DeliverSubBillType,
RealCode = default,
ReMark = pubSeDetail.Remark,
};
_vmiService.In(logType: Vmi.VmiLogType.Type100, changedNumber: pubSeDetail.DnBillNum, data: vmiBalance);
});
}
}
}

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

@ -23,8 +23,9 @@ public class YinDuSeSyncAppService : JitSeSyncAppService, IJobService
public YinDuSeSyncAppService(
WMSBJBMPTDbContext wmsBJBMPTContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository,
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository
) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository)
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository,
VmiAppService vmiService
) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository, vmiService)
{
base.SeSyncConfigInfo = new SeSyncConfig()
{
@ -38,7 +39,6 @@ public class YinDuSeSyncAppService : JitSeSyncAppService, IJobService
};
}
[ApiExplorerSettings(IgnoreApi = true)]
public async Task Invoke(IServiceProvider serviceProvider)
{
await this.Invoke();

7
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/ZhiGongBBACSeSyncAppService.cs

@ -23,8 +23,9 @@ public class ZhiGongBBACSeSyncAppService : JitSeSyncAppService, IJobService
public ZhiGongBBACSeSyncAppService(
WMSBJBMPTDbContext wmsBJBMPTContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository,
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository
) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository)
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository,
VmiAppService vmiService
) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository, vmiService)
{
base.SeSyncConfigInfo = new SeSyncConfig()
{
@ -38,7 +39,7 @@ public class ZhiGongBBACSeSyncAppService : JitSeSyncAppService, IJobService
};
}
[ApiExplorerSettings(IgnoreApi = true)]
[HttpPost]
public async Task Invoke(IServiceProvider serviceProvider)
{
await this.Invoke();

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

@ -23,8 +23,9 @@ public class ZhiGongHBPOSeSyncAppService : JitSeSyncAppService, IJobService
public ZhiGongHBPOSeSyncAppService(
WMSBJBMPTDbContext wmsBJBMPTContext,
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository,
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository
) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository)
INormalEfCoreRepository<PUB_SE_DETAIL, Guid> pubSeDetailRepository,
VmiAppService vmiService
) : base(wmsBJBMPTContext, syncPositionFlagRepository, pubSeDetailRepository, vmiService)
{
base.SeSyncConfigInfo = new SeSyncConfig()
{
@ -38,7 +39,6 @@ public class ZhiGongHBPOSeSyncAppService : JitSeSyncAppService, IJobService
};
}
[ApiExplorerSettings(IgnoreApi = true)]
public async Task Invoke(IServiceProvider serviceProvider)
{
await this.Invoke();

37
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_SE_DETAIL.cs

@ -3,6 +3,7 @@ using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Win.Sfs.SettleAccount;
using Win.Sfs.SettleAccount.Entities.BQ.Syncs;
namespace SettleAccount.Domain.BQ;
[Display(Name = "PUB发运数据")]
@ -150,6 +151,42 @@ public class PUB_SE_DETAIL :SE_BASE
[Display(Name = "备注")]
public string Remark { get; set; }
/// <summary>
/// 单据类型
/// </summary>
[DisplayName("单据类型")]
public EnumBillType BillType { get; set; }
/// <summary>
/// 子单据类型
/// </summary>
[DisplayName("子单据类型")]
public EnumSubBillType SubBillType { get; set; }
/// <summary>
/// 业务类型
/// </summary>
[DisplayName("业务类型")]
public EnumProTpe ProType { get; set; }
/// <summary>
/// 事务类型
/// </summary>
[DisplayName("事务类型")]
public EnumDelTransType TransType { get; set; }
/// <summary>
/// 发运主类型
/// </summary>
[DisplayName("发运主类型")]
public EnumDeliverBjBmpBillType DeliverBillType { get; set; }
/// <summary>
/// 发运子类型
/// </summary>
[DisplayName("发运子类型")]
public EnumDeliverSubBillType DeliverSubBillType { get; set; }
public PUB_SE_DETAIL(Guid guid, string keyCode, int version, string lU, string pN, decimal qty, string extend1, string extend2, string extend3, EnumBusinessType businessType, DateTime beginDate, DateTime shippingDate, string wmsBillNum)
{
Id=guid;

2
code/src/Modules/SettleAccount/src/SettleAccount.Job/Services/Report/PubSaSeCompareExportService.cs

@ -350,7 +350,7 @@ namespace SettleAccount.Job.Services.Report
private void Notify()
{
this._hubContext.Clients.All.ServerToClient("Compare", "refresh", "");
this._hubContext.Clients.All.ServerToClient("SaSeCompare", "refresh", "");
}
#endregion
}

Loading…
Cancel
Save