From 4261951c50fadb3cdac395086974a715487bab82 Mon Sep 17 00:00:00 2001 From: hutongqing <hutongqing@hnkhzn.com> Date: 星期五, 13 十二月 2024 10:48:44 +0800 Subject: [PATCH] 1 --- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/System/Sys_Log.cs | 8 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_LogService.cs | 19 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/ISupplierInfoService.cs | 14 代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/14ef4958-5f37-43d7-b6b6-32b232fbb4bc.vsidx | 0 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/SupplierInfoController.cs | 17 代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ca62f48d-432c-4d58-86d0-434723bd9fe0.vsidx | 0 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/Middlewares/ApiLogMiddleware.cs | 77 +-- 代码管理/WMS/WIDESEA_WMSClient/src/views/system/Sys_Log.vue | 278 +++++++++-- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/ERP/ErpOutOrderDTO.cs | 37 + 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_ISystemRepository/ISys_LogRepository.cs | 14 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Basic/Dt_MaterielInfo.cs | 7 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicRepository/SupplierInfoRepository.cs | 18 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/SupplierInfoService.cs | 19 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/Logger.cs | 278 +++++++----- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/Extensions/AutofacModuleRegister.cs | 2 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/HostedService/PermissionDataHostService.cs | 5 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/RequestLogModel.cs | 13 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs | 1 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/ERP/ErpController.cs | 143 ++++++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_SystemRepository/Sys_LogRepository.cs | 18 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/SupplierDTO.cs | 33 + /dev/null | 188 -------- 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_LogController.cs | 17 代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/c9f3f4cc-1088-4f89-861d-e06654ee2ded.vsidx | 0 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/MaterielInfoDTO.cs | 45 ++ 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IBasicRepository/ISupplierInfoRepository.cs | 14 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/ILocationInfoService.cs | 8 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/LocationInfoController.cs | 11 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_ISystemService/ISys_LogService.cs | 14 代码管理/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/df8c89a0-0422-4f14-9c5d-6b61ed92a257.vsidx | 0 30 files changed, 862 insertions(+), 436 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/views/system/Sys_Log.vue" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/views/system/Sys_Log.vue" index 9742628..d9ae6b2 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/views/system/Sys_Log.vue" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSClient/src/views/system/Sys_Log.vue" @@ -4,67 +4,221 @@ *浠g爜鐢辨鏋剁敓鎴�,浠讳綍鏇存敼閮藉彲鑳藉鑷磋浠g爜鐢熸垚鍣ㄨ鐩� *涓氬姟璇峰湪@/extension/system/Sys_Log.js姝ゅ缂栧啓 --> -<template> - <view-grid ref="grid" - :columns="columns" - :detail="detail" - :editFormFields="editFormFields" - :editFormOptions="editFormOptions" - :searchFormFields="searchFormFields" - :searchFormOptions="searchFormOptions" - :table="table" - :extend="extend"> + <template> + <view-grid + ref="grid" + :columns="columns" + :detail="detail" + :editFormFields="editFormFields" + :editFormOptions="editFormOptions" + :searchFormFields="searchFormFields" + :searchFormOptions="searchFormOptions" + :table="table" + :extend="extend" + > </view-grid> -</template> -<script> - import extend from "@/extension/system/Sys_Log.js"; - import { ref, defineComponent } from "vue"; - export default defineComponent({ - setup() { - const table = ref({ - key: 'Id', - footer: "Foots", - cnName: '绯荤粺鏃ュ織', - name: 'Sys_Log', - url: "/Sys_Log/", - 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":"鏈嶅姟鍣↖P","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:'鏈嶅姟鍣↖P',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 detail = ref({ - cnName: "#detailCnName", - columns: [], - sortName: "", - key: "" - }); - return { - table, - extend, - editFormFields, - editFormOptions, - searchFormFields, - searchFormOptions, - columns, - detail, - }; + </template> + <script> + import extend from "@/extension/system/Sys_Log.js"; + import { ref, defineComponent } from "vue"; + export default defineComponent({ + setup() { + const table = ref({ + key: "Id", + footer: "Foots", + cnName: "绯荤粺鏃ュ織", + name: "Sys_Log", + url: "/Sys_Log/", + 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: "鏈嶅姟鍣↖P", 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", }, - }); -</script> + { + 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: "鏈嶅姟鍣↖P", + 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: "", + }); + return { + table, + extend, + editFormFields, + editFormOptions, + searchFormFields, + searchFormOptions, + columns, + detail, + }; + }, + }); + </script> + \ No newline at end of file diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/09f72f2c-b273-4279-b316-3cd115d14817.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/09f72f2c-b273-4279-b316-3cd115d14817.vsidx" deleted file mode 100644 index 9390d9f..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/09f72f2c-b273-4279-b316-3cd115d14817.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/14ef4958-5f37-43d7-b6b6-32b232fbb4bc.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/14ef4958-5f37-43d7-b6b6-32b232fbb4bc.vsidx" new file mode 100644 index 0000000..88d9196 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/14ef4958-5f37-43d7-b6b6-32b232fbb4bc.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/17995e9c-2ddd-48c7-bbd9-eada1e6c4f48.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/17995e9c-2ddd-48c7-bbd9-eada1e6c4f48.vsidx" deleted file mode 100644 index 946ae09..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/17995e9c-2ddd-48c7-bbd9-eada1e6c4f48.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/c9f3f4cc-1088-4f89-861d-e06654ee2ded.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/c9f3f4cc-1088-4f89-861d-e06654ee2ded.vsidx" new file mode 100644 index 0000000..f791915 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/c9f3f4cc-1088-4f89-861d-e06654ee2ded.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ca62f48d-432c-4d58-86d0-434723bd9fe0.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ca62f48d-432c-4d58-86d0-434723bd9fe0.vsidx" new file mode 100644 index 0000000..bb2adee --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/ca62f48d-432c-4d58-86d0-434723bd9fe0.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/d7105167-5efc-465c-b440-fa7c68170e72.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/d7105167-5efc-465c-b440-fa7c68170e72.vsidx" deleted file mode 100644 index e07e61b..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/d7105167-5efc-465c-b440-fa7c68170e72.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/df8c89a0-0422-4f14-9c5d-6b61ed92a257.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/df8c89a0-0422-4f14-9c5d-6b61ed92a257.vsidx" new file mode 100644 index 0000000..269d480 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/df8c89a0-0422-4f14-9c5d-6b61ed92a257.vsidx" Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/f24c70fa-e22c-4a39-92fe-e726fb794d24.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/f24c70fa-e22c-4a39-92fe-e726fb794d24.vsidx" deleted file mode 100644 index 4c41aff..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/FileContentIndex/f24c70fa-e22c-4a39-92fe-e726fb794d24.vsidx" +++ /dev/null Binary files differ diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicRepository/SupplierInfoRepository.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicRepository/SupplierInfoRepository.cs" new file mode 100644 index 0000000..c774ecf --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicRepository/SupplierInfoRepository.cs" @@ -0,0 +1,18 @@ +锘縰sing 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) + { + } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/SupplierInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/SupplierInfoService.cs" new file mode 100644 index 0000000..400844c --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_BasicService/SupplierInfoService.cs" @@ -0,0 +1,19 @@ +锘縰sing 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) + { + } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Extensions/AutofacModuleRegister.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Extensions/AutofacModuleRegister.cs" index fe9c711..c98e78c 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Extensions/AutofacModuleRegister.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/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(); } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/HostedService/PermissionDataHostService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/HostedService/PermissionDataHostService.cs" index f583a3a..95b79b2 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/HostedService/PermissionDataHostService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/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>() diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/Logger.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/Logger.cs" index a8e99dd..3f5cc23 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/Logger.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/Logger.cs" @@ -1,10 +1,9 @@ -锘� -using Microsoft.AspNetCore.Http; -using Microsoft.Extensions.Logging; -using Newtonsoft.Json; +锘縰sing 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(); + }); + + } + + static void StartWriteLog() + { + DataTable queueTable = CreateEmptyTable(); + while (true) + { + try + { + //濡傛灉闃熷垪涓湁鏁版嵁涓旈槦鍒楄〃涓殑琛屾暟灏忎簬500锛屽垯灏嗛槦鍒椾腑鐨勬暟鎹啓鍏ラ槦鍒楄〃 + if (loggerQueueData.Count() > 0 && queueTable.Rows.Count < 500) + { + DequeueToTable(queueTable); continue; + } + //姣�5绉掑啓涓�娆℃暟鎹� + Thread.Sleep(5000); + + //濡傛灉闃熷垪琛ㄤ腑鐨勮鏁颁负0锛屽垯璺宠繃鏈寰幆 + if (queueTable.Rows.Count == 0) { continue; } + + //鍒涘缓SqlSugarClient瀵硅薄锛岀敤浜庤繛鎺ユ暟鎹簱 + SqlSugarClient sugarClient = new SqlSugarClient(new ConnectionConfig() + { + ConnectionString = DBContext.GetMainConnectionDb().Connection, + IsAutoCloseConnection = true, + DbType = MainDb.DbType, + }); + + //灏嗛槦鍒楄〃涓殑鏁版嵁鎵归噺鎻掑叆鏁版嵁搴� + int rows = sugarClient.Fastest<DataTable>().AS("Sys_Log").BulkCopy(queueTable); + + //娓呯┖闃熷垪琛� + queueTable.Clear(); + } + catch (Exception ex) + { + //鎵撳嵃寮傚父淇℃伅 + Console.WriteLine(ex.ToString()); + } } } - /// <summary> - /// 鍐欏叆淇℃伅鏃ュ織 - /// </summary> - /// <param name="fileName"></param> - /// <param name="msg"></param> - public void WriteInfo(string fileName, string msg) + private static void DequeueToTable(DataTable queueTable) { - StringBuilder builder = new StringBuilder(msg); - builder.Append(Environment.NewLine); - builder.Append(Environment.NewLine); - WriteLogToFile($"Info_{fileName}", builder.ToString()); + loggerQueueData.TryDequeue(out dynamic log); + if (log != null) + { + DataRow row = queueTable.NewRow(); + // 濡傛灉log鐨凚eginDate涓虹┖鎴栬�匓eginDate鐨勫勾浠藉皬浜�2010锛屽垯灏咮eginDate璁剧疆涓哄綋鍓嶆椂闂� + if (log.BeginDate == null || log.BeginDate?.Year < 2010) + { + log.BeginDate = DateTime.Now; + } + // 濡傛灉log鐨凟ndDate涓虹┖锛屽垯灏咵ndDate璁剧疆涓哄綋鍓嶆椂闂� + if (log.EndDate == null) + { + log.EndDate = DateTime.Now; + } + // row["Id"] = log.Id; + // 灏哛equestParam涓殑鎹㈣绗︽浛鎹负绌哄瓧绗︿覆 + row["RequestParam"] = log.RequestParam?.Replace("\r\n", ""); + // 灏哛esponseParam涓殑鎹㈣绗︽浛鎹负绌哄瓧绗︿覆 + row["ResponseParam"] = log.ResponseParam?.Replace("\r\n", ""); + //row["Success"] = log.Success ?? -1; + // 灏咮eginDate璁剧疆涓簂og鐨凚eginDate + row["BeginDate"] = log.BeginDate; + // 灏咵ndDate璁剧疆涓簂og鐨凟ndDate + row["EndDate"] = log.EndDate; + // 璁$畻ElapsedTime锛屽嵆EndDate鍑忓幓BeginDate鐨勬绉掓暟 + row["ElapsedTime"] = ((DateTime)log.EndDate - (DateTime)log.BeginDate).TotalMilliseconds; + // 灏哢serIP璁剧疆涓簂og鐨刄serIP + row["UserIP"] = log.UserIP; + // 灏哢rl璁剧疆涓簂og鐨刄rl + row["Url"] = log.Url; + // 濡傛灉log鐨刄serId涓虹┖锛屽垯灏哢serId璁剧疆涓�-1锛屽惁鍒欒缃负log鐨刄serId + row["UserId"] = log.UserId ?? -1; + // 灏哢serName璁剧疆涓簂og鐨刄serName + row["UserName"] = log.UserName; + // 灏唕ow娣诲姞鍒皅ueueTable涓� + queueTable.Rows.Add(row); + } } - /// <summary> - /// 鍐欏叆閿欒鏃ュ織 - /// </summary> - /// <param name="fileName"></param> - /// <param name="msg"></param> - /// <param name="ex"></param> - public void WriteError(string fileName, string msg, Exception ex) + private static DataTable CreateEmptyTable() { - 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()); + 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; } - - 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) + public static void Add(string requestParameter, string responseParameter) { + dynamic log = null; try { - // 杩涘叆鍐欓攣 - LogWriteLock.EnterWriteLock(); - - // 濡傛灉鏂囦欢澶逛笉瀛樺湪锛屽垯鍒涘缓鏂囦欢澶� - if (!Directory.Exists(folderPath)) + //鑾峰彇褰撳墠HttpContext + HttpContext context = App.HttpContext; + //濡傛灉HttpContext涓虹┖锛屽垯杩斿洖 + if (context == null) { - Directory.CreateDirectory(folderPath); + return; } - // 鑾峰彇鏃ュ織鏂囦欢璺緞 - string logFilePath = Path.Combine(folderPath, GetLastAccessFileName(fileName)); - // 鑾峰彇褰撳墠鏃堕棿 - DateTime now = DateTime.Now; - // 鏋勯�犳棩蹇楀唴瀹� - string logContent = $"銆恵now}銆憑Environment.NewLine}{log}"; + //濡傛灉璇锋眰鏂规硶涓篛PTIONS锛屽垯杩斿洖 + if (context.Request.Method == "OPTIONS") return; + //鑾峰彇RequestLogModel瀹炰緥 + RequestLogModel logModel = (context.RequestServices.GetService(typeof(RequestLogModel)) as RequestLogModel) ?? new RequestLogModel { RequestDate = DateTime.Now }; - // 灏嗘棩蹇楀唴瀹硅拷鍔犲埌鏃ュ織鏂囦欢涓� - File.AppendAllText(logFilePath, logContent); - } - catch { } - finally - { - // 閫�鍑哄啓閿� - 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(); - - FileInfo? file = selectFiles.FirstOrDefault(); - // 濡傛灉鏈夌鍚堟潯浠剁殑鏂囦欢锛岃繑鍥炵涓�涓枃浠剁殑瀹屾暣璺緞 - if (file != null) - { - return file.FullName; - } - - // 濡傛灉娌℃湁绗﹀悎鏉′欢鐨勬枃浠讹紝杩斿洖涓�涓柊鐨勬枃浠惰矾寰勶紝鏂囦欢鍚嶄负鍘熸枃浠跺悕鍔犱笂褰撳墠鏃堕棿 - return Path.Combine(folderPath, $@"{fileName}_{DateTime.Now.ToString("HH-mm-ss")}.log"); - } - - private string GetLastAccessFileName(string fileName) - { - foreach (var m in GetExistLogFileNames(fileName)) - { - FileInfo fileInfo = new FileInfo(m); - if (fileInfo.Length < size) + //鑾峰彇褰撳墠鐢ㄦ埛 + IUser user = App.User; + //鍒涘缓鏃ュ織瀵硅薄 + log = new { - return m; - } + //璇锋眰寮�濮嬫椂闂� + BeginDate = logModel.RequestDate, + //璇锋眰缁撴潫鏃堕棿 + EndDate = DateTime.Now, + //璇锋眰鍙傛暟 + RequestParam = requestParameter, + //鍝嶅簲鍙傛暟 + ResponseParam = responseParameter, + //璇锋眰URL + Url = context.Request.Scheme + "://" + context.Request.Host + context.Request.PathBase + context.Request.Path, + //瀹㈡埛绔疘P + UserIP = GetClientIP(context)?.Replace("::ffff:", "").Replace("::1", "127.0.0.1"), + //鐢ㄦ埛ID + UserId = user.UserId, + //鐢ㄦ埛鍚� + UserName = user.UserName + }; } - - // 杩斿洖涓�涓柊鐨勯粯璁ゅ綋鍓嶆椂闂寸殑鏃ュ織鍚嶇О - return $@"{fileName}_{DateTime.Now.ToString("HH-mm-ss")}.log"; + catch (Exception exception) + { + //濡傛灉鍙戠敓寮傚父锛屽垯鍒涘缓鏃ュ織瀵硅薄 + log = log ?? new + { + //璇锋眰寮�濮嬫椂闂� + BeginDate = DateTime.Now, + //璇锋眰缁撴潫鏃堕棿 + EndDate = DateTime.Now, + //璇锋眰鍙傛暟 + RequestParam = requestParameter, + //鍝嶅簲鍙傛暟 + ResponseParam = responseParameter, + }; + } + //娣诲姞绯荤粺鏃ュ織 + loggerQueueData.Enqueue(log); } - private string[] GetExistLogFileNames(string fileName) + public static string GetClientIP(HttpContext context) { - string[] fileNames = Directory.GetFiles(folderPath, fileName + "*.log"); - return fileNames; + // 鑾峰彇璇锋眰澶翠腑鐨刋-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; } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/RequestLogModel.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/RequestLogModel.cs" new file mode 100644 index 0000000..0404a69 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/RequestLogModel.cs" @@ -0,0 +1,13 @@ +锘縰sing 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; } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/WriteLog.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/WriteLog.cs" deleted file mode 100644 index da4fb46..0000000 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/LogHelper/WriteLog.cs" +++ /dev/null @@ -1,188 +0,0 @@ -锘縰sing Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace WIDESEA_Core.Log -{ - public class WriteLog - { - private int fileSize; - private string logFileName; - public static WriteLog log; - static string EquipName; - public static WriteLog GetLog(string equipName) - { - EquipName = equipName; - //if (log == null) - log = new WriteLog(equipName); - log.FileLogPath = AppContext.BaseDirectory + "\\log\\" + DateTime.Now.ToString("yyyyMMdd") /*+ "\\" + EquipName + "_" + DateTime.Now.ToString("yyyyMMdd")*/ + "\\"; - return log; - } - - public static WriteLog Info(string equipName) - { - EquipName = equipName; - //if (log == null) - log = new WriteLog("Info" + equipName); - log.FileLogPath = AppContext.BaseDirectory + "\\log\\Info\\" + DateTime.Now.ToString("yyyyMMdd") /*+ "\\" + EquipName + "_" + DateTime.Now.ToString("yyyyMMdd")*/ + "\\"; - return log; - } - - public static WriteLog Error(string equipName) - { - EquipName = equipName; - //if (log == null) - log = new WriteLog("Error" + equipName); - log.FileLogPath = AppContext.BaseDirectory + "\\log\\Error\\" + DateTime.Now.ToString("yyyyMMdd") /*+ "\\" + EquipName + "_" + DateTime.Now.ToString("yyyyMMdd")*/ + "\\"; - return log; - } - - private WriteLog(string equipName) - { - //鍒濆鍖栧ぇ浜�399M鏃ュ織鏂囦欢灏嗚嚜鍔ㄥ垹闄�; - - this.fileSize = 2048 * 1024 * 200;//50M 2048 * 1024 * 200= 419430000瀛楄妭(b)=399.9996185鍏嗗瓧鑺�(mb) - - //榛樿璺緞 - - //this.FileLogPath = AppContext.BaseDirectory + "\\log\\" + EquipName + "\\"; - EquipName = equipName; - if (!string.IsNullOrEmpty(equipName)) - this.logFileName = equipName + "_log" + DateTime.Now.ToString("yyyyMMdd") + ".log"; - else - this.logFileName = "log" + DateTime.Now.ToString("yyyyMMdd") + ".log"; - //this.logFileName = EquipName + "_log" + DateTime.Now.ToString("yyyyMMdd") + ".log"; - } - - public int FileSize - { - set - { - fileSize = value; - } - get - { - return fileSize; - } - } - - public string FileLogPath { set; get; } //= AppContext.BaseDirectory + "\\log\\" + EquipName + "\\"; - - public string LogFileName - { - set - { - this.logFileName = value; - } - get - { - return this.logFileName; - } - } - - object flag = new object(); - - public void Write(string Message, string equipName) - { - lock (flag) - { - if (!string.IsNullOrEmpty(equipName)) - this.logFileName = equipName + "_log" + DateTime.Now.ToString("yyyyMMdd") + ".log"; - else - this.logFileName = "log" + DateTime.Now.ToString("yyyyMMdd") + ".log"; - this.Write(this.logFileName, Message, equipName); - } - } - - public void Write(string LogFileName, string Message, string equipName) - { - - //DirectoryInfo path=new DirectoryInfo(LogFileName); - //濡傛灉鏃ュ織鏂囦欢鐩綍涓嶅瓨鍦�,鍒欏垱寤� - if (!Directory.Exists(this.FileLogPath)) - { - Directory.CreateDirectory(this.FileLogPath); - } - - FileInfo finfo = new FileInfo(this.FileLogPath + LogFileName); - if (finfo.Exists && finfo.Length > fileSize) - { - finfo.Delete(); - } - try - { - FileStream fs = new FileStream(this.FileLogPath + LogFileName, FileMode.Append); - StreamWriter strwriter = new StreamWriter(fs); - try - { - - DateTime d = DateTime.Now; - strwriter.WriteLine("鏃堕棿:" + d.ToString()); - strwriter.WriteLine(Message); - strwriter.WriteLine("-----------------------------------------------------"); - strwriter.WriteLine(); - strwriter.Flush(); - } - catch (Exception ee) - { - //Console.WriteLine("鏃ュ織鏂囦欢鍐欏叆澶辫触淇℃伅:" + ee.ToString()); - } - finally - { - strwriter.Close(); - strwriter = null; - fs.Close(); - fs = null; - } - } - catch (Exception ee) - { - //Console.WriteLine("鏃ュ織鏂囦欢娌℃湁鎵撳紑,璇︾粏淇℃伅濡備笅:"); - } - } - /// <summary> - /// 鍐欏叆鏃ュ織(涓嶈澶氱嚎绋嬫搷浣滃悓涓�鏂囦欢锛屼竴涓澶囦竴涓枃浠跺す) - /// </summary> - /// <param name="groupName">鏃ュ織缁�</param> - /// <param name="logName">鏃ュ織鍚嶇О</param> - /// <param name="content">鍐呭</param> - /// <param name="data">鏁版嵁</param> - public static void Write_Log(string groupName, string logName, string content, object data = null) - { - DateTime nowTime = DateTime.Now; - string basePath = System.Environment.CurrentDirectory + "/Log/" + $"/{groupName}/{nowTime.ToString("yyyy-MM-dd")}"; - //濡傛灉鏃ュ織鏂囦欢鐩綍涓嶅瓨鍦�,鍒欏垱寤� - if (!Directory.Exists(basePath)) - { - Directory.CreateDirectory(basePath); - } - try - { - FileStream fs = new FileStream(basePath + "/" + logName + $"{nowTime.ToString("yyMMdd")}.txt", FileMode.Append); - StreamWriter strwriter = new StreamWriter(fs); - try - { - strwriter.WriteLine(nowTime.ToString() + "." + nowTime.Millisecond); - strwriter.WriteLine(content); - if (data != null) - { - strwriter.WriteLine(JsonConvert.SerializeObject(data)); - } - strwriter.WriteLine("-----------------------------------------------------"); - strwriter.WriteLine(); - strwriter.Flush(); - } - catch { } - finally - { - strwriter.Close(); - fs.Close(); - } - } - catch { } - } - } -} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Middlewares/ApiLogMiddleware.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Middlewares/ApiLogMiddleware.cs" index ee5bdd9..fbbfef0 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Middlewares/ApiLogMiddleware.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/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,18 +55,19 @@ 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) { // 璁板綍寮傚父 - + } finally { @@ -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 }); - request.Body.Position = 0; - } + + 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; } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/MaterielInfoDTO.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/MaterielInfoDTO.cs" new file mode 100644 index 0000000..4d12609 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/MaterielInfoDTO.cs" @@ -0,0 +1,45 @@ +锘縰sing 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; } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/SupplierDTO.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/SupplierDTO.cs" new file mode 100644 index 0000000..4ea44a1 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/Basic/SupplierDTO.cs" @@ -0,0 +1,33 @@ +锘縰sing 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; } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/ERP/ErpOutOrderDTO.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/ERP/ErpOutOrderDTO.cs" new file mode 100644 index 0000000..92e5702 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_DTO/ERP/ErpOutOrderDTO.cs" @@ -0,0 +1,37 @@ +锘縰sing 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; } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IBasicRepository/ISupplierInfoRepository.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IBasicRepository/ISupplierInfoRepository.cs" new file mode 100644 index 0000000..f813d2e --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IBasicRepository/ISupplierInfoRepository.cs" @@ -0,0 +1,14 @@ +锘縰sing 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> + { + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/ILocationInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/ILocationInfoService.cs" index e32d8bb..69697c9 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/ILocationInfoService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/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); diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/ISupplierInfoService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/ISupplierInfoService.cs" new file mode 100644 index 0000000..b37c267 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_IBasicService/ISupplierInfoService.cs" @@ -0,0 +1,14 @@ +锘縰sing 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> + { + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ISystemRepository/ISys_LogRepository.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ISystemRepository/ISys_LogRepository.cs" new file mode 100644 index 0000000..afb622e --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ISystemRepository/ISys_LogRepository.cs" @@ -0,0 +1,14 @@ +锘縰sing 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> + { + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ISystemService/ISys_LogService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ISystemService/ISys_LogService.cs" new file mode 100644 index 0000000..27dcb29 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ISystemService/ISys_LogService.cs" @@ -0,0 +1,14 @@ +锘縰sing 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> + { + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Basic/Dt_MaterielInfo.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Basic/Dt_MaterielInfo.cs" index d842122..0c7d21e 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/Basic/Dt_MaterielInfo.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/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; } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/System/Sys_Log.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/System/Sys_Log.cs" index d5d22b8..8c15781 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Model/Models/System/Sys_Log.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/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> /// 鐢ㄦ埛涓婚敭 diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_SystemRepository/Sys_LogRepository.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_SystemRepository/Sys_LogRepository.cs" new file mode 100644 index 0000000..128f9d0 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_SystemRepository/Sys_LogRepository.cs" @@ -0,0 +1,18 @@ +锘縰sing 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) + { + } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_LogService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_LogService.cs" new file mode 100644 index 0000000..a19fd81 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_LogService.cs" @@ -0,0 +1,19 @@ +锘縰sing 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) + { + } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" index 3797b3a..ba3138c 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/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; diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/LocationInfoController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/LocationInfoController.cs" index 68946b4..3b6853e 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/LocationInfoController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/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); ; + } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/SupplierInfoController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/SupplierInfoController.cs" new file mode 100644 index 0000000..cf7d994 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Basic/SupplierInfoController.cs" @@ -0,0 +1,17 @@ +锘縰sing 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) + { + } + } +} diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/ERP/ErpController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/ERP/ErpController.cs" index 068b487..b9f3f59 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/ERP/ErpController.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/ERP/ErpController.cs" @@ -1,13 +1,18 @@ 锘縰sing 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); + } } } } diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_LogController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_LogController.cs" new file mode 100644 index 0000000..175bb74 --- /dev/null +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/System/Sys_LogController.cs" @@ -0,0 +1,17 @@ +锘縰sing 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) + { + } + } +} -- Gitblit v1.9.3