| | |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.BaseRepository; |
| | | using WIDESEAWCS_Core.BaseServices; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_DTO.Telescopic; |
| | | using WIDESEAWCS_ITaskInfoService; |
| | | using WIDESEAWCS_Model.Models; |
| | |
| | | /// </summary> |
| | | /// <param name="entity"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent AddAlarmHsy(string alarmContent, bool resetStatus) |
| | | public WebResponseContent AddAlarmHsy(int deptid,string alarmContent, bool resetStatus) |
| | | { |
| | | var alarm = new Dt_AlarmResetHsy |
| | | { |
| | | AlarmContent= alarmContent, |
| | | Deptid= deptid, |
| | | AlarmContent = alarmContent, |
| | | ResetStatus= resetStatus, |
| | | AlarmTime=DateTime.Now, |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | public WebResponseContent GetWebSocketInfo() |
| | | public WebResponseContent GetWebSocketInfo(int deptid) |
| | | { |
| | | try |
| | | { |
| | |
| | | // var query = Db.Queryable<Dt_AlarmResetHsy>() |
| | | // .OrderBy(x => new { ResetStatus = SqlFunc.IsNull(x.ResetStatus, false), x.CreateDate }, OrderByType.Desc); // 按 ResetStatus 为 true 排在前,并按 CreateDate 降序 |
| | | |
| | | var query = BaseDal.QueryData().OrderByDescending(x => x.ResetStatus). ThenByDescending(x => x.CreateDate); // 再按 CreateDate 降序; |
| | | var query = BaseDal.QueryData(x=>x.Deptid==deptid).OrderByDescending(x => x.ResetStatus). ThenByDescending(x => x.CreateDate); // 再按 CreateDate 降序; |
| | | |
| | | // 如果需要根据其他字段进行过滤或模糊查询,可以在此添加 |
| | | |
| | |
| | | /// </summary> |
| | | /// <param name="status"></param> |
| | | /// <returns></returns> |
| | | public WebResponseContent BecomeTrue(string account) |
| | | public WebResponseContent BecomeTrue() |
| | | { |
| | | //找到登入人的deptid |
| | | var loginer = _user.QueryFirst(x => x.UserName == account); |
| | | ////找到登入人的deptid |
| | | //var loginer = _user.QueryFirst(x => x.UserName == account); |
| | | if (!int.TryParse(AppSettings.Get("DepartmentID"), out int deid)) |
| | | { |
| | | return new WebResponseContent { Status = false, Message = "配置项 DepartmentID 无法转换为整数" }; |
| | | } |
| | | |
| | | var query = BaseDal.QueryData(x => x.ResetStatus == true && x.Deptid==loginer.Dept_Id ).ToList(); |
| | | var query = BaseDal.QueryData(x => x.ResetStatus == true && x.Deptid== deid).ToList(); |
| | | // 如果没有找到符合条件的数据 |
| | | if (query.Count == 0) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | public WebResponseContent DeleteAllinform() |
| | | { |
| | | try |
| | | { |
| | | |
| | | if (!int.TryParse(AppSettings.Get("DepartmentID"), out int deid)) //获取轨道站号 |
| | | { |
| | | Console.WriteLine("配置项 DepartmentID 无法转换为整数"); |
| | | } |
| | | //找到该轨道站的全部信息 |
| | | var alarm = BaseDal.QueryData(x => x.Deptid == deid).ToList(); |
| | | if (alarm.Count<=0) |
| | | { |
| | | return new WebResponseContent { Status = false, Message = $"没有要删除的{deid}轨道站的报警信息" }; |
| | | } |
| | | //找到后全部删除 |
| | | var reslut= BaseDal.DeleteData(alarm); |
| | | return new WebResponseContent { Status = true, Message = "删除成功", Data = reslut }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | |
| | | return new WebResponseContent { Status = false, Message = ex.Message }; |
| | | } |
| | | } |
| | | } |
| | | } |