You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

137 lines
4.9 KiB

using System.IO;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc.Client;
using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy;
using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.AuditLogging.EntityFrameworkCore;
using Volo.Abp.Autofac;
using Volo.Abp.BlobStoring.FileSystem;
using Volo.Abp.Caching.StackExchangeRedis;
using Volo.Abp.Http.Client;
using Volo.Abp.Http.Client.IdentityModel.Web;
using Volo.Abp.Identity;
using Volo.Abp.Modularity;
using Volo.Abp.PermissionManagement.EntityFrameworkCore;
using Volo.Abp.SettingManagement.EntityFrameworkCore;
using Volo.Abp.Swashbuckle;
using Volo.Abp.VirtualFileSystem;
using Win_in.Sfs.Auth;
using Win_in.Sfs.Basedata.Application.Contracts;
using Win_in.Sfs.FileStorage;
using Win_in.Sfs.Label.Application.Contracts;
using Win_in.Sfs.Message.Application.Contracts;
using Win_in.Sfs.Shared.Host;
using Win_in.Sfs.Wms.Inventory.Application;
using Win_in.Sfs.Wms.Inventory.EntityFrameworkCore;
using Win_in.Sfs.Wms.Inventory.HttpApi;
using Win_in.Sfs.Wms.Store.Application;
using Win_in.Sfs.Wms.Store.Application.Contracts;
using Win_in.Sfs.Wms.Store.EntityFrameworkCore;
using Win_in.Sfs.Wms.Store.Event;
using Win_in.Sfs.Wms.Store.HttpApi;
namespace Win_in.Sfs.Wms.Store;
[DependsOn(
typeof(AbpIdentityHttpApiClientModule),
typeof(AbpAspNetCoreMvcClientModule),
typeof(AbpHttpClientIdentityModelWebModule),
typeof(SharedHostModule)
)]
//ABP
[DependsOn(
typeof(AbpAspNetCoreMvcUiMultiTenancyModule),
typeof(AbpAutofacModule),
typeof(AbpHttpClientModule),
typeof(AbpCachingStackExchangeRedisModule),
//typeof(AbpEntityFrameworkCoreMySQLModule),
typeof(AbpAspNetCoreSerilogModule),
typeof(AbpSwashbuckleModule),
typeof(AbpBlobStoringFileSystemModule),
typeof(AbpAuditLoggingEntityFrameworkCoreModule),
typeof(AbpPermissionManagementEntityFrameworkCoreModule),
typeof(AbpSettingManagementEntityFrameworkCoreModule)
)]
//仓库
[DependsOn(
typeof(StoreApplicationModule),
typeof(StoreEntityFrameworkCoreModule),
typeof(StoreHttpApiModule),
typeof(StoreEventModule)
)]
//库存
[DependsOn(
typeof(InventoryApplicationModule),
typeof(InventoryEntityFrameworkCoreModule),
typeof(InventoryHttpApiModule)
)]
[DependsOn(
typeof(BasedataApplicationContractsModule),
typeof(FileStorageApplicationContractsModule),
typeof(MessageApplicationContractsModule),
typeof(LabelApplicationContractsModule)
)]
public class StoreHttpApiHostModule : ModuleBase<StoreHttpApiHostModule>
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
base.ConfigureServices(context);
ConfigureVirtualFileSystem();
//ConfigureSwaggerServices(context, context.Services.GetConfiguration());
}
protected override void ConfigureHttpClientProxies()
{
ServiceConfigurationContext.Services.AddHttpClientProxies(
typeof(BasedataApplicationContractsModule).Assembly,
"BaseData"
);
ServiceConfigurationContext.Services.AddHttpClientProxies(
typeof(FileStorageApplicationContractsModule).Assembly,
"FileStorage"
);
ServiceConfigurationContext.Services.AddHttpClientProxies(
typeof(MessageApplicationContractsModule).Assembly,
"Message"
);
ServiceConfigurationContext.Services.AddHttpClientProxies(
typeof(LabelApplicationContractsModule).Assembly,
"Label"
);
ServiceConfigurationContext.Services.AddHttpClientProxies(
typeof(AuthApplicationContractsModule).Assembly,
"Auth"
);
}
private void ConfigureVirtualFileSystem()
{
var hostingEnvironment = ServiceConfigurationContext.Services.GetHostingEnvironment();
if (hostingEnvironment.IsDevelopment())
{
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.ReplaceEmbeddedByPhysical<StoreApplicationContractsModule>(
Path.Combine(hostingEnvironment.ContentRootPath,
string.Format("..{0}..{0}..{0}Modules{0}Store{0}src{0}Win_in.Sfs.Wms.Store.Application.Contracts",
Path.DirectorySeparatorChar)));
options.FileSets.ReplaceEmbeddedByPhysical<StoreApplicationModule>(Path.Combine(
hostingEnvironment.ContentRootPath,
string.Format("..{0}..{0}..{0}Modules{0}Store{0}src{0}Win_in.Sfs.Wms.Store.Application", Path.DirectorySeparatorChar)));
});
}
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
CreateDatabase<StoreDbContext>(context);
CreateDatabase<InventoryDbContext>(context);
base.OnApplicationInitialization(context);
}
}