0904
This commit is contained in:
parent
0a1f2c458d
commit
7e3a51b8b0
@ -4,7 +4,7 @@ using Learun.Application.TwoDevelopment.ZZDT_EC;
|
||||
using Learun.Loger;
|
||||
using Learun.Util;
|
||||
using Learun.Util.SqlSugar;
|
||||
using log4net.Config;
|
||||
using log4net.Config;
|
||||
using Microsoft.Practices.ObjectBuilder2;
|
||||
using Newtonsoft.Json;
|
||||
using Org.BouncyCastle.Bcpg.OpenPgp;
|
||||
@ -104,7 +104,7 @@ namespace Learun.Application.Web.AppApi
|
||||
nodeCatalogue.NodeExtData = Loc;
|
||||
treeList.Add(nodeCatalogue);
|
||||
|
||||
var listPanel = Panels.Where(x => x.Panel_Loc_ID == Loc.DataItemDetailID && x.systempanel == specialType.系统柜.ToString()).ToList();
|
||||
var listPanel = Panels.Where(x => x.Panel_Loc_ID == Loc.DataItemDetailID && x.systempanel == GlobalEnum.specialType.系统柜.ToString()).ToList();
|
||||
if (listPanel != null && listPanel.Count > 0)
|
||||
{
|
||||
foreach (var Panel in listPanel)
|
||||
@ -236,6 +236,85 @@ namespace Learun.Application.Web.AppApi
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 自动分配通道(点表信号自动分配)
|
||||
/// </summary>
|
||||
/// <param name="projId"></param>
|
||||
/// <param name="AcceptUnmatchedPanel">如果没有匹配的采集箱,则提示“未找到具有XX类型的采集箱,请新增后再次分配,是否取消自动分配进程?</param>
|
||||
/// <returns></returns>
|
||||
public IHttpActionResult AutoAssignCable2Channel(string projId, bool AcceptUnmatchedPanel)
|
||||
{
|
||||
#region 数据准备
|
||||
var cbll = new ec_CableBLL();
|
||||
var panelTable = ProjectSugar.TableName<ec_PanelEntity>(projId);
|
||||
var stripTable = ProjectSugar.TableName<ec_PanelStripEntity>(projId);
|
||||
#endregion
|
||||
#region 先要知道有哪些待分配的信号
|
||||
|
||||
var cablesNeedAssigned = cbll.GetCablesPreAssign(projId, true);
|
||||
|
||||
#endregion
|
||||
//涉及到哪些箱子
|
||||
var panelsNeed = SqlSugarHelper.Db.Queryable<ec_PanelEntity>().AS(panelTable).
|
||||
Where(x => cablesNeedAssigned.Select(xx => xx.PanelID).Contains(x.PanelID)).ToList();
|
||||
var stripsNeed = SqlSugarHelper.Db.Queryable<ec_PanelStripEntity>().AS(stripTable).
|
||||
Where(x => panelsNeed.Select(xx => xx.PanelID).Contains(x.PanelID)).
|
||||
ToList();
|
||||
#region 1.1判断(信号预分配选择的采集箱可能并没有该电缆需要的信号类型)
|
||||
var cablesNotMatchIO = cablesNeedAssigned.Where(x => !x.IOTypeMatch).ToList(); // GetCablesPreAssign 查询时已经处理过io是否匹配了
|
||||
if (cablesNotMatchIO != null && cablesNotMatchIO.Count > 0)
|
||||
{
|
||||
if (!AcceptUnmatchedPanel)//允许进行
|
||||
{
|
||||
//???
|
||||
}
|
||||
else
|
||||
{
|
||||
//不继续自动分配,中断进程,等添加完正确的模块后再继续自动分配
|
||||
return Fail("等电缆的预分配IO类型和其预分配的采集箱的IO类型无法匹配。等添加完正确的模块后再继续自动分配。");
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 1.2
|
||||
#region 先分组 1.2.2
|
||||
cablesNeedAssigned = cablesNeedAssigned.OrderBy(x => new { x.PreAssignIOType, x.System, x.PanelID }).ToList();
|
||||
var curPanel = new ec_PanelEntity();
|
||||
curPanel = panelsNeed.FirstOrDefault(x => x.PanelID == cablesNeedAssigned[0].PanelID);//先定位到第一个电缆所在的箱子
|
||||
curPanel.strips = stripsNeed.Where(x => x.PanelID == curPanel.PanelID).ToList();
|
||||
var curStrip = new ec_PanelStripEntity();
|
||||
#endregion
|
||||
for (var i = 0; i < cablesNeedAssigned.Count; i++)
|
||||
{
|
||||
|
||||
#region 是否有端子排 1.2.1
|
||||
if (curPanel.PanelID != cablesNeedAssigned[i].PanelID)
|
||||
{
|
||||
curPanel = panelsNeed.FirstOrDefault(x => x.PanelID == cablesNeedAssigned[0].PanelID);//切换箱子
|
||||
curPanel.strips = stripsNeed.Where(x => x.PanelID == curPanel.PanelID).ToList();
|
||||
}
|
||||
foreach (var set in cablesNeedAssigned[i].Sets)
|
||||
{
|
||||
var availableStrips = curPanel.strips.Where(x => x.IO_TYPE.ToUpper() == set.IOType.ToString().ToUpper()).ToList();
|
||||
|
||||
if (availableStrips != null && availableStrips.Count > 0)
|
||||
{
|
||||
//已经存在端子排
|
||||
}
|
||||
else
|
||||
{
|
||||
//没有端子排,根据信号数里自动新建端子排,通道数里根据端子io模板的默认值获得
|
||||
//?????????????????????????????????
|
||||
}
|
||||
}
|
||||
可能要换一下循环主体,评估下是按照cable循环好,还是按strip循环好
|
||||
#endregion
|
||||
|
||||
}
|
||||
#endregion
|
||||
return Success("自动关联完成");
|
||||
}
|
||||
/// <summary>
|
||||
/// 把电缆分配到空余的模块的通道上。
|
||||
/// </summary>
|
||||
/// <param name="projId"></param>
|
||||
@ -256,48 +335,10 @@ namespace Learun.Application.Web.AppApi
|
||||
[HttpGet]
|
||||
public IHttpActionResult GetCablePreAssignPreview(string projId)
|
||||
{
|
||||
var table = ProjectSugar.TableName<ec_CableEntity>(projId);
|
||||
var tagTable = ProjectSugar.TableName<ec_enginedataEntity>(projId);
|
||||
var panelTable = ProjectSugar.TableName<ec_PanelEntity>(projId);
|
||||
var setServ = new ec_CableSetService();
|
||||
var wireServ = new ec_CableSetWireService();
|
||||
var preAssignedCables = SqlSugarHelper.Db.Queryable<ec_CableEntity>().AS(table).Where(x => !string.IsNullOrEmpty(x.PanelID)).ToList();
|
||||
var tags = SqlSugarHelper.Db.Queryable<ec_enginedataEntity>().AS(tagTable).
|
||||
Where(x => preAssignedCables.Select(xx => xx.EngineerDataID).Contains(x.EngineDataID)).ToList();
|
||||
var bll = new ec_CableBLL();
|
||||
var res = bll.GetCablesPreAssign(projId);
|
||||
|
||||
var panels = SqlSugarHelper.Db.Queryable<ec_PanelEntity>().AS(panelTable).
|
||||
Where(x => preAssignedCables.Select(xx => xx.PanelID).Contains(x.PanelID)).ToList();
|
||||
var panelTags = SqlSugarHelper.Db.Queryable<ec_enginedataEntity>().AS(tagTable).
|
||||
Where(x => panels.Select(xx => xx.EngineerDataID).Contains(x.EngineDataID)).ToList();
|
||||
foreach (var cable in preAssignedCables)
|
||||
{
|
||||
var sets = setServ.GetList(projId, cable.CableID);
|
||||
var Wires = wireServ.GetList(projId, cable.CableID, "");
|
||||
|
||||
|
||||
//剩下的感觉都可以是set上的参数?
|
||||
foreach (var set in sets)
|
||||
{
|
||||
var wires = Wires.Where(x => x.CableSetID == set.CableSetID);
|
||||
set.Wires = wires.ToList();
|
||||
}
|
||||
cable.Sets = sets;
|
||||
|
||||
|
||||
cable.TagNumber = tags.FirstOrDefault(x => x.EngineDataID == cable.EngineerDataID)?.TagNumber;
|
||||
|
||||
var panelObj = panels.FirstOrDefault(x => x.PanelID == cable.PanelID);
|
||||
if (panelObj != null)
|
||||
{
|
||||
panelObj.TagNumber = panelTags.FirstOrDefault(x => x.EngineDataID == panelObj.EngineerDataID)?.TagNumber;
|
||||
}
|
||||
|
||||
cable.ToPanel = panelObj;
|
||||
}
|
||||
|
||||
//分组
|
||||
preAssignedCables = preAssignedCables.OrderBy(x => x.PreAssignIOType).ToList();
|
||||
return Success(preAssignedCables);
|
||||
return Success(res);
|
||||
|
||||
|
||||
}
|
||||
|
@ -70,6 +70,7 @@ namespace Learun.Application.Web.AppApi
|
||||
var res = new ec_Wire_GroupBLL(projId).GetList("{ProjectId:\"" + projId + "\"}", Assigned, false, true);
|
||||
return Success(res);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取信号组信息,用于输出点落实信息(暂时)
|
||||
/// </summary>
|
||||
@ -95,15 +96,15 @@ namespace Learun.Application.Web.AppApi
|
||||
var approvedCount = group.Sub.Where(y => y.Status == WireGroupStatusEnum.Confirmed).Count();
|
||||
if (approvedCount == 0)
|
||||
{
|
||||
group.status = signalGroupStatusEnum.未核对;
|
||||
group.status = GlobalEnum.signalGroupStatusEnum.未核对;
|
||||
}
|
||||
else if (approvedCount == group.Sub.Count)
|
||||
{
|
||||
group.status = signalGroupStatusEnum.已落实;
|
||||
group.status = GlobalEnum.signalGroupStatusEnum.已落实;
|
||||
}
|
||||
else
|
||||
{
|
||||
group.status = signalGroupStatusEnum.沟通中;
|
||||
group.status =GlobalEnum.signalGroupStatusEnum.沟通中;
|
||||
}
|
||||
res.Add(group);
|
||||
}
|
||||
|
@ -69,8 +69,13 @@ namespace Learun.Application.Web
|
||||
mappedPort = (14000 + req.RequestUri.Port).ToString();
|
||||
return "http://" + req.RequestUri.Host + ":" + mappedPort;
|
||||
}
|
||||
|
||||
else if (req.RequestUri.ToString().Contains("server.211002.xyz"))
|
||||
{
|
||||
return "http://" + req.RequestUri.Host + ":" + "15001";//彬总服务器给的公网端口
|
||||
}
|
||||
else if (req.RequestUri.ToString().Contains("27.154.35.18"))
|
||||
{
|
||||
{
|
||||
return "http://" + req.RequestUri.Host + ":" + "7044";//彬总服务器给的公网端口
|
||||
}
|
||||
else
|
||||
|
@ -8,6 +8,71 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
{
|
||||
public class GlobalEnum
|
||||
{
|
||||
#region 自动分配、预分配、io模块模板有关
|
||||
public enum inOrOut
|
||||
{
|
||||
输入 = 0,
|
||||
输出 = 1
|
||||
}
|
||||
/// <summary>
|
||||
/// 电缆预分配时,会选择的信号类型。通讯和非通讯(digital等几个)
|
||||
/// </summary>
|
||||
public enum signalType
|
||||
{
|
||||
/// <summary>
|
||||
/// 数字量
|
||||
/// </summary>
|
||||
Digital = 1,
|
||||
/// <summary>
|
||||
/// 模拟量 4-20mA等
|
||||
/// </summary>
|
||||
Analog = 2,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
TenVolt = 3,
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
PT100 = 4,
|
||||
PULSE
|
||||
}
|
||||
/// <summary>
|
||||
/// 端子排上的IO类型
|
||||
/// </summary>
|
||||
public enum IOType
|
||||
{
|
||||
DI = 0,
|
||||
DO,
|
||||
AI,
|
||||
AO,
|
||||
PT100,
|
||||
PULSE,
|
||||
TenVolt,
|
||||
LAN,
|
||||
/// <summary>
|
||||
/// 485 422
|
||||
/// </summary>
|
||||
RS485,
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 对象类型上特殊的一些分类。对应<see cref="ec_objecttypeEntity.specialType"/>
|
||||
/// </summary>
|
||||
public enum specialType
|
||||
{
|
||||
未定义 = 0,
|
||||
电力一次 = 1,
|
||||
电力二次 = 2,
|
||||
系统柜 = 3,
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 用于<see cref="ec_enginedataEntity.DataStatus"/>
|
||||
/// </summary>
|
||||
public enum TagDataStatus
|
||||
{
|
||||
外部 = 00001,
|
||||
@ -15,5 +80,23 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
有效 = 00003,
|
||||
导入 = 00004
|
||||
}
|
||||
/// <summary>
|
||||
/// 用于 信号组别的状态<see cref="signalGroup.status"/>
|
||||
/// </summary>
|
||||
public enum signalGroupStatusEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// 待删除
|
||||
/// </summary>
|
||||
未核对 = 01,
|
||||
/// <summary>
|
||||
/// 新增的
|
||||
/// </summary>
|
||||
沟通中 = 02,
|
||||
/// <summary>
|
||||
/// 已关联
|
||||
/// </summary>
|
||||
已落实 = 03
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,12 +5,12 @@ using System.Collections.Generic;
|
||||
namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
|
||||
{
|
||||
public enum BreakerType
|
||||
{
|
||||
ACB = 1,
|
||||
MCCB = 2,
|
||||
MCB = 3
|
||||
}
|
||||
//public enum BreakerType
|
||||
//{
|
||||
// ACB = 1,
|
||||
// MCCB = 2,
|
||||
// MCB = 3
|
||||
//}
|
||||
/// <summary>
|
||||
/// 创 建:YuXH
|
||||
/// 日 期:2024-08-09 15:32
|
||||
|
@ -7,7 +7,7 @@ using System.ComponentModel;
|
||||
namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
{
|
||||
/// <summary>
|
||||
/// 信号组别
|
||||
/// 信号组别(后续考虑单独开一个表,而不是现在的ec_dataitem)
|
||||
/// </summary>
|
||||
public class signalGroup
|
||||
{
|
||||
@ -20,25 +20,11 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
public string Code { get; set; }
|
||||
public string Id { get; set; }
|
||||
|
||||
public signalGroupStatusEnum status { get; set; }
|
||||
public GlobalEnum.signalGroupStatusEnum status { get; set; }
|
||||
|
||||
public List<ec_Wire_GroupEntity> Sub = new List<ec_Wire_GroupEntity>();
|
||||
}
|
||||
public enum signalGroupStatusEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// 待删除
|
||||
/// </summary>
|
||||
未核对 = 01,
|
||||
/// <summary>
|
||||
/// 新增的
|
||||
/// </summary>
|
||||
沟通中 = 02,
|
||||
/// <summary>
|
||||
/// 已关联
|
||||
/// </summary>
|
||||
已落实 = 03
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ using Learun.Util;
|
||||
using Learun.Util.SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
|
||||
@ -166,12 +167,14 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 预览所有有信号预分配的电缆信息
|
||||
/// 预分配情况下的电缆set wire数据
|
||||
/// </summary>
|
||||
/// <param name="ProjID"></param>
|
||||
/// <param name="EngineerDataID"></param>
|
||||
/// <returns></returns>
|
||||
public ec_CableEntity CablePreAssignPreview(string ProjID)
|
||||
public ec_CableEntity GetCablePreAssign(string ProjID, string EngineerDataID)
|
||||
{
|
||||
var engineerDataServ = new ec_enginedataService();
|
||||
var panelServ = new ec_PanelService();
|
||||
@ -187,14 +190,12 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
return null;
|
||||
}
|
||||
|
||||
var res = ec_CableService.GetList("{ProjectId:\"" + ProjID + "\"}").FirstOrDefault(); //电缆
|
||||
var res = ec_CableService.GetList("{ProjectId:\"" + ProjID + "\",EngineerDataID:\"" + EngineerDataID + "\"}").FirstOrDefault(); //电缆
|
||||
if (res != null)
|
||||
{
|
||||
var sets = ec_CableSetService.GetList(ProjID, res.CableID);
|
||||
var Wires = ec_CableSetWireService.GetList(ProjID, res.CableID, "");
|
||||
|
||||
Console.WriteLine(res.CableClass);//是否通讯信号
|
||||
Console.WriteLine(res.PreAssignIOType);//通讯类型
|
||||
|
||||
//剩下的感觉都可以是set上的参数?
|
||||
foreach (var set in sets)
|
||||
@ -219,53 +220,132 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
#region 还没有预配置
|
||||
#endregion
|
||||
}
|
||||
public ec_CableEntity GetCablePreAssign(string ProjID, string EngineerDataID)
|
||||
|
||||
public List<ec_CableEntity> GetCablesPreAssign(string projId, bool needProp = false)
|
||||
{
|
||||
var engineerDataServ = new ec_enginedataService();
|
||||
var panelServ = new ec_PanelService();
|
||||
var panelStripBll = new ec_PanelStripBLL();
|
||||
var panelStripServ = new ec_PanelStripService();
|
||||
var termServ = new ec_PanelStripTermBLL();
|
||||
var channelServ = new ec_PanelChannelService();
|
||||
var table = ProjectSugar.TableName<ec_CableEntity>(projId);
|
||||
var tagTable = ProjectSugar.TableName<ec_enginedataEntity>(projId);
|
||||
var panelTable = ProjectSugar.TableName<ec_PanelEntity>(projId);
|
||||
var propTable = ProjectSugar.TableName<ec_enginedata_propertyEntity>(projId);
|
||||
var relTable = ProjectSugar.TableName<ec_enginedata_relEntity>(projId);
|
||||
|
||||
var ProjectEntity = new ec_projectEntity();
|
||||
ProjectEntity = new ec_projectBLL().GetEntity(ProjID);
|
||||
if (ProjectEntity == null)
|
||||
var setServ = new ec_CableSetService();
|
||||
var wireServ = new ec_CableSetWireService();
|
||||
//先查出所有已经预分配的电缆
|
||||
var preAssignedCables = SqlSugarHelper.Db.Queryable<ec_CableEntity>().AS(table).
|
||||
Where(x => !string.IsNullOrEmpty(x.PanelID)).ToList();
|
||||
var tags = SqlSugarHelper.Db.Queryable<ec_enginedataEntity>().AS(tagTable).
|
||||
Where(x => preAssignedCables.Select(xx => xx.EngineerDataID).Contains(x.EngineDataID)).ToList();
|
||||
var allpropOnFrom = new List<ec_enginedata_propertyEntity>();
|
||||
|
||||
var panels = SqlSugarHelper.Db.Queryable<ec_PanelEntity>().AS(panelTable).
|
||||
Where(x => preAssignedCables.Select(xx => xx.PanelID).Contains(x.PanelID)).ToList();
|
||||
var panelTags = SqlSugarHelper.Db.Queryable<ec_enginedataEntity>().AS(tagTable).
|
||||
Where(x => panels.Select(xx => xx.EngineerDataID).Contains(x.EngineDataID)).ToList();
|
||||
if (needProp)
|
||||
{
|
||||
return null;
|
||||
var FromRels = SqlSugarHelper.Db.Queryable<ec_enginedata_relEntity>().AS(relTable).
|
||||
Where(x => preAssignedCables.Select(y => y.EngineerDataID).Contains(x.RelEngineData2ID)
|
||||
&& x.RelTypeID == ((int)enum_RelType.设备_电缆).ToString()).ToList();
|
||||
allpropOnFrom = SqlSugarHelper.Db.Queryable<ec_enginedata_propertyEntity>().AS(propTable).
|
||||
Where(x => FromRels.Select(xx => xx.RelEngineData2ID).Distinct().Contains(x.EngineDataID)).ToList();
|
||||
}
|
||||
|
||||
var res = ec_CableService.GetList("{ProjectId:\"" + ProjID + "\",EngineerDataID:\"" + EngineerDataID + "\"}").FirstOrDefault(); //电缆
|
||||
if (res != null)
|
||||
foreach (var cable in preAssignedCables)
|
||||
{
|
||||
var sets = ec_CableSetService.GetList(ProjID, res.CableID);
|
||||
var Wires = ec_CableSetWireService.GetList(ProjID, res.CableID, "");
|
||||
var sets = setServ.GetList(projId, cable.CableID);
|
||||
var Wires = wireServ.GetList(projId, cable.CableID, "");
|
||||
|
||||
Console.WriteLine(res.CableClass);//是否通讯信号
|
||||
Console.WriteLine(res.PreAssignIOType);//通讯类型
|
||||
|
||||
|
||||
|
||||
cable.TagNumber = tags.FirstOrDefault(x => x.EngineDataID == cable.EngineerDataID)?.TagNumber;
|
||||
var panelObj = panels.FirstOrDefault(x => x.PanelID == cable.PanelID);
|
||||
if (panelObj == null)
|
||||
{
|
||||
continue;//分配就已经不合理了
|
||||
}
|
||||
else if (panelObj != null)
|
||||
{
|
||||
panelObj.TagNumber = panelTags.FirstOrDefault(x => x.EngineDataID == panelObj.EngineerDataID)?.TagNumber;
|
||||
|
||||
//1.2.1 系统属性从电缆的from端上的设备中取设备的系统
|
||||
cable.System = allpropOnFrom.FirstOrDefault(x => x.EngineDataID == cable.PanelID && x.PropertyName == GlobalObject.propName_System)?.PropertyValue;
|
||||
|
||||
|
||||
}
|
||||
|
||||
cable.ToPanel = panelObj;
|
||||
var IOsOnPanel = panelObj.allowedIOTypes.Split(',').ToList();
|
||||
//剩下的感觉都可以是set上的参数?
|
||||
foreach (var set in sets)
|
||||
{
|
||||
{
|
||||
#region 判断下io匹配程度
|
||||
if (set.PreAssignInOrOut == GlobalEnum.inOrOut.输入.ToString() && cable.PreAssignIOType.ToLower() == "digital")
|
||||
{
|
||||
set.IOType = GlobalEnum.IOType.DI;
|
||||
}
|
||||
else if (set.PreAssignInOrOut == GlobalEnum.inOrOut.输出.ToString() && cable.PreAssignIOType.ToLower() == "digital")
|
||||
{
|
||||
set.IOType = GlobalEnum.IOType.DO;
|
||||
}
|
||||
else if (set.PreAssignInOrOut == GlobalEnum.inOrOut.输入.ToString() && cable.PreAssignIOType == "4~20mA")
|
||||
{
|
||||
set.IOType = GlobalEnum.IOType.AI;
|
||||
}
|
||||
else if (set.PreAssignInOrOut == GlobalEnum.inOrOut.输出.ToString() && cable.PreAssignIOType == "4~20mA")
|
||||
{
|
||||
set.IOType = GlobalEnum.IOType.AO;
|
||||
}
|
||||
else if (cable.PreAssignIOType == "10v")
|
||||
{
|
||||
set.IOType = GlobalEnum.IOType.TenVolt;
|
||||
}
|
||||
else if (cable.PreAssignIOType == GlobalEnum.IOType.PT100.ToString())
|
||||
{
|
||||
set.IOType = GlobalEnum.IOType.PT100;
|
||||
}
|
||||
else if (cable.PreAssignIOType.ToUpper() == GlobalEnum.IOType.PULSE.ToString())
|
||||
{
|
||||
set.IOType = GlobalEnum.IOType.PULSE;
|
||||
}
|
||||
else if (cable.PreAssignIOType == GlobalEnum.IOType.PT100.ToString())
|
||||
{
|
||||
set.IOType = GlobalEnum.IOType.PT100;
|
||||
}
|
||||
//下面是通讯的
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (IOsOnPanel.Contains(set.IOType.ToString()))
|
||||
{
|
||||
set.IOTypeMatch = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
set.IOTypeMatch = false;
|
||||
}
|
||||
#endregion
|
||||
var wires = Wires.Where(x => x.CableSetID == set.CableSetID);
|
||||
set.Wires = wires.ToList();
|
||||
}
|
||||
res.Sets = sets;
|
||||
//除了端子号
|
||||
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
//还没有电缆规格的实体,自然肯定也没有预配置
|
||||
return null;//由客户端根据当前电缆规格来渲染布局,然后保存时进行新建set wire和其他的预分配的内容
|
||||
cable.Sets = sets;
|
||||
if (cable.Sets.Any(x => !x.IOTypeMatch))
|
||||
{
|
||||
cable.IOTypeMatch = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
cable.IOTypeMatch = false;
|
||||
}
|
||||
}
|
||||
|
||||
#region 已经有了预配置
|
||||
#endregion
|
||||
//分组
|
||||
preAssignedCables = preAssignedCables.OrderBy(x => x.PreAssignIOType).ToList();
|
||||
|
||||
#region 还没有预配置
|
||||
#endregion
|
||||
|
||||
return preAssignedCables;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
@ -47,8 +47,9 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
/// Digital 4-20mA Pulse Pt100(如果是非母线,IO类型是什么。)
|
||||
/// </summary>
|
||||
public string PreAssignIOType { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 电缆预分配时,必须指定它应该在哪个IO柜子
|
||||
/// 电缆预分配时,必须指定它应该在哪个IO柜子。所以这个不为空,就说明是预分配的电缆。
|
||||
/// </summary>
|
||||
public string PanelID { get; set; }
|
||||
/// <summary>
|
||||
@ -101,6 +102,11 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
|
||||
#region 扩展字段
|
||||
/// <summary>
|
||||
/// <see cref="PreAssignIOType"/> 是否和 <see cref="ec_PanelEntity.allowedIOTypes"/> 里的匹配。
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public bool IOTypeMatch { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
@ -129,16 +135,20 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string TagNumber { set; get; }
|
||||
|
||||
/// <summary>
|
||||
/// 电缆所在的From端设备的所在的system
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string System { set; get; }
|
||||
/// <summary>
|
||||
/// From连接处的工程位号信息
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public ec_PanelEntity FromPanel { set; get; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// From连接处的工程位号信息(
|
||||
/// From连接处的工程位号信息。同时,也表达下预分配电缆panelid对应的柜子信息。
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public ec_PanelEntity ToPanel { set; get; }
|
||||
|
@ -129,6 +129,16 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
|
||||
#region 扩展字段
|
||||
/// <summary>
|
||||
/// 根据<see cref="PreAssignInOrOut"/> 和 <see cref="PreAssignIOTypeDetail"/> 算出来的(比如4-20mA + 输入)得到AI
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public GlobalEnum.IOType IOType { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public bool IOTypeMatch { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
|
@ -454,7 +454,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
}
|
||||
|
||||
var objectType = new ec_objecttypeBLL().GetEntity(item.ObjectTypeID, ProjectId);
|
||||
if (objectType != null && objectType.specialType == specialType.系统柜)
|
||||
if (objectType != null && objectType.specialType == GlobalEnum.specialType.系统柜)
|
||||
{
|
||||
//如果对象类型属于特定的panel类
|
||||
var newPanel = new ec_PanelEntity();
|
||||
|
@ -114,7 +114,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
{
|
||||
TreeModel nodeCatalogue = new TreeModel();
|
||||
nodeCatalogue.id = item.ObjectTypeID;
|
||||
if (item.specialType == specialType.电力一次)
|
||||
if (item.specialType == GlobalEnum.specialType.电力一次)
|
||||
{
|
||||
nodeCatalogue.text = item.ObjectTypeName + "(电力一次系统)";
|
||||
item.ObjectTypeName = item.ObjectTypeName + "(电力一次系统)";
|
||||
|
@ -51,7 +51,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
/// 特殊类型
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public specialType specialType { get; set; }
|
||||
public GlobalEnum.specialType specialType { get; set; }
|
||||
/// <summary>
|
||||
/// 对象类型名称
|
||||
/// </summary>
|
||||
@ -120,7 +120,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
/// </summary>
|
||||
public void Create()
|
||||
{
|
||||
this.specialType = specialType.未定义;
|
||||
this.specialType = GlobalEnum.specialType.未定义;
|
||||
this.ObjectTypeID = Guid.NewGuid().ToString();
|
||||
this.CreateTime = Time.MySqlTime;
|
||||
UserInfo userInfo = LoginUserInfo.Get();
|
||||
@ -181,12 +181,6 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
#endregion
|
||||
}
|
||||
|
||||
public enum specialType
|
||||
{
|
||||
未定义 = 0,
|
||||
电力一次 = 1,
|
||||
电力二次 = 2,
|
||||
系统柜 = 3,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user