009_DI-Elec/Learun.Application.Web/AppApi/WireGroupTemplateApiController.cs

62 lines
1.9 KiB
C#
Raw 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 Learun.Application.TwoDevelopment.ZZDT_EC;
using Learun.Util;
using System;
using System.Web.Http;
namespace Learun.Application.Web.AppApi
{
/// <summary>
/// 信号模板By ChenGT
/// </summary>
[HandlerApiLogin(FilterMode.Enforce)]
[TokenAuthorize]
public class WireGroupTemplateApiController : WebApiControllerBase
{
#region
private ec_Wire_Group_TemplateIBLL ec_Wire_Group_TemplateIBLL = new ec_Wire_Group_TemplateBLL();
#endregion
#region
/// <summary>
/// 标准库的信号模板列表不需要projId只有查项目级的才有意义
/// </summary>
/// <returns></returns>
[HttpGet]
public IHttpActionResult GetList()
{
try
{
var res = ec_Wire_Group_TemplateIBLL.GetList("{\"ProjectId\":\"\"}");
return Success(res);
}
catch (Exception ex)
{
return Fail(ex.Message);
}
}
/// <summary>
/// 初始化项目信号(从公司级的某个模板下的所有信号复制到项目级)
/// </summary>
/// <param name="WireGroupTemplateID">信号模板编号</param>
/// <param name="projId">项目编号</param>
/// <returns></returns>
[HttpPost]
public IHttpActionResult InitProjectWireGroupTemplate(string WireGroupTemplateID, string projId)
{
try
{
if (string.IsNullOrEmpty(projId.Trim()))
{
return Fail("请选择项目!");
}
ec_Wire_Group_TemplateIBLL.InitProjectWireGroupTemplate(WireGroupTemplateID, projId);
return Success("OK");
}
catch (Exception e)
{
return Fail(e.Message);
}
}
#endregion
}
}