2025-08-15 15:36:40 +08:00

84 lines
2.7 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.Linq;
using System.Threading.Tasks;
using SWS.Commons;
using SWS.Model;
namespace SWS.Service
{
public class EnginedataService : HttpService
{
public EnginedataService() : base()
{
}
/// <summary>
/// 获取位号的pixel对象仅有位号.
/// 插件端的设计浏览处用到
/// </summary>
/// <param name="objectTypeID"></param>
/// <returns></returns>
public async Task<List<ec_enginedata_pixel>> GetTagPixelsById(string objectTypeID)
{
var res = await this.GetAsync<List<ec_enginedata_pixel>>($"EnginedataApi/GetTagPixelsById?projectId={GlobalObject.curProject.ProjectId}&EngineDataID={objectTypeID}");
if (res.code == 200)
{
return res.data;
}
else
{
return null;
}
}
/// <summary>
/// 批量的去判断位号是否存在
/// </summary>
/// <param name="tagNumber">位号</param>
/// <returns>true:有重复false:无重复</returns>
public async Task<bool> CheckTagsExist(string tagNumber, string objectTypeId)
{
List<string> listResult = new List<string>();
List<string> listTagNumber = new List<string>();
listTagNumber.Add($"{tagNumber},{objectTypeId}");
var res = await this.PostBodyAsync<List<string>, List<string>>($"EnginedataApi/CheckTagsExist?projId={GlobalObject.curProject?.ProjectId}", listTagNumber);
if (res.code == 200)
{
if (res.data.Any())
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
/// <summary>
/// 获取位号的pixel对象仅有位号.
/// 解锁、加锁
/// </summary>
/// <param name="Enginedataids">逗号分开</param>
/// <param name="action">加锁1或解锁0</param>
/// <returns></returns>
public async Task<string> LockTag(string Enginedataids, string action)
{
var res = await this.PostBodyAsync<object, object>($"EnginedataApi/LockTag?projectId={GlobalObject.curProject.ProjectId}&Enginedataids={Enginedataids}&action={action}", null);
if (res.code == 200 && res.info.ToUpper().Contains("OK"))
{
return "";
}
else
{
return res.info;
}
}
}
}