Merge branch 'main' of http://27.154.35.18:7053/yuxingheng/009_DI-Elec
This commit is contained in:
commit
d88f2c2654
@ -454,7 +454,9 @@ namespace Learun.Application.Web.AppApi
|
|||||||
[HttpGet]
|
[HttpGet]
|
||||||
public void AutoAssignCable2Channel_ResExport(string projectId, bool flg)
|
public void AutoAssignCable2Channel_ResExport(string projectId, bool flg)
|
||||||
{
|
{
|
||||||
var BLL = new ec_Wire_GroupBLL();
|
ICache redisObj = CacheFactory.CaChe();
|
||||||
|
var cablesNeedAssigned = redisObj.Read<List<ec_CableEntity>>("IOModule_AutoAssign2Ch_" + projectId, CacheId.IOModule_AutoAssign2Ch);
|
||||||
|
var PanelAssigned = redisObj.Read<List<ec_PanelEntity>>("IOModule_AutoAssign2ChByPanel_" + projectId, CacheId.IOModule_AutoAssign2Ch);
|
||||||
var bytes = new byte[] { };
|
var bytes = new byte[] { };
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -462,8 +464,67 @@ namespace Learun.Application.Web.AppApi
|
|||||||
|
|
||||||
using (var package = new ExcelPackage())//新建
|
using (var package = new ExcelPackage())//新建
|
||||||
{
|
{
|
||||||
var sheet = package.Workbook.Worksheets.Add("test");
|
var sheet = package.Workbook.Worksheets.Add("已经分配的");
|
||||||
sheet.Cells[1, 1].Value = "test";
|
sheet.Cells[1, 1].Value = "电缆位号";
|
||||||
|
sheet.Cells[1, 2].Value = "电缆对";
|
||||||
|
sheet.Cells[1, 3].Value = "信号类型";
|
||||||
|
sheet.Cells[1, 4].Value = "预分配箱子";
|
||||||
|
sheet.Cells[1, 5].Value = "实际分配箱子";
|
||||||
|
sheet.Cells[1, 6].Value = "实际分配端子排";
|
||||||
|
sheet.Cells[1, 7].Value = "备注";
|
||||||
|
int rowIdx = 2;
|
||||||
|
#region ByCable
|
||||||
|
foreach (var cable in cablesNeedAssigned)
|
||||||
|
{
|
||||||
|
sheet.Cells[rowIdx, 1].Value = cable.TagNumber;
|
||||||
|
rowIdx++;
|
||||||
|
foreach (var set in cable.Sets)
|
||||||
|
{
|
||||||
|
|
||||||
|
sheet.Cells[rowIdx, 2].Value = set.CableSetName;
|
||||||
|
sheet.Cells[rowIdx, 7].Value = set.ConnectionInfo;
|
||||||
|
rowIdx++;
|
||||||
|
}
|
||||||
|
|
||||||
|
rowIdx = rowIdx + 2;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region ByPanel
|
||||||
|
sheet = package.Workbook.Worksheets.Add("模块视角");
|
||||||
|
sheet.Cells[1, 1].Value = "采集箱位号";
|
||||||
|
sheet.Cells[1, 2].Value = "模块名字";
|
||||||
|
sheet.Cells[1, 3].Value = "IO类型";
|
||||||
|
sheet.Cells[1, 4].Value = "通道名字";
|
||||||
|
sheet.Cells[1, 5].Value = "通道顺序";
|
||||||
|
sheet.Cells[1, 6].Value = "关联电缆";
|
||||||
|
sheet.Cells[1, 7].Value = "关联Set";
|
||||||
|
sheet.Cells[1, 8].Value = "关联信号";
|
||||||
|
sheet.Cells[1, 9].Value = "备注";
|
||||||
|
rowIdx = 2;
|
||||||
|
|
||||||
|
foreach (var p in PanelAssigned)
|
||||||
|
{
|
||||||
|
var newTS = p.strips.FindAll(x => x.Channels.Any(y => !string.IsNullOrEmpty(y.ConnectionInfo)));
|
||||||
|
|
||||||
|
foreach (var ts in newTS)
|
||||||
|
{
|
||||||
|
foreach (var ch in ts.Channels)
|
||||||
|
{
|
||||||
|
sheet.Cells[rowIdx, 1].Value = p.TagNumber;
|
||||||
|
sheet.Cells[rowIdx, 2].Value = ts.StripName;
|
||||||
|
sheet.Cells[rowIdx, 3].Value = ts.IO_TYPE;
|
||||||
|
sheet.Cells[rowIdx, 4].Value = ch.ChannelName;
|
||||||
|
sheet.Cells[rowIdx, 5].Value = ch.Channel_Seq;
|
||||||
|
sheet.Cells[rowIdx, 6].Value = ch.assignCable;
|
||||||
|
sheet.Cells[rowIdx, 7].Value = ch.assignCableSet;
|
||||||
|
sheet.Cells[rowIdx, 8].Value = ch.ConnectionInfo;
|
||||||
|
rowIdx++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rowIdx = rowIdx + 2;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
package.Save();
|
||||||
bytes = package.GetAsByteArray();
|
bytes = package.GetAsByteArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -638,7 +699,7 @@ namespace Learun.Application.Web.AppApi
|
|||||||
.GroupBy(x => x.PanelID)
|
.GroupBy(x => x.PanelID)
|
||||||
.ToDictionary(x => x.Key, x => x.ToList());//带出strip下的channel
|
.ToDictionary(x => x.Key, x => x.ToList());//带出strip下的channel
|
||||||
|
|
||||||
|
var PanelResultPreview = new List<ec_PanelEntity>();//为了看by panel的预览情况,有时候光by cable看不出问题
|
||||||
foreach (var c in cNotPanel)
|
foreach (var c in cNotPanel)
|
||||||
{
|
{
|
||||||
foreach (var set in c.Sets)
|
foreach (var set in c.Sets)
|
||||||
@ -654,6 +715,9 @@ namespace Learun.Application.Web.AppApi
|
|||||||
var cablesOnThisPanel = cablesGrouped.Where(x => x.AssignedPanel.PanelID == curPanelId).ToList();
|
var cablesOnThisPanel = cablesGrouped.Where(x => x.AssignedPanel.PanelID == curPanelId).ToList();
|
||||||
if (cablesOnThisPanel == null || cablesOnThisPanel.Count == 0) continue;//next panel
|
if (cablesOnThisPanel == null || cablesOnThisPanel.Count == 0) continue;//next panel
|
||||||
var lastUsedStrip = (ec_PanelStripEntity)null;
|
var lastUsedStrip = (ec_PanelStripEntity)null;
|
||||||
|
var lastUsedPanel = new ec_PanelEntity();
|
||||||
|
lastUsedPanel.strips = allStrips[curPanelId];//已经存在的所有模块
|
||||||
|
|
||||||
foreach (var cable in cablesOnThisPanel)
|
foreach (var cable in cablesOnThisPanel)
|
||||||
{
|
{
|
||||||
//1.2.2 分组原则为同一信号类型、同一系统的为一组,系统属性从电缆的from端上的设备中取设备的系统,同组的优先放到同一个箱子的同一个模块里面,
|
//1.2.2 分组原则为同一信号类型、同一系统的为一组,系统属性从电缆的from端上的设备中取设备的系统,同组的优先放到同一个箱子的同一个模块里面,
|
||||||
@ -778,7 +842,7 @@ namespace Learun.Application.Web.AppApi
|
|||||||
#region NewTS
|
#region NewTS
|
||||||
|
|
||||||
//1.2 流程图 根据信号数里自动新建端子排,端子排通道数里根据箱子模板中的默认值获得
|
//1.2 流程图 根据信号数里自动新建端子排,端子排通道数里根据箱子模板中的默认值获得
|
||||||
var newTS = CreatePanelStripByProfile2(projId, cable.AssignedPanel, newTSSeq++, ioTypeOnC);
|
var newTS = CreatePanelStripByProfile2(projId, cable.AssignedPanel, newTSSeq++, ioTypeOnC);//当前采集箱无模块,需要新建
|
||||||
|
|
||||||
matchedStrips.Add(newTS);
|
matchedStrips.Add(newTS);
|
||||||
|
|
||||||
@ -795,6 +859,7 @@ namespace Learun.Application.Web.AppApi
|
|||||||
List<ec_PanelChannelEntity> notUsedChs = new List<ec_PanelChannelEntity>();
|
List<ec_PanelChannelEntity> notUsedChs = new List<ec_PanelChannelEntity>();
|
||||||
|
|
||||||
#region 1.2 流程图 按规则先放几个信号进去(放不下就延到下一个模块)
|
#region 1.2 流程图 按规则先放几个信号进去(放不下就延到下一个模块)
|
||||||
|
#region old
|
||||||
//if (cable.Sets.Count > 10)
|
//if (cable.Sets.Count > 10)
|
||||||
//{
|
//{
|
||||||
// //另外如果电缆对数大于10对,即像12 * 2 * 0.75这种,无论它预分配了多少根电缆对,永远预留4个以下的空白通道。意思就是一个模块里面够4个或4个以上空白通道就留4个空白通道,如果不够4个就留4个以下即可。
|
// //另外如果电缆对数大于10对,即像12 * 2 * 0.75这种,无论它预分配了多少根电缆对,永远预留4个以下的空白通道。意思就是一个模块里面够4个或4个以上空白通道就留4个空白通道,如果不够4个就留4个以下即可。
|
||||||
@ -1001,6 +1066,8 @@ namespace Learun.Application.Web.AppApi
|
|||||||
//else
|
//else
|
||||||
//{
|
//{
|
||||||
//5%的空白通道
|
//5%的空白通道
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region FindNextAvailableTS(可能多个)
|
#region FindNextAvailableTS(可能多个)
|
||||||
//还分2种情况判断模块是否符合:
|
//还分2种情况判断模块是否符合:
|
||||||
//case1,. 占满可用通道后,还剩至少一个预分配的set和spared的set。 //这种时候要spared不用考虑
|
//case1,. 占满可用通道后,还剩至少一个预分配的set和spared的set。 //这种时候要spared不用考虑
|
||||||
@ -1009,20 +1076,21 @@ namespace Learun.Application.Web.AppApi
|
|||||||
bool NeedNextTS = false;
|
bool NeedNextTS = false;
|
||||||
|
|
||||||
#region FindNextAvailableTS
|
#region FindNextAvailableTS
|
||||||
|
var trueAvailableChs = 0;
|
||||||
|
var sparedButCanNotUsedChs = 0;//需要特意预留的通道,
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
while (idx < matchedStrips.Count)
|
while (idx < matchedStrips.Count)
|
||||||
{
|
{
|
||||||
NeedNextTS = false;
|
NeedNextTS = false;
|
||||||
var TS = matchedStrips[idx];
|
var TS = matchedStrips[idx];
|
||||||
var allCh = TS.Channels;
|
var allCh = TS.Channels;
|
||||||
var allChCount = allCh.Count;
|
if (allCh.Count == 0)
|
||||||
if (allChCount == 0)
|
|
||||||
{
|
{
|
||||||
NeedNextTS = true;
|
NeedNextTS = true;
|
||||||
//同时又是最后一个了
|
//同时又是最后一个了
|
||||||
if (idx == matchedStrips.Count - 1)
|
if (idx == matchedStrips.Count - 1)
|
||||||
{
|
{
|
||||||
var newTS = CreatePanelStripByProfile2(projId, cable.AssignedPanel, newTSSeq++, ioTypeOnC);
|
var newTS = CreatePanelStripByProfile2(projId, cable.AssignedPanel, newTSSeq++, ioTypeOnC);//当前ts无ch,需要新建
|
||||||
if (newTS.Channels.Count() < setsSpared.Count + 1)//1代表至少要放一个set
|
if (newTS.Channels.Count() < setsSpared.Count + 1)//1代表至少要放一个set
|
||||||
{
|
{
|
||||||
//有问题了 panel的io模板,估计会导致无限循环了
|
//有问题了 panel的io模板,估计会导致无限循环了
|
||||||
@ -1030,62 +1098,105 @@ namespace Learun.Application.Web.AppApi
|
|||||||
}
|
}
|
||||||
matchedStrips.Add(newTS);
|
matchedStrips.Add(newTS);
|
||||||
}
|
}
|
||||||
idx++; continue;//本模块没有一个ch
|
idx++; continue;//本模块没有一个ch,否则后面 5% 会除以0
|
||||||
}
|
}
|
||||||
//被占用的(wt里有或者信号里或有),或者被锁定的,都算占用
|
//被占用的(wt里有或者信号里或有),或者被锁定的,都算占用
|
||||||
usedChs = allCh.Where(x => allUsedCHBySignalOrSet.Contains(x.ChannelID) || x.lock_flg == 1).ToList();
|
usedChs = allCh.Where(x => allUsedCHBySignalOrSet.Contains(x.ChannelID) || x.lock_flg == 1).ToList();
|
||||||
notUsedChs = allCh.Where(x => !usedChs.Select(c => c.ChannelID).Contains(x.ChannelID)).ToList();
|
notUsedChs = allCh.Where(x => !usedChs.Select(c => c.ChannelID).Contains(x.ChannelID)).ToList();
|
||||||
|
|
||||||
|
trueAvailableChs = 0;
|
||||||
var ChNeedConn = 0;
|
var ChNeedConn = 0;
|
||||||
var SparedNeedConn = 0;
|
var SparedNeedConn = 0;
|
||||||
|
|
||||||
|
//分3种情况,确认具体要接的ch个数和是否需要下一个ts
|
||||||
if (cable.CableClass.ToLower() == SWS.Share.Enum.cableClass.homerun.ToString())
|
if (cable.CableClass.ToLower() == SWS.Share.Enum.cableClass.homerun.ToString())
|
||||||
{
|
{
|
||||||
//1.2.3(2)如果模块是通讯信号(像RS485这种就是通讯信号),则不用管预留空白通道这个事情,看到有空的通道就放。
|
//1.2.3(2) 如果模块是通讯信号(像RS485这种就是通讯信号),则不用管预留空白通道这个事情,看到有空的通道就放。
|
||||||
|
#region 可用通道(通讯)
|
||||||
if (allChCount < sets.Count)
|
trueAvailableChs = notUsedChs.Count;
|
||||||
|
#endregion
|
||||||
|
if (trueAvailableChs < sets.Count)
|
||||||
{
|
{
|
||||||
//case1,能顺利接完,set还有多,还要再do循环一次,多余的set和spared都要放到下一个模块
|
//case1,能顺利接完,set还有多,还要再do循环一次,多余的set和spared都要放到下一个模块
|
||||||
NeedNextTS = true;
|
NeedNextTS = true;
|
||||||
ChNeedConn = allChCount; SparedNeedConn = 0;
|
ChNeedConn = trueAvailableChs; SparedNeedConn = 0;
|
||||||
}
|
}
|
||||||
else if (allChCount == sets.Count)
|
else if (trueAvailableChs == sets.Count)
|
||||||
{
|
{
|
||||||
//case3,刚好,只有spared可能多
|
//case3,刚好,只有spared可能多
|
||||||
ChNeedConn = allChCount;
|
ChNeedConn = trueAvailableChs;
|
||||||
SparedNeedConn = 0; //homerun不用考虑预留一个set去配合后续的spared
|
SparedNeedConn = 0; //homerun不用考虑预留一个set去配合后续的spared
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ChNeedConn = sets.Count;
|
ChNeedConn = sets.Count;
|
||||||
SparedNeedConn = 0;
|
SparedNeedConn = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#region 可用通道(非通讯)
|
||||||
//1.2 流程图 空的通道数够不够
|
//1.2 流程图 空的通道数够不够
|
||||||
double sparedRate = notUsedChs.Count * 1.0 / allChCount * 1.0;
|
if (cable.Sets.Count > 10)
|
||||||
if (sparedRate < 0.05)
|
|
||||||
{
|
{
|
||||||
NeedNextTS = true;
|
//1.2.3 空白通道原则,另外如果电缆对数大于10对,即像12*2*0.75这种,无论它预分配了多少根电缆对,永远预留4个以下的空白通道。
|
||||||
//同时又是最后一个了
|
if (notUsedChs.Count < 4)
|
||||||
if (idx == matchedStrips.Count - 1)
|
|
||||||
{
|
{
|
||||||
var newTS = CreatePanelStripByProfile2(projId, cable.AssignedPanel, newTSSeq++, ioTypeOnC);
|
//可以认为这个ts不可用了
|
||||||
if (newTS.Channels.Count() < setsSpared.Count + 1)//1代表至少要放一个set
|
trueAvailableChs = 0;
|
||||||
{
|
sparedButCanNotUsedChs = notUsedChs.Count;
|
||||||
//有问题了 panel的io模板,估计会导致无限循环了
|
notUsedChs.ForEach(x => x.lock_flg = 1);//全部标记为不可用
|
||||||
break;
|
|
||||||
}
|
|
||||||
matchedStrips.Add(newTS);
|
|
||||||
}
|
}
|
||||||
idx++; continue;//本模块可用的模块小于5%
|
else
|
||||||
}
|
{
|
||||||
//没有空闲通道 next
|
//all 16,used 7,notused9, 砍去4,
|
||||||
//或者空闲通道不够放下这个电缆的所有set
|
// 1. 计算起始索引
|
||||||
//算一下5%是多少个通道
|
int startIndex = Math.Max(0, notUsedChs.Count - 4);
|
||||||
var trueAvailableChs = notUsedChs.Count - (allChCount - FindMaxNumberChannel(allChCount));//真正能用的(没接过的,然后去掉5%)
|
|
||||||
|
|
||||||
|
// 2. 计算要截取的数量(从起始索引到末尾的元素数)
|
||||||
|
int takeCount = notUsedChs.Count - startIndex;
|
||||||
|
|
||||||
|
// 3. 截取最后4个元素
|
||||||
|
var lastFour = notUsedChs.GetRange(startIndex, takeCount);//最后4个给不可用,并且这4个也要被标记为不能使用
|
||||||
|
lastFour.ForEach(x => x.lock_flg = 1);//标记为不可用
|
||||||
|
usedChs.AddRange(lastFour);
|
||||||
|
notUsedChs = allCh.Where(x => !usedChs.Select(c => c.ChannelID).Contains(x.ChannelID)).ToList();
|
||||||
|
trueAvailableChs = notUsedChs.Count;
|
||||||
|
sparedButCanNotUsedChs = 4;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//5%
|
||||||
|
double sparedRate = notUsedChs.Count * 1.0 / allCh.Count * 1.0;
|
||||||
|
if (sparedRate < 0.05)
|
||||||
|
{
|
||||||
|
NeedNextTS = true;
|
||||||
|
trueAvailableChs = 0;
|
||||||
|
sparedButCanNotUsedChs = notUsedChs.Count;
|
||||||
|
notUsedChs.ForEach(x => x.lock_flg = 1);//全部标记为不可用
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sparedButCanNotUsedChs = allCh.Count - FindMaxNumberChannel(allCh.Count);
|
||||||
|
// 1. 计算起始索引
|
||||||
|
int startIndex = Math.Max(0, notUsedChs.Count - sparedButCanNotUsedChs);
|
||||||
|
|
||||||
|
// 2. 计算要截取的数量(从起始索引到末尾的元素数)
|
||||||
|
int takeCount = notUsedChs.Count - startIndex;
|
||||||
|
|
||||||
|
// 3. 截取最后4个元素
|
||||||
|
var lastFour = notUsedChs.GetRange(startIndex, takeCount);//最后4个给不可用,并且这4个也要被标记为不能使用
|
||||||
|
lastFour.ForEach(x => x.lock_flg = 1);//标记为不可用
|
||||||
|
|
||||||
|
trueAvailableChs = notUsedChs.Count - sparedButCanNotUsedChs;//真正能用的(没接过的,然后去掉5%)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
if (trueAvailableChs < sets.Count)
|
if (trueAvailableChs < sets.Count)
|
||||||
{
|
{
|
||||||
//case1,能顺利接完,set还有多,还要再do循环一次,多余的set和spared都要放到下一个模块
|
//case1,能顺利接完,set还有多,还要再do循环一次,多余的set和spared都要放到下一个模块
|
||||||
@ -1097,10 +1208,21 @@ namespace Learun.Application.Web.AppApi
|
|||||||
//case3,刚好,只有spared可能多
|
//case3,刚好,只有spared可能多
|
||||||
if (setsSpared.Count > 0)
|
if (setsSpared.Count > 0)
|
||||||
{
|
{
|
||||||
//自己的感觉(非客户word需求里的原话):spared不能自己单独占用一个模块
|
if (sets.Count == 1)
|
||||||
NeedNextTS = true;
|
{
|
||||||
ChNeedConn = trueAvailableChs - 1;//留一个给spared
|
//避免死循环
|
||||||
SparedNeedConn = 0;
|
ChNeedConn = 1;
|
||||||
|
NeedNextTS = false;
|
||||||
|
SparedNeedConn = trueAvailableChs - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//自己的感觉(非客户word需求里的原话):spared不能自己单独占用一个模块
|
||||||
|
NeedNextTS = true;
|
||||||
|
ChNeedConn = trueAvailableChs - 1;//留一个给spared
|
||||||
|
SparedNeedConn = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1120,10 +1242,21 @@ namespace Learun.Application.Web.AppApi
|
|||||||
//这种时候要确保spared也能放下
|
//这种时候要确保spared也能放下
|
||||||
else if (trueAvailableChs < sets.Count + setsSpared.Count)
|
else if (trueAvailableChs < sets.Count + setsSpared.Count)
|
||||||
{
|
{
|
||||||
//自己的感觉(非客户word需求里的原话):spared不能自己单独占用一个模块
|
if (sets.Count == 1)
|
||||||
ChNeedConn = sets.Count - 1;//留一个给spared
|
{
|
||||||
NeedNextTS = true;
|
//避免死循环
|
||||||
SparedNeedConn = 0;
|
ChNeedConn = 1;
|
||||||
|
NeedNextTS = false;
|
||||||
|
SparedNeedConn = trueAvailableChs - 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//自己的感觉(非客户word需求里的原话):spared不能自己单独占用一个模块
|
||||||
|
ChNeedConn = sets.Count - 1;//留一个给spared。如果sets.COUNT只有1个,这种情况就会死循环了
|
||||||
|
NeedNextTS = true;
|
||||||
|
SparedNeedConn = 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1137,17 +1270,20 @@ namespace Learun.Application.Web.AppApi
|
|||||||
|
|
||||||
//到这里,说明本模块至少都是可用的
|
//到这里,说明本模块至少都是可用的
|
||||||
|
|
||||||
TS.Channels = allCh.OrderBy(X => X.Channel_Seq).ToList();//不能像之前一样过滤掉,否则下一个电缆进来时,总数就不对了。
|
TS.Channels = allCh.OrderBy(X => X.Channel_Seq).ToList();//不能像之前一样过滤掉,否则下一个电缆进来时,总数就不对了。
|
||||||
|
|
||||||
lastUsedStrip = TS;
|
lastUsedStrip = TS;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region conn
|
#region conn
|
||||||
|
|
||||||
for (int i = 0; i < ChNeedConn; i++)
|
for (int i = 0; i < ChNeedConn; i++)
|
||||||
{
|
{
|
||||||
var set = sets[i];
|
var set = sets[i];
|
||||||
var ch = notUsedChs[i];
|
var ch = notUsedChs[i];
|
||||||
|
ch.assignCable = cable.TagNumber;
|
||||||
|
ch.assignCableSet = set.CableSetName + " / " + set.CableSetSeq;
|
||||||
|
ch.ConnectionInfo = $"信号:{set.PreAssignGroup_Desc}/信号类型:{set.PreAssignIOTypeDetail}/传感器:{set.PreAssignSensorCode}";
|
||||||
if (lastUsedStrip.TagNumber == "CreatePanelStripByProfile2")
|
if (lastUsedStrip.TagNumber == "CreatePanelStripByProfile2")
|
||||||
{
|
{
|
||||||
set.ConnectionInfo = $"采集箱:{PanelName}/模块(端子排):(自动创建){lastUsedStrip.StripName}/通道:{ch.ChannelName}";
|
set.ConnectionInfo = $"采集箱:{PanelName}/模块(端子排):(自动创建){lastUsedStrip.StripName}/通道:{ch.ChannelName}";
|
||||||
@ -1170,6 +1306,10 @@ namespace Learun.Application.Web.AppApi
|
|||||||
{
|
{
|
||||||
var set = setsSpared[i];
|
var set = setsSpared[i];
|
||||||
var ch = notUsedChs[ChNeedConn + i];
|
var ch = notUsedChs[ChNeedConn + i];
|
||||||
|
ch.assignCable = cable.TagNumber;
|
||||||
|
ch.assignCableSet = set.CableSetName + " / " + set.CableSetSeq + "/冗余";
|
||||||
|
ch.ConnectionInfo = $"信号:{set.PreAssignGroup_Desc}/信号类型:{set.PreAssignIOTypeDetail}/传感器:{set.PreAssignSensorCode}";
|
||||||
|
|
||||||
if (lastUsedStrip.TagNumber == "CreatePanelStripByProfile2")
|
if (lastUsedStrip.TagNumber == "CreatePanelStripByProfile2")
|
||||||
{
|
{
|
||||||
set.ConnectionInfo = $"采集箱:{PanelName}/模块(端子排):(自动创建){lastUsedStrip.StripName}/通道:{ch.ChannelName}/冗余";
|
set.ConnectionInfo = $"采集箱:{PanelName}/模块(端子排):(自动创建){lastUsedStrip.StripName}/通道:{ch.ChannelName}/冗余";
|
||||||
@ -1183,17 +1323,40 @@ namespace Learun.Application.Web.AppApi
|
|||||||
allUsedCHBySignalOrSet.Add(ch.ChannelID);
|
allUsedCHBySignalOrSet.Add(ch.ChannelID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
#region 预留空白通道
|
||||||
|
if (sparedButCanNotUsedChs > 0)
|
||||||
|
{
|
||||||
|
Console.WriteLine("");
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
//shi否要继续
|
//shi否要继续
|
||||||
TS.ChannelsSpared = notUsedChs.Where(x => x.lock_flg != 1).Count();
|
TS.ChannelsSpared = notUsedChs.Where(x => x.lock_flg != 1).Count();
|
||||||
TS.ChannelsUsed = allChCount - TS.ChannelsSpared;// usedChs.Count + (notUsedChs.Where(x => x.lock_flg == 1).Count());
|
TS.ChannelsUsed = allCh.Count - TS.ChannelsSpared;// usedChs.Count + (notUsedChs.Where(x => x.lock_flg == 1).Count());
|
||||||
|
//var xx = lastUsedPanel.strips;
|
||||||
|
#region panel record
|
||||||
|
if (ChNeedConn > 0 || SparedNeedConn > 0)
|
||||||
|
{
|
||||||
|
//记录本模块被使用过
|
||||||
|
var idx2 = lastUsedPanel.strips.FindIndex(ts => ts.StripID == lastUsedStrip.StripID);
|
||||||
|
if (idx2 != -1)
|
||||||
|
{
|
||||||
|
lastUsedPanel.strips[idx2] = lastUsedStrip;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lastUsedPanel.strips.Add(lastUsedStrip);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
if (NeedNextTS)
|
if (NeedNextTS)
|
||||||
{
|
{
|
||||||
sets = sets.Where(x => !x.IsConned ?? false).ToList();//移除已经分配过的set
|
sets = sets.Where(x => !x.IsConned ?? false).ToList();//移除已经分配过的set
|
||||||
//同时又是最后一个了
|
//同时又是最后一个了
|
||||||
if (idx == matchedStrips.Count - 1)
|
if (idx == matchedStrips.Count - 1)
|
||||||
{
|
{
|
||||||
var newTS = CreatePanelStripByProfile2(projId, cable.AssignedPanel, newTSSeq++, ioTypeOnC);
|
var newTS = CreatePanelStripByProfile2(projId, cable.AssignedPanel, newTSSeq++, ioTypeOnC);//还有set需要接,需要新建
|
||||||
if (newTS.Channels.Count() < setsSpared.Count + 1)//1代表至少要放一个set
|
if (newTS.Channels.Count() < setsSpared.Count + 1)//1代表至少要放一个set
|
||||||
{
|
{
|
||||||
//有问题了 panel的io模板,估计会导致无限循环了
|
//有问题了 panel的io模板,估计会导致无限循环了
|
||||||
@ -1208,6 +1371,8 @@ namespace Learun.Application.Web.AppApi
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -1229,7 +1394,14 @@ namespace Learun.Application.Web.AppApi
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PanelResultPreview.Add(lastUsedPanel);
|
||||||
}
|
}
|
||||||
|
//必要的数据存入redis,以便后续步骤使用
|
||||||
|
redisObj.Remove("IOModule_AutoAssign2Ch_" + projId, CacheId.IOModule_AutoAssign2Ch);
|
||||||
|
redisObj.Write<List<ec_CableEntity>>("IOModule_AutoAssign2Ch_" + projId, cablesNeedAssigned, CacheId.IOModule_AutoAssign2Ch);
|
||||||
|
|
||||||
|
redisObj.Remove("IOModule_AutoAssign2ChByPanel_" + projId, CacheId.IOModule_AutoAssign2Ch);
|
||||||
|
redisObj.Write<List<ec_PanelEntity>>("IOModule_AutoAssign2ChByPanel_" + projId, PanelResultPreview, CacheId.IOModule_AutoAssign2Ch);
|
||||||
|
|
||||||
return Success(cablesNeedAssigned);
|
return Success(cablesNeedAssigned);
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ namespace Learun.Application.Web.AppApi
|
|||||||
/// <param name="PDBId">分电箱的工程ID</param>
|
/// <param name="PDBId">分电箱的工程ID</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public IHttpActionResult SaveBreakers(string projId, string PDBId)
|
public IHttpActionResult SaveBreakers(string projId, string PDBId, [FromBody] List<ec_CircuitBreakerEntity> CBs)
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -72,7 +72,7 @@ namespace Learun.Application.Web.AppApi
|
|||||||
ec_enginedata_relBLL ec_Enginedata_RelBLL = new ec_enginedata_relBLL();
|
ec_enginedata_relBLL ec_Enginedata_RelBLL = new ec_enginedata_relBLL();
|
||||||
var ec_RelTypeBll = new ec_reltypeBLL();
|
var ec_RelTypeBll = new ec_reltypeBLL();
|
||||||
var asyncContent = Request.Content.ReadAsStringAsync().Result;
|
var asyncContent = Request.Content.ReadAsStringAsync().Result;
|
||||||
var CBs = asyncContent.ToObject<List<ec_CircuitBreakerEntity>>();
|
//var CBs = asyncContent.ToObject<List<ec_CircuitBreakerEntity>>();
|
||||||
//var RelType = ec_RelTypeBll.GetList("{\"ProjectId\":\"" + projId + "\", \"RelType\": \"" + (int)enum_RelType.开关_电缆 + "\"}").FirstOrDefault();
|
//var RelType = ec_RelTypeBll.GetList("{\"ProjectId\":\"" + projId + "\", \"RelType\": \"" + (int)enum_RelType.开关_电缆 + "\"}").FirstOrDefault();
|
||||||
if (CBs == null)
|
if (CBs == null)
|
||||||
{
|
{
|
||||||
|
@ -160,6 +160,7 @@ namespace Learun.Application.Web.AppApi
|
|||||||
|
|
||||||
res.Add(layoutTag);
|
res.Add(layoutTag);
|
||||||
}
|
}
|
||||||
|
res = res.OrderByDescending(x => x.RoomNo).ToList();
|
||||||
// 找出area和deck列组合重复的行
|
// 找出area和deck列组合重复的行
|
||||||
var duplicateGroups = res
|
var duplicateGroups = res
|
||||||
.GroupBy(r => new { r.area, r.deck, r.RoomNo })
|
.GroupBy(r => new { r.area, r.deck, r.RoomNo })
|
||||||
@ -179,7 +180,7 @@ namespace Learun.Application.Web.AppApi
|
|||||||
var validSystems = keyValue.Split(';').ToList();
|
var validSystems = keyValue.Split(';').ToList();
|
||||||
matchedTagIds = propAll.Where(item =>
|
matchedTagIds = propAll.Where(item =>
|
||||||
item.PropertyName == keyProp &&
|
item.PropertyName == keyProp &&
|
||||||
validSystems.Any(prefix => item.PropertyValue == prefix) || validSystems.Any(prefix => item.PropertyValue.StartsWith(prefix + GlobalObject.enum_separator))
|
(validSystems.Any(prefix => item.PropertyValue == prefix) || validSystems.Any(prefix => item.PropertyValue.StartsWith(prefix + GlobalObject.enum_separator)))
|
||||||
).Select(X => X.EngineDataID).Distinct().ToList();
|
).Select(X => X.EngineDataID).Distinct().ToList();
|
||||||
//}
|
//}
|
||||||
//else
|
//else
|
||||||
@ -200,15 +201,22 @@ namespace Learun.Application.Web.AppApi
|
|||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
//有效范围的设备的所有属性
|
//有效范围的设备的所有属性
|
||||||
var EquipPropAll = propAll.Where(x => matchedTags.Select(y => y.EngineDataID).Contains(x.EngineDataID)).ToList();
|
var EquipPropAll = propAll.Where(x => matchedTags.Select(y => y.EngineDataID).Contains(x.EngineDataID))
|
||||||
|
.Select(x=>new ec_enginedata_propertyEntity {
|
||||||
|
PropertyName=x.PropertyName,
|
||||||
|
PropertyValue=x.PropertyValue,
|
||||||
|
EngineDataID=x.EngineDataID,
|
||||||
|
Marker = false
|
||||||
|
}).ToList();
|
||||||
foreach (var basePoint in res)
|
foreach (var basePoint in res)
|
||||||
{
|
{
|
||||||
#region 每个基点关联的设备
|
#region 每个基点关联的设备
|
||||||
//甲板 区域都和基点一致的设备
|
//甲板 区域都和基点一致的设备
|
||||||
var DeckMatchedTagIds = EquipPropAll.Where(x => x.PropertyName == "甲板号" && (x.PropertyValue?.Split(new[] { "||" }, StringSplitOptions.None)[0] == basePoint.deck)).Select(X => X.EngineDataID).ToList();
|
var DeckMatchedTagIds = EquipPropAll.Where(x => x.PropertyName == "甲板号" && (x.PropertyValue?.Split(new[] { "||" }, StringSplitOptions.None)[0] == basePoint.deck) && x.Marker==false).Select(X => X.EngineDataID).ToList();
|
||||||
//var AreaMatchedTagIds = EquipPropAll.Where(x => x.PropertyName == "区域" && x.PropertyValue == basePoint.area).Select(X => X.EngineDataID).ToList();
|
//var AreaMatchedTagIds = EquipPropAll.Where(x => x.PropertyName == "区域" && x.PropertyValue == basePoint.area).Select(X => X.EngineDataID).ToList();
|
||||||
//#task 9542
|
//#task 9542
|
||||||
var matchPointTagIds = DeckMatchedTagIds;//.Intersect(AreaMatchedTagIds).ToList();
|
var matchPointTagIds = DeckMatchedTagIds;//.Intersect(AreaMatchedTagIds).ToList();
|
||||||
|
var matchPointTagIdSet = new System.Collections.Generic.HashSet<string>(matchPointTagIds);
|
||||||
|
|
||||||
foreach (var matchPointTagId in matchPointTagIds)
|
foreach (var matchPointTagId in matchPointTagIds)
|
||||||
{
|
{
|
||||||
@ -225,7 +233,7 @@ namespace Learun.Application.Web.AppApi
|
|||||||
Prop_RoomNo = Prop_RoomNo.Split(new string[] { GlobalObject.enum_separator }, StringSplitOptions.None)[0];//插件端对于下拉列表 都是 name || nameEN
|
Prop_RoomNo = Prop_RoomNo.Split(new string[] { GlobalObject.enum_separator }, StringSplitOptions.None)[0];//插件端对于下拉列表 都是 name || nameEN
|
||||||
}
|
}
|
||||||
var matchedFrame = frameLists.FirstOrDefault(X => X.Num == Prop_Frame);
|
var matchedFrame = frameLists.FirstOrDefault(X => X.Num == Prop_Frame);
|
||||||
var matchedRoom = roomLists.FirstOrDefault(x => x.DataItemName == Prop_RoomNo);
|
var matchedRoom = roomLists.FirstOrDefault(x => x.DataItemName == Prop_RoomNo || x.DataItemName+" "+ x.DataItemNameEN==Prop_RoomNo);
|
||||||
if (matchedFrame == null && matchedRoom == null)
|
if (matchedFrame == null && matchedRoom == null)
|
||||||
{
|
{
|
||||||
var layoutTagInfoInvalid = new layoutTagInfoBrief()
|
var layoutTagInfoInvalid = new layoutTagInfoBrief()
|
||||||
@ -236,6 +244,11 @@ namespace Learun.Application.Web.AppApi
|
|||||||
area = "ERR",
|
area = "ERR",
|
||||||
};
|
};
|
||||||
basePoint.Tags.Add(layoutTagInfoInvalid);
|
basePoint.Tags.Add(layoutTagInfoInvalid);
|
||||||
|
foreach (var item in EquipPropAll)
|
||||||
|
{
|
||||||
|
if (matchPointTagIdSet.Contains(item.EngineDataID))
|
||||||
|
item.Marker = true;
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
double xValue = 0;
|
double xValue = 0;
|
||||||
@ -352,6 +365,11 @@ namespace Learun.Application.Web.AppApi
|
|||||||
RoomNo = strRoom
|
RoomNo = strRoom
|
||||||
};
|
};
|
||||||
basePoint.Tags.Add(layoutTagInfo);
|
basePoint.Tags.Add(layoutTagInfo);
|
||||||
|
foreach (var item in EquipPropAll)
|
||||||
|
{
|
||||||
|
if (matchPointTagIdSet.Contains(item.EngineDataID))
|
||||||
|
item.Marker = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ namespace Learun.Application.Web.AppApi
|
|||||||
var res4 = templateCategoryBll.GetTemplateCategory(ProjId);
|
var res4 = templateCategoryBll.GetTemplateCategory(ProjId);
|
||||||
#endregion
|
#endregion
|
||||||
#region ObjectTypeApi/GetObjectTypeData0
|
#region ObjectTypeApi/GetObjectTypeData0
|
||||||
var res5 = objectTypeBll.GetObjectTypeData3Level(ProjId, "0");
|
var res5 = objectTypeBll.GetObjectTypeData3Level(ProjId, "0","",true);
|
||||||
#endregion
|
#endregion
|
||||||
#region ObjectTypeApi/GetObjectTypeData2
|
#region ObjectTypeApi/GetObjectTypeData2
|
||||||
// 这个数据量太大,导致加载项目时卡顿长达6分钟,所以单独独立出去
|
// 这个数据量太大,导致加载项目时卡顿长达6分钟,所以单独独立出去
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using DocumentFormat.OpenXml.Bibliography;
|
using ClosedXML.Excel;
|
||||||
|
using DocumentFormat.OpenXml.Bibliography;
|
||||||
using DocumentFormat.OpenXml.Drawing.Charts;
|
using DocumentFormat.OpenXml.Drawing.Charts;
|
||||||
using DocumentFormat.OpenXml.ExtendedProperties;
|
using DocumentFormat.OpenXml.ExtendedProperties;
|
||||||
using DocumentFormat.OpenXml.Spreadsheet;
|
using DocumentFormat.OpenXml.Spreadsheet;
|
||||||
@ -597,7 +598,7 @@ namespace Learun.Application.Web.Areas.ZZDT_EC.Controllers
|
|||||||
/// <param name="ProjectId">项目ID</param>
|
/// <param name="ProjectId">项目ID</param>
|
||||||
/// <param name="folderId">文件夹ID</param>
|
/// <param name="folderId">文件夹ID</param>
|
||||||
/// <param name="reportFileName">报表文件名称</param>
|
/// <param name="reportFileName">报表文件名称</param>
|
||||||
|
///<param name="param">前端的json格式的参数</param>
|
||||||
public void ReportToExcel(string ProjectId, string folderId, string reportFileName, string param)
|
public void ReportToExcel(string ProjectId, string folderId, string reportFileName, string param)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -1311,6 +1312,9 @@ namespace Learun.Application.Web.Areas.ZZDT_EC.Controllers
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
break;
|
break;
|
||||||
|
case "电缆册":
|
||||||
|
CreateReportForCableOfDivision2(paramObj, workbook, ProjectId);
|
||||||
|
break;
|
||||||
case "云线备注清单":
|
case "云线备注清单":
|
||||||
#region 云线备注清单
|
#region 云线备注清单
|
||||||
int SelectModel;
|
int SelectModel;
|
||||||
@ -2007,6 +2011,499 @@ namespace Learun.Application.Web.Areas.ZZDT_EC.Controllers
|
|||||||
return DetailName.Substring(0, index);
|
return DetailName.Substring(0, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 专门帮2室做的电缆册抽取
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="paramObj"></param>
|
||||||
|
/// <param name="workbook"></param>
|
||||||
|
/// <param name="ProjectId"></param>
|
||||||
|
public void CreateReportForCableOfDivision2(JObject paramObj, IWorkbook workbook, string ProjectId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string dataItemDetailIDOrDwgCategoryID; int model;
|
||||||
|
dataItemDetailIDOrDwgCategoryID = paramObj.Value<string>("dataItemDetailIDOrDrawingCategoryID");// paramObj["dataItemDetailIDOrDwgCategoryID"].ToString();
|
||||||
|
model = paramObj.Value<int>("model");
|
||||||
|
|
||||||
|
|
||||||
|
ISheet sheetCable = workbook.CreateSheet("电缆清册");
|
||||||
|
ISheet sheetCable2 = workbook.CreateSheet("电缆清册(双星)");
|
||||||
|
#region 表头部分
|
||||||
|
IRow rowCable = sheetCable.CreateRow(0);
|
||||||
|
rowCable.CreateCell(0).SetCellValue("所属系统");
|
||||||
|
rowCable.CreateCell(1).SetCellValue("电缆编号");
|
||||||
|
rowCable.CreateCell(2).SetCellValue("电缆类型");
|
||||||
|
rowCable.CreateCell(3).SetCellValue("电缆规格");
|
||||||
|
rowCable.CreateCell(4).SetCellValue("起始设备代码");
|
||||||
|
rowCable.CreateCell(5).SetCellValue("起始" + "\n" + "FrDeck");
|
||||||
|
rowCable.CreateCell(6).SetCellValue("设备位置" + "\n" + "FrRoom");
|
||||||
|
rowCable.CreateCell(7).SetCellValue("设备名称" + "\n" + "FrEquip");
|
||||||
|
rowCable.CreateCell(8).SetCellValue("终止设备代码");
|
||||||
|
rowCable.CreateCell(9).SetCellValue("终止" + "\n" + "ToDeck");
|
||||||
|
rowCable.CreateCell(10).SetCellValue("设备位置" + "\n" + "ToRoom");
|
||||||
|
rowCable.CreateCell(11).SetCellValue("设备名称" + "\n" + "ToEquip");
|
||||||
|
rowCable.CreateCell(12).SetCellValue("是否变频");
|
||||||
|
rowCable.CreateCell(13).SetCellValue("是否本安");
|
||||||
|
rowCable.CreateCell(14).SetCellValue("是否独立屏蔽");
|
||||||
|
rowCable.CreateCell(15).SetCellValue("是否防火");
|
||||||
|
rowCable.CreateCell(16).SetCellValue("是否铠装");
|
||||||
|
|
||||||
|
IRow rowCable2 = sheetCable2.CreateRow(0);
|
||||||
|
rowCable2.CreateCell(0).SetCellValue("所属系统");
|
||||||
|
rowCable2.CreateCell(1).SetCellValue("电缆编号");
|
||||||
|
rowCable2.CreateCell(2).SetCellValue("电缆类型");
|
||||||
|
rowCable2.CreateCell(3).SetCellValue("电缆规格");
|
||||||
|
rowCable2.CreateCell(4).SetCellValue("起始设备代码");
|
||||||
|
rowCable2.CreateCell(5).SetCellValue("起始" + "\n" + "FrDeck");
|
||||||
|
rowCable2.CreateCell(6).SetCellValue("设备位置" + "\n" + "FrRoom");
|
||||||
|
rowCable2.CreateCell(7).SetCellValue("设备名称" + "\n" + "FrEquip");
|
||||||
|
rowCable2.CreateCell(8).SetCellValue("终止设备代码");
|
||||||
|
rowCable2.CreateCell(9).SetCellValue("终止" + "\n" + "ToDeck");
|
||||||
|
rowCable2.CreateCell(10).SetCellValue("设备位置" + "\n" + "ToRoom");
|
||||||
|
rowCable2.CreateCell(11).SetCellValue("设备名称" + "\n" + "ToEquip");
|
||||||
|
rowCable2.CreateCell(12).SetCellValue("是否变频");
|
||||||
|
rowCable2.CreateCell(13).SetCellValue("是否本安");
|
||||||
|
rowCable2.CreateCell(14).SetCellValue("是否独立屏蔽");
|
||||||
|
rowCable2.CreateCell(15).SetCellValue("是否防火");
|
||||||
|
rowCable2.CreateCell(16).SetCellValue("是否铠装");
|
||||||
|
#endregion
|
||||||
|
#region 表名区
|
||||||
|
var enginedataTableName = ProjectSugar.TableName<ec_enginedataEntity>(ProjectId);
|
||||||
|
var objectTypeTableName = ProjectSugar.TableName<ec_objecttypeEntity>(ProjectId);
|
||||||
|
var relTypeTableName = ProjectSugar.TableName<ec_reltypeEntity>(ProjectId);
|
||||||
|
var PropertyTableName = ProjectSugar.TableName<ec_propertyEntity>(ProjectId);
|
||||||
|
var DataItemTableName = ProjectSugar.TableName<ec_dataitemEntity>(ProjectId);
|
||||||
|
var DataItemDetailTableName = ProjectSugar.TableName<ec_dataitemdetailEntity>(ProjectId);
|
||||||
|
var relTableName = ProjectSugar.TableName<ec_enginedata_relEntity>(ProjectId);
|
||||||
|
var propertyTableName = ProjectSugar.TableName<ec_enginedata_propertyEntity>(ProjectId);
|
||||||
|
var pixelTableName = ProjectSugar.TableName<ec_enginedata_pixelEntity>(ProjectId);
|
||||||
|
var dwgTableName = ProjectSugar.TableName<ec_drawing_fileEntity>(ProjectId);
|
||||||
|
var dwgCategoryTableName = ProjectSugar.TableName<ec_drawing_catalogueEntity>(ProjectId);
|
||||||
|
#endregion
|
||||||
|
#region 数据查询区,避免循环里查询
|
||||||
|
var pixels = SqlSugarHelper.Db.Queryable<ec_enginedata_pixelEntity>().AS(pixelTableName).Distinct().ToList();
|
||||||
|
pixels = pixels.Where(x => x.DeleteFlg != 1).ToList();
|
||||||
|
var dwgCategory = SqlSugarHelper.Db.Queryable<ec_drawing_catalogueEntity>().AS(dwgCategoryTableName).Distinct().ToList();
|
||||||
|
|
||||||
|
var allDwgs = SqlSugarHelper.Db.Queryable<ec_drawing_fileEntity>().AS(dwgTableName).ToList();
|
||||||
|
//var allProps = SqlSugarHelper.Db.Queryable<ec_enginedata_propertyEntity>().AS(propertyTableName).ToList();
|
||||||
|
var DeckProp = SqlSugarHelper.Db.Queryable<ec_propertyEntity>().AS(PropertyTableName).First(x => x.PropertyName == "甲板号");
|
||||||
|
List<ec_dataitemdetailEntity> allDecks = new List<ec_dataitemdetailEntity>();
|
||||||
|
List<ec_dataitemdetailEntity> allSystems = new List<ec_dataitemdetailEntity>();
|
||||||
|
List<string> validSystemIds = new List<string>(); // dataItemDetailID 以及 其下面所有的
|
||||||
|
if (DeckProp != null)
|
||||||
|
{
|
||||||
|
var DeckEnumList = SqlSugarHelper.Db.Queryable<ec_dataitemEntity>().AS(DataItemTableName).First(x => x.DataItemName == DeckProp.EnumData);
|
||||||
|
if (DeckEnumList != null)
|
||||||
|
{
|
||||||
|
allDecks = SqlSugarHelper.Db.Queryable<ec_dataitemdetailEntity>().AS(DataItemDetailTableName).Where(x => x.DataItemID == DeckEnumList.DataItemID).ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var SystemEnumList = SqlSugarHelper.Db.Queryable<ec_dataitemEntity>().AS(DataItemTableName).First(x => x.DataItemCode == GlobalObject.enumlist_System);
|
||||||
|
if (SystemEnumList != null)
|
||||||
|
{
|
||||||
|
allSystems = SqlSugarHelper.Db.Queryable<ec_dataitemdetailEntity>().AS(DataItemDetailTableName).Where(x => x.DataItemID == SystemEnumList.DataItemID).ToList();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
var needPropsName = new List<string>() {
|
||||||
|
GlobalObject.propName_System, GlobalObject.propName_CableSpec,
|
||||||
|
"变频电缆","本安电缆","是否独立屏蔽","是否防火","是否铠装","电缆供货类型","平行电缆",
|
||||||
|
"甲板号","房间号","中文名称",GlobalObject.propName_Frame, GlobalObject.propName_cableTypeTest};
|
||||||
|
var allprops = SqlSugarHelper.Db.Queryable<ec_enginedata_propertyEntity>().AS(propertyTableName).
|
||||||
|
Where(x => needPropsName.Contains(x.PropertyName)).
|
||||||
|
ToList();
|
||||||
|
|
||||||
|
switch (model)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
case 1://按系统
|
||||||
|
validSystemIds = new ec_dataitemBLL().GetChildNodes(ProjectId, dataItemDetailIDOrDwgCategoryID); break;
|
||||||
|
case 2://按图纸(可能选的是目录,也可能选的是图纸)
|
||||||
|
var folder = dwgCategory.FirstOrDefault(x => x.DrawingCatalogueID == dataItemDetailIDOrDwgCategoryID);
|
||||||
|
if (folder != null)
|
||||||
|
{
|
||||||
|
//选的是目录
|
||||||
|
validSystemIds = new ec_drawing_catalogueBLL().GetChildNodes(ProjectId, dataItemDetailIDOrDwgCategoryID); break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var dwg = allDwgs.FirstOrDefault(x => x.DrawingFileID == dataItemDetailIDOrDwgCategoryID);
|
||||||
|
if (dwg != null)
|
||||||
|
{
|
||||||
|
//选的是文件
|
||||||
|
validSystemIds.Add(dwg.DrawingFileID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//ID 有些问题
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
var cableFromToRel = SqlSugarHelper.Db.Queryable<ec_reltypeEntity>().AS(relTypeTableName).ToList().FirstOrDefault(x => x.RelType == enum_RelType.设备_电缆);
|
||||||
|
if (cableFromToRel == null)
|
||||||
|
{
|
||||||
|
throw new Exception($"查不到【{enum_RelType.设备_电缆.ToString()}】这个关联类型。");
|
||||||
|
}
|
||||||
|
var relDatas = SqlSugarHelper.Db.Queryable<ec_enginedata_relEntity>().AS(relTableName)
|
||||||
|
.LeftJoin<ec_enginedataEntity>((eere, eede1) => eere.RelEngineData1ID == eede1.EngineDataID).AS<ec_enginedataEntity>(enginedataTableName)
|
||||||
|
.LeftJoin<ec_objecttypeEntity>((eere, eede1, eote1) => eede1.ObjectTypeID == eote1.ObjectTypeID).AS<ec_objecttypeEntity>(objectTypeTableName)
|
||||||
|
.LeftJoin<ec_enginedataEntity2>((eere, eede1, eote1, eede2) => eere.RelEngineData2ID == eede2.EngineDataID).AS<ec_enginedataEntity2>(enginedataTableName)
|
||||||
|
.LeftJoin<ec_objecttypeEntity2>((eere, eede1, eote1, eede2, eote2) => eede2.ObjectTypeID == eote2.ObjectTypeID).AS<ec_objecttypeEntity2>(objectTypeTableName)
|
||||||
|
.Where((eere, eede1, eote1, eede2, eote2) => eere.RelTypeID == cableFromToRel.RelTypeID)
|
||||||
|
.Select((eere, eede1, eote1, eede2, eote2) => new {
|
||||||
|
eere.EngineDataRelID,
|
||||||
|
eere.RelTypeID,
|
||||||
|
eere.RelEngineData1ID,
|
||||||
|
RelEngDataObjType1 = eote1.ObjectTypeName,
|
||||||
|
eere.RelEngineData2ID,
|
||||||
|
RelEngDataObjType2 = eote2.ObjectTypeName,
|
||||||
|
eere.OPCPixel
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
var cables = SqlSugarHelper.Db.Queryable<ec_enginedataEntity>().AS(enginedataTableName)
|
||||||
|
.InnerJoin<ec_objecttypeEntity>((a, b) => a.ObjectTypeID == b.ObjectTypeID).AS<ec_objecttypeEntity>(objectTypeTableName)
|
||||||
|
.InnerJoin<ec_enginedata_pixelEntity>((a, b, c) => a.EngineDataID == c.EngineDataID).AS<ec_enginedata_pixelEntity>(pixelTableName)
|
||||||
|
.Where((a, b, c) =>
|
||||||
|
b.ObjectTypeName.EndsWith("电缆") &&
|
||||||
|
!string.IsNullOrEmpty(a.TagNumber) &&
|
||||||
|
c.DeleteFlg != 1)
|
||||||
|
.OrderBy((a, b) => a.TagNumber)
|
||||||
|
.Select((a, b, c) => new ec_enginedataEntity
|
||||||
|
{
|
||||||
|
CaseID = a.CaseID,
|
||||||
|
EngineDataID = a.EngineDataID,
|
||||||
|
TagNumber = a.TagNumber,
|
||||||
|
ObjectTypeID = a.ObjectTypeID,
|
||||||
|
ObjectTypeName = b.ObjectTypeName,
|
||||||
|
DataStatus = a.DataStatus
|
||||||
|
})
|
||||||
|
.Distinct()
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
//24 4 2,过滤掉图面上不存在的
|
||||||
|
|
||||||
|
var Equips = SqlSugarHelper.Db.Queryable<ec_enginedataEntity>().AS(enginedataTableName)
|
||||||
|
.InnerJoin<ec_objecttypeEntity>((a, b) => a.ObjectTypeID == b.ObjectTypeID).AS<ec_objecttypeEntity>(objectTypeTableName)
|
||||||
|
.Where((a, b) => !b.ObjectTypeName.EndsWith("电缆"))
|
||||||
|
.OrderBy((a, b) => a.TagNumber)
|
||||||
|
.ToList();
|
||||||
|
#endregion
|
||||||
|
int curRow = 1;
|
||||||
|
//对电缆编号排序
|
||||||
|
cables.Sort((x, y) => CommonHelper.Compare(x.TagNumber, y.TagNumber));
|
||||||
|
|
||||||
|
foreach (var cable in cables) //Where(x => x.TagNumber == "TEST-CABLE-001" || x.TagNumber == "1L11-7")
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
bool RoutingType = false;//true时,代表**,会出现在第二个sheet里
|
||||||
|
rowCable = sheetCable.CreateRow(curRow++);
|
||||||
|
rowCable.CreateCell(0).SetCellValue("");
|
||||||
|
rowCable.CreateCell(1).SetCellValue("");
|
||||||
|
rowCable.CreateCell(2).SetCellValue("");
|
||||||
|
rowCable.CreateCell(3).SetCellValue("");
|
||||||
|
rowCable.CreateCell(4).SetCellValue("");
|
||||||
|
rowCable.CreateCell(5).SetCellValue("");
|
||||||
|
rowCable.CreateCell(6).SetCellValue("");
|
||||||
|
rowCable.CreateCell(7).SetCellValue("");
|
||||||
|
rowCable.CreateCell(8).SetCellValue("");
|
||||||
|
rowCable.CreateCell(9).SetCellValue("");
|
||||||
|
rowCable.CreateCell(10).SetCellValue("");
|
||||||
|
rowCable.CreateCell(11).SetCellValue("");
|
||||||
|
rowCable.CreateCell(12).SetCellValue("");
|
||||||
|
rowCable.CreateCell(13).SetCellValue("");
|
||||||
|
rowCable.CreateCell(14).SetCellValue("");
|
||||||
|
rowCable.CreateCell(15).SetCellValue("");
|
||||||
|
rowCable.CreateCell(16).SetCellValue("");
|
||||||
|
rowCable.CreateCell(17).SetCellValue("");
|
||||||
|
//rowCable.CreateCell(18).SetCellValue("");
|
||||||
|
|
||||||
|
//25 02 28,优化速速,估注释,搬到循环外
|
||||||
|
var TagProps = allprops.Where(x => x.EngineDataID == cable.EngineDataID)//&& (x.CaseID == "0" || string.IsNullOrEmpty(x.CaseID))
|
||||||
|
.ToList();//位号的所有属性
|
||||||
|
var PropValue = "";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#region 所属系统
|
||||||
|
var TagProp = TagProps.Where(x => x.PropertyName == GlobalObject.propName_System && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
PropValue = GetNameBeforeDoublePipe(PropValue);//双||的事情
|
||||||
|
|
||||||
|
if (!TagInRange(model, PropValue, cable, validSystemIds, ref pixels, ref allDwgs, ref allSystems))
|
||||||
|
{
|
||||||
|
curRow--;
|
||||||
|
continue;
|
||||||
|
} //判断是否在范围内
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(PropValue) && Regex.IsMatch(PropValue, "^[A-Za-z0-9]*$") && allSystems.Any(x => x.DataItemName == PropValue))
|
||||||
|
{
|
||||||
|
//换成枚举的描述
|
||||||
|
PropValue = allSystems.FirstOrDefault(x => x.DataItemName == PropValue).DataItemCode;
|
||||||
|
}
|
||||||
|
rowCable.Cells[0].SetCellValue(PropValue);//感觉这里保持默认好点
|
||||||
|
#endregion
|
||||||
|
#region 位号
|
||||||
|
rowCable.Cells[1].SetCellValue(cable.TagNumber);
|
||||||
|
if (cable.TagNumber.Contains("**"))
|
||||||
|
{
|
||||||
|
RoutingType = true;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
TagProp = TagProps.Where(x => x.PropertyName == GlobalObject.propName_cableTypeTest && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
rowCable.Cells[2].SetCellValue(PropValue);//电缆类型,信号、电力、本安、动力、随机
|
||||||
|
#region 电缆规格
|
||||||
|
TagProp = TagProps.Where(x => x.PropertyName == GlobalObject.propName_CableSpec && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
rowCable.Cells[3].SetCellValue(PropValue);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
#region 电缆型号(CJ86)
|
||||||
|
TagProp = TagProps.Where(x => x.PropertyName == "变频电缆" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
rowCable.Cells[12].SetCellValue(PropValue);
|
||||||
|
|
||||||
|
TagProp = TagProps.Where(x => x.PropertyName == "本安电缆" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
rowCable.Cells[13].SetCellValue(PropValue);
|
||||||
|
|
||||||
|
TagProp = TagProps.Where(x => x.PropertyName == "是否独立屏蔽" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
rowCable.Cells[14].SetCellValue(PropValue);
|
||||||
|
|
||||||
|
TagProp = TagProps.Where(x => x.PropertyName == "是否防火" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
rowCable.Cells[15].SetCellValue(PropValue);
|
||||||
|
|
||||||
|
TagProp = TagProps.Where(x => x.PropertyName == "是否铠装" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
rowCable.Cells[16].SetCellValue(PropValue);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
xxx:
|
||||||
|
#region 供货范围
|
||||||
|
//TagProp = TagProps.Where(x => x.PropertyName == "电缆供货类型" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
//PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
//if (PropValue.Contains("**"))
|
||||||
|
//{
|
||||||
|
// RoutingType = true;
|
||||||
|
//}
|
||||||
|
//else if (PropValue.Contains("*"))
|
||||||
|
//{
|
||||||
|
// rowCable.Cells[2].SetCellValue("A");//电缆类型,信号、电力、本安、动力、随机
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// //根据前面的 CableTypeEnum 来
|
||||||
|
//}
|
||||||
|
#endregion
|
||||||
|
//电缆的from to是根据甲板号的order顺序来的,高优先级的就属于from
|
||||||
|
int? FromOrder = -1; int? ToOrder = -1;
|
||||||
|
#region From
|
||||||
|
var cableFromId = relDatas?.FirstOrDefault(x => x?.RelEngineData2ID == cable?.EngineDataID && x?.RelEngDataObjType1?.Contains(GlobalObject.objectType_OPC) == false)?.RelEngineData1ID;
|
||||||
|
if (!string.IsNullOrEmpty(cableFromId))
|
||||||
|
{
|
||||||
|
var cableFromObj = Equips.FirstOrDefault(x => x.EngineDataID == cableFromId);
|
||||||
|
if (cableFromObj != null)
|
||||||
|
{
|
||||||
|
var EquipFromProps = allprops.Where(x => x.EngineDataID == cableFromObj.EngineDataID)
|
||||||
|
.ToList();
|
||||||
|
rowCable.Cells[4].SetCellValue(cableFromObj?.TagNumber);
|
||||||
|
|
||||||
|
TagProp = EquipFromProps.Where(x => x.PropertyName == "甲板号" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
//转换
|
||||||
|
if (!string.IsNullOrEmpty(PropValue))
|
||||||
|
{
|
||||||
|
var frDeck = allDecks.FirstOrDefault(x => x.DataItemName == ec_dataitemService.GetNameBeforeDoublePipe(PropValue));
|
||||||
|
if (frDeck != null)
|
||||||
|
{
|
||||||
|
//找到匹配的enum,但是如果code为空,依旧使用自己原本的
|
||||||
|
PropValue = string.IsNullOrEmpty(frDeck.DataItemCode) ? PropValue : frDeck.DataItemCode;
|
||||||
|
FromOrder = frDeck.OrderID;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
rowCable.Cells[5].SetCellValue(PropValue);//没找到依旧用自己原本的
|
||||||
|
|
||||||
|
TagProp = EquipFromProps.Where(x => x.PropertyName == "房间号" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
if (string.IsNullOrEmpty(PropValue))
|
||||||
|
{
|
||||||
|
//没房间号,取肋位号
|
||||||
|
TagProp = EquipFromProps.Where(x => x.PropertyName == GlobalObject.propName_Frame && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//有房间号,取房间号
|
||||||
|
}
|
||||||
|
rowCable.Cells[6].SetCellValue(PropValue);
|
||||||
|
|
||||||
|
|
||||||
|
TagProp = EquipFromProps.Where(x => x.PropertyName == "中文名称" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
rowCable.Cells[7].SetCellValue(PropValue);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#region To
|
||||||
|
var cableEndId = relDatas?.FirstOrDefault(x => x?.RelEngineData1ID == cable?.EngineDataID && x?.RelEngDataObjType2?.Contains(GlobalObject.objectType_OPC) == false)?.RelEngineData2ID;
|
||||||
|
if (!string.IsNullOrEmpty(cableEndId))
|
||||||
|
{
|
||||||
|
var cableEndObj = Equips.FirstOrDefault(x => x.EngineDataID == cableEndId);
|
||||||
|
if (cableEndObj != null)
|
||||||
|
{
|
||||||
|
var EquipToProps = allprops.Where(x => x.EngineDataID == cableEndObj.EngineDataID)
|
||||||
|
.ToList();
|
||||||
|
rowCable.Cells[8].SetCellValue(cableEndObj?.TagNumber);
|
||||||
|
|
||||||
|
|
||||||
|
TagProp = EquipToProps.Where(x => x.PropertyName == "甲板号" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
//转换
|
||||||
|
if (!string.IsNullOrEmpty(PropValue))
|
||||||
|
{
|
||||||
|
//目前属性寸的是name + || + nameEN,因为cad需要这样显示
|
||||||
|
//但是电缆表需要的是Code
|
||||||
|
var ToDeck = allDecks.FirstOrDefault(x => x.DataItemName == ec_dataitemService.GetNameBeforeDoublePipe(PropValue));
|
||||||
|
if (ToDeck != null)
|
||||||
|
{
|
||||||
|
//找到匹配的enum,但是如果code为空,依旧使用自己原本的
|
||||||
|
PropValue = string.IsNullOrEmpty(ToDeck.DataItemCode) ? PropValue : ToDeck.DataItemCode;
|
||||||
|
ToOrder = ToDeck.OrderID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rowCable.Cells[9].SetCellValue(PropValue);
|
||||||
|
|
||||||
|
TagProp = EquipToProps.Where(x => x.PropertyName == "房间号" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
if (string.IsNullOrEmpty(PropValue))
|
||||||
|
{
|
||||||
|
//没房间号,取肋位号
|
||||||
|
TagProp = EquipToProps.Where(x => x.PropertyName == GlobalObject.propName_Frame && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//有房间号,取房间号
|
||||||
|
}
|
||||||
|
rowCable.Cells[10].SetCellValue(PropValue);
|
||||||
|
|
||||||
|
|
||||||
|
TagProp = EquipToProps.Where(x => x.PropertyName == "中文名称" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
rowCable.Cells[11].SetCellValue(PropValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
if (FromOrder != -1 && ToOrder != -1)
|
||||||
|
{
|
||||||
|
if (FromOrder > ToOrder)
|
||||||
|
{
|
||||||
|
//5678 9 10 11 12
|
||||||
|
var tempTag = rowCable.Cells[4].StringCellValue;
|
||||||
|
var tempDeck = rowCable.Cells[5].StringCellValue;
|
||||||
|
var tempRoom = rowCable.Cells[6].StringCellValue;
|
||||||
|
var tempName = rowCable.Cells[7].StringCellValue;
|
||||||
|
|
||||||
|
rowCable.Cells[4].SetCellValue(rowCable.Cells[8].StringCellValue);
|
||||||
|
|
||||||
|
rowCable.Cells[5].SetCellValue(rowCable.Cells[9].StringCellValue);
|
||||||
|
|
||||||
|
rowCable.Cells[6].SetCellValue(rowCable.Cells[10].StringCellValue);
|
||||||
|
|
||||||
|
rowCable.Cells[7].SetCellValue(rowCable.Cells[11].StringCellValue);
|
||||||
|
|
||||||
|
rowCable.Cells[8].SetCellValue(tempTag);
|
||||||
|
rowCable.Cells[9].SetCellValue(tempDeck);
|
||||||
|
rowCable.Cells[10].SetCellValue(tempRoom);
|
||||||
|
rowCable.Cells[11].SetCellValue(tempName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#region 第二个sheet和平行电缆
|
||||||
|
if (RoutingType)
|
||||||
|
{
|
||||||
|
// 在目标工作表中创建新行
|
||||||
|
IRow newRow = sheetCable2.CreateRow(sheetCable2.LastRowNum + 1); // 将新行添加到目标工作表的末尾
|
||||||
|
|
||||||
|
// 复制源行的单元格数据到新行
|
||||||
|
for (int i = 0; i < rowCable.LastCellNum; i++)
|
||||||
|
{
|
||||||
|
ICell sourceCell = rowCable.GetCell(i);
|
||||||
|
ICell newCell = newRow.CreateCell(i);
|
||||||
|
|
||||||
|
if (sourceCell != null)
|
||||||
|
{
|
||||||
|
newCell.SetCellValue(sourceCell.StringCellValue); // 这里假设你的单元格都包含文本数据
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < rowCable.LastCellNum; i++)
|
||||||
|
{
|
||||||
|
rowCable.CreateCell(i).SetCellValue("");
|
||||||
|
}
|
||||||
|
curRow--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TagProp = TagProps.Where(x => x.PropertyName == "平行电缆" && !string.IsNullOrEmpty(x.PropertyValue)).ToList();
|
||||||
|
PropValue = TagProp.Count() == 0 ? "" : TagProp.Last()?.PropertyValue;
|
||||||
|
if (!string.IsNullOrEmpty(PropValue))
|
||||||
|
{
|
||||||
|
foreach (var pCable in PropValue.Split(','))
|
||||||
|
{
|
||||||
|
// 创建新行
|
||||||
|
IRow newRow = sheetCable.CreateRow(curRow++); // 将新行添加到目标工作表的末尾
|
||||||
|
|
||||||
|
// 复制源行的单元格数据到新行
|
||||||
|
for (int i = 0; i < rowCable.LastCellNum; i++)
|
||||||
|
{
|
||||||
|
ICell sourceCell = rowCable.GetCell(i);
|
||||||
|
ICell newCell = newRow.CreateCell(i);
|
||||||
|
|
||||||
|
if (sourceCell != null)
|
||||||
|
{
|
||||||
|
newCell.SetCellValue(sourceCell.StringCellValue); // 这里假设你的单元格都包含文本数据
|
||||||
|
}
|
||||||
|
}
|
||||||
|
newRow.CreateCell(1).SetCellValue(pCable);
|
||||||
|
}
|
||||||
|
Console.Write(PropValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
log4net.LogManager.GetLogger("ERROR").Error("导出电缆清册 - " + ex.Message + ex.StackTrace);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,7 @@ var bootstrap = function ($, learun) {
|
|||||||
url: top.$.rootUrl + '/ZZDT_EC/ec_library_file/GetTreeDataByObjectType',//获取数据地址
|
url: top.$.rootUrl + '/ZZDT_EC/ec_library_file/GetTreeDataByObjectType',//获取数据地址
|
||||||
param: { ProjectId: ProjectId, ObjectTypeID: objectTypeId }, //请求后台参数
|
param: { ProjectId: ProjectId, ObjectTypeID: objectTypeId }, //请求后台参数
|
||||||
type: 'tree',//数据展示类型: 1.default:普通;2.tree:树形数据;3. treemultiple:树形多选;multiple:普通多选
|
type: 'tree',//数据展示类型: 1.default:普通;2.tree:树形数据;3. treemultiple:树形多选;multiple:普通多选
|
||||||
allowSearch: true,
|
allowSearch: true
|
||||||
maxHeight: 225
|
|
||||||
}).lrselectSet(LayoutLibFileID);//lrselectSet获取下拉框选择的值,传入objectTypeId
|
}).lrselectSet(LayoutLibFileID);//lrselectSet获取下拉框选择的值,传入objectTypeId
|
||||||
},
|
},
|
||||||
initData: function () {
|
initData: function () {
|
||||||
|
@ -97,8 +97,8 @@ var bootstrap = function ($, learun) {
|
|||||||
var keyValue = $('#gridtable').jfGridValue('ObjectTypeID');
|
var keyValue = $('#gridtable').jfGridValue('ObjectTypeID');
|
||||||
var keyName = $('#gridtable').jfGridValue('ObjectTypeName');
|
var keyName = $('#gridtable').jfGridValue('ObjectTypeName');
|
||||||
if (learun.checkrow(keyValue)) {
|
if (learun.checkrow(keyValue)) {
|
||||||
if (keyName == "OPC" || keyName == "基点" || keyName == "图框") {
|
if (keyName = "附属件_内部开关" || keyName == "OPC" || keyName == "基点" || keyName == "图框") {
|
||||||
learun.alert.warning("OPC为系统内置的特殊类型,无法编辑其属性!");
|
learun.alert.warning(keyName + " 为系统内置的特殊类型,无法编辑其属性!");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
learun.layerForm({
|
learun.layerForm({
|
||||||
@ -123,7 +123,7 @@ var bootstrap = function ($, learun) {
|
|||||||
var keyValue = $('#gridtable').jfGridValue('ObjectTypeID');
|
var keyValue = $('#gridtable').jfGridValue('ObjectTypeID');
|
||||||
var keyName = $('#gridtable').jfGridValue('ObjectTypeName');
|
var keyName = $('#gridtable').jfGridValue('ObjectTypeName');
|
||||||
if (learun.checkrow(keyValue)) {
|
if (learun.checkrow(keyValue)) {
|
||||||
if (keyName == "OPC" || keyName == "基点" || keyName == "图框" || keyName == "TagNumber") {
|
if (keyName = "附属件_内部开关" || keyName == "OPC" || keyName == "基点" || keyName == "图框" ) {
|
||||||
learun.alert.warning(keyName + "为系统内置的特殊类型,无法删除!");
|
learun.alert.warning(keyName + "为系统内置的特殊类型,无法删除!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -190,8 +190,8 @@ var bootstrap = function ($, learun) {
|
|||||||
learun.alert.warning('请选择最后一级!');
|
learun.alert.warning('请选择最后一级!');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (keyName == "OPC" || keyName == "基点" || keyName == "图框") {
|
if (keyName = "附属件_内部开关" || keyName == "OPC" || keyName == "基点" || keyName == "图框") {
|
||||||
learun.alert.warning("OPC为系统内置的特殊类型 \u000d 无法进行“命名规则设置”!");
|
learun.alert.warning(keyName+ " 为系统内置的特殊类型 \u000d 无法进行“命名规则设置”!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
learun.layerForm({
|
learun.layerForm({
|
||||||
|
@ -40,7 +40,7 @@ var bootstrap = function ($, learun) {
|
|||||||
if (learun.checkrow(keyValue)) {
|
if (learun.checkrow(keyValue)) {
|
||||||
var folderId = $('#gridtable').jfGridValue('FolderId');
|
var folderId = $('#gridtable').jfGridValue('FolderId');
|
||||||
var reportFileName = $('#gridtable').jfGridValue('ReportFileName');
|
var reportFileName = $('#gridtable').jfGridValue('ReportFileName');
|
||||||
if (reportFileName == '电缆清册') {
|
if (reportFileName == '电缆清册' || reportFileName == '电缆册') {
|
||||||
learun.layerForm({
|
learun.layerForm({
|
||||||
id: 'systemselect',
|
id: 'systemselect',
|
||||||
title: '电缆清册 参数选择',
|
title: '电缆清册 参数选择',
|
||||||
|
@ -3434,6 +3434,8 @@
|
|||||||
<Content Include="SQL\250307\Project\ec_archive_enginedata_3.sql" />
|
<Content Include="SQL\250307\Project\ec_archive_enginedata_3.sql" />
|
||||||
<Content Include="SQL\250307\Project\ec_archive_property_3.sql" />
|
<Content Include="SQL\250307\Project\ec_archive_property_3.sql" />
|
||||||
<Content Include="SQL\250307\Project\ec_archive_rel_3.sql" />
|
<Content Include="SQL\250307\Project\ec_archive_rel_3.sql" />
|
||||||
|
<Content Include="SQL\251013\Project\ec_dataitem.sql" />
|
||||||
|
<Content Include="SQL\251013\Project\ec_objecttypeP.sql" />
|
||||||
<Content Include="SQL\250902\Project\ec_objecttype.sql" />
|
<Content Include="SQL\250902\Project\ec_objecttype.sql" />
|
||||||
<Content Include="SQL\250829\Project\ec_dataItem.sql" />
|
<Content Include="SQL\250829\Project\ec_dataItem.sql" />
|
||||||
<Content Include="SQL\250829\NoProject\ec_project.sql" />
|
<Content Include="SQL\250829\NoProject\ec_project.sql" />
|
||||||
@ -3663,6 +3665,7 @@
|
|||||||
<Folder Include="SQL\250728\NoProject\" />
|
<Folder Include="SQL\250728\NoProject\" />
|
||||||
<Folder Include="SQL\250825\NoProject\" />
|
<Folder Include="SQL\250825\NoProject\" />
|
||||||
<Folder Include="SQL\250902\NoProject\" />
|
<Folder Include="SQL\250902\NoProject\" />
|
||||||
|
<Folder Include="SQL\251013\NoProject\" />
|
||||||
<Folder Include="Views\PlotLayout\" />
|
<Folder Include="Views\PlotLayout\" />
|
||||||
<Folder Include="Views\Property\" />
|
<Folder Include="Views\Property\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE ec_dataitem ADD ShowEN int NULL;
|
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE ec_objecttypep ADD ShowEN int NULL;
|
@ -729,9 +729,9 @@ CREATE TABLE `ec_objecttype` (
|
|||||||
`DefaultLayoutLibFileID` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '布置图默认的å<EFBFBD>?,
|
`DefaultLayoutLibFileID` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '布置图默认的å<EFBFBD>?,
|
||||||
`ObjectTypeName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
`ObjectTypeName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||||
`ObjectTypeNameEN` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
`ObjectTypeNameEN` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||||
`IsSerialNumber` int NULL DEFAULT NULL COMMENT '是å<EFBFBD>¦ç”Ÿæˆ<EFBFBD>æµ<EFBFBD>æ°´å<EFBFBD>?,
|
`IsSerialNumber` int NULL DEFAULT NULL ,
|
||||||
`IsOOTB` int NULL DEFAULT NULL COMMENT '是å<EFBFBD>¦æ˜¯å†…置的特殊类型',
|
`IsOOTB` int NULL DEFAULT NULL ,
|
||||||
`specialType` int NULL DEFAULT NULL COMMENT '电力一æ¬?æˆ?电力二次 æˆ?系统柜ç‰',
|
`specialType` int NULL DEFAULT NULL ,
|
||||||
`OrderID` int NULL DEFAULT NULL,
|
`OrderID` int NULL DEFAULT NULL,
|
||||||
`FullPath` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
`FullPath` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||||
`FullPathCN` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
`FullPathCN` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||||
|
@ -729,9 +729,9 @@ CREATE TABLE `ec_objecttype` (
|
|||||||
`DefaultLayoutLibFileID` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '布置图默认的å<EFBFBD>?,
|
`DefaultLayoutLibFileID` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '布置图默认的å<EFBFBD>?,
|
||||||
`ObjectTypeName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
`ObjectTypeName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||||
`ObjectTypeNameEN` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
`ObjectTypeNameEN` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||||
`IsSerialNumber` int NULL DEFAULT NULL COMMENT '是å<EFBFBD>¦ç”Ÿæˆ<EFBFBD>æµ<EFBFBD>æ°´å<EFBFBD>?,
|
`IsSerialNumber` int NULL DEFAULT NULL ,
|
||||||
`IsOOTB` int NULL DEFAULT NULL COMMENT '是å<EFBFBD>¦æ˜¯å†…置的特殊类型',
|
`IsOOTB` int NULL DEFAULT NULL ,
|
||||||
`specialType` int NULL DEFAULT NULL COMMENT '电力一æ¬?æˆ?电力二次 æˆ?系统柜ç‰',
|
`specialType` int NULL DEFAULT NULL ,
|
||||||
`OrderID` int NULL DEFAULT NULL,
|
`OrderID` int NULL DEFAULT NULL,
|
||||||
`FullPath` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
`FullPath` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||||
`FullPathCN` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
`FullPathCN` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -81,6 +81,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
|||||||
public const string propName_YOff = "纵骨偏移量(mm)";
|
public const string propName_YOff = "纵骨偏移量(mm)";
|
||||||
public const string propName_TagNumber = "TagNumber";
|
public const string propName_TagNumber = "TagNumber";
|
||||||
public const string propName_Room = "房间号";
|
public const string propName_Room = "房间号";
|
||||||
|
public const string propName_cableTypeTest = "电缆类型(测试)";
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region projSetting
|
#region projSetting
|
||||||
|
@ -64,9 +64,9 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var CB in res)
|
foreach (var CB in res)
|
||||||
{
|
{
|
||||||
Type type = CB.GetType();
|
Type type = CB.GetType();
|
||||||
//CB.CableIDs = ec_Enginedata_RelBLL.GetList("{ProjectId:\"" + ProjID + "\",RelEngineData1ID:\"" + CB.EngineerDataID + "\"}").
|
//CB.CableIDs = ec_Enginedata_RelBLL.GetList("{ProjectId:\"" + ProjID + "\",RelEngineData1ID:\"" + CB.EngineerDataID + "\"}").
|
||||||
// Where(X => !string.IsNullOrEmpty(X.TagNumber2)).
|
// Where(X => !string.IsNullOrEmpty(X.TagNumber2)).
|
||||||
@ -76,16 +76,16 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
|||||||
CB.CableTagNumbers = new List<string>();
|
CB.CableTagNumbers = new List<string>();
|
||||||
|
|
||||||
|
|
||||||
foreach (var item in CBsProps.Where(x=>x.EngineDataID == CB.EngineerDataID))
|
foreach (var item in CBsProps.Where(x => x.EngineDataID == CB.EngineerDataID))
|
||||||
{
|
{
|
||||||
PropertyInfo property = type .GetProperty(item.PropertyName);
|
PropertyInfo property = type.GetProperty(item.PropertyName);
|
||||||
if (property != null && property.CanWrite)
|
if (property != null && property.CanWrite)
|
||||||
{
|
{
|
||||||
property.SetValue(CB, Convert.ChangeType(item.PropertyValue, property.PropertyType));
|
property.SetValue(CB, Convert.ChangeType(item.PropertyValue, property.PropertyType));
|
||||||
} //属性要怎么来,从property来了,然后通过反射,填充到 cb 类的属性里
|
} //属性要怎么来,从property来了,然后通过反射,填充到 cb 类的属性里
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//所有在一端是开关的关联关系
|
//所有在一端是开关的关联关系
|
||||||
//foreach (var item in RelBreaker_CableCol.
|
//foreach (var item in RelBreaker_CableCol.
|
||||||
@ -162,6 +162,125 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 按tag的属性来返回开关
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ProjID"></param>
|
||||||
|
/// <param name="EngineerDataID">开关箱对应的工程id</param>
|
||||||
|
/// <param name="OnlySelf"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public List<ec_CircuitBreakerEntity> GetBreakersUnderPDBNew(string ProjID, string EngineerDataID, bool OnlySelf = false)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var engineBll = new ec_enginedataService();
|
||||||
|
var ProjectEntity = new ec_projectEntity();
|
||||||
|
ProjectEntity = new ec_projectBLL().GetEntity(ProjID);
|
||||||
|
if (ProjectEntity == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var propTbName = ProjectSugar.TableName<ec_enginedata_propertyEntity>(ProjID);
|
||||||
|
var objectTypeTbName = ProjectSugar.TableName<ec_objecttypeEntity>(ProjID);
|
||||||
|
var objectType = SqlSugarHelper.Db.Queryable<ec_objecttypeEntity>().AS(objectTypeTbName).First(x => x.ObjectTypeName == GlobalObject.objectType_Breaker);
|
||||||
|
|
||||||
|
if (objectType == null)
|
||||||
|
{
|
||||||
|
throw new Exception("项目中不存在" + GlobalObject.objectType_Breaker + "这个内置类型。请联系管理员。");
|
||||||
|
}
|
||||||
|
//所有类别的属性信息
|
||||||
|
var objectTypeProps = new ec_objecttypepBLL().GetObjectTypePById(objectType.ObjectTypeID, ProjID, true);
|
||||||
|
//所有和电缆的关联关系
|
||||||
|
var allRels = ec_Enginedata_RelBLL.GetList("{ProjectId:\"" + ProjID + "\",RelType:\"" + (int)enum_RelType.设备_电缆 + "\"}");
|
||||||
|
//该PDB上和电缆的关联关系
|
||||||
|
//var PDBallRels = allRels.Where(x => x.RelEngineData1ID == EngineerDataID || x.RelEngineData2ID == EngineerDataID).ToList();
|
||||||
|
//所有开关
|
||||||
|
var CBs = ec_CircuitBreakerService.GetList("{ProjectId:\"" + ProjID + "\"}");
|
||||||
|
//属于这个箱子的开关
|
||||||
|
CBs = CBs.Where(x => x.PDBId == EngineerDataID).OrderBy(x => x.OrderId).ToList();
|
||||||
|
List<string> resIDs = CBs.Select(x => x.EngineerDataID).ToList();
|
||||||
|
//开关上的所有属性
|
||||||
|
var CBsProps = SqlSugarHelper.Db.Queryable<ec_enginedata_propertyEntity>().AS(propTbName).
|
||||||
|
Where(x => resIDs.Contains(x.EngineDataID)).ToList();
|
||||||
|
var CBTags = engineBll.GetListSingleTable(ProjID, resIDs).ToList();
|
||||||
|
#region 远端电缆
|
||||||
|
foreach (var CB in CBs)
|
||||||
|
{
|
||||||
|
CB.CableIDs = new List<string>();
|
||||||
|
CB.CableTagNumbers = new List<string>();
|
||||||
|
//所有在一端是开关的关联关系
|
||||||
|
if (!string.IsNullOrEmpty(CB.CableID))
|
||||||
|
{
|
||||||
|
CB.CableIDs = CB.CableID.Split(',').ToList();//目前就考虑一个
|
||||||
|
CB.CableTagNumbers = engineBll.GetListSingleTable(ProjID, CB.CableIDs).Select(x => x.TagNumber).ToList();
|
||||||
|
//另一边的开关(cableid相同 但是开关id不同)
|
||||||
|
foreach (var RemoteItem in CBs.Where(x => x.CableID == CB.CableID && x.EngineerDataID != CB.EngineerDataID))
|
||||||
|
{
|
||||||
|
// var remoteCB = ec_CircuitBreakerService.GetList("{ProjectId:\"" + ProjID + "\",EngineerDataID:\"" + RemoteItem.RelEngineData1ID + "\"}").FirstOrDefault();
|
||||||
|
// if (remoteCB != null)
|
||||||
|
// {
|
||||||
|
CB.RemoteCB = RemoteItem;//此时,插件端用的是这个来拼出"对面的开关"
|
||||||
|
// 属性从 prop里来,而不是从CB表来
|
||||||
|
|
||||||
|
CB.RemoteDeviceId = RemoteItem.PDBId;
|
||||||
|
CB.RemoteDeviceName = RemoteItem.PDBName;
|
||||||
|
CB.RemoteDeviceObjectType = RemoteItem.ObjectTypeName;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CB.RemoteCB == null)
|
||||||
|
{
|
||||||
|
//对面不是通过开关连接,而是直接接到了负载上
|
||||||
|
var remoteRelObj = allRels.FirstOrDefault(x => x.RelEngineData1ID == CB.CableID && x.RelEngineData2ID != EngineerDataID);
|
||||||
|
if (remoteRelObj != null)
|
||||||
|
{
|
||||||
|
CB.RemoteDeviceId = remoteRelObj.RelEngineData2ID;
|
||||||
|
CB.RemoteDeviceName = remoteRelObj.TagNumber2;
|
||||||
|
CB.RemoteDeviceObjectType = remoteRelObj.Type2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
remoteRelObj = allRels.FirstOrDefault(x => x.RelEngineData2ID == CB.CableID && x.RelEngineData1ID != EngineerDataID);
|
||||||
|
|
||||||
|
if (remoteRelObj != null)
|
||||||
|
{
|
||||||
|
CB.RemoteDeviceId = remoteRelObj.RelEngineData1ID;
|
||||||
|
CB.RemoteDeviceName = remoteRelObj.TagNumber1;
|
||||||
|
CB.RemoteDeviceObjectType = remoteRelObj.Type1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//NULL
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CB.Tag = CBTags.FirstOrDefault(x => x.EngineDataID == CB.EngineerDataID);
|
||||||
|
if (CB.Tag != null)
|
||||||
|
{
|
||||||
|
CB.Tag.EngineDataProperty = CBsProps.Where(x => x.EngineDataID == CB.EngineerDataID).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
return CBs.Where(x => x.Tag != null).ToList();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
if (ex is ExceptionEx)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw ExceptionEx.ThrowBusinessException(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -190,22 +309,22 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
|||||||
{
|
{
|
||||||
if (entity != null)
|
if (entity != null)
|
||||||
{
|
{
|
||||||
|
var typeTbName = ProjectSugar.TableName<ec_objecttypeEntity>(ProjectId);
|
||||||
|
var ec_objtype = SqlSugarHelper.Db.Queryable<ec_objecttypeEntity>().AS(typeTbName).First(x => x.ObjectTypeName == GlobalObject.objectType_Breaker);
|
||||||
|
if (ec_objtype == null)
|
||||||
|
{
|
||||||
|
throw new Exception($"系统中找不到内置的开关类型【{GlobalObject.objectType_Breaker}】。请联系管理员。");
|
||||||
|
}
|
||||||
#region CB
|
#region CB
|
||||||
bool mode = BreakerID == "" ? true : false;
|
bool mode = string.IsNullOrEmpty(BreakerID) ? true : false;
|
||||||
entity.PDBId = PBDId;
|
entity.PDBId = PBDId;
|
||||||
ec_CircuitBreakerService.SaveEntity(ProjectId, ref BreakerID, entity);
|
ec_CircuitBreakerService.SaveEntity(ProjectId, ref BreakerID, entity);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region tag
|
#region tag
|
||||||
var typeTbName = ProjectSugar.TableName<ec_objecttypeEntity>(ProjectId);
|
|
||||||
var ec_objtype = SqlSugarHelper.Db.Queryable<ec_objecttypeEntity>().AS(typeTbName).First(x => x.ObjectTypeName == GlobalObject.objectType_Breaker);
|
|
||||||
if (ec_objtype == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var tagTbName = ProjectSugar.TableName<ec_enginedataEntity>(ProjectId);
|
var tagTbName = ProjectSugar.TableName<ec_enginedataEntity>(ProjectId);
|
||||||
ec_enginedataEntity addEnginedata = new ec_enginedataEntity();
|
ec_enginedataEntity addEnginedata = new ec_enginedataEntity();
|
||||||
@ -231,7 +350,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region prop
|
#region prop
|
||||||
var propBll = new ec_enginedata_propertyBLL();
|
var propBll = new ec_enginedata_propertyBLL();
|
||||||
//属性还是要去存enginedata_prop表
|
//属性还是要去存enginedata_prop表
|
||||||
var TagProps = propBll.ConvertPropToEngineProp<ec_CircuitBreakerEntity>(ProjectId, ec_objtype.ObjectTypeID, addEnginedata.EngineDataID, entity);
|
var TagProps = propBll.ConvertPropToEngineProp<ec_CircuitBreakerEntity>(ProjectId, ec_objtype.ObjectTypeID, addEnginedata.EngineDataID, entity);
|
||||||
propBll.SaveEngineProp(ProjectId, TagProps);
|
propBll.SaveEngineProp(ProjectId, TagProps);
|
||||||
|
@ -327,6 +327,8 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
|||||||
[SugarColumn(IsIgnore = true)]
|
[SugarColumn(IsIgnore = true)]
|
||||||
public string RemoteDeviceObjectType { get; set; }
|
public string RemoteDeviceObjectType { get; set; }
|
||||||
|
|
||||||
|
[SugarColumn(IsIgnore = true)]
|
||||||
|
public ec_enginedataEntity Tag { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -171,6 +171,10 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
|||||||
{
|
{
|
||||||
//ProjectEntity = this.BaseRepository().FindEntity<ec_projectEntity>(ProjectId);
|
//ProjectEntity = this.BaseRepository().FindEntity<ec_projectEntity>(ProjectId);
|
||||||
ProjectEntity = new ec_projectBLL().GetEntity(ProjectId);
|
ProjectEntity = new ec_projectBLL().GetEntity(ProjectId);
|
||||||
|
if (ProjectEntity == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1017,24 +1017,6 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
|||||||
{
|
{
|
||||||
sourceTag.ObjectTypeID = curObjectTypeData.ObjectTypeID;//新的对象类型ID //会影响sourceTags这个原始集合
|
sourceTag.ObjectTypeID = curObjectTypeData.ObjectTypeID;//新的对象类型ID //会影响sourceTags这个原始集合
|
||||||
|
|
||||||
//if (curdEngineData != null)
|
|
||||||
//{
|
|
||||||
// //位号重复
|
|
||||||
// strEngineDataID = curdEngineData[0].EngineDataID;
|
|
||||||
|
|
||||||
// //删除当前项目的属性数据
|
|
||||||
// listPropByEngineIds.Add(curdEngineData[0].EngineDataID);
|
|
||||||
|
|
||||||
// curdEngineData[0].ObjectTypeID = curObjectTypeID;
|
|
||||||
// curdEngineData[0].UpdateTime = Time.MySqlTime;
|
|
||||||
// curdEngineData[0].UpdateUserID = userInfo.userId;
|
|
||||||
// //更新工程数据表
|
|
||||||
// updateEngineDataList.Add(curdEngineData[0]);
|
|
||||||
|
|
||||||
//}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
|
|
||||||
#region enginedata
|
#region enginedata
|
||||||
//判断当前项目中工程数据是否存在
|
//判断当前项目中工程数据是否存在
|
||||||
ec_enginedataEntity targetTagWithSameName = targetTags.FirstOrDefault(x => x.TagNumber.ToUpper() == sourceTag.TagNumber.ToUpper());
|
ec_enginedataEntity targetTagWithSameName = targetTags.FirstOrDefault(x => x.TagNumber.ToUpper() == sourceTag.TagNumber.ToUpper());
|
||||||
@ -1441,7 +1423,9 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
|||||||
|
|
||||||
Db.Insertable(addEngineDataList).AS($"ec_enginedata_{targetProject.ProjectIndex}").ExecuteCommand();
|
Db.Insertable(addEngineDataList).AS($"ec_enginedata_{targetProject.ProjectIndex}").ExecuteCommand();
|
||||||
Db.Insertable(addPixelList).AS($"ec_enginedata_pixel_{targetProject.ProjectIndex}").ExecuteCommand();
|
Db.Insertable(addPixelList).AS($"ec_enginedata_pixel_{targetProject.ProjectIndex}").ExecuteCommand();
|
||||||
Db.Insertable(addPropertyList).AS($"ec_enginedata_property_{targetProject.ProjectIndex}").ExecuteCommand();
|
Db.Ado.ExecuteCommand("SET GLOBAL local_infile = 1;");
|
||||||
|
//Db.Insertable(addPropertyList).AS($"ec_enginedata_property_{targetProject.ProjectIndex}").ExecuteCommand();
|
||||||
|
Db.Fastest<ec_enginedata_propertyEntity>().AS($"ec_enginedata_property_{targetProject.ProjectIndex}").PageSize(10000).BulkCopy(addPropertyList);
|
||||||
|
|
||||||
Db.Insertable(addCableList).AS($"ec_cable_{targetProject.ProjectIndex}").ExecuteCommand();
|
Db.Insertable(addCableList).AS($"ec_cable_{targetProject.ProjectIndex}").ExecuteCommand();
|
||||||
Db.Insertable(addSetList).AS($"ec_Cable_Set_{targetProject.ProjectIndex}").ExecuteCommand();
|
Db.Insertable(addSetList).AS($"ec_Cable_Set_{targetProject.ProjectIndex}").ExecuteCommand();
|
||||||
@ -1485,7 +1469,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
return "导入结束。";
|
return string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Learun.Util;
|
using Learun.Util;
|
||||||
|
using Learun.Util.SqlSugar;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -86,7 +87,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 将一些特殊的对象,其属性对应到ec-EngineData-property上。
|
/// 将一些特殊的对象,其属性对应到ec-EngineData-property上。
|
||||||
/// 原则是:对象的属性名 = objectType关联下的PropertyName。
|
/// 原则是:对象的属性名 = objectType关联下的PropertyName。
|
||||||
/// 如果没找到,还是会按照objectType关联的属性来一份,无非是属性为空。
|
/// 比如开关,其属性不是在右侧属性栏里输入的,而是在开关箱管理界面,所以不得不这样。那能不能搞一个和右侧属性里一样的
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T"></typeparam>
|
/// <typeparam name="T"></typeparam>
|
||||||
/// <param name="ProjId"></param>
|
/// <param name="ProjId"></param>
|
||||||
@ -94,12 +95,20 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
|||||||
/// <param name="Obj"></param>
|
/// <param name="Obj"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<ec_enginedata_propertyEntity> ConvertPropToEngineProp<T>(string ProjId, string ObjectTypeId, string EngineDataId, T Obj)
|
public List<ec_enginedata_propertyEntity> ConvertPropToEngineProp<T>(string ProjId, string ObjectTypeId, string EngineDataId, T Obj)
|
||||||
{
|
{
|
||||||
var objectTypePBll = new ec_objecttypepBLL();
|
|
||||||
var typeP = objectTypePBll.GetObjectTypePById(ObjectTypeId, ProjId, true);
|
|
||||||
//属性还是要去存enginedata_prop表
|
|
||||||
var type = Obj.GetType();
|
var type = Obj.GetType();
|
||||||
var propsInClass = type.GetProperties();
|
var propsInClass = type.GetProperties();
|
||||||
|
var objectTypePBll = new ec_objecttypepBLL();
|
||||||
|
#region addauto
|
||||||
|
var existObjectTypeP = SqlSugarHelper.Db.Queryable<ec_objecttypepEntity>().Where(x=>x.ObjectTypeID == ObjectTypeId).ToList();
|
||||||
|
foreach (var propDef in propsInClass)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
var typeP = objectTypePBll.GetObjectTypePById(ObjectTypeId, ProjId, true);
|
||||||
|
//属性还是要去存enginedata_prop表
|
||||||
|
|
||||||
var TagProps = new List<ec_enginedata_propertyEntity>();
|
var TagProps = new List<ec_enginedata_propertyEntity>();
|
||||||
foreach (var prop in typeP)
|
foreach (var prop in typeP)
|
||||||
{
|
{
|
||||||
|
@ -118,6 +118,11 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(IsIgnore = true)]
|
[SugarColumn(IsIgnore = true)]
|
||||||
public string ObjectTypeName { get; set; }
|
public string ObjectTypeName { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 标记是否已使用,布置图自动放置时用
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(IsIgnore = true)]
|
||||||
|
public bool Marker { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
|||||||
/// <param name="dataType">0:对象类型、1:位号、2:图纸</param>
|
/// <param name="dataType">0:对象类型、1:位号、2:图纸</param>
|
||||||
/// <param name="KeyWork">位号的关键字</param>
|
/// <param name="KeyWork">位号的关键字</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<TreeModel> GetObjectTypeData3Level(string projectId, string dataType, string KeyWord = "")
|
public List<TreeModel> GetObjectTypeData3Level(string projectId, string dataType, string KeyWord = "",bool showOOTB = false)
|
||||||
{
|
{
|
||||||
List<TreeModel> treeList = new List<TreeModel>();
|
List<TreeModel> treeList = new List<TreeModel>();
|
||||||
|
|
||||||
@ -78,7 +78,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
|||||||
if (dataType.Equals("0") || dataType.Equals("1") || dataType.Equals("2"))
|
if (dataType.Equals("0") || dataType.Equals("1") || dataType.Equals("2"))
|
||||||
{
|
{
|
||||||
//获取所有的对象类型的基础信息
|
//获取所有的对象类型的基础信息
|
||||||
var listObjectType = GetList("{\"ProjectId\":\"" + projectId + "\"}", null).ToList();
|
var listObjectType = GetList("{\"ProjectId\":\"" + projectId + "\"}", null, showOOTB).ToList();
|
||||||
//包括关键字的对象类型
|
//包括关键字的对象类型
|
||||||
var listObjectTypeFiltered = listObjectType.Where(x => x.ObjectTypeName.Contains(KeyWord) || x.ObjectTypeNameEN.Contains(KeyWord)).ToList();
|
var listObjectTypeFiltered = listObjectType.Where(x => x.ObjectTypeName.Contains(KeyWord) || x.ObjectTypeNameEN.Contains(KeyWord)).ToList();
|
||||||
//查询位号的基础信息
|
//查询位号的基础信息
|
||||||
|
@ -15,7 +15,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
|||||||
#region 获取数据
|
#region 获取数据
|
||||||
List<ec_objTypeLayoutFilter> GetLayoutFilterList(string projId, string objTypeId);
|
List<ec_objTypeLayoutFilter> GetLayoutFilterList(string projId, string objTypeId);
|
||||||
|
|
||||||
List<TreeModel> GetObjectTypeData3Level(string projectId, string dataType, string KeyWord = "");
|
List<TreeModel> GetObjectTypeData3Level(string projectId, string dataType, string KeyWord = "",bool showOOTB=false);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取列表数据
|
/// 获取列表数据
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -150,12 +150,16 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[SugarColumn(IsIgnore = true)]
|
[SugarColumn(IsIgnore = true)]
|
||||||
public string HomerunCableName { get; set; } = "";
|
public string HomerunCableName { get; set; } = "";
|
||||||
/// <summary>
|
|
||||||
/// true时,表示假的。真正的结构还是panel strip term
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(IsIgnore = true)]
|
[SugarColumn(IsIgnore = true)]
|
||||||
bool fakeFlg { get; set; } = false;
|
public string assignCable { get; set; }
|
||||||
|
|
||||||
|
[SugarColumn(IsIgnore = true)]
|
||||||
|
public string assignCableSet { get; set; }
|
||||||
|
|
||||||
|
[SugarColumn(IsIgnore = true)]
|
||||||
|
public string ConnectionInfo { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
|
|
||||||
FE:\Di-Electrical\SWSDBSchemeUpgradeTool\MainWindow.xaml;;
|
FC:\repo\CODE\009_DI-Elec\SWSDBSchemeUpgradeTool\MainWindow.xaml;;
|
||||||
FE:\Di-Electrical\SWSDBSchemeUpgradeTool\SQLPreview.xaml;;
|
FC:\repo\CODE\009_DI-Elec\SWSDBSchemeUpgradeTool\SQLPreview.xaml;;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user