From 01c5166aad248cf4de78d7aeb53c31f961835f02 Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期日, 27 四月 2025 08:46:23 +0800
Subject: [PATCH] 1

---
 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/MaintenanceService.cs |  124 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 122 insertions(+), 2 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/MaintenanceService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/MaintenanceService.cs"
index f821fef..8a0db39 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/MaintenanceService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/MaintenanceService.cs"
@@ -142,7 +142,12 @@
 
 
 
-
+        /// <summary>
+        /// 鏇存柊鐘舵�佹槸鍚﹀厑璁歌繘鍏ユ淇�
+        /// </summary>
+        /// <param name="id"></param>
+        /// <param name="ispossible"></param>
+        /// <returns></returns>
         public WebResponseContent RunOperation(int id, string  ispossible)
         {
             try
@@ -292,7 +297,122 @@
             }
         }
 
-      
+
+        /// <summary>
+        /// 鐪嬩粖澶╃殑妫�淇换鍔�
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public WebResponseContent MaintenanceTasksOfTheDay(string account)
+        {
+            try
+            {
+                var today = DateTime.Today;               // 浠婂ぉ鐨勯浂鐐�
+                var tomorrow = today.AddDays(1);         // 鏄庡ぉ鐨勯浂鐐�
+
+                var query = _user.Db.Queryable<Sys_User>()
+                    .InnerJoin<Dt_Maintenance>((a, b) => a.UserName == b.UserAccount)
+                    .Where((a, b) => b.IsPossible == "true" && b.UserAccount == account &&
+                    b.MaintenanceDate >= today && b.MaintenanceDate < tomorrow).Select((a, b) => new
+                    {
+                        b.ID,
+                        a.UserTrueName,
+                        a.UserName,
+                        a.CardNumber,
+                        a.Userteam,
+                        a.HeadImageUrl,
+                        b.IsPossible,
+                        b.MaintenanceDate,
+                        b.MaintenancStartTime,
+                        b.MaintenancEendTime,
+                    }).ToList();
+                if (query==null)
+                {
+                    return new WebResponseContent { Status = false, Message = "浣犱粖澶╂病鏈夋淇换鍔�" };
+                }
+                
+
+
+                return new WebResponseContent { Status=true, Data = query };
+            }
+            catch (Exception ex)
+            {
+
+                return new WebResponseContent { Status = false, Message = "閿欒淇℃伅锛�" + ex.Message };
+            }
+                    
+        }
+
+        /// <summary>
+        /// 寮�濮嬫淇�
+        /// </summary>
+        /// <param name="account"></param>
+        /// <returns></returns>
+        public WebResponseContent StartMaintenceTask(string account)
+        {
+            try
+            {
+                var today = DateTime.Today;               // 浠婂ぉ鐨勯浂鐐�
+                var tomorrow = today.AddDays(1);         // 鏄庡ぉ鐨勯浂鐐�
+
+
+                var maint = BaseDal.QueryData(x =>
+                    x.UserAccount == account &&
+                    x.IsPossible == "true" &&
+                    x.MaintenanceDate >= today &&
+                    x.MaintenanceDate < tomorrow
+                ).FirstOrDefault();
+
+                if (maint == null)
+                {
+                    return new WebResponseContent { Status = false, Message = "鏈壘鍒颁粖鏃ョ殑缁存姢浠诲姟璁板綍" };
+                }
+
+                maint.MaintenancStartTime = DateTime.Now;
+                BaseDal.UpdateData(maint);
+
+                return new WebResponseContent { Status = true, Data = maint };
+            }
+            catch (Exception ex)
+            {
+                return new WebResponseContent { Status = false, Message = "閿欒淇℃伅锛�" + ex.Message };
+            }
+        }
+
+
+        /// <summary>
+        /// 缁撴潫妫�淇�
+        /// </summary>
+        /// <param name="account"></param>
+        /// <returns></returns>
+        public WebResponseContent StopMaintenanceTask(string account)
+        {
+            try
+            {
+                var today = DateTime.Today;               // 浠婂ぉ鐨勯浂鐐�
+                var tomorrow = today.AddDays(1);         // 鏄庡ぉ鐨勯浂鐐�
+
+                var maint = BaseDal.QueryData(x => x.UserAccount == account && x.IsPossible == "true"
+                && x.MaintenanceDate >= today &&x.MaintenanceDate < tomorrow).FirstOrDefault();
+                if (maint == null)
+                {
+                    return new WebResponseContent { Status = false, Message = "鏈壘鍒板彲鐢ㄧ殑缁存姢浠诲姟璁板綍" };
+                }
+                // 淇敼鍏剁粨鏉熸椂闂�
+                maint.MaintenancEendTime = DateTime.Now;
+                maint.IsPossible = "ok";//ok灏变唬琛ㄥ畬鎴愪簡
+                BaseDal.UpdateData(maint);
+                return new WebResponseContent { Status = true, Data = maint };
+
+            }
+            catch (Exception ex)
+            {
+
+                return new WebResponseContent { Status = false, Message = "閿欒淇℃伅锛�" + ex.Message };
+            }
+        }
+
+
 
         /// <summary>
         /// 鐘舵�佹灇涓�

--
Gitblit v1.9.3