mahao
1 year ago
20 changed files with 11976 additions and 55 deletions
@ -0,0 +1,49 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using SettleAccount.Domain.BQ; |
|||
using Win.Sfs.SettleAccount.Entities.BQ.Managers; |
|||
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
|||
using Win.Sfs.SettleAccount.EntityFrameworkCore; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; |
|||
|
|||
/// <summary>
|
|||
/// JisBBAC发运同步
|
|||
/// </summary>
|
|||
[AllowAnonymous] |
|||
[Route("api/settleaccount/[controller]/[action]")]
|
|||
public class JisBBACSeSyncAppService : JisBBACSeSyncBaseAppService, IJobService |
|||
{ |
|||
/// <summary>
|
|||
/// 构造
|
|||
/// </summary>
|
|||
public JisBBACSeSyncAppService( |
|||
WMSBJBMPTDbContext wmsBJBMPTContext, |
|||
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository, |
|||
INormalEfCoreRepository<BBAC_SE_DETAIL, Guid> jisSeDetailRepository, |
|||
MaterialRelationshipManager materialRelationshipManager, |
|||
VmiAppService vmiService |
|||
) : base(wmsBJBMPTContext, syncPositionFlagRepository, jisSeDetailRepository, materialRelationshipManager, vmiService) |
|||
{ |
|||
base.SeSyncConfigInfo = new SeSyncConfig() |
|||
{ |
|||
SyncTableName = "JisBBACSync", |
|||
SyncDeliverBillType = EnumDeliverBjBmpBillType.JIS件, |
|||
SyncDeliverSubBillTypes = new List<EnumDeliverSubBillType> |
|||
{ |
|||
EnumDeliverSubBillType.保险杠BBAC, |
|||
EnumDeliverSubBillType.小件BBAC |
|||
}, |
|||
BusinessType = EnumBusinessType.JisBBAC |
|||
}; |
|||
} |
|||
|
|||
public async Task Invoke(IServiceProvider serviceProvider) |
|||
{ |
|||
await this.Invoke().ConfigureAwait(false); |
|||
} |
|||
} |
@ -0,0 +1,199 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Linq.Expressions; |
|||
using System.Threading.Tasks; |
|||
using Coravel.Invocable; |
|||
using EFCore.BulkExtensions; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using SettleAccount.Domain.BQ; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.Uow; |
|||
using Win.Sfs.SettleAccount.Entities.BQ.Managers; |
|||
using Win.Sfs.SettleAccount.EntityFrameworkCore; |
|||
using Win.Sfs.SettleAccount.MaterialRelationships; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; |
|||
|
|||
/// <summary>
|
|||
/// Jis发运数据同步
|
|||
/// </summary>
|
|||
[ApiExplorerSettings(IgnoreApi = true)] |
|||
public class JisBBACSeSyncBaseAppService : ApplicationService, IInvocable |
|||
{ |
|||
/// <summary>
|
|||
/// WMS数据上下文
|
|||
/// </summary>
|
|||
private readonly WMSBJBMPTDbContext _wmsBJBMPTContext; |
|||
|
|||
/// <summary>
|
|||
/// 同步位置标记
|
|||
/// </summary>
|
|||
private readonly INormalEfCoreRepository<SyncPositionFlag, Guid> _syncPositionFlagRepository; |
|||
|
|||
/// <summary>
|
|||
/// Jis发运数据仓储
|
|||
/// </summary>
|
|||
private readonly INormalEfCoreRepository<BBAC_SE_DETAIL, Guid> _jisSeDetailRepository; |
|||
|
|||
/// <summary>
|
|||
/// 客户零件关系领域
|
|||
/// </summary>
|
|||
private readonly MaterialRelationshipManager _materialRelationshipManager; |
|||
|
|||
private readonly IVmiService _vmiService; |
|||
|
|||
/// <summary>
|
|||
/// 构造
|
|||
/// </summary>
|
|||
public JisBBACSeSyncBaseAppService( |
|||
WMSBJBMPTDbContext wmsBJBMPTContext, |
|||
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository, |
|||
INormalEfCoreRepository<BBAC_SE_DETAIL, Guid> jisSeDetailRepository, |
|||
MaterialRelationshipManager materialRelationshipManager, |
|||
VmiAppService vmiService) |
|||
{ |
|||
_wmsBJBMPTContext = wmsBJBMPTContext; |
|||
_syncPositionFlagRepository = syncPositionFlagRepository; |
|||
_jisSeDetailRepository = jisSeDetailRepository; |
|||
_materialRelationshipManager = materialRelationshipManager; |
|||
_vmiService = vmiService; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 发运同步配置
|
|||
/// </summary>
|
|||
public SeSyncConfig SeSyncConfigInfo { get; set; } |
|||
|
|||
[HttpPost] |
|||
public async Task Invoke() |
|||
{ |
|||
if (SeSyncConfigInfo == null) |
|||
{ |
|||
return; |
|||
} |
|||
await SyncJitRecordAsync().ConfigureAwait(false); |
|||
await SyncJisRecordAsync().ConfigureAwait(false); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 同步JitRecord
|
|||
/// </summary>
|
|||
[UnitOfWork] |
|||
private async Task SyncJitRecordAsync() |
|||
{ |
|||
//同步表名称
|
|||
var syncTableName = $"{SeSyncConfigInfo.SyncTableName}_Jit"; |
|||
//同步发运主类型
|
|||
var deliverBillType = SeSyncConfigInfo.SyncDeliverBillType; |
|||
//同步发运子类型
|
|||
var deliverSubBillTypes = SeSyncConfigInfo.SyncDeliverSubBillTypes; |
|||
//业务类别
|
|||
var businessType = SeSyncConfigInfo.BusinessType; |
|||
|
|||
Expression<Func<TM_BJBMPT_JIT_RECORD, bool>> predicate = (t) => t.DeliverBillType == deliverBillType && deliverSubBillTypes.Contains(t.DeliverSubBillType); |
|||
var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName).ConfigureAwait(false); |
|||
if (syncPositionFlag != null) |
|||
{ |
|||
predicate = (t) => t.UID > int.Parse(syncPositionFlag.Position) && t.DeliverBillType == deliverBillType && deliverSubBillTypes.Contains(t.DeliverSubBillType); |
|||
} |
|||
|
|||
//WMS发运记录
|
|||
var wmsSeRecords = _wmsBJBMPTContext.TM_BJBMPT_JIT_RECORD.Where(predicate).OrderBy(b => b.UID).Take(100000).ToList(); |
|||
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<BBAC_SE_DETAIL>>(wmsSeRecords); |
|||
jisSeDetails.RemoveAll(t => string.IsNullOrEmpty(t.LU) || string.IsNullOrEmpty(t.FactoryPartCode)); |
|||
if (jisSeDetails.Any()) |
|||
{ |
|||
//客户零件号和厂内零件号
|
|||
var luRePartCodes = jisSeDetails.Select(t => new { t.LU, t.FactoryPartCode }).Distinct().ToList(); |
|||
if (luRePartCodes.Any()) |
|||
{ |
|||
var materialRelationships = luRePartCodes.Select(t => new MaterialRelationship(GuidGenerator.Create(), t.LU, "", t.FactoryPartCode, businessType.ToString())); |
|||
await _materialRelationshipManager.AddNewMaterialRelationships(materialRelationships).ConfigureAwait(false); |
|||
} |
|||
|
|||
jisSeDetails.ForEach(t => |
|||
{ |
|||
t.BusinessType = businessType; |
|||
t.KeyCode = t.PN + t.LU; |
|||
}); |
|||
await _jisSeDetailRepository.DbContext.BulkInsertAsync(jisSeDetails).ConfigureAwait(false); |
|||
|
|||
if (syncPositionFlag != null) |
|||
{ |
|||
syncPositionFlag.Position = wmsSeRecords.Last().UID.ToString(); |
|||
await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag).ConfigureAwait(false); |
|||
} |
|||
else |
|||
{ |
|||
syncPositionFlag = new SyncPositionFlag() |
|||
{ |
|||
TableName = syncTableName, |
|||
Position = wmsSeRecords.Last().UID.ToString() |
|||
}; |
|||
await _syncPositionFlagRepository.InsertAsync(syncPositionFlag).ConfigureAwait(false); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 同步JisRecord
|
|||
/// </summary>
|
|||
[UnitOfWork] |
|||
private async Task SyncJisRecordAsync() |
|||
{ |
|||
//同步表名称
|
|||
var syncTableName = $"{SeSyncConfigInfo.SyncTableName}_Jis"; |
|||
//同步发运主类型
|
|||
var deliverBillType = SeSyncConfigInfo.SyncDeliverBillType; |
|||
//同步发运子类型
|
|||
var deliverSubBillTypes = SeSyncConfigInfo.SyncDeliverSubBillTypes; |
|||
//业务类别
|
|||
var businessType = SeSyncConfigInfo.BusinessType; |
|||
|
|||
Expression<Func<TM_BJBMPT_JIS_RECORD, bool>> predicate = (t) => t.DeliverBillType == deliverBillType && deliverSubBillTypes.Contains(t.DeliverSubBillType); |
|||
var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName).ConfigureAwait(false); |
|||
if (syncPositionFlag != null) |
|||
{ |
|||
predicate = (t) => t.UID > int.Parse(syncPositionFlag.Position) && t.DeliverBillType == deliverBillType && deliverSubBillTypes.Contains(t.DeliverSubBillType); |
|||
} |
|||
|
|||
//WMS发运数据
|
|||
var wmsRecords = _wmsBJBMPTContext.TM_BJBMPT_JIS_RECORD.Where(predicate).OrderBy(b => b.UID).Take(100000).ToList(); |
|||
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIS_RECORD>, List<BBAC_SE_DETAIL>>(wmsRecords); |
|||
jisSeDetails.RemoveAll(t => string.IsNullOrEmpty(t.LU) || string.IsNullOrEmpty(t.FactoryPartCode)); |
|||
if (jisSeDetails.Any()) |
|||
{ |
|||
//客户零件号和厂内零件号
|
|||
var luRePartCodes = jisSeDetails.Select(t => new { t.LU, t.FactoryPartCode }).Distinct().ToList(); |
|||
if (luRePartCodes.Any()) |
|||
{ |
|||
var materialRelationships = luRePartCodes.Select(t => new MaterialRelationship(GuidGenerator.Create(), t.LU, "", t.FactoryPartCode, businessType.ToString())); |
|||
await _materialRelationshipManager.AddNewMaterialRelationships(materialRelationships).ConfigureAwait(false); |
|||
} |
|||
|
|||
jisSeDetails.ForEach(t => |
|||
{ |
|||
t.BusinessType = businessType; |
|||
t.KeyCode = t.PN + t.LU; |
|||
}); |
|||
await _jisSeDetailRepository.DbContext.BulkInsertAsync(jisSeDetails).ConfigureAwait(false); |
|||
|
|||
if (syncPositionFlag != null) |
|||
{ |
|||
syncPositionFlag.Position = wmsRecords.Last().UID.ToString(); |
|||
await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag).ConfigureAwait(false); |
|||
} |
|||
else |
|||
{ |
|||
syncPositionFlag = new SyncPositionFlag() |
|||
{ |
|||
TableName = syncTableName, |
|||
Position = wmsRecords.Last().UID.ToString() |
|||
}; |
|||
await _syncPositionFlagRepository.InsertAsync(syncPositionFlag).ConfigureAwait(false); ; |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,49 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using SettleAccount.Domain.BQ; |
|||
using Win.Sfs.SettleAccount.Entities.BQ.Managers; |
|||
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
|||
using Win.Sfs.SettleAccount.EntityFrameworkCore; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; |
|||
|
|||
/// <summary>
|
|||
/// JisHBPO发运同步
|
|||
/// </summary>
|
|||
[AllowAnonymous] |
|||
[Route("api/settleaccount/[controller]/[action]")]
|
|||
public class JisHBPOSeSyncAppService : JisHBPOSeSyncBaseAppService, IJobService |
|||
{ |
|||
/// <summary>
|
|||
/// 构造
|
|||
/// </summary>
|
|||
public JisHBPOSeSyncAppService( |
|||
WMSBJBMPTDbContext wmsBJBMPTContext, |
|||
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository, |
|||
INormalEfCoreRepository<HBPO_SE_DETAIL, Guid> jisSeDetailRepository, |
|||
MaterialRelationshipManager materialRelationshipManager, |
|||
VmiAppService vmiService |
|||
) : base(wmsBJBMPTContext, syncPositionFlagRepository, jisSeDetailRepository, materialRelationshipManager, vmiService) |
|||
{ |
|||
base.SeSyncConfigInfo = new SeSyncConfig() |
|||
{ |
|||
SyncTableName = "JisHBPOSync", |
|||
SyncDeliverBillType = EnumDeliverBjBmpBillType.JIS件, |
|||
SyncDeliverSubBillTypes = new List<EnumDeliverSubBillType> |
|||
{ |
|||
EnumDeliverSubBillType.保险杠HBPO, |
|||
EnumDeliverSubBillType.小件HBPO |
|||
}, |
|||
BusinessType = EnumBusinessType.MaiDanJianHBPO |
|||
}; |
|||
} |
|||
|
|||
public async Task Invoke(IServiceProvider serviceProvider) |
|||
{ |
|||
await this.Invoke().ConfigureAwait(false); |
|||
} |
|||
} |
@ -0,0 +1,199 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Linq.Expressions; |
|||
using System.Threading.Tasks; |
|||
using Coravel.Invocable; |
|||
using EFCore.BulkExtensions; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using SettleAccount.Domain.BQ; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.Uow; |
|||
using Win.Sfs.SettleAccount.Entities.BQ.Managers; |
|||
using Win.Sfs.SettleAccount.EntityFrameworkCore; |
|||
using Win.Sfs.SettleAccount.MaterialRelationships; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; |
|||
|
|||
/// <summary>
|
|||
/// Jis发运数据同步
|
|||
/// </summary>
|
|||
[ApiExplorerSettings(IgnoreApi = true)] |
|||
public class JisHBPOSeSyncBaseAppService : ApplicationService, IInvocable |
|||
{ |
|||
/// <summary>
|
|||
/// WMS数据上下文
|
|||
/// </summary>
|
|||
private readonly WMSBJBMPTDbContext _wmsBJBMPTContext; |
|||
|
|||
/// <summary>
|
|||
/// 同步位置标记
|
|||
/// </summary>
|
|||
private readonly INormalEfCoreRepository<SyncPositionFlag, Guid> _syncPositionFlagRepository; |
|||
|
|||
/// <summary>
|
|||
/// Jis发运数据仓储
|
|||
/// </summary>
|
|||
private readonly INormalEfCoreRepository<HBPO_SE_DETAIL, Guid> _jisSeDetailRepository; |
|||
|
|||
/// <summary>
|
|||
/// 客户零件关系领域
|
|||
/// </summary>
|
|||
private readonly MaterialRelationshipManager _materialRelationshipManager; |
|||
|
|||
private readonly IVmiService _vmiService; |
|||
|
|||
/// <summary>
|
|||
/// 构造
|
|||
/// </summary>
|
|||
public JisHBPOSeSyncBaseAppService( |
|||
WMSBJBMPTDbContext wmsBJBMPTContext, |
|||
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository, |
|||
INormalEfCoreRepository<HBPO_SE_DETAIL, Guid> jisSeDetailRepository, |
|||
MaterialRelationshipManager materialRelationshipManager, |
|||
VmiAppService vmiService) |
|||
{ |
|||
_wmsBJBMPTContext = wmsBJBMPTContext; |
|||
_syncPositionFlagRepository = syncPositionFlagRepository; |
|||
_jisSeDetailRepository = jisSeDetailRepository; |
|||
_materialRelationshipManager = materialRelationshipManager; |
|||
_vmiService = vmiService; |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 发运同步配置
|
|||
/// </summary>
|
|||
public SeSyncConfig SeSyncConfigInfo { get; set; } |
|||
|
|||
[HttpPost] |
|||
public async Task Invoke() |
|||
{ |
|||
if (SeSyncConfigInfo == null) |
|||
{ |
|||
return; |
|||
} |
|||
await SyncJitRecordAsync().ConfigureAwait(false); |
|||
await SyncJisRecordAsync().ConfigureAwait(false); |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 同步JitRecord
|
|||
/// </summary>
|
|||
[UnitOfWork] |
|||
private async Task SyncJitRecordAsync() |
|||
{ |
|||
//同步表名称
|
|||
var syncTableName = "JisBBACSeSync_Jit"; |
|||
//同步发运主类型
|
|||
var deliverBillType = SeSyncConfigInfo.SyncDeliverBillType; |
|||
//同步发运子类型
|
|||
var deliverSubBillTypes = SeSyncConfigInfo.SyncDeliverSubBillTypes; |
|||
//业务类别
|
|||
var businessType = SeSyncConfigInfo.BusinessType; |
|||
|
|||
Expression<Func<TM_BJBMPT_JIT_RECORD, bool>> predicate = (t) => t.DeliverBillType == deliverBillType && deliverSubBillTypes.Contains(t.DeliverSubBillType); |
|||
var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName).ConfigureAwait(false); |
|||
if (syncPositionFlag != null) |
|||
{ |
|||
predicate = (t) => t.UID > int.Parse(syncPositionFlag.Position) && t.DeliverBillType == deliverBillType && deliverSubBillTypes.Contains(t.DeliverSubBillType); |
|||
} |
|||
|
|||
//WMS发运记录
|
|||
var wmsSeRecords = _wmsBJBMPTContext.TM_BJBMPT_JIT_RECORD.Where(predicate).OrderBy(b => b.UID).Take(100000).ToList(); |
|||
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIT_RECORD>, List<HBPO_SE_DETAIL>>(wmsSeRecords); |
|||
jisSeDetails.RemoveAll(t => string.IsNullOrEmpty(t.LU) || string.IsNullOrEmpty(t.FactoryPartCode)); |
|||
if (jisSeDetails.Any()) |
|||
{ |
|||
//客户零件号和厂内零件号
|
|||
var luRePartCodes = jisSeDetails.Select(t => new { t.LU, t.FactoryPartCode }).Distinct().ToList(); |
|||
if (luRePartCodes.Any()) |
|||
{ |
|||
var materialRelationships = luRePartCodes.Select(t => new MaterialRelationship(GuidGenerator.Create(), t.LU, "", t.FactoryPartCode, businessType.ToString())); |
|||
await _materialRelationshipManager.AddNewMaterialRelationships(materialRelationships).ConfigureAwait(false); |
|||
} |
|||
|
|||
jisSeDetails.ForEach(t => |
|||
{ |
|||
//t.BusinessType = businessType;
|
|||
t.KeyCode = t.PN + t.LU; |
|||
}); |
|||
await _jisSeDetailRepository.DbContext.BulkInsertAsync(jisSeDetails).ConfigureAwait(false); |
|||
|
|||
if (syncPositionFlag != null) |
|||
{ |
|||
syncPositionFlag.Position = wmsSeRecords.Last().UID.ToString(); |
|||
await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag).ConfigureAwait(false); |
|||
} |
|||
else |
|||
{ |
|||
syncPositionFlag = new SyncPositionFlag() |
|||
{ |
|||
TableName = syncTableName, |
|||
Position = wmsSeRecords.Last().UID.ToString() |
|||
}; |
|||
await _syncPositionFlagRepository.InsertAsync(syncPositionFlag).ConfigureAwait(false); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/// <summary>
|
|||
/// 同步JisRecord
|
|||
/// </summary>
|
|||
[UnitOfWork] |
|||
private async Task SyncJisRecordAsync() |
|||
{ |
|||
//同步表名称
|
|||
var syncTableName = "JisBBACSeSync_Jit"; |
|||
//同步发运主类型
|
|||
var deliverBillType = SeSyncConfigInfo.SyncDeliverBillType; |
|||
//同步发运子类型
|
|||
var deliverSubBillTypes = SeSyncConfigInfo.SyncDeliverSubBillTypes; |
|||
//业务类别
|
|||
var businessType = SeSyncConfigInfo.BusinessType; |
|||
|
|||
Expression<Func<TM_BJBMPT_JIS_RECORD, bool>> predicate = (t) => t.DeliverBillType == deliverBillType && deliverSubBillTypes.Contains(t.DeliverSubBillType); |
|||
var syncPositionFlag = await _syncPositionFlagRepository.FindAsync(t => t.TableName == syncTableName).ConfigureAwait(false); |
|||
if (syncPositionFlag != null) |
|||
{ |
|||
predicate = (t) => t.UID > int.Parse(syncPositionFlag.Position) && t.DeliverBillType == deliverBillType && deliverSubBillTypes.Contains(t.DeliverSubBillType); |
|||
} |
|||
|
|||
//WMS发运数据
|
|||
var wmsRecords = _wmsBJBMPTContext.TM_BJBMPT_JIS_RECORD.Where(predicate).OrderBy(b => b.UID).Take(100000).ToList(); |
|||
var jisSeDetails = ObjectMapper.Map<List<TM_BJBMPT_JIS_RECORD>, List<HBPO_SE_DETAIL>>(wmsRecords); |
|||
jisSeDetails.RemoveAll(t => string.IsNullOrEmpty(t.LU) || string.IsNullOrEmpty(t.FactoryPartCode)); |
|||
if (jisSeDetails.Any()) |
|||
{ |
|||
//客户零件号和厂内零件号
|
|||
var luRePartCodes = jisSeDetails.Select(t => new { t.LU, t.FactoryPartCode }).Distinct().ToList(); |
|||
if (luRePartCodes.Any()) |
|||
{ |
|||
var materialRelationships = luRePartCodes.Select(t => new MaterialRelationship(GuidGenerator.Create(), t.LU, "", t.FactoryPartCode, businessType.ToString())); |
|||
await _materialRelationshipManager.AddNewMaterialRelationships(materialRelationships).ConfigureAwait(false); |
|||
} |
|||
|
|||
jisSeDetails.ForEach(t => |
|||
{ |
|||
//t.BusinessType = businessType;
|
|||
t.KeyCode = t.PN + t.LU; |
|||
}); |
|||
await _jisSeDetailRepository.DbContext.BulkInsertAsync(jisSeDetails).ConfigureAwait(false); |
|||
|
|||
if (syncPositionFlag != null) |
|||
{ |
|||
syncPositionFlag.Position = wmsRecords.Last().UID.ToString(); |
|||
await _syncPositionFlagRepository.UpdateAsync(syncPositionFlag).ConfigureAwait(false); |
|||
} |
|||
else |
|||
{ |
|||
syncPositionFlag = new SyncPositionFlag() |
|||
{ |
|||
TableName = syncTableName, |
|||
Position = wmsRecords.Last().UID.ToString() |
|||
}; |
|||
await _syncPositionFlagRepository.InsertAsync(syncPositionFlag).ConfigureAwait(false); ; |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,49 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using SettleAccount.Domain.BQ; |
|||
using Win.Sfs.SettleAccount.Entities.BQ.Managers; |
|||
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
|||
using Win.Sfs.SettleAccount.EntityFrameworkCore; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; |
|||
|
|||
/// <summary>
|
|||
/// 买单件BBAC发运同步
|
|||
/// </summary>
|
|||
[AllowAnonymous] |
|||
[Route("api/settleaccount/[controller]/[action]")]
|
|||
public class MaiDanBBACSeSyncAppService : JisBBACSeSyncBaseAppService, IJobService |
|||
{ |
|||
/// <summary>
|
|||
/// 构造
|
|||
/// </summary>
|
|||
public MaiDanBBACSeSyncAppService( |
|||
WMSBJBMPTDbContext wmsBJBMPTContext, |
|||
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository, |
|||
INormalEfCoreRepository<BBAC_SE_DETAIL, Guid> jisSeDetailRepository, |
|||
MaterialRelationshipManager materialRelationshipManager, |
|||
VmiAppService vmiService |
|||
) : base(wmsBJBMPTContext, syncPositionFlagRepository, jisSeDetailRepository, materialRelationshipManager, vmiService) |
|||
{ |
|||
base.SeSyncConfigInfo = new SeSyncConfig() |
|||
{ |
|||
SyncTableName = "MaiDanBBACSync", |
|||
SyncDeliverBillType = EnumDeliverBjBmpBillType.JIS件, |
|||
SyncDeliverSubBillTypes = new List<EnumDeliverSubBillType> |
|||
{ |
|||
EnumDeliverSubBillType.买单件保险杠BBAC, |
|||
EnumDeliverSubBillType.买单件小件BBAC |
|||
}, |
|||
BusinessType = EnumBusinessType.MaiDanJianBBAC |
|||
}; |
|||
} |
|||
|
|||
public async Task Invoke(IServiceProvider serviceProvider) |
|||
{ |
|||
await this.Invoke().ConfigureAwait(false); |
|||
} |
|||
} |
@ -0,0 +1,49 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Authorization; |
|||
using Microsoft.AspNetCore.Mvc; |
|||
using SettleAccount.Domain.BQ; |
|||
using Win.Sfs.SettleAccount.Entities.BQ.Managers; |
|||
using Win.Sfs.SettleAccount.Entities.BQ.Vmi; |
|||
using Win.Sfs.SettleAccount.EntityFrameworkCore; |
|||
using Win.Sfs.Shared.RepositoryBase; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Entities.BQ.Syncs; |
|||
|
|||
/// <summary>
|
|||
/// 买单件HBPO发运同步
|
|||
/// </summary>
|
|||
[AllowAnonymous] |
|||
[Route("api/settleaccount/[controller]/[action]")]
|
|||
public class MaiDanHBPOSeSyncAppService : JisHBPOSeSyncBaseAppService, IJobService |
|||
{ |
|||
/// <summary>
|
|||
/// 构造
|
|||
/// </summary>
|
|||
public MaiDanHBPOSeSyncAppService( |
|||
WMSBJBMPTDbContext wmsBJBMPTContext, |
|||
INormalEfCoreRepository<SyncPositionFlag, Guid> syncPositionFlagRepository, |
|||
INormalEfCoreRepository<HBPO_SE_DETAIL, Guid> jisSeDetailRepository, |
|||
MaterialRelationshipManager materialRelationshipManager, |
|||
VmiAppService vmiService |
|||
) : base(wmsBJBMPTContext, syncPositionFlagRepository, jisSeDetailRepository, materialRelationshipManager, vmiService) |
|||
{ |
|||
base.SeSyncConfigInfo = new SeSyncConfig() |
|||
{ |
|||
SyncTableName = "MaiDanHBPOSync", |
|||
SyncDeliverBillType = EnumDeliverBjBmpBillType.JIS件, |
|||
SyncDeliverSubBillTypes = new List<EnumDeliverSubBillType> |
|||
{ |
|||
EnumDeliverSubBillType.买单件保险杠HBPO, |
|||
EnumDeliverSubBillType.买单件小件HBPO |
|||
}, |
|||
BusinessType = EnumBusinessType.MaiDanJianHBPO |
|||
}; |
|||
} |
|||
|
|||
public async Task Invoke(IServiceProvider serviceProvider) |
|||
{ |
|||
await this.Invoke().ConfigureAwait(false); |
|||
} |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,158 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Migrations |
|||
{ |
|||
public partial class _202308172 : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DeleteData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("d50400b0-b0d4-38d1-fcdf-b1e7ac1d3a68")); |
|||
|
|||
migrationBuilder.DeleteData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("d6d5e1d7-9326-ceea-eed4-fb4039e7ee68")); |
|||
|
|||
migrationBuilder.DeleteData( |
|||
table: "Set_VmiBalance", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("9f155520-78d6-44b1-b8d4-dbdc31507b21")); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "FactoryPartCode", |
|||
table: "Set_PUB_SE_DETAIL", |
|||
type: "nvarchar(max)", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "FactoryPartCode", |
|||
table: "Set_HBPO_SE_DETAIL", |
|||
type: "nvarchar(max)", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.AddColumn<string>( |
|||
name: "FactoryPartCode", |
|||
table: "Set_BBAC_SE_DETAIL", |
|||
type: "nvarchar(max)", |
|||
nullable: true); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"), |
|||
column: "Cron", |
|||
value: "0 0/30 * * * ? "); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"), |
|||
column: "Cron", |
|||
value: "0 0/30 * * * ? "); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"), |
|||
column: "Cron", |
|||
value: "0 0/30 * * * ? "); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"), |
|||
column: "Cron", |
|||
value: "0 0/30 * * * ? "); |
|||
|
|||
migrationBuilder.InsertData( |
|||
table: "Set_JobItem", |
|||
columns: new[] { "Id", "Cron", "HeartBeat", "IsDisabled", "IsRunning", "Name", "Service" }, |
|||
values: new object[,] |
|||
{ |
|||
{ new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"), "0 0/30 * * * ? ", null, false, false, "买单件BBAC发运数据同步", "Win.Sfs.SettleAccount.Entities.BQ.Syncs.MaiDanBBACSeSyncAppService" }, |
|||
{ new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"), "0 0/30 * * * ? ", null, false, false, "买单件HBPO发运数据同步", "Win.Sfs.SettleAccount.Entities.BQ.Syncs.MaiDanBBACSeSyncAppService" } |
|||
}); |
|||
|
|||
migrationBuilder.InsertData( |
|||
table: "Set_VmiBalance", |
|||
columns: new[] { "Id", "BackupTime", "BillTime", "BillType", "CodeType", "ConcurrencyStamp", "Configcode", "CustomerPartCode", "DeliverTime", "ErpToLoc", "MatchNumber", "OrderNum", "PartCode", "PjsNum", "Qty", "ReMark", "RealCode", "Seq", "SubBillType", "UniqueCode", "VinCode", "factory" }, |
|||
values: new object[] { new Guid("514d1103-1558-4b8c-9172-6d0dd6a4eb32"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "78276bb327a64a0982919addb1cc1bcf", null, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "ErpToLoc", null, "OrderNum", "PartCode", null, 0m, null, null, null, 0, null, "VinCode", null }); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DeleteData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa")); |
|||
|
|||
migrationBuilder.DeleteData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e")); |
|||
|
|||
migrationBuilder.DeleteData( |
|||
table: "Set_VmiBalance", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("514d1103-1558-4b8c-9172-6d0dd6a4eb32")); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "FactoryPartCode", |
|||
table: "Set_PUB_SE_DETAIL"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "FactoryPartCode", |
|||
table: "Set_HBPO_SE_DETAIL"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "FactoryPartCode", |
|||
table: "Set_BBAC_SE_DETAIL"); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"), |
|||
column: "Cron", |
|||
value: "0 0/10 * * * ? "); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"), |
|||
column: "Cron", |
|||
value: "0 0/10 * * * ? "); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"), |
|||
column: "Cron", |
|||
value: "0 0/10 * * * ? "); |
|||
|
|||
migrationBuilder.UpdateData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"), |
|||
column: "Cron", |
|||
value: "0 0/10 * * * ? "); |
|||
|
|||
migrationBuilder.InsertData( |
|||
table: "Set_JobItem", |
|||
columns: new[] { "Id", "Cron", "HeartBeat", "IsDisabled", "IsRunning", "Name", "Service" }, |
|||
values: new object[,] |
|||
{ |
|||
{ new Guid("d6d5e1d7-9326-ceea-eed4-fb4039e7ee68"), "0 0/10 * * * ? ", null, false, false, "BBAC发运数据同步", "Win.Sfs.SettleAccount.Entities.BQ.Syncs.BBACSeSyncAppService" }, |
|||
{ new Guid("d50400b0-b0d4-38d1-fcdf-b1e7ac1d3a68"), "0 0/10 * * * ? ", null, false, false, "HBPO发运数据同步", "Win.Sfs.SettleAccount.Entities.BQ.Syncs.HBPOSeSyncAppService" } |
|||
}); |
|||
|
|||
migrationBuilder.InsertData( |
|||
table: "Set_VmiBalance", |
|||
columns: new[] { "Id", "BackupTime", "BillTime", "BillType", "CodeType", "ConcurrencyStamp", "Configcode", "CustomerPartCode", "DeliverTime", "ErpToLoc", "MatchNumber", "OrderNum", "PartCode", "PjsNum", "Qty", "ReMark", "RealCode", "Seq", "SubBillType", "UniqueCode", "VinCode", "factory" }, |
|||
values: new object[] { new Guid("9f155520-78d6-44b1-b8d4-dbdc31507b21"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "4e37e65449bf44728f7a3cf6a93d4e01", null, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "ErpToLoc", null, "OrderNum", "PartCode", null, 0m, null, null, null, 0, null, "VinCode", null }); |
|||
} |
|||
} |
|||
} |
File diff suppressed because it is too large
@ -0,0 +1,54 @@ |
|||
using System; |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
namespace Win.Sfs.SettleAccount.Migrations |
|||
{ |
|||
public partial class _202308173 : Migration |
|||
{ |
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DeleteData( |
|||
table: "Set_VmiBalance", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("514d1103-1558-4b8c-9172-6d0dd6a4eb32")); |
|||
|
|||
migrationBuilder.InsertData( |
|||
table: "Set_JobItem", |
|||
columns: new[] { "Id", "Cron", "HeartBeat", "IsDisabled", "IsRunning", "Name", "Service" }, |
|||
values: new object[] { new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"), "0 0/30 * * * ? ", null, false, false, "JisBBAC发运数据同步", "Win.Sfs.SettleAccount.Entities.BQ.Syncs.JisBBACSeSyncAppService" }); |
|||
|
|||
migrationBuilder.InsertData( |
|||
table: "Set_JobItem", |
|||
columns: new[] { "Id", "Cron", "HeartBeat", "IsDisabled", "IsRunning", "Name", "Service" }, |
|||
values: new object[] { new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"), "0 0/30 * * * ? ", null, false, false, "JisHBPO发运数据同步", "Win.Sfs.SettleAccount.Entities.BQ.Syncs.JisHBPOSeSyncAppService" }); |
|||
|
|||
migrationBuilder.InsertData( |
|||
table: "Set_VmiBalance", |
|||
columns: new[] { "Id", "BackupTime", "BillTime", "BillType", "CodeType", "ConcurrencyStamp", "Configcode", "CustomerPartCode", "DeliverTime", "ErpToLoc", "MatchNumber", "OrderNum", "PartCode", "PjsNum", "Qty", "ReMark", "RealCode", "Seq", "SubBillType", "UniqueCode", "VinCode", "factory" }, |
|||
values: new object[] { new Guid("9574edd9-55aa-48b6-bb63-fae78eaf5cf7"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "14dfff8fd6ae4d639ca21b8c8c950de5", null, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "ErpToLoc", null, "OrderNum", "PartCode", null, 0m, null, null, null, 0, null, "VinCode", null }); |
|||
} |
|||
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DeleteData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("49b1da12-418c-544d-fe8b-be7e5b572452")); |
|||
|
|||
migrationBuilder.DeleteData( |
|||
table: "Set_JobItem", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5")); |
|||
|
|||
migrationBuilder.DeleteData( |
|||
table: "Set_VmiBalance", |
|||
keyColumn: "Id", |
|||
keyValue: new Guid("9574edd9-55aa-48b6-bb63-fae78eaf5cf7")); |
|||
|
|||
migrationBuilder.InsertData( |
|||
table: "Set_VmiBalance", |
|||
columns: new[] { "Id", "BackupTime", "BillTime", "BillType", "CodeType", "ConcurrencyStamp", "Configcode", "CustomerPartCode", "DeliverTime", "ErpToLoc", "MatchNumber", "OrderNum", "PartCode", "PjsNum", "Qty", "ReMark", "RealCode", "Seq", "SubBillType", "UniqueCode", "VinCode", "factory" }, |
|||
values: new object[] { new Guid("514d1103-1558-4b8c-9172-6d0dd6a4eb32"), null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, null, "78276bb327a64a0982919addb1cc1bcf", null, null, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), "ErpToLoc", null, "OrderNum", "PartCode", null, 0m, null, null, null, 0, null, "VinCode", null }); |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue