111 lines
3.1 KiB
C#
111 lines
3.1 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Web.Http;
|
|||
|
using System.Web.Http.Description;
|
|||
|
using Learun.Application.Base.SystemModule;
|
|||
|
using Learun.Application.TwoDevelopment.ZZDT_EC;
|
|||
|
using Learun.Util;
|
|||
|
using log4net.Config;
|
|||
|
using NPOI.POIFS.Properties;
|
|||
|
using Pipelines.Sockets.Unofficial.Arenas;
|
|||
|
|
|||
|
namespace Learun.Application.Web.AppApi
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 平行电缆(By YuXH)(暂时没用)
|
|||
|
/// </summary>
|
|||
|
[HandlerApiLogin(FilterMode.Enforce)]
|
|||
|
[TokenAuthorize]
|
|||
|
public class ParallelCableApiController : WebApiControllerBase
|
|||
|
{
|
|||
|
|
|||
|
|
|||
|
#region 信號相關
|
|||
|
/// <summary>
|
|||
|
/// 查询
|
|||
|
/// </summary>
|
|||
|
/// <param name="projId"></param>
|
|||
|
/// <param name="cableId">如果为0或空,则查询所有。</param>
|
|||
|
/// <returns></returns>
|
|||
|
[HttpGet]
|
|||
|
public IHttpActionResult GetParalleCable(string projId, string cableId = "")
|
|||
|
{
|
|||
|
List<string> Ids = new List<string>();
|
|||
|
if (string.IsNullOrEmpty(cableId) || cableId == "0")
|
|||
|
{
|
|||
|
cableId = "";
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Ids = cableId.Split(',').ToList();
|
|||
|
}
|
|||
|
var res = new ec_parallel_CableService().GetList(projId, Ids);
|
|||
|
return Success(res);
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 批量保存(增、改)。传入ec_cable的集合
|
|||
|
/// </summary>
|
|||
|
/// <param name="projId"></param>
|
|||
|
/// <returns></returns>
|
|||
|
[HttpPost]
|
|||
|
public IHttpActionResult Save(string projId)
|
|||
|
{
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
var serv = new ec_parallel_CableService();
|
|||
|
var asyncContent = Request.Content.ReadAsStringAsync().Result;
|
|||
|
var entity = asyncContent.ToObject<List<ec_CableEntity>>();
|
|||
|
foreach (var c in entity)
|
|||
|
{
|
|||
|
foreach (var p in c.parallelCables)
|
|||
|
{
|
|||
|
var id = p.p_CableId;
|
|||
|
serv.SaveEntity(projId, ref id, p);
|
|||
|
p.p_CableId = id;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
return Success(entity);
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
|
|||
|
return Fail(e.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 移除某一个平行电缆
|
|||
|
/// </summary>
|
|||
|
/// <param name="projId"></param>
|
|||
|
/// <param name="pCableIds">删除多个,以逗号隔开</param>
|
|||
|
/// <returns></returns>
|
|||
|
[HttpPost]
|
|||
|
public IHttpActionResult Remove(string projId, string pCableIds)
|
|||
|
{
|
|||
|
|
|||
|
try
|
|||
|
{
|
|||
|
var serv = new ec_parallel_CableService();
|
|||
|
var IDs = pCableIds.Split(',');
|
|||
|
foreach (var Id in IDs)
|
|||
|
{
|
|||
|
serv.DeleteEntity(projId, Id);
|
|||
|
}
|
|||
|
|
|||
|
return Success("OK");
|
|||
|
}
|
|||
|
catch (Exception e)
|
|||
|
{
|
|||
|
|
|||
|
return Fail(e.Message);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|