Browse Source

EF迁移发运表字段

master
mahao 1 year ago
parent
commit
7a06fda88f
  1. 6
      code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs
  2. 30
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs
  3. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/HandSeSyncAppService.cs
  4. 49
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeSyncAppService.cs
  5. 199
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeSyncBaseAppService.cs
  6. 49
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncAppService.cs
  7. 199
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncBaseAppService.cs
  8. 9
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JitSeSyncAppService.cs
  9. 49
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MaiDanBBACSeSyncAppService.cs
  10. 49
      code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MaiDanHBPOSeSyncAppService.cs
  11. 2
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.csproj
  12. 22
      code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs
  13. 13
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs
  14. 5
      code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_SA.cs
  15. 14
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs
  16. 5521
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230817033153_20230817-2.Designer.cs
  17. 158
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230817033153_20230817-2.cs
  18. 5539
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230817035945_20230817-3.Designer.cs
  19. 54
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230817035945_20230817-3.cs
  20. 55
      code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

6
code/src/Modules/SettleAccount/src/SettleAccount.Application.Contracts/Entities/BQ/Dtos/PUB_SA_DTO.cs

@ -80,7 +80,7 @@ public class ZhiGongJianBBACImportDto
/// </summary>
[Display(Name = "Pstng Date")]
[ImporterHeader(Name = "Pstng Date")]
public string SettleDate { set; get; }
public DateTime SettleDate { set; get; }
/// <summary>
/// 客户零件号
@ -212,7 +212,7 @@ public class BeiJianImportDto : BeiJianExtraImportDto
/// </summary>
[Display(Name = "结算日期")]
[ImporterHeader(Name = "零件时间")]
public string SettleDate { set; get; }
public DateTime SettleDate { set; get; }
/// <summary>
/// 客户零件号
@ -367,7 +367,7 @@ public class YinDuJianImportDto
/// </summary>
[Display(Name = "Delivery Date")]
[ImporterHeader(Name = "Delivery Date")]
public string SettleDate { set; get; }
public DateTime SettleDate { set; get; }
/// <summary>
/// 客户零件号

30
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs

@ -4,6 +4,7 @@ using System.Globalization;
using System.Linq;
using System.Linq.Dynamic.Core;
using System.Threading.Tasks;
using EFCore.BulkExtensions;
using Magicodes.ExporterAndImporter.Core.Models;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
@ -200,7 +201,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
}
if (pubSaDetails.Any())
{
await _pubSaDetailRepository.DeleteManyAsync(pubSaDetails);
await _pubSaDetailRepository.DbContext.BulkDeleteAsync(pubSaDetails).ConfigureAwait(false);
}
if (pubCanSas.Any())
{
@ -208,11 +209,11 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
}
if (pubCanSaDetails.Any())
{
await _pubCanSaDetailRepository.DeleteManyAsync(pubCanSaDetails);
await _pubCanSaDetailRepository.DbContext.BulkDeleteAsync(pubCanSaDetails).ConfigureAwait(false);
}
if (pubNotSaDetails.Any())
{
await _pubNotSaDetailRepository.DeleteManyAsync(pubNotSaDetails);
await _pubNotSaDetailRepository.DbContext.BulkDeleteAsync(pubNotSaDetails).ConfigureAwait(false);
}
}
@ -254,23 +255,23 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
//删除
if (pubSas.Any())
{
await _repository.DeleteManyAsync(pubSas);
await _repository.DbContext.BulkDeleteAsync(pubSas).ConfigureAwait(false);
}
if (pubSaDetails.Any())
{
await _pubSaDetailRepository.DeleteManyAsync(pubSaDetails);
await _pubSaDetailRepository.DbContext.BulkDeleteAsync(pubSaDetails).ConfigureAwait(false);
}
if (pubCanSas.Any())
{
await _pubCanSaRepository.DeleteManyAsync(pubCanSas);
await _pubCanSaRepository.DbContext.BulkDeleteAsync(pubCanSas).ConfigureAwait(false);
}
if (pubCanSaDetails.Any())
{
await _pubCanSaDetailRepository.DeleteManyAsync(pubCanSaDetails);
await _pubCanSaDetailRepository.DbContext.BulkDeleteAsync(pubCanSaDetails).ConfigureAwait(false);
}
if (pubNotSaDetails.Any())
{
await _pubNotSaDetailRepository.DeleteManyAsync(pubNotSaDetails);
await _pubNotSaDetailRepository.DbContext.BulkDeleteAsync(pubNotSaDetails).ConfigureAwait(false);
}
return new JsonResult(new { Code = 200, Message = "成功" });
@ -464,6 +465,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
pubSaDetails.ForEach(importPubSaDetail =>
{
importPubSaDetail.SetId(GuidGenerator.Create());
List<string> lus = importPubSaDetail.LU.Split(" ").ToList();
importPubSaDetail.LU = lus[0].Replace(" ", "");
if (lus.Count > 1)
@ -565,8 +567,8 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
#endregion
#region 添加入库
await _repository.InsertAsync(pubSa);
await _pubSaDetailRepository.InsertManyAsync(pubSaDetails);
await _repository.InsertAsync(pubSa).ConfigureAwait(false);
(await _pubSaDetailRepository.GetDbContextAsync().ConfigureAwait(false)).BulkInsert(pubSaDetails);
if (pubCanSaDetails.Count > 0)
{
pubCanSa.InvGroupNum = pubCanSaDetails.Count.ToString();
@ -575,12 +577,14 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase<PUB_SA>
pubCanSaDetail.BillNum = pubCanSaDetail.InvGroupNum = pubCanSaBillNum;
});
await _pubCanSaRepository.InsertAsync(pubCanSa);
await _pubCanSaDetailRepository.InsertManyAsync(pubCanSaDetails);
await _pubCanSaRepository.InsertAsync(pubCanSa).ConfigureAwait(false);
await _pubCanSaDetailRepository.DbContext.BulkInsertAsync(pubCanSaDetails).ConfigureAwait(false);
//await _pubCanSaDetailRepository.InsertManyAsync(pubCanSaDetails);
}
if (pubNotSaDetails.Count > 0)
{
await _pubNotSaDetailRepository.InsertManyAsync(pubNotSaDetails);
await _pubNotSaDetailRepository.DbContext.BulkInsertAsync(pubNotSaDetails).ConfigureAwait(false);
//await _pubNotSaDetailRepository.InsertManyAsync(pubNotSaDetails);
}
#endregion
}

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

@ -1,5 +1,6 @@
using System;
using System.Threading.Tasks;
using Coravel.Invocable;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
@ -29,14 +30,18 @@ public class HandSeSyncAppService : ApplicationService
public async Task SyncAsync([FromBody] EnumBusinessType businessType)
{
using var scope = this._applicationServices.CreateScope();
JitSeSyncAppService jitSeSyncAppService = businessType switch
IInvocable jitSeSyncAppService = businessType switch
{
EnumBusinessType.JisBBAC => scope.ServiceProvider.GetRequiredService<JisBBACSeSyncAppService>(),
EnumBusinessType.JisHBPO => scope.ServiceProvider.GetRequiredService<JisHBPOSeSyncAppService>(),
EnumBusinessType.MaiDanJianBBAC => scope.ServiceProvider.GetRequiredService<MaiDanBBACSeSyncAppService>(),
EnumBusinessType.MaiDanJianHBPO => scope.ServiceProvider.GetRequiredService<MaiDanHBPOSeSyncAppService>(),
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();
await jitSeSyncAppService.Invoke().ConfigureAwait(false);
}
}

49
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeSyncAppService.cs

@ -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);
}
}

199
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisBBACSeSyncBaseAppService.cs

@ -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); ;
}
}
}
}

49
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncAppService.cs

@ -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);
}
}

199
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/JisHBPOSeSyncBaseAppService.cs

@ -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); ;
}
}
}
}

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

@ -4,6 +4,7 @@ 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;
@ -92,14 +93,14 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
var wmsSeRecords = _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>>(wmsSeRecords);
pubSeDetails.RemoveAll(t => string.IsNullOrEmpty(t.LU) || string.IsNullOrEmpty(t.PartCode));
pubSeDetails.RemoveAll(t => string.IsNullOrEmpty(t.LU) || string.IsNullOrEmpty(t.FactoryPartCode));
if (pubSeDetails.Any())
{
//客户零件号和厂内零件号
var luRePartCodes = pubSeDetails.Select(t => new { t.LU, t.PartCode }).Distinct().ToList();
var luRePartCodes = pubSeDetails.Select(t => new { t.LU, t.FactoryPartCode }).Distinct().ToList();
if (luRePartCodes.Any())
{
var materialRelationships = luRePartCodes.Select(t => new MaterialRelationship(GuidGenerator.Create(), t.LU, "", t.PartCode, businessType.ToString()));
var materialRelationships = luRePartCodes.Select(t => new MaterialRelationship(GuidGenerator.Create(), t.LU, "", t.FactoryPartCode, businessType.ToString()));
await _materialRelationshipManager.AddNewMaterialRelationships(materialRelationships).ConfigureAwait(false);
}
@ -108,7 +109,7 @@ public class JitSeSyncAppService : ApplicationService, IInvocable
t.BusinessType = businessType;
t.KeyCode = t.PN + t.LU;
});
await _pubSeDetailRepository.InsertManyAsync(pubSeDetails).ConfigureAwait(false);
await _pubSeDetailRepository.DbContext.BulkInsertAsync(pubSeDetails).ConfigureAwait(false);
if (syncPositionFlag != null)
{

49
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MaiDanBBACSeSyncAppService.cs

@ -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);
}
}

49
code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/Syncs/MaiDanHBPOSeSyncAppService.cs

@ -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);
}
}

2
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccount.Application.csproj

@ -111,6 +111,8 @@
<ItemGroup>
<Compile Remove="Entities\BQ\Syncs\BBACSeSyncAppService.cs" />
<Compile Remove="Entities\BQ\Syncs\HBPOSeSyncAppService.cs" />
<Compile Remove="Entities\JFCarConsignAppService.cs" />
<Compile Remove="Entities\JFCarKBAppService.cs" />
</ItemGroup>

22
code/src/Modules/SettleAccount/src/SettleAccount.Application/SettleAccountApplicationAutoMapperProfile.cs

@ -1135,7 +1135,8 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.AssembleData))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIT_RECORD, HBPO_SE_DETAIL>()
@ -1145,14 +1146,16 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.AssembleData))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIT_RECORD, PUB_SE_DETAIL>()
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.AssembleData))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
@ -1163,7 +1166,8 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIS_RECORD, HBPO_SE_DETAIL>()
@ -1173,14 +1177,16 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
CreateMap<TM_BJBMPT_JIS_RECORD, PUB_SE_DETAIL>()
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.RealPartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.VinCode))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
@ -1188,8 +1194,8 @@ namespace Win.Sfs.SettleAccount
.ForMember(x => x.BeginDate, y => y.MapFrom(d => d.AssembleData))
.ForMember(x => x.ShippingDate, y => y.MapFrom(d => d.BillTime))
.ForMember(x => x.WmsBillNum, y => y.MapFrom(d => d.BillNum))
//.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.LU, y => y.MapFrom(d => d.PartCode))
.ForMember(x => x.LU, y => y.MapFrom(d => d.CustPartCode))
.ForMember(x => x.FactoryPartCode, y => y.MapFrom(d => d.PartCode))
.ForMember(x => x.PN, y => y.MapFrom(d => d.BillNum))
.ForMember(x => x.Qty, y => y.MapFrom(d => d.Qty));
}

13
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Bases/EntityBase.cs

@ -546,21 +546,24 @@ namespace SettleAccount.Bases
/// 发运单号
/// </summary>
public string WmsBillNum { set; get; }
/// <summary>
/// 厂内零件号
/// 客户零件号
/// </summary>
public string LU { get; set; }
/// <summary>
/// 生產號
/// 厂内零件号
/// </summary>
public string FactoryPartCode { get; set; }
/// <summary>
/// 生产号
/// </summary>
public string PN { get; set; }
/// <summary>
/// 組合鍵值(LU+PN)
/// 组合键值(PN+LU
/// </summary>
public string KeyCode { get; set; }
/// <summary>
///
///
/// </summary>
public decimal Qty { get; set; }
}

5
code/src/Modules/SettleAccount/src/SettleAccount.Domain/Entities/BQ/PUB_SA.cs

@ -133,4 +133,9 @@ public class PUB_SA_DETAIL:SA_BASE
public PUB_SA_DETAIL()
{
}
public void SetId(Guid id)
{
Id = id;
}
}

14
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/EntityFrameworkCore/SettleAccountDbContextModelCreatingExtensions.cs

@ -1342,12 +1342,14 @@ namespace Win.Sfs.SettleAccount
//seed
builder.Entity<JobItem>().HasData(new JobItem("vmi".ToGuid()) { Name = "库存快照", Cron = "0 0 8 26 *", Service = "Win.Sfs.SettleAccount.Entities.BQ.VmiAppService" });
builder.Entity<JobItem>().HasData(new JobItem("BBACSeSync".ToGuid()) { Name = "BBAC发运数据同步", Cron = "0 0/10 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.BBACSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("HBPOSeSync".ToGuid()) { Name = "HBPO发运数据同步", Cron = "0 0/10 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.HBPOSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("ZhiGongBBACSeSync".ToGuid()) { Name = "直供件BBAC发运同步", Cron = "0 0/10 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.ZhiGongBBACSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("ZhiGongHBPOSeSync".ToGuid()) { Name = "直供件HBPO发运同步", Cron = "0 0/10 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.ZhiGongHBPOSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("BeiSeSync".ToGuid()) { Name = "备件发运同步", Cron = "0 0/10 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.BeiSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("YinDuSeSync".ToGuid()) { Name = "印度件发运同步", Cron = "0 0/10 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.YinDuSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("JisBBACSeSync".ToGuid()) { Name = "JisBBAC发运数据同步", Cron = "0 0/30 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.JisBBACSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("JisHBPOSeSync".ToGuid()) { Name = "JisHBPO发运数据同步", Cron = "0 0/30 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.JisHBPOSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("MaiDanBBACSeSync".ToGuid()) { Name = "买单件BBAC发运数据同步", Cron = "0 0/30 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.MaiDanBBACSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("MaiDanHBPOSeSync".ToGuid()) { Name = "买单件HBPO发运数据同步", Cron = "0 0/30 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.MaiDanBBACSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("ZhiGongBBACSeSync".ToGuid()) { Name = "直供件BBAC发运同步", Cron = "0 0/30 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.ZhiGongBBACSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("ZhiGongHBPOSeSync".ToGuid()) { Name = "直供件HBPO发运同步", Cron = "0 0/30 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.ZhiGongHBPOSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("BeiSeSync".ToGuid()) { Name = "备件发运同步", Cron = "0 0/30 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.BeiSeSyncAppService" });
builder.Entity<JobItem>().HasData(new JobItem("YinDuSeSync".ToGuid()) { Name = "印度件发运同步", Cron = "0 0/30 * * * ? ", Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.YinDuSeSyncAppService" });
//builder.Entity<VmiCategory>().HasData(new VmiCategory("发运入库".ToGuid()) { Type = VmiType.In, Name = "发运入库", Number = "100" });
//builder.Entity<VmiCategory>().HasData(new VmiCategory("结算出库".ToGuid()) { Type = VmiType.Out, Name = "结算出库", Number = "200" });
//builder.Entity<VmiCategory>().HasData(new VmiCategory("客户退货".ToGuid()) { Type = VmiType.Out, Name = "客户退货", Number = "300" });

5521
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230817033153_20230817-2.Designer.cs

File diff suppressed because it is too large

158
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230817033153_20230817-2.cs

@ -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 });
}
}
}

5539
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230817035945_20230817-3.Designer.cs

File diff suppressed because it is too large

54
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/20230817035945_20230817-3.cs

@ -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 });
}
}
}

55
code/src/Modules/SettleAccount/src/SettleAccount.EntityFrameworkCore/Migrations/SettleAccountDbContextModelSnapshot.cs

@ -689,6 +689,9 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<string>("Factory")
.HasColumnType("nvarchar(max)");
b.Property<string>("FactoryPartCode")
.HasColumnType("nvarchar(max)");
b.Property<string>("FromLoc")
.HasColumnType("nvarchar(max)");
@ -1875,6 +1878,9 @@ namespace Win.Sfs.SettleAccount.Migrations
b.Property<string>("Factory")
.HasColumnType("nvarchar(max)");
b.Property<string>("FactoryPartCode")
.HasColumnType("nvarchar(max)");
b.Property<string>("FromLoc")
.HasColumnType("nvarchar(max)");
@ -3576,6 +3582,9 @@ namespace Win.Sfs.SettleAccount.Migrations
.HasColumnType("nvarchar(max)")
.HasColumnName("ExtraProperties");
b.Property<string>("FactoryPartCode")
.HasColumnType("nvarchar(max)");
b.Property<string>("FromErpLocCode")
.HasColumnType("nvarchar(max)");
@ -4333,26 +4342,44 @@ namespace Win.Sfs.SettleAccount.Migrations
},
new
{
Id = new Guid("d6d5e1d7-9326-ceea-eed4-fb4039e7ee68"),
Cron = "0 0/10 * * * ? ",
Id = new Guid("b9b9c79f-4894-474b-4f67-b1ec121c41e5"),
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
Name = "JisBBAC发运数据同步",
Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.JisBBACSeSyncAppService"
},
new
{
Id = new Guid("49b1da12-418c-544d-fe8b-be7e5b572452"),
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
Name = "JisHBPO发运数据同步",
Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.JisHBPOSeSyncAppService"
},
new
{
Id = new Guid("7a0dc087-a859-5863-eb6e-56f588bd779e"),
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
Name = "BBAC发运数据同步",
Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.BBACSeSyncAppService"
Name = "买单件BBAC发运数据同步",
Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.MaiDanBBACSeSyncAppService"
},
new
{
Id = new Guid("d50400b0-b0d4-38d1-fcdf-b1e7ac1d3a68"),
Cron = "0 0/10 * * * ? ",
Id = new Guid("6f68fc8f-b058-c3f4-e07d-722c61f3f7fa"),
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
Name = "HBPO发运数据同步",
Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.HBPOSeSyncAppService"
Name = "买单件HBPO发运数据同步",
Service = "Win.Sfs.SettleAccount.Entities.BQ.Syncs.MaiDanBBACSeSyncAppService"
},
new
{
Id = new Guid("f306b380-47e5-5c01-b902-67ca4113a8f4"),
Cron = "0 0/10 * * * ? ",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
Name = "直供件BBAC发运同步",
@ -4361,7 +4388,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("8f7dc23d-e2e9-3691-cfe9-545bb958e3f2"),
Cron = "0 0/10 * * * ? ",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
Name = "直供件HBPO发运同步",
@ -4370,7 +4397,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("c1f71240-1b81-0107-8b23-ddc9811a3efe"),
Cron = "0 0/10 * * * ? ",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
Name = "备件发运同步",
@ -4379,7 +4406,7 @@ namespace Win.Sfs.SettleAccount.Migrations
new
{
Id = new Guid("c09c23ea-815f-1b43-4476-2365a8d9a60b"),
Cron = "0 0/10 * * * ? ",
Cron = "0 0/30 * * * ? ",
IsDisabled = false,
IsRunning = false,
Name = "印度件发运同步",
@ -4501,10 +4528,10 @@ namespace Win.Sfs.SettleAccount.Migrations
b.HasData(
new
{
Id = new Guid("9f155520-78d6-44b1-b8d4-dbdc31507b21"),
Id = new Guid("9574edd9-55aa-48b6-bb63-fae78eaf5cf7"),
BillTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
BillType = 1,
ConcurrencyStamp = "4e37e65449bf44728f7a3cf6a93d4e01",
ConcurrencyStamp = "14dfff8fd6ae4d639ca21b8c8c950de5",
DeliverTime = new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
ErpToLoc = "ErpToLoc",
OrderNum = "OrderNum",

Loading…
Cancel
Save