| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- using System.Diagnostics;
- using Admin.NET.Plugin.AiDOP.Entity;
- using Admin.NET.Plugin.AiDOP.Entity.S0.Manufacturing;
- using Admin.NET.Plugin.AiDOP.Entity.S0.Sales;
- using Admin.NET.Plugin.AiDOP.Infrastructure;
- using Microsoft.AspNetCore.Builder;
- using Microsoft.AspNetCore.Hosting;
- using Microsoft.AspNetCore.Mvc;
- using Microsoft.Extensions.DependencyInjection;
- using Microsoft.Extensions.Hosting;
- using SqlSugar;
- namespace Admin.NET.Plugin.AiDOP;
- /// <summary>
- /// AiDOP 插件启动配置(按需扩展 DI)
- /// </summary>
- [AppStartup(900)]
- public class Startup : AppStartup
- {
- public void ConfigureServices(IServiceCollection services)
- {
- services.AddScoped<AdoS0ExceptionFilter>();
- services.AddScoped<AdoS0ResultFilter>();
- services.Configure<MvcOptions>(options =>
- {
- options.Filters.AddService<AdoS0ExceptionFilter>();
- options.Filters.AddService<AdoS0ResultFilter>();
- });
- }
- /// <summary>
- /// 开发环境下为 Demo 表执行 CodeFirst(表已存在则跳过变更,行为取决于 SqlSugar 配置)。
- /// </summary>
- public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
- {
- try
- {
- AidopMenuLinkSync.EnsureLinked(app.ApplicationServices);
- }
- catch (Exception ex)
- {
- Trace.TraceWarning("Ai-DOP AidopMenuLinkSync: " + ex);
- }
- if (!env.IsDevelopment())
- return;
- using var scope = app.ApplicationServices.CreateScope();
- var db = scope.ServiceProvider.GetRequiredService<ISqlSugarClient>();
- db.CodeFirst.InitTables(
- typeof(AdoOrder),
- typeof(AdoPlan),
- typeof(AdoWorkOrder),
- typeof(AdoS0Customer),
- typeof(AdoS0Material),
- typeof(AdoS0OrderPriorityRule),
- typeof(AdoS0MfgBom),
- typeof(AdoS0MfgBomItem),
- typeof(AdoS0MfgStandardOperation),
- typeof(AdoS0MfgProductionLine),
- typeof(AdoS0MfgRouting),
- typeof(AdoS0MfgRoutingOperation),
- typeof(AdoS0MfgPersonSkillAssignment),
- typeof(AdoS0MfgMaterialSubstitution),
- typeof(AdoS0MfgWorkOrderControl),
- typeof(AdoS0MfgPersonSkill),
- typeof(AdoS0MfgLinePost),
- typeof(AdoS0MfgLinePostSkill),
- typeof(AdoS0MfgWorkCenter),
- typeof(AdoS0MfgLineMaterial),
- typeof(AdoS0MfgElementParam),
- typeof(AdoS0MfgMaterialProcessElement),
- typeof(AdoS0MfgPreprocessElement),
- typeof(AdoS0MfgPreprocessElementParam),
- typeof(AdoS0MfgSopFileType),
- typeof(AdoS0MfgSopDocument)
- );
- }
- }
|