From b1aa3a97ed3fcc221a863b8a26ae447975e65907 Mon Sep 17 00:00:00 2001 From: yanjinhui <3306209981@qq.com> Date: 星期三, 09 四月 2025 17:08:10 +0800 Subject: [PATCH] 4/9 --- 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITelescopicService/IMaintenanceService.cs | 21 +++++ 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/wwwroot/image/59293addef4da93a4de193c42fc3c21.jpg | 0 /dev/null | 0 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_TelescopicService/MaintenanceService.cs | 124 ++++++++++++++++++++++++++++++ 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/Telescopic/Dt_Maintenance.cs | 4 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/WIDESEAWCS_Server.csproj | 4 - 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Telescopic/MaintenanceController.cs | 38 +++++++++ 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs | 2 8 files changed, 183 insertions(+), 10 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITelescopicService/IMaintenanceService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITelescopicService/IMaintenanceService.cs" index 279087c..2a4db2d 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITelescopicService/IMaintenanceService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITelescopicService/IMaintenanceService.cs" @@ -42,7 +42,26 @@ /// </summary> /// <returns></returns> WebResponseContent MaintenanceOperationRecord(PaginationDTO pagination); - + + + //寮�濮嬫淇拰缁撴潫妫�淇紙灞曠ず褰撳墠鐧诲叆鐢ㄦ埛鐨勬淇换鍔★級 + WebResponseContent MaintenanceTasksOfTheDay(string account); + + /// <summary> + /// 寮�濮嬫淇� + /// </summary> + /// <param name="id">鐢ㄦ埛id</param> + /// <returns></returns> + WebResponseContent StartMaintenceTask(string account); + + /// <summary> + /// 缁撴潫妫�淇� + /// </summary> + /// <param name="id">鐢ㄦ埛id</param> + /// <returns></returns> + WebResponseContent StopMaintenanceTask(string account); + + } diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/Telescopic/Dt_Maintenance.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/Telescopic/Dt_Maintenance.cs" index 65b9154..c126ce6 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/Telescopic/Dt_Maintenance.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/Telescopic/Dt_Maintenance.cs" @@ -45,13 +45,13 @@ /// 妫�淇紑濮嬫椂闂� /// </summary> [SugarColumn(Length = 50, IsNullable = true, ColumnDescription = "妫�淇紑濮嬫椂闂�")] - public DateTime MaintenancStartTime { get; set; } + public DateTime? MaintenancStartTime { get; set; } // <summary> /// 妫�淇粨鏉熸椂闂� /// </summary> [SugarColumn(Length = 50, IsNullable = true, ColumnDescription = "妫�淇粨鏉熸椂闂�")] - public DateTime MaintenancEendTime { get; set; } + public DateTime? MaintenancEendTime { get; set; } diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Telescopic/MaintenanceController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Telescopic/MaintenanceController.cs" index 3508240..34cdb72 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Telescopic/MaintenanceController.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Telescopic/MaintenanceController.cs" @@ -1,6 +1,7 @@ 锘縰sing Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using System; using WIDESEAWCS_Core; using WIDESEAWCS_Core.BaseController; using WIDESEAWCS_DTO.Telescopic; @@ -72,5 +73,42 @@ { return Service.MaintenanceOperationRecord(pagination); } + + + /// <summary> + /// 鏌ョ湅鐧诲叆浠婂ぉ璐﹀彿鐨勬淇换鍔� + /// </summary> + /// <param name="id"></param> + /// <returns></returns> + [HttpPost, Route("MaintenanceTasksOfTheDay"), AllowAnonymous] + public WebResponseContent MaintenanceTasksOfTheDay(string account) + { + return Service.MaintenanceTasksOfTheDay(account); + } + + + + /// <summary> + /// 寮�濮嬫淇� + /// </summary> + /// <param name="account"></param> + /// <returns></returns> + [HttpPost, Route("StartMaintenceTask"), AllowAnonymous] + public WebResponseContent StartMaintenceTask(string account) + { + return Service.StartMaintenceTask(account); + } + + + /// <summary> + /// 缁撴潫妫�淇� + /// </summary> + /// <param name="account"></param> + /// <returns></returns> + [HttpPost, Route("StopMaintenanceTask"), AllowAnonymous] + public WebResponseContent StopMaintenanceTask(string account) + { + return Service.StopMaintenanceTask(account); + } } } diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/WIDESEAWCS_Server.csproj" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/WIDESEAWCS_Server.csproj" index f63ee45..9e8131c 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/WIDESEAWCS_Server.csproj" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/WIDESEAWCS_Server.csproj" @@ -86,8 +86,4 @@ </Content> </ItemGroup> - <ItemGroup> - <Folder Include="wwwroot\image\" /> - </ItemGroup> - </Project> diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/wwwroot/image/59293addef4da93a4de193c42fc3c21.jpg" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/wwwroot/image/59293addef4da93a4de193c42fc3c21.jpg" new file mode 100644 index 0000000..a989db4 --- /dev/null +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/wwwroot/image/59293addef4da93a4de193c42fc3c21.jpg" Binary files differ diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/wwwroot/image/newLogo.png" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/wwwroot/image/newLogo.png" deleted file mode 100644 index a3646e6..0000000 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/wwwroot/image/newLogo.png" +++ /dev/null Binary files differ diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs" index 2e1b8a6..d1cff0e 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_UserService.cs" @@ -210,7 +210,7 @@ content = WebResponseContent.Instance.OK(data: new { token, - userName = user.UserTrueName, + userName = user.UserName, img = user.HeadImageUrl, ID = user.UserId, RoleId = user.RoleId, 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