From f43b7df8400f4fcffc9f19dca0888d61e2b33d5f Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期三, 12 三月 2025 18:41:52 +0800
Subject: [PATCH] WMS系统添加PDA权限,PDA程序

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_Core/Extensions/AutofacModuleRegister.cs |   39 ++++++++++++++++++++-------------------
 1 files changed, 20 insertions(+), 19 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Core/Extensions/AutofacModuleRegister.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Core/Extensions/AutofacModuleRegister.cs"
index 370e2d5..c0eda16 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Core/Extensions/AutofacModuleRegister.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Core/Extensions/AutofacModuleRegister.cs"
@@ -1,6 +1,5 @@
 锘縰sing Autofac;
 using Autofac.Extras.DynamicProxy;
-using log4net;
 using Microsoft.Extensions.DependencyModel;
 using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
 using System;
@@ -14,6 +13,7 @@
 using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
 using WIDESEA_Core.Helper;
+using WIDESEA_Core.LogHelper;
 
 namespace WIDESEA_Core.Extensions
 {
@@ -22,10 +22,14 @@
         //private static readonly ILog log = LogManager.GetLogger(typeof(AutofacModuleRegister));
         protected override void Load(ContainerBuilder builder)
         {
+            var basePath = AppContext.BaseDirectory;
             var cacheType = new List<Type>();
 
             builder.RegisterType<LogAOP>();
-            cacheType.Add(typeof(LogAOP));
+            if (AppSettings.app("LogAopEnable").ObjToBool())
+            {
+                cacheType.Add(typeof(LogAOP));
+            }
 
             builder.RegisterGeneric(typeof(RepositoryBase<>)).As(typeof(IRepository<>)).InstancePerDependency();//娉ㄥ唽浠撳偍
             builder.RegisterGeneric(typeof(ServiceBase<,>)).As(typeof(IService<>)).InstancePerDependency();//娉ㄥ唽鏈嶅姟
@@ -34,15 +38,22 @@
 
             List<RuntimeLibrary> compilationLibrary = DependencyContext.Default
                     .RuntimeLibraries
-                    .Where(x => !x.Serviceable && x.Type == "project")
+                    .Where(x => !x.Serviceable
+                    && x.Type == "project")
                     .ToList();
-
             List<Assembly> assemblyList = new List<Assembly>();
             foreach (var library in compilationLibrary)
             {
                 try
                 {
-                    assemblyList.Add(AssemblyLoadContext.Default.LoadFromAssemblyName(new AssemblyName(library.Name)));
+                    string path = Path.Combine(basePath, $"{library.Name}.dll");
+                    if (!File.Exists(path))
+                    {
+                        var msg = $"{library.Name}.dll涓㈠け锛屽洜涓洪」鐩В鑰︿簡锛屾墍浠ラ渶瑕佸厛F6缂栬瘧锛屽啀F5杩愯锛岃妫�鏌� bin 鏂囦欢澶癸紝骞舵嫹璐濄��";
+                        //log.Error(msg);
+                        throw new Exception(msg);
+                    }
+                    assemblyList.Add(Assembly.LoadFrom(path));
                 }
                 catch (Exception ex)
                 {
@@ -53,26 +64,16 @@
             builder.RegisterAssemblyTypes(assemblyList.ToArray()).Where(x => !x.IsInterface && !x.IsAbstract && baseType.IsAssignableFrom(x))
                         .AsImplementedInterfaces()
                         .PropertiesAutowired()
-                        .InstancePerDependency()
-                        .EnableInterfaceInterceptors()
+                        .InstancePerDependency().
+                        EnableInterfaceInterceptors()
                         .InterceptedBy(cacheType.ToArray());
-
-
-            foreach (var assembly in assemblyList)
-            {
-                foreach (var type in assembly.GetTypes())
-                {
-                    if (!type.IsInterface && !type.IsAbstract && baseType.IsAssignableFrom(type))
-                    {
-                        Console.WriteLine($"娉ㄥ唽绫诲瀷: {type.FullName}");
-                    }
-                }
-            }
 
             builder.RegisterType<UnitOfWorkManage>().As<IUnitOfWorkManage>()
                .AsImplementedInterfaces()
                .InstancePerLifetimeScope()
                .PropertiesAutowired();
+
+            builder.RegisterType<RequestLogModel>().InstancePerLifetimeScope();
         }
     }
 }

--
Gitblit v1.9.3