using SWS.CAD.Models; using SWS.CAD.Models.NoEntity; using SWS.Commons; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Runtime.InteropServices; using System.Threading.Tasks; using System.Windows.Markup; namespace SWS.CAD.Services { public class NotificationService : HttpService { public NotificationService() : base() { } /// /// /// /// 0接收到的信息,1发出去的信息 /// public async Task> GetUserAllNotification(int mode = 0) { var projectid = GlobalObject.curProject == null ? "" : GlobalObject.curProject.ProjectId; var res = await this.GetAsync>($"NotificationApi/GetUserAllNotification?ProjectId={projectid}&User={GlobalObject.userInfo.account}&mode={mode}"); if (res.code == 200) { if (res.data == null) { return new List(); } //res.data = res.data.Where(x => x.RetrieveUserID.ToUpper() != x.SenderUserID.ToUpper()).ToList(); return res.data; } else { } return new List(); ; } #region 提交已读 /// /// 提交已读 /// /// /// public async Task SubmitUnread(string IDs) { var res = await this.GetAsync($"NotificationApi/ApproveNofity?ProjectId={GlobalObject.curProject.ProjectId}&IDs={IDs}"); ; if (res.info == "OK") { return true; } else { } return false; } #endregion /// /// 获取所有图纸,需要生产确认的检入记录 /// /// public async Task>> GetCheckInLogNeedApprove() { try { string url = $"NotificationApi/GetCheckInLogNeedApprove?projectId={GlobalObject.curProject?.ProjectId}"; var res = await this.GetAsync>>(url); if (res.code == 200) { return res.data; } else { string errorMsg = $"获取检入审核记录失败,信息:{res.info}"; LoggerHelper.Current.Error(errorMsg); return null; } } catch (Exception ex) { string errorMsg = $"获取检入审核记录失败:{ex.Message}"; LoggerHelper.Current.Error(errorMsg); return null; } } /// /// 批量确认捡入记录里需要生产主管确认的 /// /// public async Task ApproveCheckInLog(string IDs) { try { string url = $"NotificationApi/ApproveCheckInLog?projectId={GlobalObject.curProject?.ProjectId}&userId={GlobalObject.userInfo.userId}&IDs={IDs}"; var res = await this.GetAsync(url); if (res.code == 200 && res.info.ToUpper().Contains("OK")) { return ""; } else { string errorMsg = $"获取检入批量审核失败,信息:{res.info}"; LoggerHelper.Current.Error(errorMsg); return null; } } catch (Exception ex) { string errorMsg = $"获取检入批量审核失败:{ex.Message}"; LoggerHelper.Current.Error(errorMsg); return null; } } } }