Startup.cs 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. using System.Diagnostics;
  2. using Admin.NET.Plugin.AiDOP.ChatBI;
  3. using Admin.NET.Plugin.AiDOP.Entity;
  4. using Admin.NET.Plugin.AiDOP.Entity.S0.Manufacturing;
  5. using Admin.NET.Plugin.AiDOP.Entity.S0.Quality;
  6. using Admin.NET.Plugin.AiDOP.Entity.S0.Sales;
  7. using Admin.NET.Plugin.AiDOP.Entity.S0.Supply;
  8. using Admin.NET.Plugin.AiDOP.Entity.S8;
  9. using Admin.NET.Plugin.AiDOP.Entity.S8.OrderFlow;
  10. using Admin.NET.Plugin.AiDOP.Order;
  11. using Admin.NET.Plugin.AiDOP.DataPlatform.Executors;
  12. using Admin.NET.Plugin.AiDOP.DataPlatform.HotWatch;
  13. using Admin.NET.Plugin.AiDOP.DataPlatform.Inbound;
  14. using Microsoft.AspNetCore.Authentication;
  15. using Admin.NET.Plugin.AiDOP.Entity.DataPlatform;
  16. using Admin.NET.Plugin.AiDOP.Infrastructure;
  17. using Admin.NET.Plugin.AiDOP.MaterialWarehouse;
  18. using Admin.NET.Plugin.AiDOP.WorkOrder;
  19. using Microsoft.AspNetCore.Builder;
  20. using Microsoft.AspNetCore.Hosting;
  21. using Microsoft.AspNetCore.Mvc;
  22. using Microsoft.Extensions.DependencyInjection;
  23. using Microsoft.Extensions.Hosting;
  24. using SqlSugar;
  25. namespace Admin.NET.Plugin.AiDOP;
  26. /// <summary>
  27. /// AiDOP 插件启动配置(按需扩展 DI)
  28. /// </summary>
  29. [AppStartup(900)]
  30. public class Startup : AppStartup
  31. {
  32. public void ConfigureServices(IServiceCollection services)
  33. {
  34. services.AddHttpClient();
  35. services.AddHttpClient("AidopChatBI.DeepSeek");
  36. services.AddScoped<DeepSeekChatClient>();
  37. services.AddScoped<ChatBIService>();
  38. services.AddConfigurableOptions<S8ActiveFlowWatchOptions>();
  39. services.AddConfigurableOptions<S8MasterDataOptions>();
  40. services.AddConfigurableOptions<AidopPickBillOptions>();
  41. services.AddConfigurableOptions<AidopStockOptions>();
  42. services.AddConfigurableOptions<AidopInventoryOptions>();
  43. services.AddTransient<IInventoryBalanceReader, InventoryBalanceReader>();
  44. services.AddTransient<IInventoryTransactionReader, StdInventoryTransactionReader>();
  45. // WP9:IPickBillCreator 唯一实现为 Facade(避免 Local/Mes 多实现竞注)
  46. services.AddTransient<IPickBillCreator, PickBillCreatorFacade>();
  47. services.AddScoped<AdoS0ExceptionFilter>();
  48. services.AddScoped<AdoS0ResultFilter>();
  49. services.AddScoped<AdoS0ReferenceChecker>();
  50. services.Configure<MvcOptions>(options =>
  51. {
  52. options.Filters.AddService<AdoS0ExceptionFilter>();
  53. options.Filters.AddService<AdoS0ResultFilter>();
  54. });
  55. // MDP 出站事件驱动:入队 Pulse → 立即推送;Period Job 仅兜底
  56. services.AddHostedService<MdpOutboxPushWorker>();
  57. services.AddHostedService<MdpHotWatchWorker>();
  58. services.AddHostedService<Admin.NET.Plugin.AiDOP.DataPlatform.S1Refresh.S1DashboardRebuildWorker>();
  59. services.AddHostedService<Admin.NET.Plugin.AiDOP.DataPlatform.MdpRebuild.ModuleRebuildWorker>();
  60. services.AddSingleton<Admin.NET.Plugin.AiDOP.DataPlatform.MdpRebuild.IModuleRebuildCapability, Admin.NET.Plugin.AiDOP.DataPlatform.MdpRebuild.ModuleRebuildCapability>();
  61. services.AddTransient<Admin.NET.Plugin.AiDOP.DataPlatform.MdpRebuild.IModuleRebuildJobStore, Admin.NET.Plugin.AiDOP.DataPlatform.MdpRebuild.ModuleRebuildJobStore>();
  62. services.AddTransient<Admin.NET.Plugin.AiDOP.DataPlatform.MdpRebuild.IModuleRebuildLock, Admin.NET.Plugin.AiDOP.DataPlatform.MdpRebuild.ModuleRebuildLock>();
  63. services.AddTransient<Admin.NET.Plugin.AiDOP.DataPlatform.MdpRebuild.IModuleRebuildHandler, Admin.NET.Plugin.AiDOP.DataPlatform.MdpRebuild.S1ModuleRebuildHandler>();
  64. services.AddTransient<Admin.NET.Plugin.AiDOP.DataPlatform.MdpRebuild.IModuleRebuildHandler, Admin.NET.Plugin.AiDOP.DataPlatform.MdpRebuild.S2ModuleRebuildHandler>();
  65. services.AddTransient<Admin.NET.Plugin.AiDOP.DataPlatform.MdpRebuild.IModuleRebuildHandler, Admin.NET.Plugin.AiDOP.DataPlatform.MdpRebuild.S3ModuleRebuildHandler>();
  66. services.AddTransient<Admin.NET.Plugin.AiDOP.DataPlatform.MdpRebuild.IModuleRebuildHandler, Admin.NET.Plugin.AiDOP.DataPlatform.MdpRebuild.S4ModuleRebuildHandler>();
  67. services.AddTransient<Admin.NET.Plugin.AiDOP.DataPlatform.MdpRebuild.IModuleRebuildHandler, Admin.NET.Plugin.AiDOP.DataPlatform.MdpRebuild.S5ModuleRebuildHandler>();
  68. services.AddTransient<Admin.NET.Plugin.AiDOP.DataPlatform.MdpRebuild.IModuleRebuildHandler, Admin.NET.Plugin.AiDOP.DataPlatform.MdpRebuild.S6ModuleRebuildHandler>();
  69. services.AddTransient<Admin.NET.Plugin.AiDOP.DataPlatform.MdpRebuild.IModuleRebuildHandler, Admin.NET.Plugin.AiDOP.DataPlatform.MdpRebuild.S7ModuleRebuildHandler>();
  70. // S8-DATASET-FOUNDATION-HARDENING-2:S8 取数底座的接口映射显式注册
  71. // (与上方 IModuleRebuildLock 同一先例:本项目不依赖 ITransient 自动按接口注册)。
  72. services.AddTransient<Admin.NET.Plugin.AiDOP.Service.S8.Rules.DataAccess.IS8DatasetCatalog, Admin.NET.Plugin.AiDOP.Service.S8.Rules.DataAccess.S8DatasetCatalog>();
  73. // S8-STANDARD-DATASET-HARD-CUTOVER-1:IS8LegacySqlDataProvider 及其实现已物理删除。
  74. // S8-RULE01-PURCHASE-DELIVERY-A:接入第一个真实业务数据集 PURCHASE_DELIVERY。
  75. // Catalog 有定义 + Registry 有实现,Enable Gate 才判 READY:
  76. // 缺定义 → 规则连保存都过不了(dataset_not_defined);
  77. // 缺实现 → 可存草稿但不可启用(dataset_provider_not_registered)。
  78. // 两个接口都必须显式注册(同上,不依赖 ITransient 自动按接口注册)。
  79. services.AddTransient<Admin.NET.Plugin.AiDOP.Service.S8.Rules.DataAccess.IS8DatasetDefinitionSource, Admin.NET.Plugin.AiDOP.Service.S8.Rules.DataAccess.Providers.S8BusinessDatasetDefinitions>();
  80. services.AddTransient<Admin.NET.Plugin.AiDOP.Service.S8.Rules.DataAccess.IS8MonitoringDataProvider, Admin.NET.Plugin.AiDOP.Service.S8.Rules.DataAccess.Providers.S8PurchaseDeliveryDataProvider>();
  81. // S8-RULE02-ORDER-DELIVERY-WARNING-1:第二个真实业务数据集 ORDER_DELIVERY_RISK。
  82. // 与上面同理,定义与实现两个接口都要显式注册;两者的 DatasetCode 必须逐字一致,
  83. // 否则 Enable Gate 会以 dataset_provider_not_registered 挡住启用。
  84. services.AddTransient<Admin.NET.Plugin.AiDOP.Service.S8.Rules.DataAccess.IS8DatasetDefinitionSource, Admin.NET.Plugin.AiDOP.Service.S8.Rules.DataAccess.Providers.S8OrderDeliveryDatasetDefinitions>();
  85. services.AddTransient<Admin.NET.Plugin.AiDOP.Service.S8.Rules.DataAccess.IS8MonitoringDataProvider, Admin.NET.Plugin.AiDOP.Service.S8.Rules.DataAccess.Providers.S8OrderDeliveryDataProvider>();
  86. // S8-RULE03-MATERIAL-SHORTAGE:第三个真实业务数据集 MFG_MATERIAL_SHORTAGE。
  87. // 同上:定义与实现两个接口都要显式注册,DatasetCode 必须逐字一致
  88. // (规则定义侧已改为编译期引用本数据集常量,不再各写一份字面量)。
  89. services.AddTransient<Admin.NET.Plugin.AiDOP.Service.S8.Rules.DataAccess.IS8DatasetDefinitionSource, Admin.NET.Plugin.AiDOP.Service.S8.Rules.DataAccess.Providers.S8MaterialShortageDatasetDefinitions>();
  90. services.AddTransient<Admin.NET.Plugin.AiDOP.Service.S8.Rules.DataAccess.IS8MonitoringDataProvider, Admin.NET.Plugin.AiDOP.Service.S8.Rules.DataAccess.Providers.S8MaterialShortageDataProvider>();
  91. // S8-RULE-GOVERNANCE-BATCH1:规则定义目录。业务语义从此只存在于代码里,
  92. // ado_s8_watch_rule 上的同名列降级为 provisioning 维护的只读投影。
  93. //
  94. // 注册为 **Singleton**(数据集目录是 Transient):目录构造期会做完整性校验,
  95. // 而 Transient 的失败形态是「首次解析该服务的那个请求 500」,启动日志干净但目录其实是坏的。
  96. // Singleton + Configure 里强制解析一次 = 定义写错就起不来,见下方 Configure。
  97. services.AddSingleton<Admin.NET.Plugin.AiDOP.Service.S8.Rules.Definitions.IS8RuleDefinitionSource, Admin.NET.Plugin.AiDOP.Service.S8.Rules.Definitions.S8PurchaseDeliveryRuleDefinitions>();
  98. services.AddSingleton<Admin.NET.Plugin.AiDOP.Service.S8.Rules.Definitions.IS8RuleDefinitionSource, Admin.NET.Plugin.AiDOP.Service.S8.Rules.Definitions.S8OrderDeliveryRuleDefinitions>();
  99. services.AddSingleton<Admin.NET.Plugin.AiDOP.Service.S8.Rules.Definitions.IS8RuleDefinitionSource, Admin.NET.Plugin.AiDOP.Service.S8.Rules.Definitions.S8MaterialShortageRuleDefinitions>();
  100. services.AddSingleton<Admin.NET.Plugin.AiDOP.Service.S8.Rules.Definitions.IS8RuleCatalog, Admin.NET.Plugin.AiDOP.Service.S8.Rules.Definitions.S8RuleCatalog>();
  101. // S8-RULE-GOVERNANCE-BATCH2:代码定义 → 每租户运行策略的供给服务。
  102. // ITransient 在本仓不做按接口自动注册,且它没有接口,故显式登记具体类型。
  103. services.AddTransient<Admin.NET.Plugin.AiDOP.Service.S8.S8RuleProvisioningService>();
  104. // S8-ACTION-PERMISSION-1:异常动作授权矩阵的首次供给(同 S8RuleProvisioningService,无接口需显式登记)。
  105. services.AddTransient<Admin.NET.Plugin.AiDOP.Service.S8.S8ExceptionActionRoleProvisioningService>();
  106. // S8-UAT-APPROVAL-REPAIR-1:S8 审批流审批人配置一次性对账(只修解析为 0 人的节点)。
  107. services.AddTransient<Admin.NET.Plugin.AiDOP.Service.S8.S8ApprovalFlowRepairService>();
  108. // API_INBOUND:插件侧独立签名 scheme(严禁传入默认 scheme 参数,全局默认仍是 JWT)
  109. services.AddAuthentication()
  110. .AddScheme<InboundSignatureOptions, InboundSignatureHandler>(
  111. InboundSignatureDefaults.AuthenticationScheme, _ => { });
  112. }
  113. /// <summary>
  114. /// 开发环境下为 Demo 表执行 CodeFirst(表已存在则跳过变更,行为取决于 SqlSugar 配置)。
  115. /// </summary>
  116. public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
  117. {
  118. // S8-RULE-GOVERNANCE-BATCH1:强制解析一次规则目录,把「定义写错」变成启动失败。
  119. // 刻意**不 try/catch**:重复 rule_code、rule_type 不在词表、TIMEOUT 却没给判定语义,
  120. // 都是发布事故。吞掉它只会让服务带着一个坏目录起来,然后在某条规则跑到那一 tick 时
  121. // 才在后台日志里报错——那时页面上一切正常,没人会看见。
  122. {
  123. var ruleCatalog = app.ApplicationServices
  124. .GetRequiredService<Admin.NET.Plugin.AiDOP.Service.S8.Rules.Definitions.IS8RuleCatalog>();
  125. Trace.TraceInformation($"Ai-DOP S8RuleCatalog: {ruleCatalog.Definitions.Count} rule definition(s) loaded");
  126. }
  127. try
  128. {
  129. AidopMenuLinkSync.EnsureLinked(app.ApplicationServices);
  130. }
  131. catch (Exception ex)
  132. {
  133. Trace.TraceWarning("Ai-DOP AidopMenuLinkSync: " + ex);
  134. }
  135. // S8-RULE-GOVERNANCE-BATCH2:启动期对账 —— 确保每个启用租户都拥有全部代码定义规则的运行策略行。
  136. //
  137. // 失败策略沿用本方法内既有的 sync 惯例(AidopMenuLinkSync 等):**记录后放行,不阻断启动**。
  138. // 理由是这段 Configure 与 S0–S7 共用同一个宿主,供给失败不该把整个平台拖下线;
  139. // 且新 provision 的规则一律 disabled,缺行的后果是"该租户暂时看不到这条规则",
  140. // 不是数据错误。异常对象完整落日志,不做静默吞掉 —— 「以为同步成功」比同步失败更危险。
  141. //
  142. // 与之对照:规则目录自身构造失败(重复定义 / 定义写错)**不在此列**,
  143. // 它在上方 GetRequiredService 处直接抛出、阻断启动,因为那是代码包本身有问题。
  144. try
  145. {
  146. using var provisioningScope = app.ApplicationServices.CreateScope();
  147. var provisioning = provisioningScope.ServiceProvider
  148. .GetRequiredService<Admin.NET.Plugin.AiDOP.Service.S8.S8RuleProvisioningService>();
  149. var summary = provisioning.SyncAsync().GetAwaiter().GetResult();
  150. Trace.TraceInformation(
  151. $"Ai-DOP S8RuleProvisioning: tenants={summary.TenantCount} definitions={summary.DefinitionCount} "
  152. + $"created={summary.CreatedCount} refreshed={summary.RefreshedCount} unchanged={summary.UnchangedCount} "
  153. + $"orphaned={summary.OrphanedCount} duplicate={summary.DuplicateCount}");
  154. }
  155. catch (Exception ex)
  156. {
  157. Trace.TraceError("Ai-DOP S8RuleProvisioning FAILED(本次启动未完成规则运行策略对账): " + ex);
  158. }
  159. // S8-ACTION-PERMISSION-1:动作授权矩阵首次供给。
  160. // 失败策略与上方规则供给一致:记录后放行,不阻断启动(本宿主与 S0–S7 共用)。
  161. // 后果是"该租户的异常动作暂时全部关闭"——fail closed,不是数据错误,且日志可见。
  162. try
  163. {
  164. using var actionScope = app.ApplicationServices.CreateScope();
  165. var actionProvisioning = actionScope.ServiceProvider
  166. .GetRequiredService<Admin.NET.Plugin.AiDOP.Service.S8.S8ExceptionActionRoleProvisioningService>();
  167. var actionSummary = actionProvisioning.SyncAsync().GetAwaiter().GetResult();
  168. Trace.TraceInformation(
  169. $"Ai-DOP S8ActionRoleProvisioning: tenants={actionSummary.TenantCount} actions={actionSummary.ActionCount} "
  170. + $"created={actionSummary.CreatedCount} skippedTenants={actionSummary.SkippedTenantCount} "
  171. + $"unconfigured={actionSummary.UnconfiguredCount}");
  172. }
  173. catch (Exception ex)
  174. {
  175. Trace.TraceError("Ai-DOP S8ActionRoleProvisioning FAILED(本次启动未完成动作授权供给): " + ex);
  176. }
  177. // S8-UAT-APPROVAL-REPAIR-1:修复 S8 审批流里解析不出本租户审批人的节点。
  178. //
  179. // 必须排在动作授权供给**之后** —— 它按「该租户被授予 s8:verification:approve 的角色」
  180. // 派生审批人,而那份授权正是上一步供给出来的。
  181. //
  182. // 失败策略同上:记录后放行。审批人配置坏了的后果是流程悬挂(已经在发生),
  183. // 不该再因为修复失败把整个平台拖下线。
  184. try
  185. {
  186. using var repairScope = app.ApplicationServices.CreateScope();
  187. var repair = repairScope.ServiceProvider
  188. .GetRequiredService<Admin.NET.Plugin.AiDOP.Service.S8.S8ApprovalFlowRepairService>();
  189. var repairSummary = repair.RepairAsync().GetAwaiter().GetResult();
  190. Trace.TraceInformation(
  191. $"Ai-DOP S8ApprovalFlowRepair: flows={repairSummary.FlowsInspected} nodes={repairSummary.NodesInspected} "
  192. + $"repaired={repairSummary.RepairedCount} restored={repairSummary.RestoredCount} "
  193. + $"alreadyOk={repairSummary.AlreadyOkCount} blocked={repairSummary.BlockedCount}");
  194. }
  195. catch (Exception ex)
  196. {
  197. Trace.TraceError("Ai-DOP S8ApprovalFlowRepair FAILED(本次启动未完成审批人配置对账): " + ex);
  198. }
  199. try
  200. {
  201. using var scopeS4 = app.ApplicationServices.CreateScope();
  202. var dbS4 = scopeS4.ServiceProvider.GetRequiredService<ISqlSugarClient>();
  203. dbS4.CodeFirst.InitTables(
  204. typeof(AdoSmartOpsLayoutItem),
  205. typeof(AdoSmartOpsHomeModule),
  206. typeof(AdoSmartOpsKpiMaster),
  207. typeof(AdoSmartOpsDashboardPageConfig),
  208. typeof(AdoSmartOpsDashboardWidget),
  209. typeof(AdoSmartOpsImprovementPlan),
  210. typeof(AdoMdpHotWatch),
  211. typeof(Admin.NET.Plugin.AiDOP.Entity.SmartOps.AdoS1DashboardRebuildJob),
  212. typeof(Admin.NET.Plugin.AiDOP.Entity.SmartOps.AdoModuleDashboardRebuildJob),
  213. typeof(Admin.NET.Plugin.AiDOP.Entity.SmartOps.AdoMdpRebuildLock),
  214. typeof(AdoTenantMenuSuppression));
  215. AidopTenantMigration.MigrateOldTenantId(dbS4);
  216. AidopKpiMasterSeed.EnsureSeed(dbS4);
  217. AidopKpiMasterSeed.EnsureSeed(dbS4, 1300000000888);
  218. var kpiTenantIds = dbS4.Queryable<AdoSmartOpsKpiMaster>()
  219. .Select(x => x.TenantId)
  220. .Distinct()
  221. .ToList();
  222. foreach (var tenantId in kpiTenantIds.Where(x => x > 0))
  223. AidopKpiMasterSeed.EnsureSeed(dbS4, tenantId!.Value);
  224. AidopImprovementApprovalSeed.EnsureSeed(dbS4);
  225. Admin.NET.Plugin.AiDOP.Infrastructure.IqcInspBillFlowSeed.EnsureSeed(dbS4);
  226. Admin.NET.Plugin.AiDOP.Infrastructure.IpqcInspectionFlowSeed.EnsureSeed(dbS4);
  227. Admin.NET.Plugin.AiDOP.Infrastructure.S6ProcessInspectionFlowSeed.EnsureSeed(dbS4);
  228. Admin.NET.Plugin.AiDOP.Infrastructure.FqcInspBillFlowSeed.EnsureSeed(dbS4);
  229. }
  230. catch (Exception ex)
  231. {
  232. Trace.TraceWarning("Ai-DOP CodeFirst/S4 seed: " + ex);
  233. }
  234. if (!env.IsDevelopment())
  235. return;
  236. // 客户/物料/优先级等;远端若已是遗留表(已有主键),CodeFirst 会报 Multiple primary key,不可让启动失败。
  237. try
  238. {
  239. using var scope = app.ApplicationServices.CreateScope();
  240. var db = scope.ServiceProvider.GetRequiredService<ISqlSugarClient>();
  241. db.CodeFirst.InitTables(
  242. typeof(AdoS0CustMaster),
  243. typeof(AdoS0ItemMaster),
  244. typeof(AdoS0ItemSubstituteDetail),
  245. typeof(AdoS0PriorityCode),
  246. typeof(AdoS0ProductStructureOp),
  247. typeof(AdoS0StdOpMaster),
  248. typeof(AdoS0LineMaster),
  249. typeof(AdoS0MfgRoutingOpDetail),
  250. typeof(AdoS0MfgPersonSkillAssignment),
  251. typeof(AdoS0MfgWorkOrderControl),
  252. typeof(AdoS0MfgPersonSkill),
  253. typeof(AdoS0MfgLinePost),
  254. typeof(AdoS0MfgWorkCenter),
  255. typeof(AdoS0MfgLineMaterial),
  256. typeof(AdoS0ProcessFlowCard),
  257. typeof(AdoS0OrderScheduleCycle),
  258. typeof(AdoS0MfgElementParam),
  259. typeof(AdoS0MfgMaterialProcessElement),
  260. typeof(AdoS0MfgPreprocessElement),
  261. typeof(AdoS0MfgPreprocessElementParam),
  262. typeof(AdoS0ImageType),
  263. typeof(AdoS0QualitySegmentImage),
  264. typeof(AdoS0QmsQualityBaseType),
  265. typeof(AdoS0QmsFqcInspectionSpec),
  266. typeof(AdoS0QmsFqcInspectionSpecEntry),
  267. typeof(AdoS0QmsOqcInspectionSpec),
  268. typeof(AdoS0QmsOqcInspectionSpecEntry),
  269. typeof(AdoS0CategoryLeadTime),
  270. typeof(AdoS0MaterialPlanCycle),
  271. typeof(AdoS0SrmPurchase),
  272. typeof(AdoS8Exception),
  273. typeof(AdoS8ExceptionTimeline),
  274. typeof(AdoS8DecisionRecord),
  275. typeof(AdoS8Evidence),
  276. // S8-STANDARD-DATASET-HARD-CUTOVER-1:AdoS8AlertRule 已物理删除
  277. // (运行时权威一直是 AdoS8WatchRule;该表零 Runtime Consumer)。
  278. typeof(AdoS8SceneConfig),
  279. typeof(AdoS8NotificationLayer),
  280. typeof(AdoS8WatchRule),
  281. typeof(AdoS8RolePermissionConfig),
  282. // S8-ACTION-PERMISSION-1:异常动作 ↔ 角色授权矩阵。
  283. typeof(AdoS8ExceptionActionRole),
  284. // S8-HANDLER-POOL-1:规则 ↔ 处理账号池。
  285. typeof(AdoS8RuleHandlerUser),
  286. // S8-NOTIFY-RECIPIENT-1:事件 ↔ 收件人配置。
  287. typeof(AdoS8NotificationRecipient),
  288. // S8-UAT-APPROVAL-REPAIR-1:审批人配置修复留证。
  289. typeof(AdoS8ApprovalFlowRepairLog),
  290. typeof(AdoS8NotificationLog),
  291. typeof(AdoS8DashboardCellConfig),
  292. typeof(AdoS8ExceptionType),
  293. typeof(AdoS8DetectionLog),
  294. typeof(AdoS8RuleDetectionState),
  295. typeof(AdoS8Dimension),
  296. typeof(AdoS8DimensionNode),
  297. typeof(AdoS8ConfigDraft),
  298. typeof(AdoS8MonitorObject),
  299. typeof(AdoS8MonitorMetric),
  300. typeof(AdoS8OrderFlowOrder),
  301. typeof(AdoS8OrderFlowStage),
  302. typeof(AdoS8OrderFlowSnapshot),
  303. typeof(AdoS8OrderFlowSubstep),
  304. typeof(AdoS8OrderFlowSubstepUnit),
  305. typeof(AdoS8OrderFlowProcurementPivot),
  306. typeof(ContractReview),
  307. typeof(ContractReviewFlow),
  308. typeof(ProductDesign),
  309. typeof(ProductDesignBom),
  310. typeof(ProductDesignRouting)
  311. );
  312. AidopDimensionSeed.EnsureSeed(db);
  313. AidopMonitorDictionarySeed.EnsureSeed(db);
  314. }
  315. catch (Exception ex)
  316. {
  317. Trace.TraceWarning("Ai-DOP Development CodeFirst (S0/S8/Order demo tables): " + ex);
  318. }
  319. }
  320. }