已删除5个文件
已修改11个文件
已添加18个文件
| | |
| | | *ä¸å¡è¯·å¨@/extension/system/Sys_Log.jsæ¤å¤ç¼å |
| | | --> |
| | | <template> |
| | | <view-grid ref="grid" |
| | | <view-grid |
| | | ref="grid" |
| | | :columns="columns" |
| | | :detail="detail" |
| | | :editFormFields="editFormFields" |
| | |
| | | :searchFormFields="searchFormFields" |
| | | :searchFormOptions="searchFormOptions" |
| | | :table="table" |
| | | :extend="extend"> |
| | | :extend="extend" |
| | | > |
| | | </view-grid> |
| | | </template> |
| | | <script> |
| | |
| | | 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, |
| | |
| | | }, |
| | | }); |
| | | </script> |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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) |
| | | { |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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) |
| | | { |
| | | } |
| | | } |
| | | } |
| | |
| | | using WIDESEA_Core.BaseRepository; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_Core.LogHelper; |
| | | |
| | | namespace WIDESEA_Core.Extensions |
| | | { |
| | |
| | | .InstancePerLifetimeScope() |
| | | .PropertiesAutowired(); |
| | | |
| | | builder.RegisterType<RequestLogModel>().InstancePerLifetimeScope(); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | userRoles.Add(new UserRole |
| | | { |
| | | AuthorityScope = role.AuthorityScope, |
| | | RoleId = role.RoleId, |
| | | RoleName = role.RoleName, |
| | | ParentId = role.ParentId, |
| | |
| | | { |
| | | FieldName = "RoleName", |
| | | }, |
| | | new SelectModel() |
| | | { |
| | | FieldName = "AuthorityScope", |
| | | } |
| | | }; |
| | | |
| | | List<SelectModel> UserSelectModes = new List<SelectModel>() |
| | |
| | |  |
| | | 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; |
| | |
| | | |
| | | 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; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; } |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | private readonly RequestDelegate _next; |
| | | |
| | | public ApiLogMiddleware(RequestDelegate next) |
| | | public ApiLogMiddleware(RequestDelegate next, ILogger<ApiLogMiddleware> logger) |
| | | { |
| | | _next = next; |
| | | } |
| | |
| | | { |
| | | 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 { } |
| | |
| | | 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) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | 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; } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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> |
| | | { |
| | | } |
| | | } |
| | |
| | | { |
| | | 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); |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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> |
| | | { |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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> |
| | | { |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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> |
| | | { |
| | | } |
| | | } |
| | |
| | | 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; } |
| | | } |
| | | } |
| | |
| | | |
| | | namespace WIDESEA_Model.Models |
| | | { |
| | | [MultiTenant] |
| | | [SugarTable(nameof(Sys_Log), "æ¥å£æ¥å¿")] |
| | | public class Sys_Log |
| | | { |
| | | /// <summary> |
| | |
| | | /// <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> |
| | |
| | | /// ç¨æ·åç§° |
| | | /// </summary> |
| | | [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "ç¨æ·åç§°")] |
| | | public string UserName { get; set; } |
| | | public string? UserName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ç¨æ·ä¸»é® |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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) |
| | | { |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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) |
| | | { |
| | | } |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | { |
| | | 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); ; |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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) |
| | | { |
| | | } |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | { |
| | | 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] |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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) |
| | | { |
| | | } |
| | | } |
| | | } |