| | |
| | | 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; |
| | | using WIDESEAWCS_DTO; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; |
| | | using WIDESEAWCS_DTO.Telescopic; |
| | | |
| | | namespace WIDESEAWCS_TelescopicService |
| | | { |
| | |
| | | { |
| | | _user = user; |
| | | } |
| | | |
| | | public WebResponseContent ShowMaintence() |
| | | public WebResponseContent ShowMaintence(PaginationDTO pagination) |
| | | { |
| | | 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>(); |
| | | |
| | | var result = sys.Join(main, |
| | | u => u.UserName, |
| | | m => m.UserAccount, |
| | | (u, m) => new |
| | | var query = sys.InnerJoin<Dt_Maintenance>((a, b) => a.UserName == b.UserAccount); |
| | | if (!string.IsNullOrEmpty(pagination.searchKeyword)) |
| | | { |
| | | query = query.Where((a, b) => |
| | | a.UserTrueName.Contains(pagination.searchKeyword) || |
| | | a.UserName.Contains(pagination.searchKeyword) || |
| | | a.CardNumber.ToString().Contains(pagination.searchKeyword)|| |
| | | a.Userteam.Contains(pagination.searchKeyword) |
| | | ); |
| | | } |
| | | var result= query .Select((a, b) => new |
| | | { |
| | | b.ID, |
| | | a.UserTrueName, |
| | | a.UserName, |
| | | a.CardNumber, |
| | | a.Userteam, |
| | | a.HeadImageUrl, |
| | | b.IsPossible |
| | | }).ToPageList(pagination.pageIndex, pagination.pageSize, ref totalCount); |
| | | return new WebResponseContent |
| | | { |
| | | Status = true, |
| | | Data = new |
| | | { |
| | | u.UserTrueName, |
| | | u.UserName, |
| | | u.CardNumber, |
| | | u.RoleName, |
| | | u.HeadImageUrl, |
| | | m.IsPossible, |
| | | }); |
| | | return new WebResponseContent { Status = true, Data = result }; |
| | | TotalCount = totalCount,//æ»æ° |
| | | PageIndex = pagination.pageIndex,//é¡µæ° |
| | | PageSize = pagination.pageSize,//ä¸é¡µå¤å°ä¸ªæ°æ® |
| | | Items = result |
| | | } |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | return new WebResponseContent { Status = false, Data = ex }; |
| | | return new WebResponseContent { Status = false, Data = ex.Message }; |
| | | } |
| | | } |
| | | |
| | | 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) |
| | | { |
| | | 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>(); |
| | | |
| | | var result = sys.Join(main, |
| | | u => u.UserName, |
| | | m => m.UserAccount, |
| | | (u, m) => new |
| | | var query = sys.InnerJoin<Dt_Maintenance>((a, b) => a.UserName == b.UserAccount) |
| | | .Where((a, b) => b.IsPossible == "true"); // å
çé IsPossible 为 true çæ°æ® |
| | | |
| | | // 妿æä¾äºæç´¢å
³é®åï¼åè¿è¡æ¨¡ç³æ¥è¯¢ |
| | | if (!string.IsNullOrEmpty(pagination.searchKeyword)) |
| | | { |
| | | query = query.Where((a, b) => |
| | | a.UserTrueName.Contains(pagination.searchKeyword) || // æçå®å§åæ¨¡ç³æç´¢ |
| | | a.Userteam.Contains(pagination.searchKeyword)); // æç¨æ·çç»æ¨¡ç³æç´¢ |
| | | } |
| | | |
| | | // 妿æä¾äº status åæ°ï¼åæç¶æçé |
| | | if (pagination.status.HasValue)//çä»·ifï¼statusï¼=nullï¼ |
| | | { |
| | | query = query.Where((a, b) => b.MaintenanceStatus == pagination.status.Value); |
| | | } |
| | | |
| | | var result = query |
| | | .Select((a, b) => 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 }; |
| | | a.UserTrueName, |
| | | a.Userteam, |
| | | a.HeadImageUrl, |
| | | b.MaintenanceStatus, |
| | | b.MaintenanceDate, |
| | | b.IsPossible, |
| | | }) |
| | | .ToPageList(pagination.pageIndex, pagination.pageSize, ref totalCount); // å页 |
| | | |
| | | return new WebResponseContent |
| | | { |
| | | Status = true, |
| | | Data = new |
| | | { |
| | | TotalCount = totalCount, // æ»æ° |
| | | PageIndex = pagination.pageIndex, // å½å页ç |
| | | PageSize = pagination.pageSize, // æ¯é¡µæ°æ®é |
| | | Items = result |
| | | } |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | return new WebResponseContent { Status = false, Data = ex }; |
| | | return new WebResponseContent { Status = false, Data = ex.Message }; |
| | | } |
| | | } |
| | | |
| | | public WebResponseContent RunOperation(int id) |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | 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="pageIndex">页æ°</param> |
| | | /// <param name="pageSize">ä¸é¡µå¤å°ä¸ªæ°æ®</param> |
| | | /// <returns></returns> |
| | | public WebResponseContent MaintenanceOperationRecord(PaginationDTO pagination) |
| | | { |
| | | try |
| | | { |
| | | int totalCount = 0; |
| | | 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.UserTrueName.Contains(pagination.searchKeyword)|| |
| | | a.Userteam.Contains(pagination.searchKeyword)|| |
| | | 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); |
| | | } |
| | | |
| | | var result = query.Select((a, b) => new |
| | | { |
| | | a.UserTrueName, |
| | | a.Userteam, |
| | | a.HeadImageUrl, |
| | | b.MaintenancStartTime, |
| | | b.MaintenancEendTime, |
| | | }).ToPageList(pagination.pageIndex, pagination.pageSize, ref totalCount); |
| | | |
| | | return new WebResponseContent |
| | | { |
| | | Status = true, |
| | | Data = new |
| | | { |
| | | TotalCount = totalCount,//æ»æ° |
| | | PageIndex = pagination.pageIndex,//é¡µæ° |
| | | PageSize = pagination.pageSize,//ä¸é¡µå¤å°ä¸ªæ°æ® |
| | | Items = result |
| | | } |
| | | }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | return new WebResponseContent { Status = false, Message = "é误信æ¯ï¼" + ex.Message }; |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// ç¶ææä¸¾ |
| | | /// </summary> |
| | | private enum Maint |