CHEN-ZW\acer c76c8ada14 Merge branch 'main' of http://27.154.35.18:7053/yuxingheng/009_DI-Elec
# Conflicts:
#	newFront/c#前端/SWS.CAD/Commands.cs
#	newFront/c#前端/SWS.Electrical/obj/Debug/Views/DialogTest2.g.i.cs
#	newFront/c#前端/SWS.Electrical/obj/Debug/Views/SWSDialogWindow.g.cs
#	newFront/c#前端/SWS.Electrical/obj/Debug/Views/SWSDialogWindow.g.i.cs
#	newFront/c#前端/SWS.WPF/obj/Debug/Views/CustomDialogWindow.g.cs
#	newFront/c#前端/SWS.WPF/obj/Debug/Views/CustomDialogWindow.g.i.cs
2025-10-09 18:08:19 +08:00

92 lines
3.2 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections.Generic;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using SWS.Commons;
using SWS.Model;
using SWS.Share;
namespace SWS.Service
{
public class PDBService : HttpService
{
public PDBService() : base()
{
}
/// <summary>
/// 查询某个分电箱下的所有开关
/// </summary>
/// <param name="projId"></param>
/// <param name="PDBId">分电箱的工程ID EngineerDataID</param>
/// <returns></returns>
public async Task<ec_Panel> GetBreakers(string PDBId)
{
var res = await this.GetAsync<ec_Panel>($"PDBApi/GetBreakers?projId={GlobalObject.curProject.ProjectId}&PDBId={PDBId}");
if (res.code == 200)
{
return res.data;
}
else
{
return null;
}
}
/// <summary>
/// 批量保存增、改开关。传入集合。同时建立和rel。
/// 只会在开关箱界面里调用(新建)
/// </summary>
/// <param name="projId"></param>
/// <param name="PDBId">分电箱的工程ID</param>
/// <returns></returns>
public async Task<List<ec_CircuitBreaker>> SaveBreakers(string PDBId,List<ec_CircuitBreaker> circuitBreakers)
{
var res = await this.PostBodyAsync<List<ec_CircuitBreaker>, List<ec_CircuitBreaker>>($"PDBApi/SaveBreakers?projId={GlobalObject.curProject?.ProjectId}&PDBId={PDBId}", circuitBreakers);
if (res.code == 200)
{
//return res.info;
return res.data;
}
return null;
}
/// <summary>
/// 批量保存开关箱内部开关和电缆的关联关系(也属于<see cref="SaveBreakers(string, string)"/>的一部分)。
/// 设备和电缆的关联关系走的是RelApi下的那个SaveCableConn.
/// 开关箱管理界面里不用这个。绘制照明系统图会用到这个
/// </summary>
/// <param name="projId"></param>
/// <param name="Breakers">集合CableID和EngineerDataID</param>
/// <returns></returns>
public async Task<List<ec_CircuitBreaker>> SaveCableConn(List<ec_CircuitBreaker> Breakers)
{
var res = await this.PostBodyAsync<List<ec_CircuitBreaker>, List<ec_CircuitBreaker>>($"PDBApi/SaveCableConn?projId={GlobalObject.curProject?.ProjectId}", Breakers);
if (res.code == 200)
{
//return res.info;
return res.data;
}
return null;
}
/// <summary>
/// 删除开关
/// </summary>
/// <param name="projId"></param>
/// <param name="BreakerIDs">删除多个</param>
/// <returns></returns>
public async Task<string> Delete(string BreakerIDs)
{
var res = await this.PostBodyAsync<string, string>($"PDBApi/Delete?projId={GlobalObject.curProject?.ProjectId}&BreakerIDs={BreakerIDs}", null);
if (res.code == 200)
{
//return res.info;
return res.data;
}
return null;
}
}
}