102 lines
3.2 KiB
C#
102 lines
3.2 KiB
C#
|
using Learun.Application.Base.SystemModule;
|
|||
|
using Learun.Application.TwoDevelopment.ZZDT_EC;
|
|||
|
using Learun.Util;
|
|||
|
using Learun.Util.SqlSugar;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Web;
|
|||
|
using System.Web.Http;
|
|||
|
using System.Web.Http.Description;
|
|||
|
using System.Web.UI;
|
|||
|
|
|||
|
namespace Learun.Application.Web.AppApi
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
[RoutePrefix("api/CaseApi")]
|
|||
|
[HandlerApiLogin(FilterMode.Ignore)]
|
|||
|
[TokenAuthorize]
|
|||
|
public class CaseApiController : WebApiControllerBase
|
|||
|
{
|
|||
|
private ec_CaseBLL ec_CaseBLL;
|
|||
|
/// <summary>
|
|||
|
///
|
|||
|
/// </summary>
|
|||
|
public CaseApiController()
|
|||
|
{
|
|||
|
ec_CaseBLL = new ec_CaseBLL();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取所有的工况。
|
|||
|
/// </summary>
|
|||
|
/// <param name="ProjectId">空,或者0,则查询公司级</param>
|
|||
|
/// <returns></returns>
|
|||
|
[HttpGet]
|
|||
|
public IHttpActionResult GetCases(string ProjectId)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var res = ec_CaseBLL.GetList("{\"ProjectId\":\"" + ProjectId + "\"}");
|
|||
|
return Success(res);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return Fail(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 增、改负荷计算的大组。
|
|||
|
/// </summary>
|
|||
|
/// <param name="ProjectId">空,或者0,则查询公司级</param>
|
|||
|
/// <returns></returns>
|
|||
|
[HttpPost]
|
|||
|
public IHttpActionResult SaveLoadCatalogue(string ProjectId, string Id, string Name)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var dataItemBll = new ec_dataitemBLL();
|
|||
|
var existEnumList = dataItemBll.GetEntity(GlobalObject.enumlist_CaseCatalogue, ProjectId);
|
|||
|
if (existEnumList == null)
|
|||
|
{
|
|||
|
//新建这样一个
|
|||
|
existEnumList = new ec_dataitemEntity() { DataItemCode = GlobalObject.enumlist_CaseCatalogue, DataItemName = GlobalObject.enumlist_CaseCatalogue };
|
|||
|
dataItemBll.SaveEntity("", existEnumList, ProjectId);
|
|||
|
|
|||
|
existEnumList = dataItemBll.GetEntity(GlobalObject.enumlist_CaseCatalogue, ProjectId);
|
|||
|
}
|
|||
|
|
|||
|
var entity = new ec_dataitemdetailEntity() { DataItemID = existEnumList.DataItemID, DataItemCode = Name, DataItemName = Name, DataItemNameEN = Name, IsEnabled = 1 };
|
|||
|
|
|||
|
return Success("OK");
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return Fail(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 切换位号的当前case
|
|||
|
/// </summary>
|
|||
|
/// <param name="ProjectId"></param>
|
|||
|
/// <returns></returns>
|
|||
|
[HttpPost]
|
|||
|
public IHttpActionResult SwitchCase(string ProjectId, string NewCaseId, [FromBody] List<string> EngineDatas)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
var res = ec_CaseBLL.SwitchCase(ProjectId, EngineDatas, NewCaseId);
|
|||
|
return Success(res);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
{
|
|||
|
return Fail(ex.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|