2025-08-15 16:34:31 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Threading.Tasks;
|
2025-09-04 18:28:02 +08:00
|
|
|
|
using SWS.Commons;
|
|
|
|
|
using SWS.Model;
|
2025-08-15 16:34:31 +08:00
|
|
|
|
using Teigha.DatabaseServices;
|
|
|
|
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
|
|
|
|
|
|
|
|
|
|
namespace SWS.CAD.Services
|
|
|
|
|
{
|
|
|
|
|
public class DataItemService : HttpService
|
|
|
|
|
{
|
|
|
|
|
public DataItemService( ) : base()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<List<ec_dataitemdetail>> GetDetails(string itemCode)
|
|
|
|
|
{
|
|
|
|
|
var res = await this.GetAsync<List<ec_dataitemdetail>>($"DataItemApi/GetDetails?projectId={GlobalObject.curProject.ProjectId}&itemCode={itemCode}");
|
|
|
|
|
//OnRefresh();
|
|
|
|
|
if (res.code == 200)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return res.data;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return null;//ERROR INFO
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// (计量单位)根据计量单位分类ID获取计量单位数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name = "projectId" >项目ID</param >
|
|
|
|
|
/// <param name="measuringUnitTypeID">计量单位分类ID。如果是空,就是所有的</param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<List<ec_measuring_unit>> GetMeasuringUnitList()
|
|
|
|
|
{
|
|
|
|
|
var res = await this.GetAsync<List<ec_measuring_unit>>($"DataItemApi/GetMeasuringUnitList?projectId={GlobalObject.curProject.ProjectId}");
|
|
|
|
|
//OnRefresh();
|
|
|
|
|
if (res.code == 200)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return res.data;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return null;//ERROR INFO
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task<object> SaveDetailForm(ec_dataitemdetail entity)
|
|
|
|
|
{
|
|
|
|
|
var res = await this.PostBodyAsync<ec_dataitemdetail, ec_dataitemdetail>($"DataItemApi/SaveDetailForm?ProjectId={GlobalObject.curProject?.ProjectId}", entity);
|
|
|
|
|
if (res.code == 200)
|
|
|
|
|
{
|
|
|
|
|
//return res.info;
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return res.info; // 返回错误信息
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|