1
hutongqing
2024-12-13 4261951c50fadb3cdac395086974a715487bab82
1
已删除5个文件
已修改11个文件
已添加18个文件
1222 ■■■■■ 文件已修改
代码管理/WMS/WIDESEA_WMSClient/src/views/system/Sys_Log.vue 204 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/09f72f2c-b273-4279-b316-3cd115d14817.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/14ef4958-5f37-43d7-b6b6-32b232fbb4bc.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/17995e9c-2ddd-48c7-bbd9-eada1e6c4f48.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/c9f3f4cc-1088-4f89-861d-e06654ee2ded.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ca62f48d-432c-4d58-86d0-434723bd9fe0.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/d7105167-5efc-465c-b440-fa7c68170e72.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/df8c89a0-0422-4f14-9c5d-6b61ed92a257.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/f24c70fa-e22c-4a39-92fe-e726fb794d24.vsidx 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicRepository/SupplierInfoRepository.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/SupplierInfoService.cs 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/Extensions/AutofacModuleRegister.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/HostedService/PermissionDataHostService.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/Logger.cs 280 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/RequestLogModel.cs 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/WriteLog.cs 188 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/Middlewares/ApiLogMiddleware.cs 73 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/MaterielInfoDTO.cs 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/SupplierDTO.cs 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/ERP/ErpOutOrderDTO.cs 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IBasicRepository/ISupplierInfoRepository.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/ILocationInfoService.cs 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/ISupplierInfoService.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_ISystemRepository/ISys_LogRepository.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_ISystemService/ISys_LogService.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Basic/Dt_MaterielInfo.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/System/Sys_Log.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_SystemRepository/Sys_LogRepository.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_LogService.cs 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/LocationInfoController.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/SupplierInfoController.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/ERP/ErpController.cs 143 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_LogController.cs 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
´úÂë¹ÜÀí/WMS/WIDESEA_WMSClient/src/views/system/Sys_Log.vue
@@ -5,7 +5,8 @@
 *业务请在@/extension/system/Sys_Log.js此处编写
 -->
<template>
    <view-grid ref="grid"
    <view-grid
      ref="grid"
               :columns="columns"
               :detail="detail"
               :editFormFields="editFormFields"
@@ -13,7 +14,8 @@
               :searchFormFields="searchFormFields"
               :searchFormOptions="searchFormOptions"
               :table="table"
               :extend="extend">
      :extend="extend"
    >
    </view-grid>
</template>
<script>
@@ -22,38 +24,189 @@
    export default defineComponent({
        setup() {
            const table = ref({
                key: 'Id',
        key: "Id",
                footer: "Foots",
                cnName: '系统日志',
                name: 'Sys_Log',
        cnName: "系统日志",
        name: "Sys_Log",
                url: "/Sys_Log/",
                sortName: "Id"
        sortName: "Id",
            });
            const editFormFields = ref({});
            const editFormOptions = ref([]);
            const searchFormFields = ref({"BeginDate":"","Url":"","LogType":[],"Success":[],"UserIP":"","ServiceIP":"","Role_Id":""});
            const searchFormOptions = ref([[{"title":"请求地址","field":"Url","type":"text"},{"title":"用户IP","field":"UserIP","type":"text"},{"title":"服务器IP","field":"ServiceIP","type":"text"}],[{"title":"开始时间","field":"BeginDate","type":"datetime"},{"dataKey":"restatus","data":[],"title":"响应状态","field":"Success","type":"selectList"},{"dataKey":"roles","data":[],"title":"角色ID","field":"Role_Id","type":"select"}],[{"dataKey":"log","data":[],"title":"日志类型","field":"LogType","colSize":12,"type":"checkbox"}]]);
            const columns = ref([{field:'Id',title:'Id',type:'int',width:90,hidden:true,readonly:true,require:true,align:'left'},
                       {field:'BeginDate',title:'开始时间',type:'datetime',width:140,align:'left',sortable:true},
                       {field:'UserName',title:'用户名称',type:'string',width:90,align:'left'},
                       {field:'Url',title:'请求地址',type:'string',width:110,align:'left'},
                       {field:'LogType',title:'日志类型',type:'string',bind:{ key:'log',data:[]},width:80,align:'left'},
                       {field:'Success',title:'响应状态',type:'int',bind:{ key:'restatus',data:[]},width:80,align:'left'},
                       {field:'ElapsedTime',title:'时长',type:'int',width:60,align:'left'},
                       {field:'RequestParameter',title:'请求参数',type:'string',width:70,align:'left'},
                       {field:'ResponseParameter',title:'响应参数',type:'string',width:70,align:'left'},
                       {field:'ExceptionInfo',title:'异常信息',type:'string',width:70,align:'left'},
                       {field:'UserIP',title:'用户IP',type:'string',width:90,align:'left'},
                       {field:'ServiceIP',title:'服务器IP',type:'string',width:90,hidden:true,align:'left'},
                       {field:'BrowserType',title:'浏览器类型',type:'string',width:90,align:'left'},
                       {field:'User_Id',title:'用户ID',type:'int',width:90,hidden:true,align:'left'},
                       {field:'Role_Id',title:'角色ID',type:'int',bind:{ key:'roles',data:[]},width:90,hidden:true,align:'left'},
                       {field:'EndDate',title:'结束时间',type:'datetime',width:150,hidden:true,align:'left',sortable:true}]);
      const searchFormFields = ref({
        BeginDate: "",
        Url: "",
        LogType: [],
        Success: [],
        UserIP: "",
        ServiceIP: "",
        Role_Id: "",
      });
      const searchFormOptions = ref([
        [
          { title: "请求地址", field: "url", type: "text" },
          { title: "用户IP", field: "userIP", type: "text" },
          { title: "服务器IP", field: "serviceIP", type: "text" },
        ],
        [
          { title: "开始时间", field: "beginDate", type: "datetime" },
        //   {
        //     dataKey: "restatus",
        //     data: [],
        //     title: "响应状态",
        //     field: "success",
        //     type: "selectList",
        //   },
        //   {
        //     dataKey: "roles",
        //     data: [],
        //     title: "角色ID",
        //     field: "role_Id",
        //     type: "select",
        //   },
        ],
        // [
        //   {
        //     dataKey: "log",
        //     data: [],
        //     title: "日志类型",
        //     field: "logType",
        //     colSize: 12,
        //     type: "checkbox",
        //   },
        // ],
      ]);
      const columns = ref([
        {
          field: "id",
          title: "Id",
          type: "int",
          width: 90,
          hidden: true,
          readonly: true,
          require: true,
          align: "left",
        },
        {
          field: "beginDate",
          title: "开始时间",
          type: "datetime",
          width: 140,
          align: "left",
          sortable: true,
        },
        {
          field: "userName",
          title: "用户名称",
          type: "string",
          width: 90,
          align: "left",
        },
        {
          field: "url",
          title: "请求地址",
          type: "string",
          width: 110,
          align: "left",
        },
        {
          field: "logType",
          title: "日志类型",
          type: "string",
          bind: { key: "log", data: [] },
          width: 80,
          align: "left",
        },
        {
          field: "success",
          title: "响应状态",
          type: "int",
          bind: { key: "restatus", data: [] },
          width: 80,
          align: "left",
        },
        {
          field: "elapsedTime",
          title: "时长",
          type: "int",
          width: 60,
          align: "left",
        },
        {
          field: "requestParam",
          title: "请求参数",
          type: "string",
          width: 70,
          align: "left",
        },
        {
          field: "responseParam",
          title: "响应参数",
          type: "string",
          width: 70,
          align: "left",
        },
        {
          field: "exceptionInfo",
          title: "异常信息",
          type: "string",
          width: 70,
          align: "left",
        },
        {
          field: "userIP",
          title: "用户IP",
          type: "string",
          width: 90,
          align: "left",
        },
        {
          field: "serviceIP",
          title: "服务器IP",
          type: "string",
          width: 90,
          hidden: true,
          align: "left",
        },
        {
          field: "browserType",
          title: "浏览器类型",
          type: "string",
          width: 90,
          align: "left",
        },
        {
          field: "userId",
          title: "用户ID",
          type: "int",
          width: 90,
          hidden: true,
          align: "left",
        },
        {
          field: "roleId",
          title: "角色ID",
          type: "int",
          bind: { key: "roles", data: [] },
          width: 90,
          hidden: true,
          align: "left",
        },
        {
          field: "endDate",
          title: "结束时间",
          type: "datetime",
          width: 150,
          hidden: true,
          align: "left",
          sortable: true,
        },
      ]);
            const detail = ref({
                cnName: "#detailCnName",
                columns: [],
                sortName: "",
                key: ""
        key: "",
            });
            return {
                table,
@@ -68,3 +221,4 @@
        },
    });
</script>
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/09f72f2c-b273-4279-b316-3cd115d14817.vsidx
Binary files differ
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/14ef4958-5f37-43d7-b6b6-32b232fbb4bc.vsidx
Binary files differ
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/17995e9c-2ddd-48c7-bbd9-eada1e6c4f48.vsidx
Binary files differ
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/c9f3f4cc-1088-4f89-861d-e06654ee2ded.vsidx
Binary files differ
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ca62f48d-432c-4d58-86d0-434723bd9fe0.vsidx
Binary files differ
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/d7105167-5efc-465c-b440-fa7c68170e72.vsidx
Binary files differ
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/df8c89a0-0422-4f14-9c5d-6b61ed92a257.vsidx
Binary files differ
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/f24c70fa-e22c-4a39-92fe-e726fb794d24.vsidx
Binary files differ
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicRepository/SupplierInfoRepository.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.BaseRepository;
using WIDESEA_IBasicRepository;
using WIDESEA_Model.Models;
namespace WIDESEA_BasicRepository
{
    public class SupplierInfoRepository : RepositoryBase<Dt_SupplierInfo>, ISupplierInfoRepository
    {
        public SupplierInfoRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage)
        {
        }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/SupplierInfoService.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.BaseServices;
using WIDESEA_IBasicRepository;
using WIDESEA_IBasicService;
using WIDESEA_Model.Models;
namespace WIDESEA_BasicService
{
    public class SupplierInfoService : ServiceBase<Dt_SupplierInfo, ISupplierInfoRepository>, ISupplierInfoService
    {
        public SupplierInfoService(ISupplierInfoRepository BaseDal) : base(BaseDal)
        {
        }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_Core/Extensions/AutofacModuleRegister.cs
@@ -14,6 +14,7 @@
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Helper;
using WIDESEA_Core.LogHelper;
namespace WIDESEA_Core.Extensions
{
@@ -73,6 +74,7 @@
               .InstancePerLifetimeScope()
               .PropertiesAutowired();
            builder.RegisterType<RequestLogModel>().InstancePerLifetimeScope();
        }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_Core/HostedService/PermissionDataHostService.cs
@@ -61,7 +61,6 @@
                {
                    userRoles.Add(new UserRole
                    {
                        AuthorityScope = role.AuthorityScope,
                        RoleId = role.RoleId,
                        RoleName = role.RoleName,
                        ParentId = role.ParentId,
@@ -97,10 +96,6 @@
            {
                 FieldName = "RoleName",
            },
            new SelectModel()
            {
                 FieldName = "AuthorityScope",
            }
        };
        List<SelectModel> UserSelectModes = new List<SelectModel>()
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/Logger.cs
@@ -1,10 +1,9 @@

using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Microsoft.AspNetCore.Http;
using SqlSugar;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -15,138 +14,191 @@
namespace WIDESEA_Core.LogHelper
{
    public class Logger
    public static class Logger
    {
        /// <summary>
        /// å†™å…¥è°ƒè¯•日志
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="msg"></param>
        public void WriteDebug(string fileName, string msg)
        public static ConcurrentQueue<dynamic> loggerQueueData = new ConcurrentQueue<dynamic>();
        static Logger()
        {
            if (AppSettings.Get(new string[] { "LogDeubgEnable" }).ObjToBool())
            Task.Run(() =>
            {
                StringBuilder builder = new StringBuilder(msg);
                builder.Append(Environment.NewLine);
                builder.Append(Environment.NewLine);
                WriteLogToFile($"Debug_{fileName}", builder.ToString());
            }
                StartWriteLog();
            });
        }
        /// <summary>
        /// å†™å…¥ä¿¡æ¯æ—¥å¿—
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="msg"></param>
        public void WriteInfo(string fileName, string msg)
        static void StartWriteLog()
        {
            StringBuilder builder = new StringBuilder(msg);
            builder.Append(Environment.NewLine);
            builder.Append(Environment.NewLine);
            WriteLogToFile($"Info_{fileName}", builder.ToString());
        }
        /// <summary>
        /// å†™å…¥é”™è¯¯æ—¥å¿—
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="msg"></param>
        /// <param name="ex"></param>
        public void WriteError(string fileName, string msg, Exception ex)
        {
            StringBuilder builder = new StringBuilder(msg);
            builder.Append(Environment.NewLine);
            builder.Append("错误信息:");
            builder.Append(ex.Message);
            builder.Append(Environment.NewLine);
            builder.Append("错误源:");
            builder.Append(ex.Source);
            builder.Append(Environment.NewLine);
            builder.Append("错误堆栈:");
            builder.Append(ex.StackTrace);
            builder.Append(Environment.NewLine);
            builder.Append("错误类型:");
            builder.Append(ex.GetType().ToString());
            builder.Append(Environment.NewLine);
            builder.Append("错误方法:");
            builder.Append(ex.TargetSite?.ToString());
            builder.Append(Environment.NewLine);
            builder.Append(Environment.NewLine);
            WriteLogToFile($"Error_{fileName}", builder.ToString());
        }
        ReaderWriterLockSlim LogWriteLock = new ReaderWriterLockSlim();
        string folderPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"Log\\{DateTime.Now.ToString("yyyy-MM-dd")}");
        private void WriteLogToFile(string fileName, string log)
            DataTable queueTable = CreateEmptyTable();
            while (true)
        {
            try
            {
                // è¿›å…¥å†™é”
                LogWriteLock.EnterWriteLock();
                    //如果队列中有数据且队列表中的行数小于500,则将队列中的数据写入队列表
                    if (loggerQueueData.Count() > 0 && queueTable.Rows.Count < 500)
                    {
                        DequeueToTable(queueTable); continue;
                    }
                    //每5秒写一次数据
                    Thread.Sleep(5000);
                // å¦‚果文件夹不存在,则创建文件夹
                if (!Directory.Exists(folderPath))
                {
                    Directory.CreateDirectory(folderPath);
                }
                // èŽ·å–æ—¥å¿—æ–‡ä»¶è·¯å¾„
                string logFilePath = Path.Combine(folderPath, GetLastAccessFileName(fileName));
                // èŽ·å–å½“å‰æ—¶é—´
                DateTime now = DateTime.Now;
                // æž„造日志内容
                string logContent = $"【{now}】{Environment.NewLine}{log}";
                    //如果队列表中的行数为0,则跳过本次循环
                    if (queueTable.Rows.Count == 0) { continue; }
                // å°†æ—¥å¿—内容追加到日志文件中
                File.AppendAllText(logFilePath, logContent);
            }
            catch { }
            finally
                    //创建SqlSugarClient对象,用于连接数据库
                    SqlSugarClient sugarClient = new SqlSugarClient(new ConnectionConfig()
            {
                // é€€å‡ºå†™é”
                LogWriteLock.ExitWriteLock();
            }
        }
        int size = 10 * 1024 * 1024;
        string ext = ".log";
        private string GetLogFilePath(string folderPath, string fileName)
        {
            // èŽ·å–æŒ‡å®šæ–‡ä»¶å¤¹ä¸‹çš„æ‰€æœ‰æ–‡ä»¶
            var allFiles = new DirectoryInfo(folderPath);
            // èŽ·å–ç¬¦åˆæ¡ä»¶çš„æ–‡ä»¶ï¼ŒæŒ‰æ–‡ä»¶åé™åºæŽ’åˆ—
            var selectFiles = allFiles.GetFiles().Where(fi => fi.Name.ToLower().Contains(fileName.ToLower()) && fi.Extension.ToLower() == ext.ToLower() && fi.Length < size).OrderByDescending(d => d.Name).ToList();
                        ConnectionString = DBContext.GetMainConnectionDb().Connection,
                        IsAutoCloseConnection = true,
                        DbType = MainDb.DbType,
                    });
            FileInfo? file = selectFiles.FirstOrDefault();
            // å¦‚果有符合条件的文件,返回第一个文件的完整路径
            if (file != null)
            {
                return file.FullName;
            }
                    //将队列表中的数据批量插入数据库
                    int rows = sugarClient.Fastest<DataTable>().AS("Sys_Log").BulkCopy(queueTable);
            // å¦‚果没有符合条件的文件,返回一个新的文件路径,文件名为原文件名加上当前时间
            return Path.Combine(folderPath, $@"{fileName}_{DateTime.Now.ToString("HH-mm-ss")}.log");
                    //清空队列表
                    queueTable.Clear();
        }
        private string GetLastAccessFileName(string fileName)
                catch (Exception ex)
        {
            foreach (var m in GetExistLogFileNames(fileName))
            {
                FileInfo fileInfo = new FileInfo(m);
                if (fileInfo.Length < size)
                {
                    return m;
                    //打印异常信息
                    Console.WriteLine(ex.ToString());
                }
                }
            }
            // è¿”回一个新的默认当前时间的日志名称
            return $@"{fileName}_{DateTime.Now.ToString("HH-mm-ss")}.log";
        private static void DequeueToTable(DataTable queueTable)
        {
            loggerQueueData.TryDequeue(out dynamic log);
            if (log != null)
            {
                DataRow row = queueTable.NewRow();
                // å¦‚æžœlog的BeginDate为空或者BeginDate的年份小于2010,则将BeginDate设置为当前时间
                if (log.BeginDate == null || log.BeginDate?.Year < 2010)
                {
                    log.BeginDate = DateTime.Now;
                }
                // å¦‚æžœlog的EndDate为空,则将EndDate设置为当前时间
                if (log.EndDate == null)
                {
                    log.EndDate = DateTime.Now;
                }
                //  row["Id"] = log.Id;
                // å°†RequestParam中的换行符替换为空字符串
                row["RequestParam"] = log.RequestParam?.Replace("\r\n", "");
                // å°†ResponseParam中的换行符替换为空字符串
                row["ResponseParam"] = log.ResponseParam?.Replace("\r\n", "");
                //row["Success"] = log.Success ?? -1;
                // å°†BeginDate设置为log的BeginDate
                row["BeginDate"] = log.BeginDate;
                // å°†EndDate设置为log的EndDate
                row["EndDate"] = log.EndDate;
                // è®¡ç®—ElapsedTime,即EndDate减去BeginDate的毫秒数
                row["ElapsedTime"] = ((DateTime)log.EndDate - (DateTime)log.BeginDate).TotalMilliseconds;
                // å°†UserIP设置为log的UserIP
                row["UserIP"] = log.UserIP;
                // å°†Url设置为log的Url
                row["Url"] = log.Url;
                // å¦‚æžœlog的UserId为空,则将UserId设置为-1,否则设置为log的UserId
                row["UserId"] = log.UserId ?? -1;
                // å°†UserName设置为log的UserName
                row["UserName"] = log.UserName;
                // å°†row添加到queueTable中
                queueTable.Rows.Add(row);
            }
        }
        private string[] GetExistLogFileNames(string fileName)
        private static DataTable CreateEmptyTable()
        {
            string[] fileNames = Directory.GetFiles(folderPath, fileName + "*.log");
            return fileNames;
            DataTable queueTable = new DataTable();
            queueTable.Columns.Add("BeginDate", Type.GetType("System.DateTime"));
            queueTable.Columns.Add("ElapsedTime", Type.GetType("System.Int32"));
            queueTable.Columns.Add("EndDate", Type.GetType("System.DateTime"));
            queueTable.Columns.Add("RequestParam", typeof(string));
            queueTable.Columns.Add("ResponseParam", typeof(string));
            //queueTable.Columns.Add("Success", Type.GetType("System.Int32"));
            queueTable.Columns.Add("Url", typeof(string));
            queueTable.Columns.Add("UserIP", typeof(string));
            queueTable.Columns.Add("UserName", typeof(string));
            queueTable.Columns.Add("UserId", Type.GetType("System.Int32"));
            //queueTable.Columns.Add("LogType", typeof(string));
            //queueTable.Columns.Add("ExceptionInfo", typeof(string));
            //queueTable.Columns.Add("ServiceIP", typeof(string));
            //queueTable.Columns.Add("BrowserType", typeof(string));
            //queueTable.Columns.Add("Role_Id", Type.GetType("System.Int32"));
            return queueTable;
        }
        public static void Add(string requestParameter, string responseParameter)
        {
            dynamic log = null;
            try
            {
                //获取当前HttpContext
                HttpContext context = App.HttpContext;
                //如果HttpContext为空,则返回
                if (context == null)
                {
                    return;
                }
                //如果请求方法为OPTIONS,则返回
                if (context.Request.Method == "OPTIONS") return;
                //获取RequestLogModel实例
                RequestLogModel logModel = (context.RequestServices.GetService(typeof(RequestLogModel)) as RequestLogModel) ?? new RequestLogModel { RequestDate = DateTime.Now };
                //获取当前用户
                IUser user = App.User;
                //创建日志对象
                log = new
                {
                    //请求开始时间
                    BeginDate = logModel.RequestDate,
                    //请求结束时间
                    EndDate = DateTime.Now,
                    //请求参数
                    RequestParam = requestParameter,
                    //响应参数
                    ResponseParam = responseParameter,
                    //请求URL
                    Url = context.Request.Scheme + "://" + context.Request.Host + context.Request.PathBase + context.Request.Path,
                    //客户端IP
                    UserIP = GetClientIP(context)?.Replace("::ffff:", "").Replace("::1", "127.0.0.1"),
                    //用户ID
                    UserId = user.UserId,
                    //用户名
                    UserName = user.UserName
                };
            }
            catch (Exception exception)
            {
                //如果发生异常,则创建日志对象
                log = log ?? new
                {
                    //请求开始时间
                    BeginDate = DateTime.Now,
                    //请求结束时间
                    EndDate = DateTime.Now,
                    //请求参数
                    RequestParam = requestParameter,
                    //响应参数
                    ResponseParam = responseParameter,
                };
            }
            //添加系统日志
            loggerQueueData.Enqueue(log);
        }
        public static string GetClientIP(HttpContext context)
        {
            // èŽ·å–è¯·æ±‚å¤´ä¸­çš„X-Forwarded-For字段,并将其转换为字符串
            var ip = context.Request.Headers["X-Forwarded-For"].ObjToString();
            // å¦‚æžœX-Forwarded-For字段为空,则获取远程IP地址
            if (string.IsNullOrEmpty(ip))
            {
                ip = context.Connection.RemoteIpAddress.ObjToString();
            }
            // è¿”回IP地址
            return ip;
        }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/RequestLogModel.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WIDESEA_Core.LogHelper
{
    public class RequestLogModel
    {
        public DateTime RequestDate { get; set; }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/WriteLog.cs
ÎļþÒÑɾ³ý
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_Core/Middlewares/ApiLogMiddleware.cs
@@ -22,7 +22,7 @@
        /// </summary>
        private readonly RequestDelegate _next;
        public ApiLogMiddleware(RequestDelegate next)
        public ApiLogMiddleware(RequestDelegate next, ILogger<ApiLogMiddleware> logger)
        {
            _next = next;
        }
@@ -35,13 +35,15 @@
            {
                context.Request.EnableBuffering();
                Stream originalBody = context.Response.Body;
                string requestParam = string.Empty;
                string responseParam = string.Empty;
                try
                {
                    (context.RequestServices.GetService(typeof(RequestLogModel)) as RequestLogModel).RequestDate = DateTime.Now;
                    try
                    {
                        // å­˜å‚¨è¯·æ±‚数据
                        await RequestDataLog(context);
                        requestParam = RequestDataLog(context);
                        context.Request.Body.Position = 0;
                    }
                    catch { }
@@ -53,13 +55,14 @@
                    try
                    {
                        // å­˜å‚¨å“åº”数据
                        ResponseDataLog(context.Response, ms);
                        responseParam = ResponseDataLog(context.Response);
                    }
                    catch { }
                    ms.Position = 0;
                    await ms.CopyToAsync(originalBody);
                    if (!((context.Request.Path.Value?.Contains("get")) ?? true) && !((context.Request.Path.Value?.Contains("Get")) ?? true) && !((context.Request.Path.Value?.Contains("query")) ?? true) && !((context.Request.Path.Value?.Contains("Query")) ?? true))
                        Logger.Add(requestParam, responseParam);
                }
                catch (Exception ex)
                {
@@ -77,61 +80,31 @@
            }
        }
        private async Task RequestDataLog(HttpContext context)
        private string RequestDataLog(HttpContext context)
        {
            var request = context.Request;
            var sr = new StreamReader(request.Body);
            //long length = request.Body.Length;
            RequestLogInfo requestResponse = new RequestLogInfo()
            object obj = new
            {
                Path = request.Path,
                QueryString = request.QueryString.ToString(),
                BodyData = await sr.ReadToEndAsync()
                BodyData = sr.ReadToEndAsync().Result
            };
            var content = JsonConvert.SerializeObject(requestResponse);
            if (!string.IsNullOrEmpty(content))
            {
                LogLock.OutLogAOP("接口日志", new string[] { "请求数据 -  è¯·æ±‚数据类型:" + requestResponse.GetType().ToString(), content });
            string data = JsonConvert.SerializeObject(obj);
                request.Body.Position = 0;
            }
            return data;
        }
        private void ResponseDataLog(HttpResponse response, MemoryStream ms)
        private string ResponseDataLog(HttpResponse response)
        {
            ms.Position = 0;
            var responseBody = new StreamReader(ms).ReadToEnd();
            // å޻除 Html
            var reg = "<[^>]+>";
            var isHtml = Regex.IsMatch(responseBody, reg);
            if (!string.IsNullOrEmpty(responseBody))
            {
                Parallel.For(0, 1, e =>
                {
                    LogLock.OutLogAOP("接口日志", new string[] { "响应数据 -  å“åº”数据类型:" + responseBody.GetType().ToString(), responseBody });
                });
            response.Body.Position = 0;
            using StreamReader stream = new StreamReader(response.Body, leaveOpen: true);
            string body = stream.ReadToEnd();
            response.Body.Position = 0;
            return body;
            }
        }
    }
    public class RequestLogInfo
    {
        /// <summary>
        /// è¯·æ±‚地址
        /// </summary>
        public string Path { get; set; }
        /// <summary>
        /// è¯·æ±‚参数
        /// </summary>
        public string QueryString { get; set; }
        /// <summary>
        /// Body参数
        /// </summary>
        public string BodyData { get; set; }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/MaterielInfoDTO.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WIDESEA_DTO.Basic
{
    public class MaterielInfoDTO
    {
        public string Code { get; set; }
        public string Name { get; set; }
        public string StandType { get; set; }
        public int ItemType { get; set; }
        public int ItemSourceType { get; set; }
        public string Unit { get; set; }
        public string MaterialVersion { get; set; }
        public float Size { get; set; }
        public float Length { get; set; }
        public float Thickness { get; set; }
        public float Wide { get; set; }
        public string Model { get; set; }
        public int State { get; set; }
        public string InvOrgId { get; set; }
        public int OperateType { get; set; }
        public int IsCheck { get; set; }
        public int WaId { get; set; }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/SupplierDTO.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WIDESEA_DTO.Basic
{
    public class SupplierDTO
    {
        public string Code { get; set; }
        public string Name { get; set; }
        public string ShortName { get; set; }
        public string Contacts { get; set; }
        public string ContactNumber { get; set; }
        public string ContactAddress { get; set; }
        public string Email { get; set; }
        public string Description { get; set; }
        public int State { get; set; }
        public string InvOrgId { get; set; }
        public string OperateType {  get; set; }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_DTO/ERP/ErpOutOrderDTO.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WIDESEA_DTO.ERP
{
    public class ErpOutOrderDTO
    {
        public int Way { get; set; }
        public string RowNo { get; set; }
        public string OrderNo { get; set; }
        public string WaId { get; set; }
        public int OType { get; set; }
        public string MCode { get; set; }
        public string MLot { get; set; }
        public float Qty { get; set; }
        public string Unit { get; set; }
        public string OrderData { get; set; }
        public string Node { get; set; }
        public string DepartmentCode { get; set; }
        public string DepartmentName { get; set; }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_IBasicRepository/ISupplierInfoRepository.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Model.Models;
namespace WIDESEA_IBasicRepository
{
    public interface ISupplierInfoRepository : IRepository<Dt_SupplierInfo>
    {
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/ILocationInfoService.cs
@@ -17,6 +17,14 @@
    {
        ILocationInfoRepository Repository { get; }
        WebResponseContent LocationEnableStatus(int[] keys);
        WebResponseContent LocationDisableStatus(int[] keys);
        WebResponseContent LocationEnableStatus(int key);
        WebResponseContent LocationDisableStatus(int key);
        WebResponseContent InitializationLocation(InitializationLocationDTO initializationLocationDTO);
        Dt_LocationInfo? AssignLocation(string roadwayNo, PalletTypeEnum palletType);
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/ISupplierInfoService.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.BaseServices;
using WIDESEA_Model.Models;
namespace WIDESEA_IBasicService
{
    public interface ISupplierInfoService : IService<Dt_SupplierInfo>
    {
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_ISystemRepository/ISys_LogRepository.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Model.Models;
namespace WIDESEA_ISystemRepository
{
    public interface ISys_LogRepository : IRepository<Sys_Log>
    {
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_ISystemService/ISys_LogService.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.BaseServices;
using WIDESEA_Model.Models;
namespace WIDESEA_ISystemService
{
    public interface ISys_LogService : IService<Sys_Log>
    {
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Basic/Dt_MaterielInfo.cs
@@ -111,17 +111,12 @@
        public WhetherEnum IsCheck { get; set; }
        /// <summary>
        /// ä»“库编号
        /// </summary>
        [SugarColumn(IsNullable = false, ColumnDescription = "仓库编号")]
        public int WaId { get; set; }
        /// <summary>
        /// å¤‡æ³¨
        /// </summary>
        [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "备注")]
        public string Remark { get; set; }
        [SugarColumn(IsNullable = false, ColumnDescription = "仓库编号")]
        public int WarehouseId { get; set; }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/System/Sys_Log.cs
@@ -8,7 +8,7 @@
namespace WIDESEA_Model.Models
{
    [MultiTenant]
    [SugarTable(nameof(Sys_Log), "接口日志")]
    public class Sys_Log
    {
        /// <summary>
@@ -44,13 +44,13 @@
        /// <summary>
        /// è¯·æ±‚参数
        /// </summary>
        [SugarColumn(IsNullable = true, Length = 2000, ColumnDescription = "请求参数")]
        [SugarColumn(IsNullable = true, Length = int.MaxValue, ColumnDescription = "请求参数")]
        public string RequestParam { get; set; }
        /// <summary>
        /// å“åº”参数
        /// </summary>
        [SugarColumn(IsNullable = true, Length = 2000, ColumnDescription = "响应参数")]
        [SugarColumn(IsNullable = true, Length = int.MaxValue, ColumnDescription = "响应参数")]
        public string ResponseParam { get; set; }
        /// <summary>
@@ -75,7 +75,7 @@
        /// ç”¨æˆ·åç§°
        /// </summary>
        [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "用户名称")]
        public string UserName { get; set; }
        public string? UserName { get; set; }
        /// <summary>
        /// ç”¨æˆ·ä¸»é”®
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_SystemRepository/Sys_LogRepository.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.BaseRepository;
using WIDESEA_ISystemRepository;
using WIDESEA_Model.Models;
namespace WIDESEA_SystemRepository
{
    public class Sys_LogRepository : RepositoryBase<Sys_Log>, ISys_LogRepository
    {
        public Sys_LogRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage)
        {
        }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_LogService.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.BaseServices;
using WIDESEA_ISystemRepository;
using WIDESEA_ISystemService;
using WIDESEA_Model.Models;
namespace WIDESEA_SystemService
{
    public class Sys_LogService : ServiceBase<Sys_Log, ISys_LogRepository>, ISys_LogService
    {
        public Sys_LogService(ISys_LogRepository BaseDal) : base(BaseDal)
        {
        }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs
@@ -41,7 +41,6 @@
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
using WIDESEA_Core.Log;
using WIDESEA_DTO.Inbound;
using WIDESEA_DTO.Stock;
using WIDESEA_IBasicRepository;
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/LocationInfoController.cs
@@ -35,5 +35,16 @@
        {
            return Service.AssignLocation(roadwayNo, palletType);
        }
        [HttpPost, Route("LocationEnableStatus")]
        public WebResponseContent LocationEnableStatus([FromBody] int[] keys)
        {
            return Service.LocationEnableStatus(keys); ;
        }
        [HttpPost, Route("LocationDisableStatus")]
        public WebResponseContent LocationDisableStatus([FromBody] int[] keys)
        {
            return Service.LocationDisableStatus(keys); ;
        }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/SupplierInfoController.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using WIDESEA_Core.BaseController;
using WIDESEA_IBasicService;
using WIDESEA_Model.Models;
namespace WIDESEA_WMSServer.Controllers.Basic
{
    [Route("api/[controller]")]
    [ApiController]
    public class SupplierInfoController : ApiBaseController<ISupplierInfoService, Dt_SupplierInfo>
    {
        public SupplierInfoController(ISupplierInfoService service) : base(service)
        {
        }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/ERP/ErpController.cs
@@ -1,13 +1,18 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using WIDESEA_Common.CommonEnum;
using WIDESEA_Common.MaterielEnum;
using WIDESEA_Common.OrderEnum;
using WIDESEA_Core;
using WIDESEA_Core.Attributes;
using WIDESEA_Core.Helper;
using WIDESEA_DTO;
using WIDESEA_DTO.Basic;
using WIDESEA_DTO.ERP;
using WIDESEA_External.ERPService;
using WIDESEA_IBasicRepository;
using WIDESEA_IInboundRepository;
using WIDESEA_IInboundService;
using WIDESEA_Model.Models;
@@ -20,11 +25,15 @@
    {
        private readonly IPurchaseOrderRepository _purchaseOrderRepository;
        private readonly IPurchaseOrderService _purchaseOrderService;
        private readonly ISupplierInfoRepository _supplierInfoRepository;
        private readonly IMaterielInfoRepository _materielInfoRepository;
        public ErpController(IPurchaseOrderRepository purchaseOrderRepository, IPurchaseOrderService purchaseOrderService)
        public ErpController(IPurchaseOrderRepository purchaseOrderRepository, IPurchaseOrderService purchaseOrderService, ISupplierInfoRepository supplierInfoRepository, IMaterielInfoRepository materielInfoRepository)
        {
            _purchaseOrderRepository = purchaseOrderRepository;
            _purchaseOrderService = purchaseOrderService;
            _supplierInfoRepository = supplierInfoRepository;
            _materielInfoRepository = materielInfoRepository;
        }
        [HttpPost, Route("ReceivePurchaseOrder"), AllowAnonymous, MethodParamsValidate]
@@ -60,11 +69,135 @@
            return _purchaseOrderService.ReceivePurchaseOrderSingle(model);
        }
        [HttpPost, Route("Test"), AllowAnonymous]
        public WebResponseContent Test(string str)
        [HttpPost, Route("ReceiveSupplier"), AllowAnonymous, MethodParamsValidate]
        public WebResponseContent ReceiveSupplier(SupplierDTO model)
        {
            MatSerNumAnalysisModel model = CodeAnalysisHelper.CodeAnalysis<MatSerNumAnalysisModel>(WIDESEA_Core.CodeConfigEnum.AnalysisCodeEnum.MatSerNumAnalysis, str);
            return WebResponseContent.Instance.OK(model.Serialize());
            try
            {
                if (model.OperateType == "0")
                {
                    Dt_SupplierInfo supplierInfo = new Dt_SupplierInfo()
                    {
                        Status = 1,
                        SupplierCode = model.Code,
                        SupplierName = model.Name,
                        SupplierShortName = model.ShortName
                    };
                    _supplierInfoRepository.AddData(supplierInfo);
                }
                else if (model.OperateType == "1")
                {
                    Dt_SupplierInfo supplierInfo = _supplierInfoRepository.QueryFirst(x => x.SupplierCode == model.Code);
                    if (supplierInfo == null)
                    {
                        return WebResponseContent.Instance.Error($"未找到该供应商信息");
                    }
                    supplierInfo.Status = 1;
                    supplierInfo.SupplierCode = model.Code;
                    supplierInfo.SupplierName = model.Name;
                    supplierInfo.SupplierShortName = model.ShortName;
                    _supplierInfoRepository.UpdateData(supplierInfo);
                }
                else if (model.OperateType == "2")
                {
                    Dt_SupplierInfo supplierInfo = _supplierInfoRepository.QueryFirst(x => x.SupplierCode == model.Code);
                    if (supplierInfo == null)
                    {
                        return WebResponseContent.Instance.Error($"未找到该供应商信息");
                    }
                    _supplierInfoRepository.DeleteData(supplierInfo);
                }
                return WebResponseContent.Instance.OK();
            }
            catch (Exception ex)
            {
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
        [HttpPost, Route("ReceiveMaterial"), AllowAnonymous, MethodParamsValidate]
        public WebResponseContent ReceiveMaterial(MaterielInfoDTO model)
        {
            try
            {
                if (model.OperateType == 0)
                {
                    Dt_MaterielInfo materielInfo = new Dt_MaterielInfo()
                    {
                        IsCheck = (WhetherEnum)model.IsCheck,
                        MaterielCode = model.Code,
                        MaterielInvOrgId = model.InvOrgId,
                        MaterielLength = model.Length,
                        MaterielModel = model.Model,
                        MaterielName = model.Name,
                        MaterielSize = model.Size,
                        MaterielSourceType = (MaterielSourceTypeEnum)model.ItemSourceType,
                        MaterielSpec = "model.",
                        MaterielState = (EnableEnum)model.State,
                        MaterielThickness = model.Thickness,
                        MaterielType = (MaterielTypeEnum)model.ItemType,
                        MaterielUnit = model.Unit,
                        MaterielVersion = model.MaterialVersion,
                        MaterielWide = model.Wide,
                        WarehouseId = model.WaId,
                    };
                    _materielInfoRepository.AddData(materielInfo);
                }
                else if (model.OperateType == 1)
                {
                    Dt_MaterielInfo materielInfo = _materielInfoRepository.QueryFirst(x => x.MaterielCode == model.Code);
                    if (materielInfo == null)
                    {
                        return WebResponseContent.Instance.Error($"未找到物料信息");
                    }
                    materielInfo.IsCheck = (WhetherEnum)model.IsCheck;
                    materielInfo.MaterielCode = model.Code;
                    materielInfo.MaterielInvOrgId = model.InvOrgId;
                    materielInfo.MaterielLength = model.Length;
                    materielInfo.MaterielModel = model.Model;
                    materielInfo.MaterielName = model.Name;
                    materielInfo.MaterielSize = model.Size;
                    materielInfo.MaterielSourceType = (MaterielSourceTypeEnum)model.ItemSourceType;
                    materielInfo.MaterielSpec = model.StandType;
                    materielInfo.MaterielState = (EnableEnum)model.State;
                    materielInfo.MaterielThickness = model.Thickness;
                    materielInfo.MaterielType = (MaterielTypeEnum)model.ItemType;
                    materielInfo.MaterielUnit = model.Unit;
                    materielInfo.MaterielVersion = model.MaterialVersion;
                    materielInfo.MaterielWide = model.Wide;
                    materielInfo.WarehouseId = model.WaId;
                    _materielInfoRepository.UpdateData(materielInfo);
                }
                else if (model.OperateType == 2)
                {
                    Dt_MaterielInfo materielInfo = _materielInfoRepository.QueryFirst(x => x.MaterielCode == model.Code);
                    if (materielInfo == null)
                    {
                        return WebResponseContent.Instance.Error($"未找到物料信息");
                    }
                    _materielInfoRepository.DeleteData(materielInfo);
                }
                return WebResponseContent.Instance.OK();
            }
            catch (Exception ex)
            {
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
        public WebResponseContent ReceiveOutOrder(ErpOutOrderDTO erpOutOrder)
        {
            try
            {
                return WebResponseContent.Instance.OK();
            }
            catch(Exception ex)
            {
                return WebResponseContent.Instance.Error(ex.Message);
            }
        }
    }
}
´úÂë¹ÜÀí/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_LogController.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,17 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using WIDESEA_Core.BaseController;
using WIDESEA_ISystemService;
using WIDESEA_Model.Models;
namespace WIDESEA_WMSServer.Controllers.System
{
    [Route("api/[controller]")]
    [ApiController]
    public class Sys_LogController : ApiBaseController<ISys_LogService, Sys_Log>
    {
        public Sys_LogController(ISys_LogService service) : base(service)
        {
        }
    }
}