66 lines
2.0 KiB
C#
66 lines
2.0 KiB
C#
using System.Collections.Generic;
|
||
using System.Threading.Tasks;
|
||
using SWS.Commons;
|
||
using SWS.Model;
|
||
|
||
namespace SWS.Service
|
||
{
|
||
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; // 返回错误信息
|
||
//}
|
||
return res;
|
||
}
|
||
}
|
||
}
|