using Infrastructure; using MDM.Model.Material; using MDM.Model.Plant; using MDM.Model.Process; using MDM.Models.Flow; using MDM.Models.Process; using MDM.Models.Session; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using NPOI.SS.Formula.Functions; using RIZO.Model.MES.recipe; using SqlSugar.IOC; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MDM { /// /// 初始化表 /// public static class InitModelTable { public static void InitModelDb(this IServiceCollection services, IWebHostEnvironment environment) { var db = DbScoped.SugarScope.GetConnection("0"); var options = App.OptionsSetting; if (!options.InitModelDb) return; if (environment.IsDevelopment()) { db.CodeFirst.InitTables(typeof(MaterialBom)); db.CodeFirst.InitTables(typeof(MaterialList)); db.CodeFirst.InitTables(typeof(MaterialType)); db.CodeFirst.InitTables(typeof(PlantFactorySite)); db.CodeFirst.InitTables(typeof(PlantPlcIoPoint)); db.CodeFirst.InitTables(typeof(PlantProductlinebody)); db.CodeFirst.InitTables(typeof(PlantWorkshop)); db.CodeFirst.InitTables(typeof(ProcessControlStrategyDict)); db.CodeFirst.InitTables(typeof(ProcessErrorProofRule)); db.CodeFirst.InitTables(typeof(ProcessOperation)); db.CodeFirst.InitTables(typeof(ProcessOperationCollectParameter)); db.CodeFirst.InitTables(typeof(ProcessOperationFlow)); db.CodeFirst.InitTables(typeof(ProcessOperationFlowMaterialParamter)); db.CodeFirst.InitTables(typeof(ProcessOperationReworkRule)); db.CodeFirst.InitTables(typeof(ProcessOperationTransition)); db.CodeFirst.InitTables(typeof(ProcessOperationWorkstationFlowCollectParameter)); db.CodeFirst.InitTables(typeof(ProcessOperationWorkstationMapping)); db.CodeFirst.InitTables(typeof(ProcessOprerationTransitionDict)); db.CodeFirst.InitTables(typeof(ProductLifecycle)); db.CodeFirst.InitTables(typeof(ProcessRouting)); db.CodeFirst.InitTables(typeof(ProductPassstationRecord)); db.CodeFirst.InitTables(typeof(ProductProcessData)); db.CodeFirst.InitTables(typeof(ProductProcessParameters)); db.CodeFirst.InitTables(typeof(ProductScanRecords)); db.CodeFirst.InitTables(typeof(ProcessFlowList)); db.CodeFirst.InitTables(typeof(PfRecipeIssueLog)); db.CodeFirst.InitTables(typeof(PfRecipeParameters)); db.CodeFirst.InitTables(typeof(PfRecipeTemplate)); db.CodeFirst.InitTables(typeof(PfRecipeVersion)); db.CodeFirst.InitTables(typeof(PfRefProductRecipe)); } } } }