using SWS.Commons; using SWS.Model; using System; using System.Collections.Generic; using System.Linq; using System.Net.Http; using System.Threading.Tasks; namespace SWS.CAD.Services { public class WireGroupService : HttpService { #region 辅助类 /// /// SaveSignals 专用 /// public class WireGroups { public string ID { get; set; } public List Signals { get; set; } } #endregion public WireGroupService() : base() { } /// /// 获取所有的信号 /// /// /// /// public async Task> GetSignals(string projId, bool Assigned) { var res = await this.GetAsync>($"WireGroupApi/GetSignals?projId={projId}&Assigned={Assigned}"); if (res.code == 200) { return res.data; } else { } return null; } /// /// 获取当前组可用的编码 /// /// /// public async Task GetNextAvailableSeq(string group) { var res = await this.GetAsync($"WireGroupApi/GetNextAvailableSeq?projId={GlobalObject.curProject?.ProjectId}&group={group}"); if (res.code == 200) { return res.info; } else { } return null; } /// /// 验证是否可以保存 /// /// /// public async Task CanSaveSignals(WireGroups entity ,Models.Action ActionType) { var res = await this.PostBodyAsync, WireGroups>($"WireGroupApi/CanSaveSignals?projId={GlobalObject.curProject?.ProjectId}&ActionType={ActionType}", entity); if (res.code == 200) { return "OK"; } else { return res.info; } } /// /// 保存 /// /// /// public async Task> SaveSignals(SWS.Model.WireGroups entity) { var res = await this.PostBodyAsync, Model.WireGroups>($"WireGroupApi/SaveSignals?projId={GlobalObject.curProject?.ProjectId}&mode=0", entity); if (res.code == 200) { return res.data; } else { } return null; } /// /// 查询信号信息 /// /// /// public async Task> GetNotification() { var res = await this.GetAsync>($"WireGroupApi/GetNotification?projId={GlobalObject.curProject?.ProjectId}"); if (res.code == 200) { return res.data; } else { } return null; } /// /// 查询信号历史 /// /// 项目ID /// 信号ID,多个用都逗号隔开 /// public async Task> GetSignalPropertyhis(string wireGroupIds) { var res = await this.GetAsync>($"WireGroupApi/GetSignalPropertyhis?projId={GlobalObject.curProject?.ProjectId}&wireGroupIds={wireGroupIds}"); if (res.code == 200) { return res.data; } else { } return null; } /// /// 查询信号日志 /// /// 项目ID /// 信号ID,多个用都逗号隔开 /// public async Task> GetSignalLogs(string wireGroupIds) { var res = await this.GetAsync>($"WireGroupApi/GetSignalLogs?projId={GlobalObject.curProject?.ProjectId}&wireGroupIds={wireGroupIds}"); if (res.code == 200) { return res.data; } else { } return null; } /// /// 读信号通知 /// /// /// public async Task> ReadNotification(List NoticeIds) { var res = await this.PostBodyAsync,List>($"WireGroupApi/ReadNotification?projId={GlobalObject.curProject?.ProjectId}", NoticeIds); if (res.code == 200) { return res.data; } else { } return null; } } }