From 2ca0bc7acb2fe719581e426eb5c7da96053cb31d Mon Sep 17 00:00:00 2001
From: schangxiang@126.com <schangxiang@126.com>
Date: 周三, 03 12月 2025 11:42:57 +0800
Subject: [PATCH] 禁用操作日志

---
 iWara.SCADA.Code/iWare.Wms.Application/Service/AccessInterface/AccessInterfaceService.cs |   50 ++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 38 insertions(+), 12 deletions(-)

diff --git a/iWara.SCADA.Code/iWare.Wms.Application/Service/AccessInterface/AccessInterfaceService.cs b/iWara.SCADA.Code/iWare.Wms.Application/Service/AccessInterface/AccessInterfaceService.cs
index 96655eb..6693a27 100644
--- a/iWara.SCADA.Code/iWare.Wms.Application/Service/AccessInterface/AccessInterfaceService.cs
+++ b/iWara.SCADA.Code/iWare.Wms.Application/Service/AccessInterface/AccessInterfaceService.cs
@@ -48,6 +48,7 @@
         private readonly IHttpContextAccessor _httpContextAccessor;
         private readonly IRepository<WorkPieceProcess, MasterDbContextLocator> _workPieceProcessRep;
         private readonly IAccessInterfaceLogService _accessInterfaceLog;
+        private readonly IAccessInterfaceLogForRequestService _accessInterfaceLogForRequest;
         private readonly IRepository<WorkPieceInfoLog, MasterDbContextLocator> _WorkPieceInfoLog;
         private readonly IRepository<EquipmentCurrentMonitor, MasterDbContextLocator> _equipmentCurrentMonitorRep;
         private readonly IRepository<EquipmentBaseInfo, MasterDbContextLocator> _equipmentBaseInfoRep;
@@ -63,7 +64,9 @@
         /// <param name="workPieceInfoRep"></param>
         /// <param name="httpContextAccessor"></param>
         /// <param name="accessInterfaceLog"></param>
-        public AccessInterfaceService(IRepository<QualityDataInfo, MasterDbContextLocator> qualityDataInfoRep,
+        public AccessInterfaceService(
+            IAccessInterfaceLogForRequestService accessInterfaceLogForRequest,
+            IRepository<QualityDataInfo, MasterDbContextLocator> qualityDataInfoRep,
             IRepository<QualityDataInfoLog, MasterDbContextLocator> qualityDataInfoLogRep,
             IRepository<WorkPieceInfo, MasterDbContextLocator> workPieceInfoRep,
             IHttpContextAccessor httpContextAccessor,
@@ -77,6 +80,7 @@
             , IRepository<ProductionPlanInfo, MasterDbContextLocator> productionPlanInfoRep
             , IRepository<ShiftInfo, MasterDbContextLocator> shiftInfoRep)
         {
+            _accessInterfaceLogForRequest = accessInterfaceLogForRequest;
             _qualityDataInfoRep = qualityDataInfoRep;
             _qualityDataInfoLogRep = qualityDataInfoLogRep;
             _workPieceInfoRep = workPieceInfoRep;
@@ -300,8 +304,9 @@
             {
                 try
                 {
-                    addLog.WorkPieceID = input.WorkPieceID;
-                    addLog.WorkingProcedureCurrent = input.WorkingProcedure;
+                    addLog.WorkPieceID = input?.WorkPieceID;
+                    addLog.WorkingProcedureCurrent = input?.WorkingProcedure;
+                    addLog.QualityState = input?.QualityState;
 
                     await _accessInterfaceLog.AddInterfaceLogAsync(addLog);
                 }
@@ -323,7 +328,7 @@
         [HttpGet("GetWorkingProcedureForID")]
         public async Task<AccessWorPieceInfoOutput> GetWorkingProcedureForID([FromQuery] AccessWorkPieceInfoInput input)
         {
-            AddAccessInterfaceLogInput addLog = new();
+            AddAccessInterfaceLogForRequestInput addLog = new();
             addLog.JsonString = JsonConvert.SerializeObject(input);
             addLog.Action = 2;
             addLog.Key = input.WorkPieceID;
@@ -337,7 +342,9 @@
             if (input == null || string.IsNullOrEmpty(input.WorkPieceID))
             {
                 addLog.Result = "浼犲叆鍙傛暟寮傚父锛氬伐浠跺彿涓嶈兘涓虹┖锛�";
-                await _accessInterfaceLog.AddInterfaceLogAsync(addLog);
+                //await _accessInterfaceLog.AddInterfaceLogAsync(addLog);
+                //鏇挎崲[Editby shaocx,2024-09-04]
+                await _accessInterfaceLogForRequest.AddInterfaceLogForRequestAsync(addLog);
                 throw Oops.Oh(addLog.Result);
             }
 
@@ -346,14 +353,18 @@
             if (workPieceInfo == null)
             {
                 addLog.Result = $"浼犲叆鍙傛暟寮傚父锛氬伐浠跺彿{input.WorkPieceID}涓嶈兘鎵惧埌鎸囧畾宸ヤ欢锛�";
-                await _accessInterfaceLog.AddInterfaceLogAsync(addLog);
+                //await _accessInterfaceLog.AddInterfaceLogAsync(addLog);
+                //鏇挎崲[Editby shaocx,2024-09-04]
+                await _accessInterfaceLogForRequest.AddInterfaceLogForRequestAsync(addLog);
                 throw Oops.Oh(addLog.Result);
             }
             var re = workPieceInfo.Adapt<AccessWorPieceInfoOutput>();
 
             addLog.Result = re;
 
-            await _accessInterfaceLog.AddInterfaceLogAsync(addLog);
+            //await _accessInterfaceLog.AddInterfaceLogAsync(addLog);
+            //鏇挎崲[Editby shaocx,2024-09-04]
+            await _accessInterfaceLogForRequest.AddInterfaceLogForRequestAsync(addLog);
 
             return re;
         }
@@ -368,6 +379,7 @@
         /// <returns></returns>
         [HttpGet("GetEquipmentCurrentState")]
         [AllowAnonymous]
+        [DisableOpLog]
         public async Task<List<EquipmentCurrentMonitorOutputV2>> GetEquipmentLst([FromQuery] EquipmentCurrentMonitorSearch input)
         {
 
@@ -404,6 +416,7 @@
         /// </summary>
         [HttpGet("GetProduceCompletionStatus")]
         [AllowAnonymous]
+        [DisableOpLog]
         public async Task<List<ProduceCompletionStatus>> GetProduceCompletionStatus()
         {
             List<ProduceCompletionStatus> list = new List<ProduceCompletionStatus>();
@@ -440,7 +453,9 @@
                     }
                     else
                     {
-                        produceCompletionStatus.PlanCompletionRate = Math.Round(((double)produceCompletionStatus.CompletionNum / (double)produceCompletionStatus.PlanCompletionNum), 3) * 100;
+                        produceCompletionStatus.PlanCompletionRate = (int)Math.Clamp(
+                           Math.Round(((double)produceCompletionStatus.CompletionNum / (double)produceCompletionStatus.PlanCompletionNum), 3) * 100
+                           , 0, 100);
                     }
                     list.Add(produceCompletionStatus);
 
@@ -459,6 +474,7 @@
         /// </summary>
         [HttpGet("GetCurrentProduceInfo")]
         [AllowAnonymous]
+        [DisableOpLog]
         public async Task<CurrentProduceInfo> GetCurrentProduceInfo()
         {
             CurrentProduceInfo currentProduceInfo = new CurrentProduceInfo();
@@ -548,6 +564,7 @@
         /// <returns></returns>
         [HttpGet("GetQualityData")]
         [AllowAnonymous]
+        [DisableOpLog]
         public async Task<QualityDataDisplay> GetQualityData([FromQuery] string input)
         {
             QualityDataDisplay qualityDataDisplay = new QualityDataDisplay();
@@ -603,6 +620,7 @@
         /// </summary>
         [HttpGet("GetLargeScreenFrequency")]
         [AllowAnonymous]
+        [DisableOpLog]
         public async Task<int> GetLargeScreenFrequency()
         {
             try
@@ -643,6 +661,7 @@
         /// <returns></returns>
         [HttpGet("GetProductionForTime")]
         [AllowAnonymous]
+        [DisableOpLog]
         public async Task<List<ProductionInfo>> GetProductionForTime(DateTime start, DateTime end)
         {
             //鑾峰彇鏈�杩戞湀涓嬬嚎宸ヤ欢鐨勬垚鍝�
@@ -670,6 +689,7 @@
         /// <returns></returns>
         [HttpPost("Add")]
         [AllowAnonymous]
+        [DisableOpLog]
         public async Task AddQualityDataAsync(AddQualityDataInfoInput input)
         {
 
@@ -802,12 +822,13 @@
         /// <returns></returns>
         [HttpGet("workPieceInfo")]
         [AllowAnonymous]
+        [DisableOpLog]
         public async Task<AccessWorPieceInfoOutput> GetWorkPieceInfoAsync([FromQuery] AccessWorkPieceInfoInput input)
         {
             var workPieceInfo = await _workPieceInfoRep.DetachedEntities
                 .FirstOrDefaultAsync(w => w.WorkPieceID == input.WorkPieceID.Trim());
 
-            AddAccessInterfaceLogInput addLog = new();
+            AddAccessInterfaceLogForRequestInput addLog = new();
             addLog.JsonString = JsonConvert.SerializeObject(input);
             addLog.Action = 2;
             addLog.Key = input.WorkPieceID;
@@ -818,7 +839,9 @@
                 addLog.IpAddress = ipAddress.MapToIPv4().ToString();
             }
             addLog.OperateAddress = $"{_httpContextAccessor.HttpContext.Request.Path}";// {_httpContextAccessor.HttpContext.Request.QueryString}"; //_httpContextAccessor.HttpContext.Request.GetEncodedUrl();
-            await _accessInterfaceLog.AddInterfaceLogAsync(addLog);
+            //鏇挎崲[Editby shaocx,2024-09-04]
+            // await _accessInterfaceLog.AddInterfaceLogAsync(addLog);
+            await _accessInterfaceLogForRequest.AddInterfaceLogForRequestAsync(addLog);
 
             return workPieceInfo == null ? null : workPieceInfo.Adapt<AccessWorPieceInfoOutput>();
         }
@@ -830,6 +853,7 @@
         /// <returns></returns>
         [HttpPost("ThreadStatus")]
         [AllowAnonymous]
+        [DisableOpLog]
         public async Task AddThreadStatusAsync(AddThreadStatusMonitorInput input)
         {
             var dataCapture = await _dataCaptureConfigRep.DetachedEntities.FirstOrDefaultAsync(d => d.WorkingProcedure == input.Threadcode);
@@ -865,13 +889,15 @@
                     await _threadStatusMonitorRep.UpdateAsync(threadStatusMonitor);
                 }
             }
-            AddAccessInterfaceLogInput addLog = new();
+            AddAccessInterfaceLogForRequestInput addLog = new();
             addLog.JsonString = JsonConvert.SerializeObject(input);
             addLog.Action = 1;
             addLog.Key = input.Threadcode;
             addLog.IpAddress = _httpContextAccessor.HttpContext.Connection.RemoteIpAddress.ToString();
             addLog.OperateAddress = $"{_httpContextAccessor.HttpContext.Request.Path}{_httpContextAccessor.HttpContext.Request.QueryString}";
-            await _accessInterfaceLog.AddInterfaceLogAsync(addLog);
+            //鏇挎崲[Editby shaocx,2024-09-04]
+            // await _accessInterfaceLog.AddInterfaceLogAsync(addLog);
+            await _accessInterfaceLogForRequest.AddInterfaceLogForRequestAsync(addLog);
         }
         #endregion
     }

--
Gitblit v1.9.3