| | |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using AutoMapper; |
| | | using SqlSugar; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | | using WIDESEAWCS_Core.BaseServices; |
| | | using WIDESEAWCS_ITelescopicService; |
| | | using WIDESEAWCS_Model.Models; |
| | | <<<<<<< Updated upstream |
| | | ======= |
| | | using WIDESEAWCS_DTO; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; |
| | | using WIDESEAWCS_DTO.Telescopic; |
| | | >>>>>>> Stashed changes |
| | | |
| | | namespace WIDESEAWCS_TelescopicService |
| | | { |
| | |
| | | { |
| | | _user = user; |
| | | } |
| | | <<<<<<< Updated upstream |
| | | |
| | | public WebResponseContent ShowMaintence() |
| | | ======= |
| | | |
| | | public WebResponseContent ShowMaintence(PaginationDTO pagination) |
| | | >>>>>>> Stashed changes |
| | | { |
| | | try |
| | | { |
| | | var sys = _user.QueryData(); |
| | | var main = BaseDal.QueryData(); |
| | | int totalCount = 0; |
| | | var sys = _user.Db.Queryable<Sys_User>(); |
| | | var main = Db.Queryable<Dt_Maintenance>(); |
| | | |
| | | <<<<<<< Updated upstream |
| | | var result = sys.Join(main, |
| | | u => u.UserName, |
| | | m => m.UserAccount, |
| | | (u, m) => new |
| | | { |
| | | u.UserTrueName, |
| | | u.UserName, |
| | | u.CardNumber, |
| | | u.RoleName, |
| | | u.HeadImageUrl, |
| | | m.IsPossible, |
| | | }); |
| | | return new WebResponseContent { Status = true, Data = result }; |
| | | ======= |
| | | var query = sys.InnerJoin<Dt_Maintenance>((a, b) => a.UserName == b.UserAccount); |
| | | if (!string.IsNullOrEmpty(pagination.searchKeyword)) |
| | | { |
| | |
| | | Items = result |
| | | } |
| | | }; |
| | | >>>>>>> Stashed changes |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | return new WebResponseContent { Status = false, Data = ex }; |
| | | return new WebResponseContent { Status = false, Data = ex.Message }; |
| | | } |
| | | } |
| | | |
| | | <<<<<<< Updated upstream |
| | | public WebResponseContent PersonnelMonitoring(bool ispossible) |
| | | ======= |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// æ¨¡ç³æ¥è¯¢ |
| | | /// 人åçæ§ |
| | | /// </summary> |
| | | /// <param name="pageIndex"></param> |
| | | /// <param name="pageSize"></param> |
| | | /// <param name="searchKeyword"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent PersonnelMonitoring(PaginationDTO pagination) |
| | | >>>>>>> Stashed changes |
| | | { |
| | | try |
| | | { |
| | | var sys = _user.QueryData(); |
| | | var main = BaseDal.QueryData(); |
| | | int totalCount = 0; |
| | | var sys = _user.Db.Queryable<Sys_User>(); |
| | | var main = Db.Queryable<Dt_Maintenance>(); |
| | | |
| | | <<<<<<< Updated upstream |
| | | var result = sys.Join(main, |
| | | u => u.UserName, |
| | | m => m.UserAccount, |
| | | (u, m) => new |
| | | { |
| | | u.UserTrueName, |
| | | u.RoleName, |
| | | u.HeadImageUrl, |
| | | m.MaintenanceStatus, |
| | | m.MaintenanceDate, |
| | | m.IsPossible, |
| | | }).Where(x=>x.IsPossible== ispossible); |
| | | return new WebResponseContent { Status = true, Data = result }; |
| | | ======= |
| | | var query = sys.InnerJoin<Dt_Maintenance>((a, b) => a.UserName == b.UserAccount) |
| | | .Where((a, b) => b.IsPossible == "true"); // å
çé IsPossible 为 true çæ°æ® |
| | | |
| | |
| | | Items = result |
| | | } |
| | | }; |
| | | >>>>>>> Stashed changes |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | return new WebResponseContent { Status = false, Data = ex }; |
| | | return new WebResponseContent { Status = false, Data = ex.Message }; |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent RunOperation(int id) |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// æ´æ°ç¶ææ¯å¦å
许è¿å
¥æ£ä¿® |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <param name="ispossible"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent RunOperation(int id, string ispossible) |
| | | { |
| | | try |
| | | { |
| | | var mon = BaseDal.QueryFirst(x => x.ID == id); |
| | | mon.IsPossible = true; |
| | | BaseDal.UpdateData(mon); |
| | | if (ispossible == "true") |
| | | { |
| | | mon.IsPossible = "true"; |
| | | mon.MaintenanceDate = DateTime.Now; |
| | | BaseDal.UpdateData(mon); |
| | | } |
| | | else |
| | | { |
| | | mon.IsPossible = "false"; |
| | | BaseDal.UpdateData(mon); |
| | | } |
| | | return new WebResponseContent { Status = true, Data = mon }; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// æ´æ¹ç¶æ |
| | | /// </summary> |
| | | /// <param name="id"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent ChangeTasState(int id) |
| | | { |
| | | try |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | <<<<<<< Updated upstream |
| | | ======= |
| | | /// æ£ä¿®æä½è®°å½ |
| | | /// </summary> |
| | | /// <param name="pageIndex">页æ°</param> |
| | |
| | | var sys = _user.Db.Queryable<Sys_User>(); |
| | | var main = Db.Queryable<Dt_Maintenance>(); |
| | | |
| | | //æ¨¡ç³æ¥è¯¢ |
| | | var query = sys.InnerJoin<Dt_Maintenance>((a, b) => a.UserName == b.UserAccount); |
| | | |
| | | if (!string.IsNullOrEmpty(pagination.searchKeyword)) |
| | | { |
| | | query = query.Where((a, b) => |
| | |
| | | a.HeadImageUrl.Contains(pagination.searchKeyword) |
| | | ); |
| | | } |
| | | |
| | | //æ¶é´æ¥è¯¢ |
| | | if (pagination.startDate.HasValue && pagination.endDate.HasValue) |
| | | { |
| | | query = query.Where((a, b) => b.MaintenancStartTime >= pagination.startDate.Value && b.MaintenancStartTime <= pagination.endDate.Value); |
| | | } |
| | | //æåº |
| | | if (!string.IsNullOrEmpty(pagination.sortField)) |
| | | { |
| | | var isAcs = pagination.sortOrder?.ToLower() == "asc"; |
| | | query = pagination.sortField.ToLower() switch |
| | | { |
| | | |
| | | |
| | | "maintenancstarttime" => isAcs ? query.OrderBy((a, b) => b.MaintenancStartTime) : query.OrderByDescending((a, b) => b.MaintenancStartTime), |
| | | |
| | | "maintenancenendtime" => isAcs ? query.OrderBy((a, b) => b.MaintenancEendTime) : query.OrderByDescending((a, b) => b.MaintenancEendTime), |
| | | |
| | | _ => query.OrderByDescending((a, b) => b.Creater) // é»è®¤æå建æ¶é´éåº |
| | | }; |
| | | |
| | | } |
| | | else |
| | | { |
| | | query=query.OrderByDescending((a, b) => b.Creater); |
| | | } |
| | | |
| | | //è¿åç»æ |
| | | var result = query.Select((a, b) => new |
| | | { |
| | | a.UserTrueName, |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | >>>>>>> Stashed changes |
| | | /// çä»å¤©çæ£ä¿®ä»»å¡ |
| | | /// </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> |
| | | /// ç¶ææä¸¾ |
| | | /// </summary> |
| | | private enum Maint |