From e71bc24daa8f00768787e18f5daba09128abfc62 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周二, 29 4月 2025 10:59:40 +0800 Subject: [PATCH] Merge branch 'master' of http://222.71.245.114:9086/r/HIA24016N_PipeLineDemo --- HIAWms/server/src/CMS.Plugin.HIAWms.Domain/WmsContainers/WmsContainerDataSeedContributor.cs | 67 +++++++++++++++++++++++++++++++++ 1 files changed, 67 insertions(+), 0 deletions(-) diff --git a/HIAWms/server/src/CMS.Plugin.HIAWms.Domain/WmsContainers/WmsContainerDataSeedContributor.cs b/HIAWms/server/src/CMS.Plugin.HIAWms.Domain/WmsContainers/WmsContainerDataSeedContributor.cs new file mode 100644 index 0000000..dcfabe5 --- /dev/null +++ b/HIAWms/server/src/CMS.Plugin.HIAWms.Domain/WmsContainers/WmsContainerDataSeedContributor.cs @@ -0,0 +1,67 @@ +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Guids; +using Volo.Abp.Uow; + +namespace CMS.Plugin.HIAWms.Domain.WmsContainers +{ + /// <summary> + /// WmsContainer绉嶅瓙鏁版嵁鎻愪緵绋嬪簭 + /// </summary> + public class WmsContainerDataSeedContributor : IDataSeedContributor, ITransientDependency + { + private readonly IUnitOfWorkManager _unitOfWorkManager; + private readonly IWmsContainerRepository _wmscontainerRepository; + private readonly IGuidGenerator _guidGenerator; + + /// <summary> + /// Initializes a new instance of the <see cref="WmsContainerDataSeedContributor"/> class. + /// </summary> + /// <param name="unitOfWorkManager">The unit of work manager.</param> + /// <param name="guidGenerator">The unique identifier generator.</param> + /// <param name="wmscontainerRepository">The work section repository.</param> + public WmsContainerDataSeedContributor(IUnitOfWorkManager unitOfWorkManager, IGuidGenerator guidGenerator, IWmsContainerRepository wmscontainerRepository) + { + _unitOfWorkManager = unitOfWorkManager; + _wmscontainerRepository = wmscontainerRepository; + _guidGenerator = guidGenerator; + } + + /// <inheritdoc /> + public async Task SeedAsync(DataSeedContext context) + { + if (context.Properties.ContainsKey(CMSPluginDbProperties.ConnectionStringName) && context.Properties[CMSPluginDbProperties.ConnectionStringName]?.ToString() == CMSPluginDbProperties.ConnectionStringName) + { + try + { + //using var unitofWork = _unitOfWorkManager.Begin(requiresNew: true); + //await unitofWork.SaveChangesAsync(); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + } + + if (context.Properties.ContainsKey("SeedTestData") && context.Properties["SeedTestData"]?.ToString() == "SeedTestData") + { + try + { + await SeedWmsContainerDataAsync(); + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } + } + } + + /// <summary> + /// Seeds the work section data asynchronous. + /// </summary> + private async Task SeedWmsContainerDataAsync() + { + + } + } +} -- Gitblit v1.9.3