From 74907784c7005b7307b690d010ce6f8292e0dc9b Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期五, 22 八月 2025 09:36:56 +0800
Subject: [PATCH] 修改单机版bug

---
 项目代码/后端/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_RoleService.cs                      |    2 
 项目代码/后端/后台管理/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Telescopic/ParametersController.cs |   12 ++++++
 项目代码/后端/后台管理/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs                |   23 +++++++++++
 项目代码/后端/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/MaintenanceService.cs                |   27 ++++++++-----
 项目代码/后端/后台管理/WIDESEAWCS_Server/WIDESEAWCS_ITelescopicService/IParametersService.cs              |    8 ++++
 项目代码/后端/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs                 |    3 +
 6 files changed, 61 insertions(+), 14 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_RoleService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_RoleService.cs"
index 09afbd6..41036ba 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_RoleService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_RoleService.cs"
@@ -118,7 +118,7 @@
 
 
         /// <summary>
-        /// 鑾峰彇瑙掕壊鏄惁鍙繘鍏ユ搷浣滈〉闈�
+        /// 鑾峰彇瑙掕壊鏄惁鍙繘鍏ユ搷浣滈〉闈紙鏉冮檺锛�
         /// </summary>
         /// <param name="roleId"></param>
         /// <returns></returns>
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/MaintenanceService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/MaintenanceService.cs"
index 190f7f4..1c5e22f 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/MaintenanceService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/MaintenanceService.cs"
@@ -16,6 +16,8 @@
 using SqlSugar.DistributedSystem.Snowflake;
 using System.IO;
 using System.Net;
+using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
+using WIDESEAWCS_Common;
 
 namespace WIDESEAWCS_TelescopicService
 {
@@ -259,12 +261,17 @@
                 {
                     return new WebResponseContent { Status = false, Message = "褰撳墠鐧诲綍鐢ㄦ埛鏃犳晥" };
                 }
-
-                // 3. 鏉冮檺妫�鏌ワ細褰撳墠鐢ㄦ埛鏄� admin 鎴� 褰撳墠鐢ㄦ埛鏄粍闀匡紙IsLeader == 1锛�
-                bool isAdmin = account == "admin";
+                
+                // 3. 鏉冮檺妫�鏌ワ細褰撳墠鐢ㄦ埛鏄� admin(绠$悊鍛�) 鎴� 褰撳墠鐢ㄦ埛鏄粍闀匡紙IsLeader == 1锛�
+                //bool isAdmin = account == "admin";
+                var   isState = currentUser.Role_Id=1; //妫�鏌ユ槸涓嶆槸绠$悊鍛樿鑹诧紙绠$悊鍛樿鑹睮D涓�1锛�
                 bool isLeader = currentUser.IsLeader == 1;  // 鍋囪 Sys_User 琛ㄦ湁 IsLeader 瀛楁
 
-                if (!isAdmin && !isLeader)
+                //if (!isAdmin && !isLeader)
+                //{
+                //    return new WebResponseContent { Status = false, Message = "浣犳病鏈夋潈闄愬己鍒朵笅绾�" };
+                //}
+                if (isState != 1 && !isLeader)
                 {
                     return new WebResponseContent { Status = false, Message = "浣犳病鏈夋潈闄愬己鍒朵笅绾�" };
                 }
@@ -615,13 +622,6 @@
                 var ip = LocalIP?.Replace("::ffff:", "") ?? ""; // 濡傛灉 LocalIP 鏄� null锛宨p 浼氭槸 ""
                 var address = _ipaddress.QueryData(x => x.IPaddress == ip).FirstOrDefault();
                 var addressIp = "";
-                //濡傛灉鐢ㄦ埛涓嶅湪鍘熸湰杞ㄩ亾绔欎笂缁撴潫浠诲姟锛岄偅涔堝氨鎻愮ず浠栬浠栧洖鍘�
-                if (maint.IPAddress != ip)
-                {
-                    return new WebResponseContent { Status = false, Message = "璇峰洖鍒板師鏉ョ殑杞ㄩ亾绔欑粨鏉熶换鍔�" };
-                }
-
-
                 if (maint == null || sysuer == null)
                 {
                     return new WebResponseContent { Status = false, Message = "娌℃湁鎵惧埌璇ョ敤鎴�" };
@@ -636,6 +636,11 @@
                 {
                     return new WebResponseContent { Status = false, Message = "浣犺繕娌℃湁寮�濮嬫淇紝璇峰厛鐐瑰嚮寮�濮嬫淇�" };
                 }
+                //濡傛灉鐢ㄦ埛涓嶅湪鍘熸湰杞ㄩ亾绔欎笂缁撴潫浠诲姟锛岄偅涔堝氨鎻愮ず浠栬浠栧洖
+                if (maint.IPAddress != ip)
+                {
+                    return new WebResponseContent { Status = false, Message = "璇峰洖鍒板師鏉ョ殑杞ㄩ亾绔欑粨鏉熶换鍔�" };
+                }
 
                 // 妫�鏌ユ槸鍚﹁嚦灏戞湁涓�涓粍闀垮湪鍦�
                 var activeLeaders = user.Where(x => x.IsLeader == 1 && x.MaintenanceStatus == 1).ToList();
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs"
index d2cf37b..8d38f61 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs"
@@ -5,6 +5,7 @@
 using System.Text;
 using System.Threading.Tasks;
 using AutoMapper;
+using Microsoft.AspNetCore.Http;
 using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
 using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
 using SqlSugar;
@@ -46,7 +47,7 @@
             
             try
             {
-
+                
                 ////鏍规嵁int.TryParse(AppSettings.Get("DepartmentID")璇诲彇鍒板綋鍓嶆槸杞ㄩ亾鍑狅紝鎵�鏈変汉閮藉彧鑳芥搷浣滃綋鍓�
                 //if (!int.TryParse(AppSettings.Get("DepartmentID"), out int deid))
                 //{
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_ITelescopicService/IParametersService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_ITelescopicService/IParametersService.cs"
index f2930d7..3040b55 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_ITelescopicService/IParametersService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_ITelescopicService/IParametersService.cs"
@@ -43,5 +43,13 @@
         /// <returns></returns>
         WebResponseContent CurrentLocation(int deptid);
 
+
+        /// <summary>
+        /// 鑾峰彇褰撳墠绋嬪簭鏈�鏂扮殑浼哥缉鏉嗛�熷害鍥炲~缁欏墠绔�
+        /// </summary>
+        /// <param name="plank"></param>
+        /// <returns></returns>
+        WebResponseContent BackfillSpeed(int plank);
+
     }
 }
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Telescopic/ParametersController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Telescopic/ParametersController.cs"
index d48226b..6d577a0 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Telescopic/ParametersController.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Telescopic/ParametersController.cs"
@@ -55,6 +55,18 @@
             return Service.PauseButton(deptid);
         }
 
+        /// <summary>
+        ///  鑾峰彇褰撳墠绋嬪簭鏈�鏂扮殑浼哥缉鏉嗛�熷害鍥炲~缁欏墠绔�
+        /// </summary>
+        /// <param name="plank">鏍堥亾鍙�</param>
+        /// <returns></returns>
+        [HttpPost, Route("BackfillSpeed")]
+        public WebResponseContent BackfillSpeed(int plank)
+        {
+            
+            return Service.BackfillSpeed(plank);
+        }
+
 
         /// <summary>
         /// 浼哥缉鏉嗗綋鍓嶄綅缃�
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs"
index 04cb277..1022b9a 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/\345\220\216\347\253\257/\345\220\216\345\217\260\347\256\241\347\220\206/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/ParametersService.cs"
@@ -460,7 +460,28 @@
             return (left, right);
         }
 
-   
+        /// <summary>
+        /// 鑾峰彇褰撳墠绋嬪簭鏈�鏂扮殑浼哥缉鏉嗛�熷害鍥炲~缁欏墠绔�
+        /// </summary>
+        /// <param name="plank"></param>
+        /// <returns></returns>
+        public WebResponseContent BackfillSpeed(int plank)
+        {
+            try
+            {
+                var para = BaseDal.QueryData().Where(x => x.Deptid == plank).OrderByDescending(x => x.CreateDate).FirstOrDefault();
+                if (para == null)
+                {
+                    return new WebResponseContent { Message = "浣犺繕娌℃湁閰嶇疆閫熷害" };
+                }
+                return new WebResponseContent { Status = true, Data = para };
+            }
+            catch (Exception ex)
+            {
+
+                return new WebResponseContent { Status = false, Message = ex.Message };
+            }
+        }
     }
 
 }

--
Gitblit v1.9.3