Merge branch 'main' of http://27.154.35.18:7053/yuxingheng/009_DI-Elec
# Conflicts: # newFront/c#前端/SWS.CAD/Start.cs
This commit is contained in:
commit
d3813c8d56
@ -454,7 +454,9 @@ namespace Learun.Application.Web.AppApi
|
||||
[HttpGet]
|
||||
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[] { };
|
||||
try
|
||||
{
|
||||
@ -462,8 +464,67 @@ namespace Learun.Application.Web.AppApi
|
||||
|
||||
using (var package = new ExcelPackage())//新建
|
||||
{
|
||||
var sheet = package.Workbook.Worksheets.Add("test");
|
||||
sheet.Cells[1, 1].Value = "test";
|
||||
var sheet = package.Workbook.Worksheets.Add("已经分配的");
|
||||
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();
|
||||
}
|
||||
}
|
||||
@ -638,7 +699,7 @@ namespace Learun.Application.Web.AppApi
|
||||
.GroupBy(x => x.PanelID)
|
||||
.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 set in c.Sets)
|
||||
@ -654,6 +715,9 @@ namespace Learun.Application.Web.AppApi
|
||||
var cablesOnThisPanel = cablesGrouped.Where(x => x.AssignedPanel.PanelID == curPanelId).ToList();
|
||||
if (cablesOnThisPanel == null || cablesOnThisPanel.Count == 0) continue;//next panel
|
||||
var lastUsedStrip = (ec_PanelStripEntity)null;
|
||||
var lastUsedPanel = new ec_PanelEntity();
|
||||
lastUsedPanel.strips = allStrips[curPanelId];//已经存在的所有模块
|
||||
|
||||
foreach (var cable in cablesOnThisPanel)
|
||||
{
|
||||
//1.2.2 分组原则为同一信号类型、同一系统的为一组,系统属性从电缆的from端上的设备中取设备的系统,同组的优先放到同一个箱子的同一个模块里面,
|
||||
@ -778,7 +842,7 @@ namespace Learun.Application.Web.AppApi
|
||||
#region NewTS
|
||||
|
||||
//1.2 流程图 根据信号数里自动新建端子排,端子排通道数里根据箱子模板中的默认值获得
|
||||
var newTS = CreatePanelStripByProfile2(projId, cable.AssignedPanel, newTSSeq++, ioTypeOnC);
|
||||
var newTS = CreatePanelStripByProfile2(projId, cable.AssignedPanel, newTSSeq++, ioTypeOnC);//当前采集箱无模块,需要新建
|
||||
|
||||
matchedStrips.Add(newTS);
|
||||
|
||||
@ -795,6 +859,7 @@ namespace Learun.Application.Web.AppApi
|
||||
List<ec_PanelChannelEntity> notUsedChs = new List<ec_PanelChannelEntity>();
|
||||
|
||||
#region 1.2 流程图 按规则先放几个信号进去(放不下就延到下一个模块)
|
||||
#region old
|
||||
//if (cable.Sets.Count > 10)
|
||||
//{
|
||||
// //另外如果电缆对数大于10对,即像12 * 2 * 0.75这种,无论它预分配了多少根电缆对,永远预留4个以下的空白通道。意思就是一个模块里面够4个或4个以上空白通道就留4个空白通道,如果不够4个就留4个以下即可。
|
||||
@ -1001,6 +1066,8 @@ namespace Learun.Application.Web.AppApi
|
||||
//else
|
||||
//{
|
||||
//5%的空白通道
|
||||
#endregion
|
||||
|
||||
#region FindNextAvailableTS(可能多个)
|
||||
//还分2种情况判断模块是否符合:
|
||||
//case1,. 占满可用通道后,还剩至少一个预分配的set和spared的set。 //这种时候要spared不用考虑
|
||||
@ -1009,20 +1076,21 @@ namespace Learun.Application.Web.AppApi
|
||||
bool NeedNextTS = false;
|
||||
|
||||
#region FindNextAvailableTS
|
||||
var trueAvailableChs = 0;
|
||||
var sparedButCanNotUsedChs = 0;//需要特意预留的通道,
|
||||
int idx = 0;
|
||||
while (idx < matchedStrips.Count)
|
||||
{
|
||||
NeedNextTS = false;
|
||||
var TS = matchedStrips[idx];
|
||||
var allCh = TS.Channels;
|
||||
var allChCount = allCh.Count;
|
||||
if (allChCount == 0)
|
||||
if (allCh.Count == 0)
|
||||
{
|
||||
NeedNextTS = true;
|
||||
//同时又是最后一个了
|
||||
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
|
||||
{
|
||||
//有问题了 panel的io模板,估计会导致无限循环了
|
||||
@ -1030,62 +1098,105 @@ namespace Learun.Application.Web.AppApi
|
||||
}
|
||||
matchedStrips.Add(newTS);
|
||||
}
|
||||
idx++; continue;//本模块没有一个ch
|
||||
idx++; continue;//本模块没有一个ch,否则后面 5% 会除以0
|
||||
}
|
||||
//被占用的(wt里有或者信号里或有),或者被锁定的,都算占用
|
||||
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();
|
||||
|
||||
trueAvailableChs = 0;
|
||||
var ChNeedConn = 0;
|
||||
var SparedNeedConn = 0;
|
||||
|
||||
//分3种情况,确认具体要接的ch个数和是否需要下一个ts
|
||||
if (cable.CableClass.ToLower() == SWS.Share.Enum.cableClass.homerun.ToString())
|
||||
{
|
||||
//1.2.3(2)如果模块是通讯信号(像RS485这种就是通讯信号),则不用管预留空白通道这个事情,看到有空的通道就放。
|
||||
|
||||
if (allChCount < sets.Count)
|
||||
//1.2.3(2) 如果模块是通讯信号(像RS485这种就是通讯信号),则不用管预留空白通道这个事情,看到有空的通道就放。
|
||||
#region 可用通道(通讯)
|
||||
trueAvailableChs = notUsedChs.Count;
|
||||
#endregion
|
||||
if (trueAvailableChs < sets.Count)
|
||||
{
|
||||
//case1,能顺利接完,set还有多,还要再do循环一次,多余的set和spared都要放到下一个模块
|
||||
NeedNextTS = true;
|
||||
ChNeedConn = allChCount; SparedNeedConn = 0;
|
||||
ChNeedConn = trueAvailableChs; SparedNeedConn = 0;
|
||||
}
|
||||
else if (allChCount == sets.Count)
|
||||
else if (trueAvailableChs == sets.Count)
|
||||
{
|
||||
//case3,刚好,只有spared可能多
|
||||
ChNeedConn = allChCount;
|
||||
ChNeedConn = trueAvailableChs;
|
||||
SparedNeedConn = 0; //homerun不用考虑预留一个set去配合后续的spared
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
ChNeedConn = sets.Count;
|
||||
SparedNeedConn = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#region 可用通道(非通讯)
|
||||
//1.2 流程图 空的通道数够不够
|
||||
double sparedRate = notUsedChs.Count * 1.0 / allChCount * 1.0;
|
||||
if (sparedRate < 0.05)
|
||||
if (cable.Sets.Count > 10)
|
||||
{
|
||||
NeedNextTS = true;
|
||||
//同时又是最后一个了
|
||||
if (idx == matchedStrips.Count - 1)
|
||||
//1.2.3 空白通道原则,另外如果电缆对数大于10对,即像12*2*0.75这种,无论它预分配了多少根电缆对,永远预留4个以下的空白通道。
|
||||
if (notUsedChs.Count < 4)
|
||||
{
|
||||
var newTS = CreatePanelStripByProfile2(projId, cable.AssignedPanel, newTSSeq++, ioTypeOnC);
|
||||
if (newTS.Channels.Count() < setsSpared.Count + 1)//1代表至少要放一个set
|
||||
{
|
||||
//有问题了 panel的io模板,估计会导致无限循环了
|
||||
break;
|
||||
}
|
||||
matchedStrips.Add(newTS);
|
||||
//可以认为这个ts不可用了
|
||||
trueAvailableChs = 0;
|
||||
sparedButCanNotUsedChs = notUsedChs.Count;
|
||||
notUsedChs.ForEach(x => x.lock_flg = 1);//全部标记为不可用
|
||||
}
|
||||
idx++; continue;//本模块可用的模块小于5%
|
||||
}
|
||||
//没有空闲通道 next
|
||||
//或者空闲通道不够放下这个电缆的所有set
|
||||
//算一下5%是多少个通道
|
||||
var trueAvailableChs = notUsedChs.Count - (allChCount - FindMaxNumberChannel(allChCount));//真正能用的(没接过的,然后去掉5%)
|
||||
else
|
||||
{
|
||||
//all 16,used 7,notused9, 砍去4,
|
||||
// 1. 计算起始索引
|
||||
int startIndex = Math.Max(0, notUsedChs.Count - 4);
|
||||
|
||||
// 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)
|
||||
{
|
||||
//case1,能顺利接完,set还有多,还要再do循环一次,多余的set和spared都要放到下一个模块
|
||||
@ -1097,10 +1208,21 @@ namespace Learun.Application.Web.AppApi
|
||||
//case3,刚好,只有spared可能多
|
||||
if (setsSpared.Count > 0)
|
||||
{
|
||||
//自己的感觉(非客户word需求里的原话):spared不能自己单独占用一个模块
|
||||
NeedNextTS = true;
|
||||
ChNeedConn = trueAvailableChs - 1;//留一个给spared
|
||||
SparedNeedConn = 0;
|
||||
if (sets.Count == 1)
|
||||
{
|
||||
//避免死循环
|
||||
ChNeedConn = 1;
|
||||
NeedNextTS = false;
|
||||
SparedNeedConn = trueAvailableChs - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//自己的感觉(非客户word需求里的原话):spared不能自己单独占用一个模块
|
||||
NeedNextTS = true;
|
||||
ChNeedConn = trueAvailableChs - 1;//留一个给spared
|
||||
SparedNeedConn = 0;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1120,10 +1242,21 @@ namespace Learun.Application.Web.AppApi
|
||||
//这种时候要确保spared也能放下
|
||||
else if (trueAvailableChs < sets.Count + setsSpared.Count)
|
||||
{
|
||||
//自己的感觉(非客户word需求里的原话):spared不能自己单独占用一个模块
|
||||
ChNeedConn = sets.Count - 1;//留一个给spared
|
||||
NeedNextTS = true;
|
||||
SparedNeedConn = 0;
|
||||
if (sets.Count == 1)
|
||||
{
|
||||
//避免死循环
|
||||
ChNeedConn = 1;
|
||||
NeedNextTS = false;
|
||||
SparedNeedConn = trueAvailableChs - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//自己的感觉(非客户word需求里的原话):spared不能自己单独占用一个模块
|
||||
ChNeedConn = sets.Count - 1;//留一个给spared。如果sets.COUNT只有1个,这种情况就会死循环了
|
||||
NeedNextTS = true;
|
||||
SparedNeedConn = 0;
|
||||
}
|
||||
|
||||
}
|
||||
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;
|
||||
|
||||
|
||||
|
||||
#region conn
|
||||
|
||||
for (int i = 0; i < ChNeedConn; i++)
|
||||
{
|
||||
var set = sets[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")
|
||||
{
|
||||
set.ConnectionInfo = $"采集箱:{PanelName}/模块(端子排):(自动创建){lastUsedStrip.StripName}/通道:{ch.ChannelName}";
|
||||
@ -1170,6 +1306,10 @@ namespace Learun.Application.Web.AppApi
|
||||
{
|
||||
var set = setsSpared[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")
|
||||
{
|
||||
set.ConnectionInfo = $"采集箱:{PanelName}/模块(端子排):(自动创建){lastUsedStrip.StripName}/通道:{ch.ChannelName}/冗余";
|
||||
@ -1183,17 +1323,40 @@ namespace Learun.Application.Web.AppApi
|
||||
allUsedCHBySignalOrSet.Add(ch.ChannelID);
|
||||
}
|
||||
|
||||
#endregion
|
||||
#region 预留空白通道
|
||||
if (sparedButCanNotUsedChs > 0)
|
||||
{
|
||||
Console.WriteLine("");
|
||||
}
|
||||
#endregion
|
||||
//shi否要继续
|
||||
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)
|
||||
{
|
||||
sets = sets.Where(x => !x.IsConned ?? false).ToList();//移除已经分配过的set
|
||||
//同时又是最后一个了
|
||||
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
|
||||
{
|
||||
//有问题了 panel的io模板,估计会导致无限循环了
|
||||
@ -1208,6 +1371,8 @@ namespace Learun.Application.Web.AppApi
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
#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);
|
||||
|
||||
|
@ -64,7 +64,7 @@ namespace Learun.Application.Web.AppApi
|
||||
/// <param name="PDBId">分电箱的工程ID</param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public IHttpActionResult SaveBreakers(string projId, string PDBId)
|
||||
public IHttpActionResult SaveBreakers(string projId, string PDBId, [FromBody] List<ec_CircuitBreakerEntity> CBs)
|
||||
{
|
||||
|
||||
try
|
||||
@ -72,7 +72,7 @@ namespace Learun.Application.Web.AppApi
|
||||
ec_enginedata_relBLL ec_Enginedata_RelBLL = new ec_enginedata_relBLL();
|
||||
var ec_RelTypeBll = new ec_reltypeBLL();
|
||||
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();
|
||||
if (CBs == null)
|
||||
{
|
||||
|
@ -78,6 +78,8 @@ namespace Learun.Application.Web.AppApi
|
||||
#region 预处理每个位号,然后进行分组
|
||||
foreach (ec_enginedataEntity tag in allTag)
|
||||
{
|
||||
if(tag.TagNumber.Length==38&&tag.TagNumber.Contains("{"))
|
||||
{ continue; }
|
||||
var matchedTypes = new List<string>();
|
||||
var idx = 0;
|
||||
var GroupName = TrimTagNubmer(tag.TagNumber, out idx);// 如 A-B1,A-B2,取出来的group就是A-B,idx为0
|
||||
@ -102,8 +104,7 @@ namespace Learun.Application.Web.AppApi
|
||||
{
|
||||
//如照明下的。比如10个照明的灯,4个中文名称是“顶灯”,6个中文名称是“壁灯”
|
||||
BOMTagInfo.Name = allProp.FirstOrDefault(x => x.EngineDataID == tag.EngineDataID && x.PropertyName == GlobalObject.propName_NameCN)?.PropertyValue ?? "";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
TagsInBOM.Add(BOMTagInfo);
|
||||
|
@ -160,6 +160,7 @@ namespace Learun.Application.Web.AppApi
|
||||
|
||||
res.Add(layoutTag);
|
||||
}
|
||||
res = res.OrderByDescending(x => x.RoomNo).ToList();
|
||||
// 找出area和deck列组合重复的行
|
||||
var duplicateGroups = res
|
||||
.GroupBy(r => new { r.area, r.deck, r.RoomNo })
|
||||
@ -179,7 +180,7 @@ namespace Learun.Application.Web.AppApi
|
||||
var validSystems = keyValue.Split(';').ToList();
|
||||
matchedTagIds = propAll.Where(item =>
|
||||
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();
|
||||
//}
|
||||
//else
|
||||
@ -200,15 +201,22 @@ namespace Learun.Application.Web.AppApi
|
||||
.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)
|
||||
{
|
||||
#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();
|
||||
//#task 9542
|
||||
var matchPointTagIds = DeckMatchedTagIds;//.Intersect(AreaMatchedTagIds).ToList();
|
||||
var matchPointTagIdSet = new System.Collections.Generic.HashSet<string>(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
|
||||
}
|
||||
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)
|
||||
{
|
||||
var layoutTagInfoInvalid = new layoutTagInfoBrief()
|
||||
@ -236,6 +244,10 @@ namespace Learun.Application.Web.AppApi
|
||||
area = "ERR",
|
||||
};
|
||||
basePoint.Tags.Add(layoutTagInfoInvalid);
|
||||
foreach (var item in EquipPropAll.Where(x=>x.EngineDataID== matchPointTagId))
|
||||
{
|
||||
item.Marker = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
double xValue = 0;
|
||||
@ -253,6 +265,11 @@ namespace Learun.Application.Web.AppApi
|
||||
{
|
||||
strRoom = matchedRoom.DataItemName;
|
||||
}
|
||||
if(matchedRoom==null && basePoint.RoomNo!=string.Empty)//这里基点也要判断下,只有是基点带ROOMNO值的才不统计
|
||||
{
|
||||
//如果房间号没有匹配的,肋位号有,则不打标记,而且应该把该位号放到只有肋位号的基点上去,没有这种基点则不统计
|
||||
continue;
|
||||
}
|
||||
var Prop_FrameOff = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_FrameOff)?.PropertyValue;
|
||||
var Prop_YOff = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_YOff)?.PropertyValue;
|
||||
|
||||
@ -352,6 +369,10 @@ namespace Learun.Application.Web.AppApi
|
||||
RoomNo = strRoom
|
||||
};
|
||||
basePoint.Tags.Add(layoutTagInfo);
|
||||
foreach (var item in EquipPropAll.Where(x => x.EngineDataID == matchPointTagId))
|
||||
{
|
||||
item.Marker = true;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ namespace Learun.Application.Web.AppApi
|
||||
var res4 = templateCategoryBll.GetTemplateCategory(ProjId);
|
||||
#endregion
|
||||
#region ObjectTypeApi/GetObjectTypeData0
|
||||
var res5 = objectTypeBll.GetObjectTypeData3Level(ProjId, "0");
|
||||
var res5 = objectTypeBll.GetObjectTypeData3Level(ProjId, "0","",true);
|
||||
#endregion
|
||||
#region ObjectTypeApi/GetObjectTypeData2
|
||||
// 这个数据量太大,导致加载项目时卡顿长达6分钟,所以单独独立出去
|
||||
|
@ -1,4 +1,5 @@
|
||||
using DocumentFormat.OpenXml.Bibliography;
|
||||
using ClosedXML.Excel;
|
||||
using DocumentFormat.OpenXml.Bibliography;
|
||||
using DocumentFormat.OpenXml.Drawing.Charts;
|
||||
using DocumentFormat.OpenXml.ExtendedProperties;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
@ -597,7 +598,7 @@ namespace Learun.Application.Web.Areas.ZZDT_EC.Controllers
|
||||
/// <param name="ProjectId">项目ID</param>
|
||||
/// <param name="folderId">文件夹ID</param>
|
||||
/// <param name="reportFileName">报表文件名称</param>
|
||||
|
||||
///<param name="param">前端的json格式的参数</param>
|
||||
public void ReportToExcel(string ProjectId, string folderId, string reportFileName, string param)
|
||||
{
|
||||
try
|
||||
@ -1311,6 +1312,9 @@ namespace Learun.Application.Web.Areas.ZZDT_EC.Controllers
|
||||
}
|
||||
#endregion
|
||||
break;
|
||||
case "电缆册":
|
||||
CreateReportForCableOfDivision2(paramObj, workbook, ProjectId);
|
||||
break;
|
||||
case "云线备注清单":
|
||||
#region 云线备注清单
|
||||
int SelectModel;
|
||||
@ -2007,6 +2011,499 @@ namespace Learun.Application.Web.Areas.ZZDT_EC.Controllers
|
||||
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
|
||||
}
|
||||
}
|
||||
|
@ -22,8 +22,7 @@ var bootstrap = function ($, learun) {
|
||||
url: top.$.rootUrl + '/ZZDT_EC/ec_library_file/GetTreeDataByObjectType',//获取数据地址
|
||||
param: { ProjectId: ProjectId, ObjectTypeID: objectTypeId }, //请求后台参数
|
||||
type: 'tree',//数据展示类型: 1.default:普通;2.tree:树形数据;3. treemultiple:树形多选;multiple:普通多选
|
||||
allowSearch: true,
|
||||
maxHeight: 225
|
||||
allowSearch: true
|
||||
}).lrselectSet(LayoutLibFileID);//lrselectSet获取下拉框选择的值,传入objectTypeId
|
||||
},
|
||||
initData: function () {
|
||||
|
@ -97,8 +97,8 @@ var bootstrap = function ($, learun) {
|
||||
var keyValue = $('#gridtable').jfGridValue('ObjectTypeID');
|
||||
var keyName = $('#gridtable').jfGridValue('ObjectTypeName');
|
||||
if (learun.checkrow(keyValue)) {
|
||||
if (keyName == "OPC" || keyName == "基点" || keyName == "图框") {
|
||||
learun.alert.warning("OPC为系统内置的特殊类型,无法编辑其属性!");
|
||||
if (keyName = "附属件_内部开关" || keyName == "OPC" || keyName == "基点" || keyName == "图框") {
|
||||
learun.alert.warning(keyName + " 为系统内置的特殊类型,无法编辑其属性!");
|
||||
}
|
||||
else {
|
||||
learun.layerForm({
|
||||
@ -123,7 +123,7 @@ var bootstrap = function ($, learun) {
|
||||
var keyValue = $('#gridtable').jfGridValue('ObjectTypeID');
|
||||
var keyName = $('#gridtable').jfGridValue('ObjectTypeName');
|
||||
if (learun.checkrow(keyValue)) {
|
||||
if (keyName == "OPC" || keyName == "基点" || keyName == "图框" || keyName == "TagNumber") {
|
||||
if (keyName = "附属件_内部开关" || keyName == "OPC" || keyName == "基点" || keyName == "图框" ) {
|
||||
learun.alert.warning(keyName + "为系统内置的特殊类型,无法删除!");
|
||||
return false;
|
||||
}
|
||||
@ -190,8 +190,8 @@ var bootstrap = function ($, learun) {
|
||||
learun.alert.warning('请选择最后一级!');
|
||||
return false;
|
||||
}
|
||||
if (keyName == "OPC" || keyName == "基点" || keyName == "图框") {
|
||||
learun.alert.warning("OPC为系统内置的特殊类型 \u000d 无法进行“命名规则设置”!");
|
||||
if (keyName = "附属件_内部开关" || keyName == "OPC" || keyName == "基点" || keyName == "图框") {
|
||||
learun.alert.warning(keyName+ " 为系统内置的特殊类型 \u000d 无法进行“命名规则设置”!");
|
||||
return false;
|
||||
}
|
||||
learun.layerForm({
|
||||
|
@ -40,7 +40,7 @@ var bootstrap = function ($, learun) {
|
||||
if (learun.checkrow(keyValue)) {
|
||||
var folderId = $('#gridtable').jfGridValue('FolderId');
|
||||
var reportFileName = $('#gridtable').jfGridValue('ReportFileName');
|
||||
if (reportFileName == '电缆清册') {
|
||||
if (reportFileName == '电缆清册' || reportFileName == '电缆册') {
|
||||
learun.layerForm({
|
||||
id: 'systemselect',
|
||||
title: '电缆清册 参数选择',
|
||||
|
@ -3434,6 +3434,8 @@
|
||||
<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_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\250829\Project\ec_dataItem.sql" />
|
||||
<Content Include="SQL\250829\NoProject\ec_project.sql" />
|
||||
@ -3663,6 +3665,7 @@
|
||||
<Folder Include="SQL\250728\NoProject\" />
|
||||
<Folder Include="SQL\250825\NoProject\" />
|
||||
<Folder Include="SQL\250902\NoProject\" />
|
||||
<Folder Include="SQL\251013\NoProject\" />
|
||||
<Folder Include="Views\PlotLayout\" />
|
||||
<Folder Include="Views\Property\" />
|
||||
</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>?,
|
||||
`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,
|
||||
`IsSerialNumber` int NULL DEFAULT NULL COMMENT '是å<EFBFBD>¦ç”Ÿæˆ<EFBFBD>æµ<EFBFBD>æ°´å<EFBFBD>?,
|
||||
`IsOOTB` int NULL DEFAULT NULL COMMENT '是å<EFBFBD>¦æ˜¯å†…置的特殊类型',
|
||||
`specialType` int NULL DEFAULT NULL COMMENT '电力一æ¬?æˆ?电力二次 æˆ?系统柜ç‰',
|
||||
`IsSerialNumber` int NULL DEFAULT NULL ,
|
||||
`IsOOTB` int NULL DEFAULT NULL ,
|
||||
`specialType` int NULL DEFAULT NULL ,
|
||||
`OrderID` int 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,
|
||||
|
@ -729,9 +729,9 @@ CREATE TABLE `ec_objecttype` (
|
||||
`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,
|
||||
`ObjectTypeNameEN` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL,
|
||||
`IsSerialNumber` int NULL DEFAULT NULL COMMENT '是å<EFBFBD>¦ç”Ÿæˆ<EFBFBD>æµ<EFBFBD>æ°´å<EFBFBD>?,
|
||||
`IsOOTB` int NULL DEFAULT NULL COMMENT '是å<EFBFBD>¦æ˜¯å†…置的特殊类型',
|
||||
`specialType` int NULL DEFAULT NULL COMMENT '电力一æ¬?æˆ?电力二次 æˆ?系统柜ç‰',
|
||||
`IsSerialNumber` int NULL DEFAULT NULL ,
|
||||
`IsOOTB` int NULL DEFAULT NULL ,
|
||||
`specialType` int NULL DEFAULT NULL ,
|
||||
`OrderID` int 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,
|
||||
|
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_TagNumber = "TagNumber";
|
||||
public const string propName_Room = "房间号";
|
||||
public const string propName_cableTypeTest = "电缆类型(测试)";
|
||||
#endregion
|
||||
|
||||
#region projSetting
|
||||
|
@ -64,9 +64,9 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
foreach (var CB in res)
|
||||
{
|
||||
{
|
||||
Type type = CB.GetType();
|
||||
//CB.CableIDs = ec_Enginedata_RelBLL.GetList("{ProjectId:\"" + ProjID + "\",RelEngineData1ID:\"" + CB.EngineerDataID + "\"}").
|
||||
// Where(X => !string.IsNullOrEmpty(X.TagNumber2)).
|
||||
@ -76,16 +76,16 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
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)
|
||||
{
|
||||
property.SetValue(CB, Convert.ChangeType(item.PropertyValue, property.PropertyType));
|
||||
} //属性要怎么来,从property来了,然后通过反射,填充到 cb 类的属性里
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//所有在一端是开关的关联关系
|
||||
//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
|
||||
|
||||
@ -190,22 +309,22 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
{
|
||||
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
|
||||
bool mode = BreakerID == "" ? true : false;
|
||||
bool mode = string.IsNullOrEmpty(BreakerID) ? true : false;
|
||||
entity.PDBId = PBDId;
|
||||
ec_CircuitBreakerService.SaveEntity(ProjectId, ref BreakerID, entity);
|
||||
#endregion
|
||||
|
||||
#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);
|
||||
ec_enginedataEntity addEnginedata = new ec_enginedataEntity();
|
||||
@ -215,7 +334,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
|
||||
addEnginedata.EngineDataID = BreakerID;
|
||||
addEnginedata.ObjectTypeID = ec_objtype.ObjectTypeID;
|
||||
addEnginedata.TagNumber = entity.Name;
|
||||
addEnginedata.TagNumber = entity.Name; //entity.Tag.TagNumber
|
||||
addEnginedata.CaseID = "0";
|
||||
|
||||
SqlSugarHelper.Db.Insertable(addEnginedata).AS(tagTbName).ExecuteCommand();
|
||||
@ -231,9 +350,10 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
}
|
||||
#endregion
|
||||
#region prop
|
||||
var propBll = new ec_enginedata_propertyBLL();
|
||||
var propBll = new ec_enginedata_propertyBLL();
|
||||
//属性还是要去存enginedata_prop表
|
||||
var TagProps = propBll.ConvertPropToEngineProp<ec_CircuitBreakerEntity>(ProjectId, ec_objtype.ObjectTypeID, addEnginedata.EngineDataID, entity);
|
||||
var TagProps = entity.Tag.EngineDataProperty;
|
||||
//propBll.ConvertPropToEngineProp<ec_CircuitBreakerEntity>(ProjectId, ec_objtype.ObjectTypeID, addEnginedata.EngineDataID, entity);
|
||||
propBll.SaveEngineProp(ProjectId, TagProps);
|
||||
|
||||
|
||||
|
@ -15,31 +15,31 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
[SugarTable(TableName = "ec_CircuitBreaker")]
|
||||
public class ec_CircuitBreakerEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 生成需要的属性去存储到ec enginedata property
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<ec_enginedata_propertyEntity> InitEngProp(ec_CircuitBreakerEntity entity)
|
||||
{
|
||||
List<ec_enginedata_propertyEntity> res = new List<ec_enginedata_propertyEntity>();
|
||||
//entity.CB_Type
|
||||
ec_enginedata_propertyEntity newProp = new ec_enginedata_propertyEntity()
|
||||
{
|
||||
//CaseID = "0",
|
||||
EngineDataID = entity.EngineerDataID,
|
||||
PropertyName = "输入/输出",
|
||||
PropertyValue = entity.CB_Type,
|
||||
///// <summary>
|
||||
///// 生成需要的属性去存储到ec enginedata property
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//public static List<ec_enginedata_propertyEntity> InitEngProp(ec_CircuitBreakerEntity entity)
|
||||
//{
|
||||
// List<ec_enginedata_propertyEntity> res = new List<ec_enginedata_propertyEntity>();
|
||||
// //entity.CB_Type
|
||||
// ec_enginedata_propertyEntity newProp = new ec_enginedata_propertyEntity()
|
||||
// {
|
||||
// //CaseID = "0",
|
||||
// EngineDataID = entity.EngineerDataID,
|
||||
// PropertyName = "输入/输出",
|
||||
// PropertyValue = entity.CB_Type,
|
||||
|
||||
};
|
||||
res.Add(newProp);
|
||||
// };
|
||||
// res.Add(newProp);
|
||||
|
||||
newProp.Create();
|
||||
// newProp.Create();
|
||||
|
||||
return res;
|
||||
}
|
||||
// return res;
|
||||
//}
|
||||
#region 实体成员
|
||||
/// <summary>
|
||||
/// 分电箱的Id(不在Enginedata_rel中存储)
|
||||
/// 分电箱的enginedata Id
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string PDBId { get; set; }
|
||||
@ -77,7 +77,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 目前只有在本表里有,不会在<see cref="ec_Archive_enginedata"/>表里出现对应的记录
|
||||
/// 因为开关也是在ec_enginedata里存一份的,所以这个是对应的ec_enginedata的ID
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
@ -133,114 +133,114 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
#region 扩展字段
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否需要起动器
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
[AttrInEnginePropTable]
|
||||
public int? NeedStarter { get; set; }
|
||||
/// <summary>
|
||||
/// 起动类型
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
[AttrInEnginePropTable]
|
||||
public string StartType { get; set; }
|
||||
/// <summary>
|
||||
/// 顺序起动分组结果
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
[AttrInEnginePropTable]
|
||||
public string SequentialStartGroup { get; set; }
|
||||
/// <summary>
|
||||
/// 是否带交流电流表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
[AttrInEnginePropTable]
|
||||
public int? ACAmmeter { get; set; }
|
||||
/// <summary>
|
||||
/// 起动方式
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
[AttrInEnginePropTable]
|
||||
public string StartModel { get; set; }
|
||||
/// <summary>
|
||||
/// 可逆
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
[AttrInEnginePropTable]
|
||||
public int? REV { get; set; }
|
||||
/// <summary>
|
||||
/// 是否自动起动
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
[AttrInEnginePropTable]
|
||||
public int? AutoStart { get; set; }
|
||||
/// <summary>
|
||||
/// 是否带运行时间表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
[AttrInEnginePropTable]
|
||||
public int? RHM { get; set; }
|
||||
/// <summary>
|
||||
/// 欠压方式
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
[AttrInEnginePropTable]
|
||||
public string UVMode { get; set; }
|
||||
///// <summary>
|
||||
///// 是否需要起动器
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//[SugarColumn(IsIgnore = true)]
|
||||
//[AttrInEnginePropTable]
|
||||
//public int? NeedStarter { get; set; }
|
||||
///// <summary>
|
||||
///// 起动类型
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//[SugarColumn(IsIgnore = true)]
|
||||
//[AttrInEnginePropTable]
|
||||
//public string StartType { get; set; }
|
||||
///// <summary>
|
||||
///// 顺序起动分组结果
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//[SugarColumn(IsIgnore = true)]
|
||||
//[AttrInEnginePropTable]
|
||||
//public string SequentialStartGroup { get; set; }
|
||||
///// <summary>
|
||||
///// 是否带交流电流表
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//[SugarColumn(IsIgnore = true)]
|
||||
//[AttrInEnginePropTable]
|
||||
//public int? ACAmmeter { get; set; }
|
||||
///// <summary>
|
||||
///// 起动方式
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//[SugarColumn(IsIgnore = true)]
|
||||
//[AttrInEnginePropTable]
|
||||
//public string StartModel { get; set; }
|
||||
///// <summary>
|
||||
///// 可逆
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//[SugarColumn(IsIgnore = true)]
|
||||
//[AttrInEnginePropTable]
|
||||
//public int? REV { get; set; }
|
||||
///// <summary>
|
||||
///// 是否自动起动
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//[SugarColumn(IsIgnore = true)]
|
||||
//[AttrInEnginePropTable]
|
||||
//public int? AutoStart { get; set; }
|
||||
///// <summary>
|
||||
///// 是否带运行时间表
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//[SugarColumn(IsIgnore = true)]
|
||||
//[AttrInEnginePropTable]
|
||||
//public int? RHM { get; set; }
|
||||
///// <summary>
|
||||
///// 欠压方式
|
||||
///// </summary>
|
||||
///// <returns></returns>
|
||||
//[SugarColumn(IsIgnore = true)]
|
||||
//[AttrInEnginePropTable]
|
||||
//public string UVMode { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// GUFO里有
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string Relay_Type { get; set; } = "";
|
||||
/// <summary>
|
||||
/// GUFO里有
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public double? Delay_Time { get; set; } = 0.0;
|
||||
///// <summary>
|
||||
///// GUFO里有
|
||||
///// </summary>
|
||||
//[SugarColumn(IsIgnore = true)]
|
||||
//public string Relay_Type { get; set; } = "";
|
||||
///// <summary>
|
||||
///// GUFO里有
|
||||
///// </summary>
|
||||
//[SugarColumn(IsIgnore = true)]
|
||||
//public double? Delay_Time { get; set; } = 0.0;
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// GUFO里有
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string Power_Opening { get; set; } = "";
|
||||
///// <summary>
|
||||
///// GUFO里有
|
||||
///// </summary>
|
||||
//[SugarColumn(IsIgnore = true)]
|
||||
//public string Power_Opening { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// GUFO里有
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string Power_Closing { get; set; } = "";
|
||||
///// <summary>
|
||||
///// GUFO里有
|
||||
///// </summary>
|
||||
//[SugarColumn(IsIgnore = true)]
|
||||
//public string Power_Closing { get; set; } = "";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 相数
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
[AttrInEnginePropTable]
|
||||
public int Phase { get; set; }
|
||||
///// <summary>
|
||||
///// 相数
|
||||
///// </summary>
|
||||
//[SugarColumn(IsIgnore = true)]
|
||||
//[AttrInEnginePropTable]
|
||||
//public int Phase { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 额定电压
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
[AttrInEnginePropTable]
|
||||
public string Rated_Voltage { get; set; } = "";
|
||||
///// <summary>
|
||||
///// 额定电压
|
||||
///// </summary>
|
||||
//[SugarColumn(IsIgnore = true)]
|
||||
//[AttrInEnginePropTable]
|
||||
//public string Rated_Voltage { get; set; } = "";
|
||||
|
||||
|
||||
/// <summary>
|
||||
@ -327,6 +327,8 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string RemoteDeviceObjectType { get; set; }
|
||||
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public ec_enginedataEntity Tag { get; set; }
|
||||
#endregion
|
||||
}
|
||||
/// <summary>
|
||||
|
@ -171,6 +171,10 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
{
|
||||
//ProjectEntity = this.BaseRepository().FindEntity<ec_projectEntity>(ProjectId);
|
||||
ProjectEntity = new ec_projectBLL().GetEntity(ProjectId);
|
||||
if (ProjectEntity == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -813,13 +813,13 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
#region shared
|
||||
var allAnnexesFile = Db.Queryable<AnnexesFileEntity>().ToList();
|
||||
#endregion
|
||||
#region resource数据
|
||||
var resourceTypeAll = objectTypeBll.GetList("{ProjectId:\"" + sourceProject.ProjectId + "\"}").ToList();
|
||||
var sourceTags = ec_enginedataService.GetListSingleTable(sourceProject.ProjectId, null);
|
||||
var sourceCables = Db.Queryable<ec_CableEntity>().AS($"ec_cable_{sourceProject.ProjectIndex}").ToList();
|
||||
#region source数据
|
||||
var sourceTypeAll = objectTypeBll.GetList("{ProjectId:\"" + sourceProject.ProjectId + "\"}").ToDictionary(x => x.ObjectTypeID, x => x);
|
||||
var sourceTags = ec_enginedataService.GetListSingleTable(sourceProject.ProjectId, null).ToDictionary(x => x.EngineDataID, x => x);
|
||||
var sourceCables = Db.Queryable<ec_CableEntity>().AS($"ec_cable_{sourceProject.ProjectIndex}").ToList().ToDictionary(x => x.EngineerDataID, x => x);
|
||||
var sourceCableSets = Db.Queryable<ec_CableSetEntity>().AS($"ec_Cable_Set_{sourceProject.ProjectIndex}").ToList();
|
||||
var sourceCableWires = Db.Queryable<ec_CableSetWireEntity>().AS($"ec_Cable_Set_Wire_{sourceProject.ProjectIndex}").ToList();
|
||||
var sourcePanelAll = Db.Queryable<ec_PanelEntity>().AS($"ec_Panel_{sourceProject.ProjectIndex}").ToList();
|
||||
var sourcePanelAll = Db.Queryable<ec_PanelEntity>().AS($"ec_Panel_{sourceProject.ProjectIndex}").ToList().ToDictionary(x => x.EngineerDataID, x => x);
|
||||
var sourceStripAll = Db.Queryable<ec_PanelStripEntity>().AS($"ec_Panel_Strip_{sourceProject.ProjectIndex}").ToList();
|
||||
var sourceTermAll = Db.Queryable<ec_PanelStripTermEntity>().AS($"ec_Panel_Strip_Term_{sourceProject.ProjectIndex}").ToList();
|
||||
var sourceChAll = Db.Queryable<ec_PanelChannelEntity>().AS($"ec_Panel_Channel_{sourceProject.ProjectIndex}").ToList();
|
||||
@ -856,9 +856,9 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
var targetStageDropDown = targetDropDown.FirstOrDefault(x => x.DataItemCode == GlobalObject.enumlist_DrawingStage);
|
||||
var targetStages = targetDropDownDetail.Where(x => x.DataItemID == targetStageDropDown.DataItemID).OrderBy(x => x.OrderID).ToList();
|
||||
|
||||
var targetTypeAll = objectTypeBll.GetList("{ProjectId:\"" + ProjectId + "\"}").ToList();
|
||||
var targetTypeAll = objectTypeBll.GetList("{ProjectId:\"" + ProjectId + "\"}").ToList().ToDictionary(x => x.FullPathCN, x => x);
|
||||
var TargetDrawingFile = drawingBll.GetList("{ProjectId:\"" + ProjectId + "\"}").ToList();
|
||||
var targetTags = ec_enginedataService.GetListSingleTable(ProjectId, null);
|
||||
var targetTags = ec_enginedataService.GetListSingleTable(ProjectId, null).ToDictionary(x => x.TagNumber.ToUpper(), x => x);
|
||||
var targetConnRelType = Db.Queryable<ec_reltypeEntity>().AS($"ec_reltype_{targetProject.ProjectIndex}").ToList().FirstOrDefault(x => x.RelType == enum_RelType.设备_电缆);
|
||||
if (targetConnRelType == null)
|
||||
{
|
||||
@ -990,54 +990,36 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
if (resourcePixelList != null && resourcePixelList.Count() > 0)//不包含deleteflg的
|
||||
{
|
||||
//获取拷贝图纸所有的工程数据ID
|
||||
List<string> sourceTagsOnDrawing = resourcePixelList.Select(x => x.EngineDataID).Distinct().ToList();
|
||||
List<string> sourceTagIdsOnDrawing = resourcePixelList.Select(x => x.EngineDataID).Distinct().ToList();
|
||||
//提前处理下originID,免的rel里面有问题
|
||||
foreach (var sourceTag in sourceTags)
|
||||
{
|
||||
sourceTag.originId = sourceTag.EngineDataID;
|
||||
sourceTag.Value.originId = sourceTag.Value.EngineDataID;
|
||||
}
|
||||
foreach (var oldSourceTagId in sourceTagsOnDrawing)
|
||||
foreach (var sourceTagIdOnDrawing in sourceTagIdsOnDrawing)
|
||||
{
|
||||
//获取拷贝图纸工程数据实体,由于EngineDataID经常会改变,这里用originid保险点
|
||||
var sourceTag = sourceTags.FirstOrDefault(x => x.originId == oldSourceTagId);
|
||||
sourceTags.TryGetValue(sourceTagIdOnDrawing, out ec_enginedataEntity sourceTag);
|
||||
if (sourceTag == null)
|
||||
{
|
||||
resourcePixelList.RemoveAll(x => x.EngineDataID == oldSourceTagId);
|
||||
resourcePixelList.RemoveAll(x => x.EngineDataID == sourceTagIdOnDrawing);
|
||||
continue;//无效的pixel,下一个位号
|
||||
|
||||
}
|
||||
//sourceTag.originId = oldSourceTagId;
|
||||
//对象类型ID根据对象类型库的完整路径(中文)判断。
|
||||
ec_objecttypeEntity resourceType = resourceTypeAll.FirstOrDefault(x => x.ObjectTypeID == sourceTag.ObjectTypeID);
|
||||
if (resourceType != null)
|
||||
sourceTypeAll.TryGetValue(sourceTag.ObjectTypeID, out ec_objecttypeEntity sourceType);
|
||||
if (sourceType != null)
|
||||
{
|
||||
//对象类型的匹配
|
||||
ec_objecttypeEntity curObjectTypeData = targetTypeAll.FirstOrDefault(x => x.FullPathCN == resourceType.FullPathCN);
|
||||
targetTypeAll.TryGetValue(sourceType.FullPathCN, out ec_objecttypeEntity curObjectTypeData);
|
||||
if (curObjectTypeData != null)
|
||||
{
|
||||
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
|
||||
//判断当前项目中工程数据是否存在
|
||||
ec_enginedataEntity targetTagWithSameName = targetTags.FirstOrDefault(x => x.TagNumber.ToUpper() == sourceTag.TagNumber.ToUpper());
|
||||
targetTags.TryGetValue(sourceTag.TagNumber.ToUpper(), out ec_enginedataEntity targetTagWithSameName);
|
||||
if (targetTagWithSameName != null)
|
||||
{
|
||||
//如果重复,位号 = 原来位号 + from + 原项目名称
|
||||
@ -1095,7 +1077,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
tagRel.RelTypeID = targetConnRelType.RelTypeID;
|
||||
//ID2
|
||||
//这个时候的ID2无法从 targetTags 里查到,因为id可能已经变了
|
||||
var otherTag = sourceTags.FirstOrDefault(x => x.originId == tagRel.RelEngineData2ID);//非电缆的
|
||||
sourceTags.TryGetValue(tagRel.RelEngineData2ID, out var otherTag);//非电缆的
|
||||
if (otherTag != null)
|
||||
{
|
||||
if (otherTag.originId != otherTag.EngineDataID)
|
||||
@ -1104,7 +1086,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
}
|
||||
else
|
||||
{
|
||||
var targetTagNumber = targetTags.FirstOrDefault(x => x.TagNumber.ToUpper() == otherTag.TagNumber.ToUpper());
|
||||
targetTags.TryGetValue(otherTag.TagNumber.ToUpper(), out var targetTagNumber);
|
||||
//只有目标项目里面没有这个设备才去新建,给新ID,不然还是给目标项目的ID
|
||||
if (targetTagNumber == null)
|
||||
{
|
||||
@ -1134,7 +1116,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
tagRel.RelTypeID = targetConnRelType.RelTypeID;
|
||||
//ID2
|
||||
//这个时候的ID2无法从 targetTags 里查到,因为id可能已经变了
|
||||
var otherTag = sourceTags.FirstOrDefault(x => x.originId == tagRel.RelEngineData1ID);
|
||||
sourceTags.TryGetValue(tagRel.RelEngineData1ID, out var otherTag);
|
||||
if (otherTag != null)
|
||||
{
|
||||
if (otherTag.originId != otherTag.EngineDataID)
|
||||
@ -1143,7 +1125,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
}
|
||||
else
|
||||
{
|
||||
var targetTagNumber = targetTags.FirstOrDefault(x => x.TagNumber.ToUpper() == otherTag.TagNumber.ToUpper());
|
||||
targetTags.TryGetValue(otherTag.TagNumber.ToUpper(), out var targetTagNumber);
|
||||
//只有目标项目里面没有这个设备才去新建,给新ID,不然还是给目标项目的ID
|
||||
if (targetTagNumber == null)
|
||||
{
|
||||
@ -1195,12 +1177,12 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
addPropertyList.Add(property);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
#region CABLE,SET,WIRE
|
||||
//cable
|
||||
//set
|
||||
//wire
|
||||
var sourceCable = sourceCables.FirstOrDefault(x => x.EngineerDataID == sourceTag.originId);
|
||||
sourceCables.TryGetValue(sourceTag.originId, out ec_CableEntity sourceCable);
|
||||
if (sourceCable != null)
|
||||
{
|
||||
|
||||
@ -1251,7 +1233,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
//STRIP
|
||||
//CHANNEL
|
||||
//TERM
|
||||
var sourcePanel = sourcePanelAll.FirstOrDefault(x => x.EngineerDataID == sourceTag.originId);
|
||||
sourcePanelAll.TryGetValue(sourceTag.originId, out var sourcePanel);
|
||||
if (sourcePanel != null)
|
||||
{
|
||||
|
||||
@ -1265,7 +1247,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
foreach (var sourceStrip in sourceStrips)
|
||||
{
|
||||
var sourceTerms = sourceTermAll.Where(x => x.StripID == sourceStrip.StripID).ToList();
|
||||
var sourceCHs = sourceChAll.Where(x => x.StripID == sourceStrip.StripID).ToList();
|
||||
var sourceCHs = sourceChAll.Where(x => x.StripID == sourceStrip.StripID).ToList().ToDictionary(x => x.ChannelID, x => x);
|
||||
|
||||
sourceStrip.Create();
|
||||
sourceStrip.PanelID = sourcePanel.PanelID;
|
||||
@ -1275,9 +1257,9 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
{
|
||||
foreach (var ch in sourceCHs)
|
||||
{
|
||||
ch.Create();
|
||||
ch.StripID = sourceStrip.StripID;
|
||||
addChList.Add(ch);
|
||||
ch.Value.Create();
|
||||
ch.Value.StripID = sourceStrip.StripID;
|
||||
addChList.Add(ch.Value);
|
||||
}
|
||||
}
|
||||
if (sourceTerms != null)
|
||||
@ -1289,7 +1271,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
if (term.ChannelID != "-1")
|
||||
{
|
||||
//有通道
|
||||
var existCh = sourceCHs.FirstOrDefault(x => x.ChannelID == term.ChannelID);
|
||||
sourceCHs.TryGetValue(term.ChannelID, out var existCh);
|
||||
if (existCh != null)
|
||||
{
|
||||
term.ChannelID = existCh.ChannelID;
|
||||
@ -1314,57 +1296,56 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
//已有的,单纯属性覆盖就行
|
||||
#region property
|
||||
//获取对应的工程数据属性
|
||||
var sourceTagProps = PropServ.GetTagPropById(item.ProjectId, sourceTag.originId).ToList();
|
||||
var targetTagProps = PropServ.GetTagPropById(ProjectId, sourceTag.EngineDataID).ToList();
|
||||
var sourceTagProps = PropServ.GetTagPropById(item.ProjectId, sourceTag.originId);
|
||||
var targetTagProps = PropServ.GetTagPropById(ProjectId, sourceTag.EngineDataID).ToDictionary(x => x.PropertyName, x => x);
|
||||
|
||||
var updateList = new List<ec_enginedata_propertyEntity>();
|
||||
var hisInsertList = new List<ec_enginedata_propertyhisEntity>();
|
||||
|
||||
if (sourceTagProps != null && sourceTagProps.Count > 0)
|
||||
foreach (var property in sourceTagProps)
|
||||
{
|
||||
foreach (var property in sourceTagProps)
|
||||
targetTagProps.TryGetValue(property.PropertyName, out var tarProp);
|
||||
if (tarProp != null)
|
||||
{
|
||||
var tarProp = targetTagProps.FirstOrDefault(x => x.PropertyName == property.PropertyName);
|
||||
if (tarProp != null)
|
||||
|
||||
|
||||
var propHis = new ec_enginedata_propertyhisEntity
|
||||
{
|
||||
PropertyName = tarProp.PropertyName,
|
||||
PropertyValue = tarProp.PropertyValue, // 老值
|
||||
EngineDataID = tarProp.EngineDataID
|
||||
};
|
||||
propHis.Create();
|
||||
hisInsertList.Add(propHis);
|
||||
//已有属性
|
||||
tarProp.PropertyValue = property.PropertyValue; //新值
|
||||
tarProp.MeasuringUnit = property.MeasuringUnit;
|
||||
tarProp.UpdateTime = System.DateTime.Now;
|
||||
tarProp.UpdateUserID = userInfo.userId;
|
||||
|
||||
|
||||
var propHis = new ec_enginedata_propertyhisEntity
|
||||
{
|
||||
PropertyName = tarProp.PropertyName,
|
||||
PropertyValue = tarProp.PropertyValue, // 老值
|
||||
EngineDataID = tarProp.EngineDataID
|
||||
};
|
||||
propHis.Create();
|
||||
hisInsertList.Add(propHis);
|
||||
//已有属性
|
||||
tarProp.PropertyValue = property.PropertyValue; //新值
|
||||
tarProp.MeasuringUnit = property.MeasuringUnit;
|
||||
tarProp.UpdateTime = System.DateTime.Now;
|
||||
tarProp.UpdateUserID = userInfo.userId;
|
||||
|
||||
updateList.Add(tarProp);
|
||||
//Db.Updateable(tarProp).AS($"ec_enginedata_property_{targetProject.ProjectIndex}").ExecuteCommand();
|
||||
//Db.Insertable(propHis).AS($"ec_enginedata_propertyhis_{targetProject.ProjectIndex}").ExecuteCommand();
|
||||
}
|
||||
else
|
||||
{
|
||||
property.EngineDataID = sourceTag.EngineDataID;//target里的已经存在的id了
|
||||
property.Create();
|
||||
property.UpdateTime = null;
|
||||
property.UpdateUserID = null;
|
||||
addPropertyList.Add(property);
|
||||
}
|
||||
|
||||
|
||||
//要和现有的比一下,没有的就插入,有的就更新
|
||||
updateList.Add(tarProp);
|
||||
//Db.Updateable(tarProp).AS($"ec_enginedata_property_{targetProject.ProjectIndex}").ExecuteCommand();
|
||||
//Db.Insertable(propHis).AS($"ec_enginedata_propertyhis_{targetProject.ProjectIndex}").ExecuteCommand();
|
||||
}
|
||||
else
|
||||
{
|
||||
property.EngineDataID = sourceTag.EngineDataID;//target里的已经存在的id了
|
||||
property.Create();
|
||||
property.UpdateTime = null;
|
||||
property.UpdateUserID = null;
|
||||
addPropertyList.Add(property);
|
||||
}
|
||||
|
||||
|
||||
//要和现有的比一下,没有的就插入,有的就更新
|
||||
}
|
||||
|
||||
if (updateList.Count > 0)
|
||||
{
|
||||
Db.Updateable(updateList)
|
||||
.AS($"ec_enginedata_property_{targetProject.ProjectIndex}")
|
||||
.UpdateColumns(x => new {
|
||||
.UpdateColumns(x => new
|
||||
{
|
||||
x.PropertyValue,
|
||||
x.MeasuringUnit,
|
||||
x.UpdateTime,
|
||||
@ -1403,7 +1384,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
else
|
||||
{
|
||||
|
||||
msg = sourceTag.TagNumber + $"对象类型不匹配!。老项目为{resourceType.FullPathCN},新项目则没有该类型。";
|
||||
msg = sourceTag.TagNumber + $"对象类型不匹配!。老项目为{sourceType.FullPathCN},新项目则没有该类型。";
|
||||
log.Error(msg);
|
||||
|
||||
}
|
||||
@ -1441,7 +1422,9 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
|
||||
Db.Insertable(addEngineDataList).AS($"ec_enginedata_{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(addSetList).AS($"ec_Cable_Set_{targetProject.ProjectIndex}").ExecuteCommand();
|
||||
@ -1485,7 +1468,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
|
||||
|
||||
|
||||
return "导入结束。";
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -1485,7 +1485,6 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
/// <param name="caseID">工程数据实体</param>
|
||||
public void UpdatePixelAndProp(string projectId, ec_enginedataEntity entity)
|
||||
{
|
||||
var caseID = "0";//entity.CaseID;
|
||||
var ec_relDataBLL = new ec_enginedata_relBLL();
|
||||
Db.BeginTran();
|
||||
try
|
||||
@ -1511,8 +1510,8 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
var reldataTableName = TableName<ec_enginedata_relEntity>(ProjectEntity.ProjectIndex.ToString());
|
||||
|
||||
var lookupBll = new ec_REFLOOKUPTABLEBLL();
|
||||
|
||||
var curEnginedata = GetList(("{\"ProjectId\":\"" + projectId + "\",\"TagNumber\":\"" + entity.TagNumber + "\"}")).FirstOrDefault();
|
||||
var allTags = Db.Queryable<ec_enginedataEntity>().AS(TableName<ec_enginedataEntity>(projectId)).ToList();
|
||||
var curEnginedata = allTags.FirstOrDefault(x => x.TagNumber == entity.TagNumber);
|
||||
|
||||
string engineDataID = "";
|
||||
|
||||
@ -1575,7 +1574,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
|
||||
var cableSystemObj = entity.EngineDataProperty.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_System);
|
||||
string systemNameAfterDealWith = string.Empty;
|
||||
var cableSystem =string.Empty;
|
||||
var cableSystem = string.Empty;
|
||||
var topDataItemDetailIDofDwg = string.Empty;
|
||||
var topDataItemDetailIDofEng = string.Empty;
|
||||
if (cableSystemObj != null)
|
||||
@ -1586,7 +1585,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
//获取图纸系统的最上级ID
|
||||
topDataItemDetailIDofDwg = GetTopParentDataItemDetailByID(dataitemdetailTableName, dwgObj.DrawingSystem);
|
||||
//获取位号系统的最上级ID
|
||||
topDataItemDetailIDofEng= GetTopParentDataItemDetailByID(dataitemdetailTableName, cableSystem);
|
||||
topDataItemDetailIDofEng = GetTopParentDataItemDetailByID(dataitemdetailTableName, cableSystem);
|
||||
if (topDataItemDetailIDofDwg == topDataItemDetailIDofEng && !string.IsNullOrEmpty(dwgObj.DrawingSystem))
|
||||
{
|
||||
//可以修改
|
||||
@ -1620,8 +1619,8 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
//var cableSystem = cableSystemObj == null ? "" : systems.FirstOrDefault(x => x.DataItemName == cableSystemObj.PropertyValue)?.DataItemDetailID;
|
||||
//if (cableSystem != null)
|
||||
//{
|
||||
|
||||
|
||||
|
||||
|
||||
//}
|
||||
}
|
||||
else
|
||||
@ -1659,6 +1658,20 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
{
|
||||
entity.EngineDataProperty = new List<ec_enginedata_propertyEntity>();
|
||||
}
|
||||
else
|
||||
{
|
||||
var parallelCable = entity.EngineDataProperty.FirstOrDefault(X => X.PropertyName == GlobalObject.propName_parallelCableList && !string.IsNullOrEmpty(X.PropertyValue));
|
||||
if (parallelCable != null)
|
||||
{
|
||||
var parallelCableNames = parallelCable.PropertyValue.ToUpper().Split(',');
|
||||
var duplicatedTag = allTags.Where(x => parallelCableNames.Contains(x.TagNumber.ToUpper())).ToList();
|
||||
if (duplicatedTag != null || duplicatedTag.Count > 0)
|
||||
{
|
||||
throw new Exception("平行电缆中存在和已有其他电缆的名字重复。" + string.Join(",", duplicatedTag.Select(x => x.TagNumber)));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
entity = lookupBll.ApplyLookup(projectId, entity, true);
|
||||
foreach (var prop in entity.EngineDataProperty.
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Learun.Util;
|
||||
using Learun.Util.SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -86,7 +87,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
/// <summary>
|
||||
/// 将一些特殊的对象,其属性对应到ec-EngineData-property上。
|
||||
/// 原则是:对象的属性名 = objectType关联下的PropertyName。
|
||||
/// 如果没找到,还是会按照objectType关联的属性来一份,无非是属性为空。
|
||||
/// 比如开关,其属性不是在右侧属性栏里输入的,而是在开关箱管理界面,所以不得不这样。那能不能搞一个和右侧属性里一样的
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="ProjId"></param>
|
||||
@ -94,12 +95,20 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
/// <param name="Obj"></param>
|
||||
/// <returns></returns>
|
||||
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 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>();
|
||||
foreach (var prop in typeP)
|
||||
{
|
||||
|
@ -118,6 +118,11 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string ObjectTypeName { get; set; }
|
||||
/// <summary>
|
||||
/// 标记是否已使用,布置图自动放置时用
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public bool Marker { get; set; }
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,10 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
//.WhereIF(!string.IsNullOrEmpty(CaseID), (a, b) => a.CaseID == CaseID)
|
||||
.WhereIF(EngineDataIDs != null && EngineDataIDs.Length > 0, (a, b) => EngineDataIDs.Contains(a.EngineDataID)
|
||||
&& a.PropertyName != "HKSK_POSITION_NUM").ToList();
|
||||
if (list == null)
|
||||
{
|
||||
list = new List<ec_enginedata_propertyEntity>();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -58,7 +58,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
/// <param name="dataType">0:对象类型、1:位号、2:图纸</param>
|
||||
/// <param name="KeyWork">位号的关键字</param>
|
||||
/// <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>();
|
||||
|
||||
@ -78,7 +78,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
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();
|
||||
//查询位号的基础信息
|
||||
@ -340,7 +340,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取列表数据
|
||||
/// 获取列表数据
|
||||
/// <summary>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<ec_objecttypeEntity> GetTree(string queryJson)
|
||||
|
@ -15,7 +15,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
#region 获取数据
|
||||
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>
|
||||
|
@ -150,12 +150,16 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string HomerunCableName { get; set; } = "";
|
||||
/// <summary>
|
||||
/// true时,表示假的。真正的结构还是panel strip term
|
||||
/// </summary>
|
||||
public string HomerunCableName { get; set; } = "";
|
||||
|
||||
[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
|
||||
}
|
||||
}
|
||||
|
@ -21,8 +21,8 @@ namespace Learun.Cache.Redis
|
||||
/// 24 9 4新增。
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="cacheKey"></param>
|
||||
/// <param name="dbQuery"></param>
|
||||
/// <param name="cacheKey">redis的缓存key</param>
|
||||
/// <param name="dbQuery">委托,一般是key里没有的时候,去执行一次db查询</param>
|
||||
/// <param name="expireTime"></param>
|
||||
/// <param name="dbId"></param>
|
||||
/// <returns></returns>
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
|
||||
FE:\Di-Electrical\SWSDBSchemeUpgradeTool\MainWindow.xaml;;
|
||||
FE:\Di-Electrical\SWSDBSchemeUpgradeTool\SQLPreview.xaml;;
|
||||
FC:\repo\CODE\009_DI-Elec\SWSDBSchemeUpgradeTool\MainWindow.xaml;;
|
||||
FC:\repo\CODE\009_DI-Elec\SWSDBSchemeUpgradeTool\SQLPreview.xaml;;
|
||||
|
||||
|
@ -15,6 +15,7 @@ using Path = System.IO.Path;
|
||||
using Color = Teigha.Colors.Color;
|
||||
using System.Security.Cryptography;
|
||||
using System.Threading.Tasks;
|
||||
using SWS.Model;
|
||||
namespace SWS.CAD.Base
|
||||
{
|
||||
public static class General
|
||||
@ -1131,7 +1132,7 @@ namespace SWS.CAD.Base
|
||||
}
|
||||
}
|
||||
if (idsToErase.Count > 0)
|
||||
{
|
||||
{
|
||||
foreach (ObjectId id in idsToErase)
|
||||
{
|
||||
Entity ent = (Entity)tr.GetObject(id, OpenMode.ForWrite);
|
||||
@ -1948,7 +1949,7 @@ namespace SWS.CAD.Base
|
||||
doc = Application.DocumentManager.MdiActiveDocument;
|
||||
ed = doc.Editor;
|
||||
db = doc.Database;
|
||||
var s=doc.Name;
|
||||
var s = doc.Name;
|
||||
// 开启事务
|
||||
using (Transaction tr = db.TransactionManager.StartTransaction())
|
||||
{
|
||||
@ -2019,7 +2020,7 @@ namespace SWS.CAD.Base
|
||||
#endregion
|
||||
|
||||
#region 插入文本内容
|
||||
public static string InsertTextInfo(List<DtoCadTextInfo> listTextInfo)
|
||||
public static string InsertTextInfo(List<DtoTextInfo> listTextInfo)
|
||||
{
|
||||
string res = string.Empty;
|
||||
try
|
||||
@ -2154,7 +2155,246 @@ namespace SWS.CAD.Base
|
||||
|
||||
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region 材料表插入图标块
|
||||
/// <summary>
|
||||
/// 读取元件块,插入图纸
|
||||
/// </summary>
|
||||
/// <param name="filePath">图元文件路径</param>
|
||||
/// <param name="symbolName">块名</param>
|
||||
/// <param name="scale">比例大小</param>
|
||||
/// <param name="position">坐标位置</param>
|
||||
/// <returns></returns>
|
||||
public static ObjectId AddBomSymbolDWG(string filePath, string symbolName, double scale, Point3d position)
|
||||
{
|
||||
if (scale == 0)
|
||||
{ scale = 1; }
|
||||
Document doc = Application.DocumentManager.MdiActiveDocument;
|
||||
var ed = doc.Editor;
|
||||
ObjectId oid = ObjectId.Null;
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
ed.WriteMessage("\n 错误:图元文件不存在!\n");
|
||||
return oid;
|
||||
}
|
||||
// 获取当前数据库
|
||||
Database destDb = HostApplicationServices.WorkingDatabase;
|
||||
using (Transaction tr = destDb.TransactionManager.StartTransaction())
|
||||
{
|
||||
try
|
||||
{
|
||||
// 创建临时数据库读取外部DWG
|
||||
using (Database sourceDb = new Database(false, true))
|
||||
{
|
||||
sourceDb.ReadDwgFile(filePath, FileOpenMode.OpenForReadAndAllShare, false, null);
|
||||
|
||||
// 生成唯一块名(避免重名)
|
||||
string blockName = GetUniqueBlockName(destDb, symbolName);
|
||||
// 将外部DWG转换为块定义
|
||||
ObjectId blockId = destDb.Insert(blockName, sourceDb, true);
|
||||
// 创建块参照
|
||||
BlockReference br = new BlockReference(
|
||||
Point3d.Origin, // 插入点(可修改)
|
||||
blockId// bt[blockName]
|
||||
);
|
||||
br.Position = position;
|
||||
// 设置比例和旋转
|
||||
br.ScaleFactors = new Scale3d(scale); //比例因子
|
||||
br.Rotation = 0.0; // 旋转角度(弧度)
|
||||
// 获取实时鼠标位置
|
||||
// 添加到当前模型空间
|
||||
BlockTableRecord btr = (BlockTableRecord)tr.GetObject(
|
||||
SymbolUtilityServices.GetBlockModelSpaceId(destDb),
|
||||
OpenMode.ForWrite
|
||||
);
|
||||
|
||||
// 处理插入结果
|
||||
btr.AppendEntity(br);
|
||||
tr.AddNewlyCreatedDBObject(br, true);
|
||||
//创建位号属性
|
||||
//var attDef = AddAttributeDefinition(btr, "HKSK_TAG", tag);
|
||||
//AttributeReference attRef = new AttributeReference();
|
||||
//attRef.SetAttributeFromBlock(attDef, br.BlockTransform);
|
||||
//br.AttributeCollection.AppendAttribute(attRef);
|
||||
//tr.AddNewlyCreatedDBObject(attRef, true);
|
||||
tr.Commit();
|
||||
oid = br.Id;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
tr.Abort();
|
||||
ed.WriteMessage($"\n错误: {ex.Message}\n");
|
||||
}
|
||||
}
|
||||
return oid;
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 获取当前图纸的所有有标注信息的句柄
|
||||
/// <summary>
|
||||
/// 获取当前图纸的所有有标注信息的句柄 ,XData第一个属性为(1001, "HKSK_LABEL")
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<DtoTagAnnotation> GetAllAnnotation()
|
||||
{
|
||||
doc = Application.DocumentManager.MdiActiveDocument;
|
||||
ed = doc.Editor;
|
||||
db = doc.Database;
|
||||
|
||||
List<DtoTagAnnotation> listInfo = new List<DtoTagAnnotation>();
|
||||
try
|
||||
{
|
||||
// 开启事务
|
||||
using (Transaction tr = db.TransactionManager.StartTransaction())
|
||||
{
|
||||
// 获取模型空间块表记录
|
||||
BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
|
||||
BlockTableRecord btr = tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead) as BlockTableRecord;
|
||||
|
||||
// 遍历模型空间中的所有实体
|
||||
foreach (ObjectId objId in btr)
|
||||
{
|
||||
if (objId.ObjectClass.Name == "AcDbBlockReference")
|
||||
{
|
||||
BlockReference blockRef = (BlockReference)tr.GetObject(objId, OpenMode.ForRead);
|
||||
if (blockRef.XData != null)
|
||||
{
|
||||
ResultBuffer rb = blockRef.XData;
|
||||
if (HasTargetXData(rb, "HKSK_LABEL"))
|
||||
{
|
||||
TypedValue[] xdata = rb.AsArray();
|
||||
for (int i = 1; i < xdata.Length; i++)
|
||||
{
|
||||
if (i + 1 >= xdata.Length)
|
||||
{ break; }
|
||||
TypedValue data1 = xdata[i];
|
||||
TypedValue data2 = xdata[i + 1];
|
||||
if (data1.TypeCode == 1000 && data2.TypeCode == 1005)
|
||||
{
|
||||
listInfo.Add(new DtoTagAnnotation()
|
||||
{
|
||||
TagHandId = objId.Handle.ToString(),
|
||||
Name = data1.Value.ToString(),
|
||||
LabelHandId = data2.Value.ToString(),
|
||||
});
|
||||
i++;
|
||||
}
|
||||
else { break; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
tr.Commit();
|
||||
}
|
||||
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
ed.WriteMessage($"\n错误: {ex.Message}");
|
||||
}
|
||||
return listInfo;
|
||||
}
|
||||
private static bool HasTargetXData(ResultBuffer rb, string targetAppName)
|
||||
{
|
||||
if (rb == null) return false;
|
||||
|
||||
TypedValue[] data = rb.AsArray();
|
||||
if (data.Length == 0) return false;
|
||||
|
||||
// 检查第一个TypedValue是否为(1001, "HKSK_LABEL")
|
||||
TypedValue firstValue = data[0];
|
||||
return firstValue.TypeCode == 1001 &&
|
||||
firstValue.Value.ToString() == targetAppName;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取当前图纸的所有Mtext
|
||||
/// <summary>
|
||||
/// 获取当前图纸的所有Mtext
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<DtoMText> GetAllMText()
|
||||
{
|
||||
doc = Application.DocumentManager.MdiActiveDocument;
|
||||
ed = doc.Editor;
|
||||
db = doc.Database;
|
||||
|
||||
List<DtoMText> listMText = new List<DtoMText>();
|
||||
try
|
||||
{
|
||||
// 开启事务
|
||||
using (Transaction tr = db.TransactionManager.StartTransaction())
|
||||
{
|
||||
// 获取模型空间块表记录
|
||||
BlockTable bt = tr.GetObject(db.BlockTableId, OpenMode.ForRead) as BlockTable;
|
||||
BlockTableRecord btr = tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForRead) as BlockTableRecord;
|
||||
|
||||
// 遍历模型空间中的所有实体
|
||||
foreach (ObjectId objId in btr)
|
||||
{
|
||||
Entity entity = tr.GetObject(objId, OpenMode.ForRead) as Entity;
|
||||
if (entity is MText mtext)
|
||||
{
|
||||
listMText.Add(new DtoMText() { Text = mtext.Text, HandId = mtext.Handle.ToString() });
|
||||
}
|
||||
}
|
||||
tr.Commit();
|
||||
}
|
||||
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
ed.WriteMessage($"\n错误: {ex.Message}");
|
||||
}
|
||||
return listMText;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 刷新文本信息
|
||||
/// <summary>
|
||||
/// 刷新文本信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string RefreshMTextInfo(List<KeyValueModel> keyValues)
|
||||
{
|
||||
doc = Application.DocumentManager.MdiActiveDocument;
|
||||
ed = doc.Editor;
|
||||
db = doc.Database;
|
||||
try
|
||||
{
|
||||
using (Transaction tr = db.TransactionManager.StartTransaction())
|
||||
{
|
||||
foreach (var item in keyValues)
|
||||
{
|
||||
Handle handleObj= new Handle(Convert.ToInt64(item.Key, 16));
|
||||
|
||||
// 通过句柄获取ObjectId
|
||||
ObjectId objectId = db.GetObjectId(false, handleObj, 0);
|
||||
|
||||
// 获取对象并检查是否为MText
|
||||
DBObject dbObj = tr.GetObject(objectId, OpenMode.ForWrite);
|
||||
if (dbObj is MText mtext)
|
||||
{
|
||||
mtext.Contents = item.Value;
|
||||
}
|
||||
}
|
||||
tr.Commit();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ex.Message;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
}
|
||||
|
21
newFront/c#前端/SWS.CAD.Base/Model/DtoMText.cs
Normal file
21
newFront/c#前端/SWS.CAD.Base/Model/DtoMText.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Teigha.Geometry;
|
||||
|
||||
namespace SWS.CAD.Base
|
||||
{
|
||||
public class DtoMText
|
||||
{
|
||||
/// <summary>
|
||||
/// 文本内容,多行文本用\n 进行换行
|
||||
/// </summary>
|
||||
public string Text { get; set; }
|
||||
/// <summary>
|
||||
/// 句柄Id
|
||||
/// </summary>
|
||||
public string HandId { get; set; }
|
||||
}
|
||||
}
|
25
newFront/c#前端/SWS.CAD.Base/Model/DtoSymbolInfo.cs
Normal file
25
newFront/c#前端/SWS.CAD.Base/Model/DtoSymbolInfo.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using Teigha.Geometry;
|
||||
|
||||
namespace SWS.Electrical
|
||||
{
|
||||
public class DtoSymbolInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 坐标
|
||||
/// </summary>
|
||||
public Point3d Position { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标上面部分显示内容
|
||||
/// </summary>
|
||||
public string Upper_Text { set; get; }
|
||||
/// <summary>
|
||||
/// 图标下面部分显示内容
|
||||
/// </summary>
|
||||
public string Lower_Text { set; get; }
|
||||
/// <summary>
|
||||
/// 比例
|
||||
/// </summary>
|
||||
public double Scale { set; get; }
|
||||
}
|
||||
}
|
25
newFront/c#前端/SWS.CAD.Base/Model/DtoTagAnnotation.cs
Normal file
25
newFront/c#前端/SWS.CAD.Base/Model/DtoTagAnnotation.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Teigha.Geometry;
|
||||
|
||||
namespace SWS.CAD.Base
|
||||
{
|
||||
public class DtoTagAnnotation
|
||||
{
|
||||
/// <summary>
|
||||
/// 元件句柄Id
|
||||
/// </summary>
|
||||
public string TagHandId { get; set; }
|
||||
/// <summary>
|
||||
/// 属性名
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
/// <summary>
|
||||
/// 文本标注句柄Id
|
||||
/// </summary>
|
||||
public string LabelHandId { get; set; }
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@ using Teigha.Geometry;
|
||||
|
||||
namespace SWS.CAD.Base
|
||||
{
|
||||
public class DtoCadTextInfo
|
||||
public class DtoTextInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 坐标
|
@ -52,7 +52,10 @@
|
||||
<Compile Include="BlockDragJig.cs" />
|
||||
<Compile Include="General.cs" />
|
||||
<Compile Include="Model\DtoBasePoint.cs" />
|
||||
<Compile Include="Model\DtoCadTextInfo.cs" />
|
||||
<Compile Include="Model\DtoTagAnnotation.cs" />
|
||||
<Compile Include="Model\DtoSymbolInfo.cs" />
|
||||
<Compile Include="Model\DtoMText.cs" />
|
||||
<Compile Include="Model\DtoTextInfo.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -60,6 +63,10 @@
|
||||
<Project>{9ac724f6-883d-4357-9422-602748f25b69}</Project>
|
||||
<Name>SWS.Commons</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\SWS.Model\SWS.Model.csproj">
|
||||
<Project>{1995385B-D1B0-4C55-835E-D3E769972A6A}</Project>
|
||||
<Name>SWS.Model</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
|
@ -230,28 +230,8 @@ namespace SWS.CAD
|
||||
/// </summary>
|
||||
public static List<Model.TreeModel> designTree = new List<Model.TreeModel>();
|
||||
#endregion
|
||||
|
||||
public enum dialogPar
|
||||
{
|
||||
id,
|
||||
textYes,
|
||||
textNo,
|
||||
title,
|
||||
OK,
|
||||
unitTypeId,
|
||||
info,
|
||||
unit,
|
||||
para1,
|
||||
para2
|
||||
}
|
||||
//public static IUnityContainer container;
|
||||
//public static IContainerExtension _prismContainer;
|
||||
//public static HttpClient client;
|
||||
//public static loginRes userInfo;
|
||||
//public static List<User> Users;
|
||||
|
||||
public static bool isConfigIniCreateBySys = true;
|
||||
//public static string drawingFileId;
|
||||
|
||||
public static bool isConfigIniCreateBySys = true;
|
||||
public static ec_project curProject;
|
||||
public static DateTime preClickTime = DateTime.Now;
|
||||
public static Style TransparentComboBoxStyle;
|
||||
@ -321,29 +301,7 @@ namespace SWS.CAD
|
||||
return path;
|
||||
}
|
||||
#endregion
|
||||
|
||||
//#region 根据ID获取用户名称
|
||||
///// <summary>
|
||||
///// 根据ID获取用户名称
|
||||
///// </summary>
|
||||
///// <param name="id"></param>
|
||||
///// <returns></returns>
|
||||
//public static string GetUserNameById(string id)
|
||||
//{
|
||||
// if (string.IsNullOrEmpty(id))
|
||||
// { return ""; }
|
||||
// var user = Users.FirstOrDefault(a => a.F_UserId == id || a.F_Account == id);
|
||||
// if (user != null)
|
||||
// { return user.F_RealName; }
|
||||
// else
|
||||
// {
|
||||
// return "";
|
||||
// //user = GlobalObject.Users.FirstOrDefault(a => a.F_Account == id);
|
||||
// //return user != null ? user.F_RealName : "";
|
||||
// }
|
||||
//}
|
||||
//#endregion
|
||||
|
||||
|
||||
#region 查找子控件
|
||||
|
||||
/// <summary>
|
||||
@ -376,75 +334,6 @@ namespace SWS.CAD
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 判断是否是电缆
|
||||
/// <summary>
|
||||
/// 判断是否是电缆
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool IsCable(ec_objecttype obj)
|
||||
{
|
||||
if (obj == null) { return false; }
|
||||
var flag = obj.ObjectTypeName.EndsWith("电缆");
|
||||
return flag;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 取字符串最后的一个或多个数字
|
||||
/// <summary>
|
||||
/// 取字符串最后的一个或多个数字
|
||||
/// </summary>
|
||||
/// <param name="input">输入字符串</param>
|
||||
/// <param name="preInput">数字前的字符串</param>
|
||||
/// <param name="num">最后的数字</param>
|
||||
/// <returns></returns>
|
||||
public static bool GetLastNumber(string input, ref string preInput, ref int num)
|
||||
{
|
||||
string pattern = @"(\d+)$"; // 正则表达式,匹配字符串末尾的一个或多个数字
|
||||
Match match = Regex.Match(input, pattern);
|
||||
if (match.Success)
|
||||
{
|
||||
preInput = input.Substring(0, input.Length - match.Value.Length);
|
||||
num = int.Parse(match.Value);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="resName">包括命名空间</param>
|
||||
/// <returns></returns>
|
||||
public static System.Windows.Media.ImageSource ImageSourceFromEmbeddedResourceStream(string resName)
|
||||
{
|
||||
System.Reflection.Assembly assy = System.Reflection.Assembly.GetExecutingAssembly();
|
||||
//foreach (string resource in assy.GetManifestResourceNames())
|
||||
//{
|
||||
// Console.WriteLine(resource);//遍历所有的内嵌资源
|
||||
//}
|
||||
System.IO.Stream stream = assy.GetManifestResourceStream(resName);
|
||||
if (stream == null)
|
||||
return null;
|
||||
System.Windows.Media.Imaging.BitmapImage img = new System.Windows.Media.Imaging.BitmapImage();
|
||||
img.BeginInit();
|
||||
img.StreamSource = stream;
|
||||
img.EndInit();
|
||||
return img;
|
||||
}
|
||||
|
||||
public static string GetPCInfo()
|
||||
{
|
||||
string computerName = Environment.MachineName; // 获取计算机名称
|
||||
string userName = Environment.UserName; // 获取当前用户名称
|
||||
|
||||
return $"{computerName} 计算机{userName} 用户";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -96,6 +96,42 @@ namespace SWS.CAD
|
||||
MessageBox.Show($"启动时发生错误: {ex.ToString()}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
|
||||
GlobalObject._prismContainer = new DryIocContainerExtension();
|
||||
GlobalObject._prismContainer.Register<IDialogService, DialogService>();
|
||||
GlobalObject._prismContainer.Register<IDialogWindow, Views.Dialog.CustomDialogWindow>();
|
||||
//后者类似于一个容器。给所有需要的dialog所用
|
||||
GlobalObject._prismContainer.RegisterDialog<NewDrawing, NewDrawingViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<Dialog2Select, Dialog2SelectViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogUnitSelect, DialogUnitSelectViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogInput, DialogInputViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogTagSelect, DialogTagSelectViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogNewTagNumber, DialogNewTagNumberViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogParallelCable, DialogParallelCableViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogPreCheckIn, DialogPreCheckInViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogDrawingCatalogue, DialogDrawingCatalogueViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogCheckInRecord, DialogCheckInRecordViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogPublishRecord, DialogPublishRecordViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<SWS.WPF.Views.DialogSignalManagement,SWS.WPF.ViewModels.DialogSignalManagementViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogAllOutputSignal, DialogAllOutputSignalViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogAssociatedSignal, DialogAssociatedSignalViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogOperateRecord, DialogOperateRecordViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogPropertyHistory, DialogPropertyHistoryViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogSignalNotice, DialogSignalNoticeViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogSignalPropertyhisAndLogs, DialogSignalPropertyhisAndLogsViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogSignalSelect, DialogSignalSelectViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogIODistribution, DialogIODistributionViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogNewPositional, DialogNewPositionalViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogNewStrip, DialogNewStripViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogCablePreAssignPreview, DialogCablePreAssignPreviewViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogCablePreAssignResult, DialogCablePreAssignResultViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogNewComponent, DialogNewComponentViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogCableConfig, DialogCableConfigViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogBusbarManagement, DialogBusbarManagementViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogChannelMigration, DialogChannelMigrationViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogCableConnection, DialogCableConnectionViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogCableConnection_NewStrip, DialogCableConnection_NewStripViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogSignalPredistribution, DialogSignalPredistributionViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogSectionBox, DialogSectionBoxViewModel>();
|
||||
}
|
||||
|
||||
|
||||
|
@ -432,6 +432,8 @@ namespace SWS.CAD.ViewModels
|
||||
{
|
||||
foreach (Model.TreeModel node in trees)
|
||||
{
|
||||
if (node.NodeType == "0"||node.ChildNodes!=null&&node.ChildNodes.Any())
|
||||
{ CheckInOutStatus(node.ChildNodes); }
|
||||
foreach (var item in node.ChildNodes)
|
||||
{
|
||||
ec_drawing_file dwgObj = JsonConvert.DeserializeObject<ec_drawing_file>(item.NodeExtData.ToString());
|
||||
@ -491,6 +493,7 @@ namespace SWS.CAD.ViewModels
|
||||
originDrawings = JsonConvert.DeserializeObject<ObservableCollection<Model.TreeModel>>(data.ToString());
|
||||
Drawings = new ObservableCollection<Model.TreeModel>(originDrawings);
|
||||
Drawings = CheckInOutStatus(Drawings);
|
||||
GlobalObject.AllDrawings= Drawings.ToList();
|
||||
curProjName = "当前项目:" + GlobalObject.curProject.ProjectName;
|
||||
LoginOK = true;
|
||||
//放置元件列表树
|
||||
@ -756,7 +759,7 @@ namespace SWS.CAD.ViewModels
|
||||
/// <param name="model">图纸</param>
|
||||
private async void onOpenDwg(Model.TreeModel model)
|
||||
{
|
||||
string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text);
|
||||
string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(model.ID), model.Text);
|
||||
var msg = string.Empty;
|
||||
var dwgObj = JsonConvert.DeserializeObject<ec_drawing_file>(model.NodeExtData.ToString());
|
||||
if (dwgObj.IsPublish == 1)
|
||||
@ -797,7 +800,7 @@ namespace SWS.CAD.ViewModels
|
||||
/// </summary>
|
||||
private async void OpenDwgByMyself(Model.TreeModel model)
|
||||
{
|
||||
string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text);
|
||||
string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(model.ID), model.Text);
|
||||
var dwgObj = JsonConvert.DeserializeObject<ec_drawing_file>(model.NodeExtData.ToString());
|
||||
string msg = string.Empty;
|
||||
if (!string.IsNullOrEmpty(dwgObj.PCInfo) && !GlobalObject.GetPCInfo().Equals(dwgObj.PCInfo))//对比PCInfo
|
||||
@ -848,7 +851,7 @@ namespace SWS.CAD.ViewModels
|
||||
private async void DownDwgByOpenReadOnly(Model.TreeModel model)
|
||||
{
|
||||
#region 下载文件,只读打开
|
||||
string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text);
|
||||
string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(model.ID), model.Text);
|
||||
var msg = string.Empty;
|
||||
var dwgObj = JsonConvert.DeserializeObject<ec_drawing_file>(model.NodeExtData.ToString());
|
||||
if (File.Exists(filePath))
|
||||
@ -860,7 +863,7 @@ namespace SWS.CAD.ViewModels
|
||||
}
|
||||
//已有本地图纸文件移至备份文件夹
|
||||
string now = DateTime.Now.ToString("yyyyMMddHHmmss");//加上当前时间,防止重名
|
||||
string backFile = Path.Combine(GlobalObject.GetBackupDwgFileFolder(), now + model.Text);
|
||||
string backFile = Path.Combine(GlobalObject.GetBackupDwgFileFolder(model.ID), now + model.Text);
|
||||
File.Move(filePath, backFile);
|
||||
MessageBox.Show($"本地图纸文件已移至:{backFile} !");
|
||||
}
|
||||
@ -933,7 +936,7 @@ namespace SWS.CAD.ViewModels
|
||||
{
|
||||
try
|
||||
{
|
||||
System.Diagnostics.Process.Start(GlobalObject.GetDwgFileFolder());
|
||||
System.Diagnostics.Process.Start(GlobalObject.GetDwgFileFolder(model.ID));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -955,7 +958,7 @@ namespace SWS.CAD.ViewModels
|
||||
return;
|
||||
}
|
||||
string msg = string.Empty;
|
||||
string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text);
|
||||
string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(model.ID), model.Text);
|
||||
#region 校验
|
||||
|
||||
if (!File.Exists(filePath))
|
||||
@ -1086,7 +1089,7 @@ namespace SWS.CAD.ViewModels
|
||||
ec_drawing_file dwgObj = model.dwgObj;
|
||||
List<string> handles = model.handles;
|
||||
ec_drawing_syn syn = model.syn;
|
||||
string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), dwgObj.DrawingFileName);
|
||||
string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(model.dwgObj.DrawingFileID), dwgObj.DrawingFileName);
|
||||
//预检入校验
|
||||
var msg = await _dwgService.PreCheckInDrawingFile(dwgObj, handles);
|
||||
if (!string.IsNullOrEmpty(msg))
|
||||
@ -1155,7 +1158,7 @@ namespace SWS.CAD.ViewModels
|
||||
/// <returns></returns>
|
||||
private async Task<bool> CheckOut(Model.TreeModel model)
|
||||
{
|
||||
string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text);
|
||||
string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(model.ID), model.Text);
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
if (FileHelper.IsFileLocked(filePath))
|
||||
@ -1163,12 +1166,12 @@ namespace SWS.CAD.ViewModels
|
||||
MessageBox.Show($"本地图纸文件:{model.Text} 已存在并被打开,请关闭文件再检出");
|
||||
return false;
|
||||
}
|
||||
string backFolder = GlobalObject.GetBackupDwgFileFolder();
|
||||
string backFolder = GlobalObject.GetBackupDwgFileFolder(model.ID);
|
||||
if (MessageBoxResult.OK == MessageBox.Show($"本地图纸文件:{model.Text} 已存在,继续检出会把本地图纸移至:[{backFolder}]", "是否继续检出", MessageBoxButton.OKCancel, MessageBoxImage.Question))
|
||||
{
|
||||
//本地图纸文件移至备份文件夹
|
||||
string now = DateTime.Now.ToString("yyyyMMddHHmmss");//加上当前时间,防止重名
|
||||
string backFile = Path.Combine(GlobalObject.GetBackupDwgFileFolder(), now + model.Text);
|
||||
string backFile = Path.Combine(GlobalObject.GetBackupDwgFileFolder(model.ID), now + model.Text);
|
||||
File.Move(filePath, backFile);
|
||||
}
|
||||
else
|
||||
@ -1191,7 +1194,7 @@ namespace SWS.CAD.ViewModels
|
||||
return false;
|
||||
}
|
||||
//打开图纸文件
|
||||
filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text);
|
||||
filePath = Path.Combine(GlobalObject.GetDwgFileFolder(model.ID), model.Text);
|
||||
msg = General.OpenDwg(filePath);
|
||||
|
||||
//更新图纸节点图标和字体颜色
|
||||
@ -1225,7 +1228,7 @@ namespace SWS.CAD.ViewModels
|
||||
var msg = await _dwgService.FreeDrawingFile(model.ID);
|
||||
if (!string.IsNullOrEmpty(msg))
|
||||
{ MessageBox.Show("释放失败,信息:" + msg); return; }
|
||||
string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text);
|
||||
string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(model.ID), model.Text);
|
||||
if (!FileHelper.IsFileLocked(filePath))
|
||||
{ File.Delete(filePath); }//删除本地图纸文件
|
||||
MessageBox.Show("释放成功!");
|
||||
@ -1531,7 +1534,7 @@ namespace SWS.CAD.ViewModels
|
||||
{
|
||||
//下载文件
|
||||
var dwgfileDto = await _annexesService.GetAnnexesFile(item.FolderId);
|
||||
var filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), item.LibraryFileName + ".dwg");
|
||||
var filePath = Path.Combine(GlobalObject.GetDwgFileFolder(id), item.LibraryFileName + ".dwg");
|
||||
if (File.Exists(filePath))
|
||||
{ File.Delete(filePath); }
|
||||
msg = await _annexesService.DownloadFile(filePath, dwgfileDto.F_Id);
|
||||
@ -1543,7 +1546,7 @@ namespace SWS.CAD.ViewModels
|
||||
var img = General.GetDwgThumbnail(filePath);
|
||||
if (img != null)
|
||||
{
|
||||
var imgPath = Path.Combine(GlobalObject.GetDwgFileFolder(), item.LibraryFileName + ".png");
|
||||
var imgPath = Path.Combine(GlobalObject.GetDwgFileFolder(id), item.LibraryFileName + ".png");
|
||||
if (File.Exists(imgPath))
|
||||
{ File.Delete(imgPath); }
|
||||
img.Save(imgPath);
|
||||
@ -1675,7 +1678,7 @@ namespace SWS.CAD.ViewModels
|
||||
{
|
||||
if (model == null) return;
|
||||
if (model.NodeType != "91") return;
|
||||
string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text);
|
||||
string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(model.ID), model.Text);
|
||||
var pixel = JsonConvert.DeserializeObject<ec_enginedata_pixel>(model.NodeExtData.ToString());
|
||||
var dwgObj = await _dwgService.GetDrawingFile(pixel.DrawingFileID);
|
||||
//获取属性
|
||||
@ -1797,7 +1800,7 @@ namespace SWS.CAD.ViewModels
|
||||
GlobalObject.ListDwgOpened.Add(new DrawingOpened()
|
||||
{
|
||||
Id = dwgObj.DrawingFileID,
|
||||
Path = Path.Combine(GlobalObject.GetDwgFileFolder(), dwgObj.DrawingFileName),
|
||||
Path = Path.Combine(GlobalObject.GetDwgFileFolder(dwgObj.DrawingFileID), dwgObj.DrawingFileName),
|
||||
IsReadOnly = isReadOnly
|
||||
});
|
||||
}
|
||||
@ -1815,7 +1818,7 @@ namespace SWS.CAD.ViewModels
|
||||
GlobalObject.ListDwgOpened.Add(new DrawingOpened()
|
||||
{
|
||||
Id = dwgObj.ID,
|
||||
Path = Path.Combine(GlobalObject.GetDwgFileFolder(), dwgObj.Text),
|
||||
Path = Path.Combine(GlobalObject.GetDwgFileFolder(dwgObj.ID), dwgObj.Text),
|
||||
IsReadOnly = isReadOnly
|
||||
});
|
||||
}
|
||||
@ -2138,7 +2141,7 @@ namespace SWS.CAD.ViewModels
|
||||
private async void onReadOnlyOpenDwg(Model.TreeModel model)
|
||||
{
|
||||
#region 下载文件,只读打开
|
||||
string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text);
|
||||
string filePath = Path.Combine(GlobalObject.GetDwgFileFolder(model.ID), model.Text);
|
||||
var msg = string.Empty;
|
||||
var dwgPublishObj = JsonConvert.DeserializeObject<ec_drawing_publish>(model.NodeExtData.ToString());
|
||||
if (File.Exists(filePath))
|
||||
@ -2214,7 +2217,7 @@ namespace SWS.CAD.ViewModels
|
||||
{
|
||||
string tagNum = string.Empty;
|
||||
var tagNumber = RES.Parameters.GetValue<string>(GlobalObject.dialogPar.info.ToString());
|
||||
var dgwFilePath = Path.Combine(GlobalObject.GetDwgFileFolder(), dwgLibrary.LibraryFileName + ".dwg");
|
||||
var dgwFilePath = Path.Combine(GlobalObject.GetDwgFileFolder(dwgFile.Id), dwgLibrary.LibraryFileName + ".dwg");
|
||||
var objId = General.InsertExternalDWG(dgwFilePath, tagNumber, ref tagNum);
|
||||
#region 图纸上保存图元属性
|
||||
if (!objId.IsNull)
|
||||
|
@ -353,7 +353,7 @@ namespace SWS.CAD.ViewModels
|
||||
//根据模板实体的FolderId,获取上传文件的实体
|
||||
var dwgfileDto = await _annexesService.GetAnnexesFile(templatefileDto.FolderId);
|
||||
// 指定新 DWG 文件的保存路径
|
||||
string folderPath = GlobalObject.GetDwgFileFolder();
|
||||
string folderPath = GlobalObject.GetDwgFileFolder(dwgObj.DrawingCatalogueID);
|
||||
string filePath = Path.Combine(folderPath, dwgObj.DrawingFileName);
|
||||
var msg = await _annexesService.DownloadFile(filePath, dwgfileDto.F_Id);
|
||||
if (!string.IsNullOrEmpty(msg))
|
||||
@ -414,7 +414,7 @@ namespace SWS.CAD.ViewModels
|
||||
//旧图纸文件名和新图纸文件名不一致,则修改本地图纸文件名
|
||||
if (oldDwgFileName != dwgObj.DrawingFileName)
|
||||
{
|
||||
string folderPath = GlobalObject.GetDwgFileFolder();
|
||||
string folderPath = GlobalObject.GetDwgFileFolder(dwgObj.DrawingFileID);
|
||||
var oldFilePath = Path.Combine(folderPath, oldDwgFileName);
|
||||
if (FileHelper.IsFileLocked(oldFilePath))
|
||||
{
|
||||
|
@ -36,10 +36,7 @@ namespace SWS.CAD.ViewModels.myViewModelBase
|
||||
//Application.ShowModalDialog(Application.MainWindow,);// 用来显示WinForms对话框
|
||||
Application.ShowModalWindow(Application.MainWindow.Handle, loginView);//用来显示WPF的对话框,任务栏里可以看到2个Windows
|
||||
|
||||
//if (GlobalObject.userInfo == null)
|
||||
//{
|
||||
// CloseWindowAction?.Invoke();//依旧没登录上的话,放这里没用,因为这个时候,主体还没加载呢
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
if (GlobalObject.curProject == null)
|
||||
|
@ -227,6 +227,7 @@
|
||||
<TreeView
|
||||
x:Name="treeDwgHistory"
|
||||
Margin="-5,0,0,0"
|
||||
Behaviors:TreeViewSelectedItemBehavior.SelectedItem="{Binding selectedHistoryDwg, Mode=TwoWay}"
|
||||
Background="Transparent"
|
||||
FontSize="11"
|
||||
ItemsSource="{Binding historyDrawings}"
|
||||
|
@ -179,9 +179,9 @@ namespace SWS.Commons
|
||||
/// 图纸文件所在文件夹
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetDwgFileFolder()
|
||||
public static string GetDwgFileFolder(string dwgID)
|
||||
{
|
||||
string path = Path.Combine(GetLocalFileDirectory(), curProject.ProjectIndex.ToString());
|
||||
string path = Path.Combine(GetLocalFileDirectory(), curProject.ProjectName, GetDwgPath(dwgID));
|
||||
if (!Directory.Exists(path))
|
||||
Directory.CreateDirectory(path);
|
||||
return path;
|
||||
@ -193,9 +193,9 @@ namespace SWS.Commons
|
||||
/// 图纸文件备份文件夹
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string GetBackupDwgFileFolder()
|
||||
public static string GetBackupDwgFileFolder(string dwgID)
|
||||
{
|
||||
string path = Path.Combine(GetDwgFileFolder(), "Backup");
|
||||
string path = Path.Combine(GetDwgFileFolder(dwgID), "Backup");
|
||||
if (!Directory.Exists(path))
|
||||
Directory.CreateDirectory(path);
|
||||
return path;
|
||||
@ -289,6 +289,8 @@ namespace SWS.Commons
|
||||
if (!AllDrawings.Any())
|
||||
{ return fullpath; }
|
||||
fullpath = GetParentPath(dwgID);
|
||||
if (string.IsNullOrEmpty(fullpath))
|
||||
{ return "Temp\\"; }
|
||||
return fullpath;
|
||||
}
|
||||
private static string GetParentPath(string dwgID)
|
||||
|
@ -58,6 +58,46 @@ namespace SWS.Commons
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取树节点
|
||||
/// <summary>
|
||||
/// 获取树节点
|
||||
/// </summary>
|
||||
public static Model.TreeModel GetTreeModelByText(List<Model.TreeModel> nodes, string text)
|
||||
{
|
||||
Model.TreeModel node = null;
|
||||
foreach (var dto in nodes)
|
||||
{
|
||||
//获取节点下的图纸
|
||||
node = TreeHelper.GetTreeModelByText(dto, text);
|
||||
if (node != null)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return node;
|
||||
}
|
||||
public static Model.TreeModel GetTreeModelByText(TreeModel node, string text)
|
||||
{
|
||||
// 如果根节点为空,则返回null
|
||||
if (node == null) return null;
|
||||
// 如果找到当前节点,返回当前节点
|
||||
if (node.Text == text) return node;
|
||||
//没有子节点就返回null
|
||||
if (node.ChildNodes == null) return null;
|
||||
// 否则,递归地在子节点中查找
|
||||
foreach (var child in node.ChildNodes)
|
||||
{
|
||||
var result = GetTreeModelByText(child, text);
|
||||
if (result != null)
|
||||
{
|
||||
return result; // 找到后立即返回
|
||||
}
|
||||
}
|
||||
// 如果在当前树中没有找到,返回null
|
||||
return null;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取树节点所有图纸名
|
||||
|
||||
/// <summary>
|
||||
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
@ -11,6 +12,7 @@ using Bricscad.Windows;
|
||||
using Prism.Events;
|
||||
using Prism.Ioc;
|
||||
using Prism.Services.Dialogs;
|
||||
using SWS.CAD.Base;
|
||||
using SWS.Commons;
|
||||
using SWS.Electrical;
|
||||
using SWS.Electrical.Views;
|
||||
@ -110,8 +112,8 @@ namespace SWS.Electrical
|
||||
|
||||
|
||||
// 提示用户发生了错 ?
|
||||
var result= MessageBox.Show("发生错误,是否打开日志文件以获取更多信息?", "错误", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
|
||||
if(result== System.Windows.Forms.DialogResult.OK)
|
||||
var result = MessageBox.Show("发生错误,是否打开日志文件以获取更多信息?", "错误", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
|
||||
if (result == System.Windows.Forms.DialogResult.OK)
|
||||
{
|
||||
System.Diagnostics.Process.Start("explorer.exe", GlobalObject.GetLogPath());
|
||||
}
|
||||
@ -150,7 +152,7 @@ namespace SWS.Electrical
|
||||
RibbonButton btnMenu = new RibbonButton();
|
||||
btnMenu.ToolTip = "测试绘图";
|
||||
btnMenu.Text = "测试绘图";
|
||||
btnMenu.ButtonStyle = RibbonButtonStyle.SmallWithText;
|
||||
btnMenu.ButtonStyle = RibbonButtonStyle.LargeWithText;
|
||||
btnMenu.CommandHandler = new DelegateCommand(async x =>
|
||||
{
|
||||
|
||||
@ -207,7 +209,7 @@ namespace SWS.Electrical
|
||||
btnMenu = new RibbonButton();
|
||||
btnMenu.ToolTip = "信号管理";
|
||||
btnMenu.Text = "信号管理";
|
||||
btnMenu.ButtonStyle = RibbonButtonStyle.SmallWithText;
|
||||
btnMenu.ButtonStyle = RibbonButtonStyle.LargeWithText;
|
||||
btnMenu.CommandHandler = new DelegateCommand(async x =>
|
||||
{
|
||||
|
||||
@ -256,7 +258,7 @@ namespace SWS.Electrical
|
||||
btnMenu = new RibbonButton();
|
||||
btnMenu.ToolTip = "布置图自动绘制";
|
||||
btnMenu.Text = "布置图自动绘制";
|
||||
btnMenu.ButtonStyle = RibbonButtonStyle.SmallWithText;
|
||||
btnMenu.ButtonStyle = RibbonButtonStyle.LargeWithText;
|
||||
btnMenu.CommandHandler = new DelegateCommand(async x =>
|
||||
{
|
||||
|
||||
@ -306,7 +308,7 @@ namespace SWS.Electrical
|
||||
btnMenu = new RibbonButton();
|
||||
btnMenu.ToolTip = "材料表自动生成";
|
||||
btnMenu.Text = "材料表自动生成";
|
||||
btnMenu.ButtonStyle = RibbonButtonStyle.SmallWithText;
|
||||
btnMenu.ButtonStyle = RibbonButtonStyle.LargeWithText;
|
||||
btnMenu.CommandHandler = new DelegateCommand(async x =>
|
||||
{
|
||||
|
||||
@ -340,10 +342,69 @@ namespace SWS.Electrical
|
||||
dataSource.Items.Add(ribbonRowPanel);
|
||||
#endregion
|
||||
|
||||
#region Ribbon 图形刷新
|
||||
RibbonPanelSource dwgRefreshSource = new RibbonPanelSource();
|
||||
dwgRefreshSource.Title = "图形刷新";
|
||||
dwgRefreshSource.Id = "图形刷新";
|
||||
RibbonPanel dwgRefreshPanel = new RibbonPanel();
|
||||
dwgRefreshPanel.Source = dwgRefreshSource;
|
||||
tab1.Panels.Add(dwgRefreshPanel);
|
||||
//大按钮
|
||||
#region buttons 刷新标注
|
||||
RibbonButton btnRefreshText = new RibbonButton();
|
||||
btnRefreshText.ToolTip = "刷新标注";
|
||||
btnRefreshText.Text = "刷新标注";
|
||||
btnRefreshText.ButtonStyle = RibbonButtonStyle.LargeWithText;
|
||||
btnRefreshText.CommandHandler = new DelegateCommand(async x =>
|
||||
{
|
||||
//打开窗体
|
||||
try
|
||||
{
|
||||
var flag = await GlobalObj.CheckLogin();
|
||||
if (!flag)
|
||||
{
|
||||
MessageBox.Show("登录已过期,请重新登录!");
|
||||
return;
|
||||
}
|
||||
var curName = General.GetDwgName();
|
||||
var index = curName.LastIndexOf("\\");
|
||||
if (index == -1)
|
||||
{
|
||||
MessageBox.Show("请先在左侧图纸树中打开图纸!");
|
||||
return;
|
||||
}
|
||||
var dwgName = curName.Substring(index+1);//获取当前图纸名称
|
||||
var _ServiceDrawing = GlobalObject.container.Resolve<DrawingServce>();
|
||||
var list = await _ServiceDrawing.GetDrawingCatalogue();
|
||||
GlobalObject.AllDrawings = list.ToList();
|
||||
var node = TreeHelper.GetTreeModelByText(GlobalObject.AllDrawings, dwgName);//从图纸树中获取当前节点
|
||||
if (node == null)
|
||||
{
|
||||
MessageBox.Show("当前图纸不是系统图纸,请先在左侧图纸树中打开图纸!");
|
||||
return;
|
||||
}
|
||||
var para = new DialogParameters();
|
||||
para.Add(GlobalObject.dialogPar.para1.ToString(), node);
|
||||
var _dialogService = GlobalObject._prismContainer.Resolve<IDialogService>();
|
||||
_dialogService.ShowDialog(nameof(DialogRefreshAnnotation), para, (RES) =>
|
||||
{
|
||||
|
||||
});
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message);
|
||||
}
|
||||
});
|
||||
btnRefreshText.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"RefreshText.png");
|
||||
btnRefreshText.Id = "刷新标注";
|
||||
dwgRefreshSource.Items.Add(btnRefreshText);
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
|
||||
public void Terminate()
|
||||
{
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
69
newFront/c#前端/SWS.Electrical/Models/DtoAnnotation.cs
Normal file
69
newFront/c#前端/SWS.Electrical/Models/DtoAnnotation.cs
Normal file
@ -0,0 +1,69 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SWS.Model;
|
||||
using Telerik.Windows.Controls;
|
||||
|
||||
namespace SWS.Electrical.Models
|
||||
{
|
||||
public class DtoAnnotation : DtoDrawing
|
||||
{
|
||||
private string _Status;
|
||||
/// <summary>
|
||||
/// 已刷新 未刷新
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string Status
|
||||
{
|
||||
get { return _Status; }
|
||||
set { _Status = value; RaisePropertyChanged(nameof(Status)); }
|
||||
}
|
||||
private string _ObjectTypeName;
|
||||
/// <summary>
|
||||
/// 元件类型
|
||||
/// </summary>
|
||||
public string ObjectTypeName
|
||||
{
|
||||
get { return _ObjectTypeName; }
|
||||
set { _ObjectTypeName = value; RaisePropertyChanged(nameof(ObjectTypeName)); }
|
||||
}
|
||||
private string _TagNumber;
|
||||
/// <summary>
|
||||
/// 元件位号
|
||||
/// </summary>
|
||||
public string TagNumber
|
||||
{
|
||||
get { return _TagNumber; }
|
||||
set { _TagNumber = value; RaisePropertyChanged(nameof(TagNumber)); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 元件句柄
|
||||
/// </summary>
|
||||
public string TagHandid { get; set; }
|
||||
/// <summary>
|
||||
/// 属性名
|
||||
/// </summary>
|
||||
public string AttributeName { get; set; }
|
||||
|
||||
private string _AttributeValue;
|
||||
/// <summary>
|
||||
/// 属性值
|
||||
/// </summary>
|
||||
public string AttributeValue
|
||||
{
|
||||
get { return _AttributeValue; }
|
||||
set { _AttributeValue = value; RaisePropertyChanged(nameof(AttributeValue)); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 标注句柄
|
||||
/// </summary>
|
||||
public string AnnotationHandid { get; set; }
|
||||
/// <summary>
|
||||
/// 标注值
|
||||
/// </summary>
|
||||
public string AnnotationValue { get; set; }
|
||||
}
|
||||
}
|
@ -135,14 +135,19 @@
|
||||
<Compile Include="Control\ListBoxScrollToBottomBehavior.cs" />
|
||||
<Compile Include="Event\checkInEvent.cs" />
|
||||
<Compile Include="GlobalObj.cs" />
|
||||
<Compile Include="Models\DtoAnnotation.cs" />
|
||||
<Compile Include="Models\DtoBomDrawings.cs" />
|
||||
<Compile Include="Models\DtoAutoPlotLayout.cs" />
|
||||
<Compile Include="Models\DtoDrawing.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Start.cs" />
|
||||
<Compile Include="ViewModels\DialogRefreshAnnotationViewModel.cs" />
|
||||
<Compile Include="ViewModels\DialogGenerateBOMViewModel.cs" />
|
||||
<Compile Include="ViewModels\DialogAutoArrangeLayoutViewModel.cs" />
|
||||
<Compile Include="ViewModels\DialogTest2ViewModel.cs" />
|
||||
<Compile Include="Views\DialogRefreshAnnotation.xaml.cs">
|
||||
<DependentUpon>DialogRefreshAnnotation.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\DialogGenerateBOM.xaml.cs">
|
||||
<DependentUpon>DialogGenerateBOM.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@ -209,6 +214,10 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Views\DialogRefreshAnnotation.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="Views\DialogGenerateBOM.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
|
@ -68,6 +68,7 @@ namespace SWS.Electrical
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogAssociatedSignal, DialogAssociatedSignalViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogAutoArrangeLayout, DialogAutoArrangeLayoutViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogGenerateBOM, DialogGenerateBOMViewModel>();
|
||||
GlobalObject._prismContainer.RegisterDialog<DialogRefreshAnnotation, DialogRefreshAnnotationViewModel>();
|
||||
|
||||
}
|
||||
|
||||
@ -91,7 +92,7 @@ namespace SWS.Electrical
|
||||
GlobalObject.client = new HttpClient()
|
||||
{
|
||||
BaseAddress = new Uri($"{strDomain}/api/"),
|
||||
Timeout = TimeSpan.FromSeconds(120)
|
||||
Timeout = TimeSpan.FromSeconds(200)
|
||||
};
|
||||
}
|
||||
else if (dbType == "0")
|
||||
@ -99,7 +100,7 @@ namespace SWS.Electrical
|
||||
GlobalObject.client = new HttpClient()
|
||||
{
|
||||
BaseAddress = new Uri($"http://{address}:{port}/api/"),
|
||||
Timeout = TimeSpan.FromSeconds(120)
|
||||
Timeout = TimeSpan.FromSeconds(200)
|
||||
};
|
||||
}
|
||||
GlobalObject.client.DefaultRequestHeaders.Add("logintoken", token);
|
||||
@ -109,13 +110,11 @@ namespace SWS.Electrical
|
||||
if (flag && GlobalObject.curProject == null)
|
||||
{
|
||||
//第一次要在后台初始化一些数据
|
||||
var projectService = GlobalObject.container.Resolve<ProjectService>();
|
||||
var listProjects = (await projectService.GetProjects(1, 1000)).Rows;
|
||||
var p = listProjects.FirstOrDefault(a => a.ProjectId == curProjId);
|
||||
GlobalObject.curProject = p;
|
||||
var obj = await projectService.InitProjInfo(curProjId, "");
|
||||
var treeData = obj.First(x => (string)x["Name"] == "图纸树(按目录)")["data"];
|
||||
GlobalObj.treeDrawings = JsonConvert.DeserializeObject<List<TreeModel>>(treeData.ToString());
|
||||
var projectService = GlobalObject.container.Resolve<ProjectService>();
|
||||
GlobalObject.curProject = await projectService.GetEntity(curProjId);
|
||||
//var obj = await projectService.InitProjInfo(curProjId, "");
|
||||
//var treeData = obj.First(x => (string)x["Name"] == "图纸树(按目录)")["data"];
|
||||
//GlobalObj.treeDrawings = JsonConvert.DeserializeObject<List<TreeModel>>(treeData.ToString());
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
Binary file not shown.
@ -2,7 +2,7 @@
|
||||
"Width": 230,
|
||||
"Height": 320,
|
||||
"RowPageCount": 5,
|
||||
"RowCount": 6,
|
||||
"RowCount": 10,
|
||||
"RowHeight": 20,
|
||||
"Column1X": 37,
|
||||
"Column1Y": 245,
|
||||
|
@ -1,49 +0,0 @@
|
||||
|
||||
--------------- 19-09-2025 10:11:59 --------------- v21.2.04.0 ---------------
|
||||
Exception:
|
||||
ACCESS_VIOLATION (C0000005) in module ntdll.dll at 0033:00007FF9E5D49821
|
||||
Registers:
|
||||
RAX=lX RBX=lX RCX=lX RDX=lX RSI=lX RDI=lX RBP=lX RSP=lX RIP=lX EFL=00000000 CS=17E0000 DS=100000 SS=91BA ES=2EFEB970 FS=2EF80E90 GS=2EFEB970
|
||||
|
||||
Call stack (current) (main):
|
||||
RtlDeleteBoundaryDescriptor()+0x0000000000000221, (0x00000000017E0000 0x000000002EFEB97F 0x000000002EFEB970 0x000000002EFEB980), ntdll.dll, 0x00007FF9E5D49821
|
||||
RtlGetCurrentServiceSessionId()+0x0000000000001294, (0x000000002EFEB970 0x00000000017E0000 0x000000002F2EE640 0x0000000000000000), ntdll.dll, 0x00007FF9E5D4C374
|
||||
RtlFreeHeap()+0x0000000000000051, (0x000000002F30CC20 0x0000000000000001 0x000000000171F838 0x000000002F2EE640), ntdll.dll, 0x00007FF9E5D4B041
|
||||
free_base()+0x000000000000001B, (0x000000002F2D48E0 0x00007FF900000000 0x000000000171F838 0x000000002F2EE640), ucrtbase.dll, 0x00007FF9E2EB364B
|
||||
OdString::freeData()+0x0000000000000027, (0x000000002F2F12E0 0x00007FF9E5D4B041 0x000000002F2F12D0 0x00000000017E0000), TD_Root_21.4_15.dll, 0x00000001800460F7
|
||||
ut::ConfigNode::operator=()+0x00000000000000B5, (0x000000002F30C9E0 0x000000002F2D4260 0x000000002F2F13A0 0x000000002F2F12E0), bcutils.dll, 0x0000000180013615
|
||||
ut::Config::resetProfile()+0x0000000000000810, (0x000000002F2D4340 0x000000002F2EE640 0x000000002F2F13A0 0x00007FF9E5D4B041), bcutils.dll, 0x0000000180026010
|
||||
ut::ConfigNode::ConfigNode()+0x0000000000001142, (0x000000002F2D4340 0x000000002F2EE640 0x000000002F2F1C60 0x000000000B3C6010), bcutils.dll, 0x000000018002D4C2
|
||||
ut::ConfigNode::ConfigNode()+0x000000000000111F, (0x000000002F2D4340 0x000000002F2EE640 0x000000002F2F0D60 0x00007FF9E5D4B041), bcutils.dll, 0x000000018002D49F
|
||||
ut::ConfigNode::ConfigNode()+0x000000000000111F, (0x000000002F2D4340 0x000000002F2EE640 0x000000002F2F0660 0x000000002E351440), bcutils.dll, 0x000000018002D49F
|
||||
ut::ConfigNode::ConfigNode()+0x000000000000111F, (0x000000002F2EE4A0 0x000000002F2EE640 0x000000002F2EFD60 0x000000002E351380), bcutils.dll, 0x000000018002D49F
|
||||
ut::ConfigNode::ConfigNode()+0x000000000000111F, (0x000000002F2EE4A0 0x000000002F0E7080 0x000000002F2EEAA0 0x000000000A34EE50), bcutils.dll, 0x000000018002D49F
|
||||
ut::ConfigNode::ConfigNode()+0x0000000000000F95, (0x0000000000000000 0x000000002F2EE640 0x000000002F2EE620 0x00007FF9E5D4B041), bcutils.dll, 0x000000018002D315
|
||||
ut::ConfigNode::ConfigNode()+0x0000000000000149, (0x000000002F2EE620 0x00007FF9E2EB364B 0x000000002F2EE640 0x000000002F2F3620), bcutils.dll, 0x000000018002C4C9
|
||||
ut::Config::resetProfile()+0x0000000000000810, (0x000000002F0E6960 0x000000002F0E7080 0x000000002F2F3460 0x0000000000000101), bcutils.dll, 0x0000000180026010
|
||||
ut::ConfigNode::ConfigNode()+0x0000000000001142, (0x000000002F0E6960 0x000000002F0E7080 0x000000002F2EECE0 0x0000000013EE9240), bcutils.dll, 0x000000018002D4C2
|
||||
ut::ConfigNode::ConfigNode()+0x000000000000111F, (0x000000002F0E6960 0x000000002F0E7080 0x000000002F2EE3E0 0x00007FF9E5D4C3A0), bcutils.dll, 0x000000018002D49F
|
||||
ut::ConfigNode::ConfigNode()+0x000000000000111F, (0x000000002F0E6960 0x000000002F0E7080 0x000000002F2E9220 0x00007FF9E5D4C3A0), bcutils.dll, 0x000000018002D49F
|
||||
ut::ConfigNode::ConfigNode()+0x000000000000111F, (0x000000002F0E6960 0x000000002F0E6280 0x000000002F0E6DA0 0x0000000000000000), bcutils.dll, 0x000000018002D49F
|
||||
ut::ConfigNode::ConfigNode()+0x0000000000000F95, (0x0000000000000060 0x000000002F0E7080 0x000000002F0E7060 0x00002B6C96C01301), bcutils.dll, 0x000000018002D315
|
||||
ut::ConfigNode::ConfigNode()+0x0000000000000149, (0x000000002F0E7060 0x00007FF9E5D4C3A0 0x000000002F0E7080 0x00007FF900000072), bcutils.dll, 0x000000018002C4C9
|
||||
ut::Config::resetProfile()+0x0000000000000810, (0x0000000031D8EAFF 0x000000002F0E6280 0x000000002F2F3860 0x0000000031BBADA0), bcutils.dll, 0x0000000180026010
|
||||
ut::ConfigNode::ConfigNode()+0x0000000000001142, (0x0000000031B197A0 0x0000000031BAA1F8 0x000000002F0E6460 0x000000000A34EE50), bcutils.dll, 0x000000018002D4C2
|
||||
ut::ConfigNode::ConfigNode()+0x0000000000000F95, (0x0000000031BAA1F8 0x000000002F0E6280 0x000000002F0E6260 0x00007FF9E5D4B041), bcutils.dll, 0x000000018002D315
|
||||
ut::ConfigNode::ConfigNode()+0x0000000000000149, (0x000000002F0E6260 0x000000000A01CE32 0x000000002F0E6280 0x0000000000000000), bcutils.dll, 0x000000018002C4C9
|
||||
ut::Config::resetProfile()+0x0000000000000810, (0x0000000031BA8070 0x0000000000000000 0x0000000031BA9DD8 0x0000000000000000), bcutils.dll, 0x0000000180026010
|
||||
ut::ProfileManagerBase::~ProfileManagerBase()+0x000000000000009D, (0x000000000A6ACDF0 0x0000000031BA9DB8 0x000000000171FC08 0x0000000031BA8070), bcutils.dll, 0x000000018002ED5D
|
||||
_sys_nerr()+0x00000000000002B3, (0x0000000000000000 0x000000000171FC08 0x000000000171FEE0 0x0000000000000001), ucrtbase.dll, 0x00007FF9E2EF3A93
|
||||
o_free()+0x00000000000000DE, (0x0000000000000000 0x000000000A34E4BD 0x0000000000000000 0x000000000171FBF8), ucrtbase.dll, 0x00007FF9E2EC042E
|
||||
execute_onexit_table()+0x000000000000003D, (0x000000000A6A58C8 0x0000000000000002 0x0000C76400000002 0x000000000171FBF0), ucrtbase.dll, 0x00007FF9E2EBDDDD
|
||||
OdRibbonReactorMgrImpl::fireGUIPanelCreated()+0x000000000006FC2E, (0x0000000000000001 0x0000000000000000 0x0000000000000001 0x0000000000000000), cadapp.dll, 0x00000001803EECDE
|
||||
OdRibbonReactorMgrImpl::fireGUIPanelCreated()+0x000000000006FD54, (0x0000000009F60000 0x0000000000000000 0x0000000000000001 0x000000007FFE0385), cadapp.dll, 0x00000001803EEE04
|
||||
RtlActivateActivationContextUnsafeFast()+0x000000000000012F, (0x00000000017EE080 0x0000000009F60000 0x0000000000000000 0x0000000000232000), ntdll.dll, 0x00007FF9E5D38BCF
|
||||
LdrShutdownProcess()+0x0000000000000176, (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), ntdll.dll, 0x00007FF9E5D615D6
|
||||
RtlExitUserProcess()+0x00000000000000AD, (0x0000000000070001 0x0000000000000000 0xFFFFFFFFFFFFFFFE 0xFFFFFFFFFFFFFFFF), ntdll.dll, 0x00007FF9E5D611CD
|
||||
ExitProcess()+0x000000000000000B, (0x0000000000000000 0x0000000000000000 0x000000000171FEB0 0x0000000000000000), KERNEL32.DLL, 0x00007FF9E4767FCB
|
||||
exit()+0x00000000000000B8, (0x0000000000000000 0x0000000000000000 0x0000000000000001 0x000000000171FEB0), ucrtbase.dll, 0x00007FF9E2EBBED8
|
||||
exit()+0x0000000000000279, (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000001), ucrtbase.dll, 0x00007FF9E2EBC099
|
||||
dc::QWinWidget::focusNextPrevChild()+0x0000000000007F90, (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), kunhengcad.exe, 0x000000014009EAF0
|
||||
BaseThreadInitThunk()+0x000000000000001D, (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), KERNEL32.DLL, 0x00007FF9E476259D
|
||||
RtlUserThreadStart()+0x0000000000000028, (0x0000000000000000 0x0000000000000000 0x0000000000000000 0x0000000000000000), ntdll.dll, 0x00007FF9E5D6AF78
|
Binary file not shown.
@ -305,8 +305,7 @@ namespace SWS.Electrical.ViewModels
|
||||
listMsg = new ObservableCollection<TextBlock>();
|
||||
eventAggregator.GetEvent<sendMessageEvent>().Subscribe(onReceviceMsg, ThreadOption.UIThread, true);
|
||||
var list = new ObservableCollection<KeyValueModel>();
|
||||
list.Add(new KeyValueModel { Key = "甲板号", Value = "甲板号" });
|
||||
//list.Add(new KeyValueModel { Key = "区域", Value = "区域" });
|
||||
list.Add(new KeyValueModel { Key = "甲板号", Value = "甲板号" });
|
||||
list.Add(new KeyValueModel { Key = "所属系统", Value = "所属系统" });
|
||||
listRange = new ObservableCollection<KeyValueModel>(list);
|
||||
listOperator = new ObservableCollection<KeyValueModel>()
|
||||
@ -358,36 +357,7 @@ namespace SWS.Electrical.ViewModels
|
||||
public async void OnDialogOpened(IDialogParameters parameters)
|
||||
{
|
||||
try
|
||||
{
|
||||
//if (GlobalObj.treeDrawings.Any())
|
||||
//{
|
||||
// foreach (var model in GlobalObj.treeDrawings)
|
||||
// {
|
||||
// if (model.Text == "布置图")
|
||||
// {
|
||||
// foreach (var item in model.ChildNodes)
|
||||
// {
|
||||
// if (item.NodeType == "1")
|
||||
// {
|
||||
// listDrawings.Add(new DtoDrawing() { DrawingFileID = item.ID, DrawingFileName = item.Text });
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// if (item.Text == "封面、目录、设计说明" || item.Text == "材料表")
|
||||
// { continue; }
|
||||
// var list = GetChildNodes(item);
|
||||
// if (list.Any())
|
||||
// {
|
||||
// foreach (var dto in list)
|
||||
// {
|
||||
// listDrawings.Add(new DtoDrawing() { DrawingFileID = dto.ID, DrawingFileName = dto.Text });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
{
|
||||
IsBusy = true;
|
||||
BusyContent = "数据加载中...";
|
||||
if (!listDrawings.Any())
|
||||
@ -436,16 +406,10 @@ namespace SWS.Electrical.ViewModels
|
||||
var settingModel = await _ServiceProjectSettings.GetEntity("布置图图例显示位号名称");
|
||||
if (settingModel == null)
|
||||
{
|
||||
listLibraryTagName.Add("位号");//默认
|
||||
listLibraryTagName.Add("TAG");//默认
|
||||
}
|
||||
else { listLibraryTagName = settingModel.SettingValue.Split(',').ToList(); }
|
||||
//区域下拉框对应值列表
|
||||
//var listDetail = await _ServiceDataItem.GetDetails("Area");
|
||||
//if (listDetail != null && listDetail.Any())
|
||||
//{
|
||||
// foreach (var item in listDetail)
|
||||
// { listArea.Add(new KeyValueModel() { Key = item.DataItemName, Value = item.DataItemName }); }
|
||||
//}
|
||||
|
||||
//甲板号下拉框对应值列表
|
||||
var listDetail = await _ServiceDataItem.GetDetails("甲板号");
|
||||
if (listDetail != null && listDetail.Any())
|
||||
@ -477,9 +441,7 @@ namespace SWS.Electrical.ViewModels
|
||||
{
|
||||
inputValue = "";
|
||||
if (model.Value == "甲板号")
|
||||
{ listValue = new ObservableCollection<KeyValueModel>(listDeck); }
|
||||
//else if (model.Value == "区域")
|
||||
//{ listValue = new ObservableCollection<KeyValueModel>(listArea); }
|
||||
{ listValue = new ObservableCollection<KeyValueModel>(listDeck); }
|
||||
else if (model.Value == "所属系统")
|
||||
{ listValue = new ObservableCollection<KeyValueModel>(listSystem); }
|
||||
}
|
||||
@ -624,189 +586,7 @@ namespace SWS.Electrical.ViewModels
|
||||
listMsg.Clear();
|
||||
var progress = new Progress<MessageModel>(UpdateProgress);
|
||||
await DoWorkAsync(progress, new CancellationTokenSource());
|
||||
|
||||
|
||||
#region back
|
||||
|
||||
//try
|
||||
//{
|
||||
// isDrawing = true;
|
||||
// List<ec_library_file> listFile = new List<ec_library_file>();
|
||||
// List<string> listBlockDwgPath = new List<string>(); //图块下载路径列表,同个异形块下载一次,先下载后删除
|
||||
// listMsg.Clear();
|
||||
// listUpdateEnginedata.Clear();
|
||||
// //获取多个位号属性
|
||||
// AddMsg($"开始获取全部位号属性...");
|
||||
// string strTagNumbers = string.Join(",", listDto.Select(a => a.TagNumber).ToList());
|
||||
// listObjecttype = await _ServiceObjectType.GetTagInfosByTags(strTagNumbers);
|
||||
// listEnginedata = await _ServiceObjectType.GetEngineDataListByTags(strTagNumbers);
|
||||
// AddMsg($"获取全部位号类型属性完成,共有{listObjecttype.Count}种类型!");
|
||||
// //循环画图
|
||||
// for (int i = 0; i < listDto.Count; i++)
|
||||
// {
|
||||
// var basePoint = listDto[i];
|
||||
// if (basePoint.AutoDrawing == "已绘制")
|
||||
// {
|
||||
// AddMsg($"当前基点[{basePoint.BasePointTagNumber}]和元件[{basePoint.TagNumber}]已绘制,跳至下一个元件");
|
||||
// continue;
|
||||
// }
|
||||
// if (basePoint.AutoDrawing == "已存在" && !isCheckDelete)
|
||||
// {
|
||||
// AddMsg($"当前基点[{basePoint.BasePointTagNumber}]和元件[{basePoint.TagNumber}]已存在,跳至下一个元件");
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// msg = OpenDwg(basePoint);
|
||||
// if (!string.IsNullOrEmpty(msg))
|
||||
// {
|
||||
// AddMsg($"图纸打开失败:{msg}", false);
|
||||
// continue;
|
||||
// }
|
||||
// var listTag = listDto.Where(a => a.DrawingFileID == basePoint.DrawingFileID).Select(a => a.TagNumber).ToList();
|
||||
// var listEntitys = isCheckDelete ? General.GetAllEntity(listTag) : General.GetAllEntity(new List<string>());//获取图纸所有实体
|
||||
// var entity = listEntitys.FirstOrDefault(a => a.Handle.ToString() == basePoint.PixelOnDwg);
|
||||
// if (entity == null)
|
||||
// {
|
||||
// AddMsg($"当前基点:{basePoint.BasePointTagNumber} 在图上找不到,不添加此元件,跳至下一个元件", false);
|
||||
// continue;
|
||||
// }
|
||||
// var tag = basePoint.Tag;
|
||||
// var tagDto = listEntitys.FirstOrDefault(a => a.TagNumber == basePoint.TagNumber);
|
||||
// if (tagDto != null)
|
||||
// {
|
||||
// AddMsg($"当前元件:{basePoint.TagNumber} 在图上已存在,句柄:{tagDto.Handle},不添加此元件,跳至下一个元件", false);
|
||||
// basePoint.AutoDrawing = "已存在";
|
||||
// basePoint.TagPixelOnDwg = tagDto.Handle;
|
||||
// continue;
|
||||
// }
|
||||
// filePath = Path.Combine(GlobalObject.GetCacheFolder(), $"{tag.TagNumber}.dwg");
|
||||
// string blockName = string.Empty;
|
||||
// if (string.IsNullOrEmpty(tag.FileId))
|
||||
// {
|
||||
// //元件ID为空 用本地默认图块图纸
|
||||
// if (!string.IsNullOrEmpty(tag.TagNumber_Lower))
|
||||
// {
|
||||
// var blockDwgPath = Path.Combine(GlobalObject.GetDllPath(), "Template\\常规矩形两行图块.dwg");
|
||||
// if (!File.Exists(blockDwgPath))
|
||||
// {
|
||||
// AddMsg($"默认图块找不到:{blockDwgPath}", false);
|
||||
// continue;
|
||||
// }
|
||||
// //默认上下图块
|
||||
// blockName = "常规矩形两行图块";
|
||||
// File.Copy(blockDwgPath, filePath, true);
|
||||
// AddMsg($"本地默认常规图块图纸复制成功");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// var blockDwgPath = Path.Combine(GlobalObject.GetDllPath(), "Template\\常规矩形单行图块.dwg");
|
||||
// if (!File.Exists(blockDwgPath))
|
||||
// {
|
||||
// AddMsg($"默认图块找不到:{blockDwgPath}", false);
|
||||
// continue;
|
||||
// }
|
||||
// //默认图块,只有中间部分
|
||||
// blockName = "常规矩形单行图块";
|
||||
// File.Copy(blockDwgPath, filePath, true);
|
||||
// AddMsg($"本地默认常规图块图纸复制成功");
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// string blockDwgPath = Path.Combine(GlobalObject.GetCacheFolder(), $"{tag.FileId}.dwg");
|
||||
// if (File.Exists(blockDwgPath))
|
||||
// {
|
||||
// File.Copy(blockDwgPath, filePath, true);
|
||||
// var item = listFile.FirstOrDefault(a => a.LibraryFileID == tag.FileId);
|
||||
// if (item != null)
|
||||
// {
|
||||
// blockName = item.LibraryFileName;
|
||||
// }
|
||||
// else { blockName = tag.TagNumber; }
|
||||
// AddMsg($"元件图纸:{tag.TagNumber},已下载过,复制本地缓存块图纸文件成功");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //下载元件图纸文件
|
||||
// var obj = await _ServiceLibraryFile.GetEntity(tag.FileId);
|
||||
// blockName = obj.LibraryFileName;
|
||||
// AddMsg($"元件图纸:{tag.TagNumber}, 开始下载...");
|
||||
// msg = await _ServiceAnnexes.DownloadFile(blockDwgPath, obj.FolderId);
|
||||
// if (!string.IsNullOrEmpty(msg))
|
||||
// {
|
||||
// AddMsg($"元件图纸下载失败,信息:" + msg, false);
|
||||
// continue;
|
||||
// }
|
||||
// File.Copy(blockDwgPath, filePath, true);
|
||||
// listBlockDwgPath.Add(blockDwgPath);
|
||||
// listFile.Add(obj);
|
||||
// AddMsg($"元件图纸:{tag.TagNumber}, 下载成功");
|
||||
// }
|
||||
// }
|
||||
// listBlockDwgPath.Add(filePath);
|
||||
// //把元件的位号属性改成要绘制的位号值
|
||||
// var flag = General.UpdateCableNo(filePath, listLibraryTagName, tag.TagNumber, tag.IsNotDefaultSymbol, tag.TagNumber_Upper, tag.TagNumber_Lower);
|
||||
|
||||
// //X轴:图上基点的坐标X +(接口数据元件的X + 接口数据元件的XOFF -接口数据基点的X-接口数据基点的Xoff)*比例系数
|
||||
// //Y轴:图上基点的坐标Y +(接口数据元件的Yoff-接口数据基点的Yoff)*比例系数
|
||||
// double scale = basePoint.Scale;//比例系数
|
||||
// double x = entity.X + (tag.X + double.Parse(tag.XOff) - basePoint.X - double.Parse(basePoint.XOff)) * scale;
|
||||
// AddMsg($"块X坐标计算:{entity.X}+({tag.X}+{tag.XOff}-{basePoint.X}-{basePoint.XOff})*{scale}={x}");
|
||||
// double y = entity.Y + (double.Parse(tag.YOff) - double.Parse(basePoint.XOff)) * scale;
|
||||
// AddMsg($"块Y坐标计算:{entity.Y}+({tag.YOff}-{basePoint.XOff})*{scale}={y}");
|
||||
// AddMsg($"块最后坐标:{x},{y},0");
|
||||
// double z = entity.Z;
|
||||
// Point3d tagPoint = new Point3d(x, y, z);
|
||||
// AddMsg($"元件图纸:{tag.TagNumber}, 开始添加进布置图中...");
|
||||
// msg =await AddBlock(basePoint, blockName, filePath, tagPoint);
|
||||
// if (string.IsNullOrEmpty(msg))
|
||||
// {
|
||||
// AddMsg($"布置图:{basePoint.DrawingFileName},成功插入元件:" + tag.TagNumber);
|
||||
// basePoint.AutoDrawing = "已绘制";
|
||||
// //当下一个要画元件的图纸和当前图纸不一样时,保存图纸
|
||||
// if (i + 1 >= listDto.Count)
|
||||
// { General.SetDrawingReadOnly(dwgName, false); }
|
||||
// else
|
||||
// {
|
||||
// var nextTag = listDto[i + 1];
|
||||
// if (basePoint.DrawingFileID != nextTag.DrawingFileID)
|
||||
// { General.SetDrawingReadOnly(dwgName, false); }
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// basePoint.AutoDrawing = "已失败";
|
||||
// AddMsg($"元件:{tag.TagNumber},绘制异常:{msg}", false);
|
||||
// }
|
||||
|
||||
// }
|
||||
// if (listUpdateEnginedata.Any())
|
||||
// {
|
||||
// AddMsg($"开始批量位号关联属性,数量:{listUpdateEnginedata.Count}......");
|
||||
// msg = await _ServiceObjectType.UpdatePixelAndPropBatch(listUpdateEnginedata);
|
||||
// if (string.IsNullOrEmpty(msg))
|
||||
// {
|
||||
// AddMsg("位号关联属性成功,数量:" + listUpdateEnginedata.Count);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// AddMsg($"位号关联属性失败,数量:{listUpdateEnginedata.Count},异常:{msg}", false);
|
||||
// }
|
||||
// }
|
||||
// foreach (var file in listBlockDwgPath)
|
||||
// {
|
||||
// File.Delete(file);//删除缓存图块图纸文件
|
||||
// File.Delete(file.Replace(".dwg", ".bak"));
|
||||
// }
|
||||
// AddMsg("操作已完成!");
|
||||
// isDrawing = false;
|
||||
//}
|
||||
//catch (Exception ex)
|
||||
//{
|
||||
// MessageBox.Show("绘图异常:" + ex.Message);
|
||||
// isDrawing = false;
|
||||
//}
|
||||
#endregion
|
||||
|
||||
}
|
||||
#region DoWork
|
||||
private void UpdateProgress(MessageModel dto)
|
||||
@ -1305,15 +1085,7 @@ namespace SWS.Electrical.ViewModels
|
||||
string blockDwgId = basePoint.Tag.FileId;
|
||||
string tagNumber = basePoint.Tag.TagNumber;
|
||||
double scale = basePoint.Scale;
|
||||
string msg = string.Empty;
|
||||
//string tagNum = string.Empty;
|
||||
//var lsitEnginedata = await _ServiceObjectType.GetEngineDataListByTags(tagNumber);
|
||||
//if (!lsitEnginedata.Any())
|
||||
//{
|
||||
// msg = $"元件位号:{tagNumber},属性未绑定,_ServiceObjectType.GetEngineDataListByTags({tagNumber})接口无数据";
|
||||
// AddMsg(msg, false);
|
||||
// return msg;
|
||||
//}
|
||||
string msg = string.Empty;
|
||||
var enginedata = listEnginedata.FirstOrDefault(a => a.TagNumber == tagNumber);
|
||||
if (enginedata == null)
|
||||
{
|
||||
@ -1325,17 +1097,13 @@ namespace SWS.Electrical.ViewModels
|
||||
var objId = General.AddTagDWG(blockDwg, tagName, tagNumber, objTypeId, scale, tagPoint);
|
||||
#region 图纸上保存图元属性
|
||||
if (!objId.IsNull)
|
||||
{
|
||||
//AddMsg($"元件已添加至图纸,句柄:{objId.Handle.ToString()}");
|
||||
//RefreshUI(999, $"元件已添加至图纸,句柄:{objId.Handle.ToString()}");
|
||||
//var dwgLibrary = await _ServiceLibraryFile.GetEntity(blockDwgId);
|
||||
{
|
||||
List<ec_enginedata_property> listPro = new List<ec_enginedata_property>();
|
||||
var handlid = objId.Handle.ToString();//添加图元返回的句柄
|
||||
ec_enginedata item = new ec_enginedata();
|
||||
item.EngineDataID = enginedataId;
|
||||
item.TagNumber = tagNumber;
|
||||
item.ObjectTypeID = objTypeId;
|
||||
//item.Layout_Block_File = dwgLibrary;
|
||||
item.ObjectTypeID = objTypeId;
|
||||
var tagInfo = listObjecttype.FirstOrDefault(a => a.ObjectTypeID == enginedata.ObjectTypeID);
|
||||
if (tagInfo == null)
|
||||
{
|
||||
@ -1427,7 +1195,7 @@ namespace SWS.Electrical.ViewModels
|
||||
System.Windows.Application.Current.Dispatcher.Invoke((System.Action)(() =>
|
||||
{
|
||||
TextBlock tb = new TextBlock();
|
||||
tb.Text = DateTime.Now.ToString("yyyy-MM-6dd HH:mm:ss:ffff") + "==>> " + msg;
|
||||
tb.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff") + "==>> " + msg;
|
||||
tb.Foreground = isSucc ? Brushes.LightSeaGreen : Brushes.Red;
|
||||
listMsg.Add(tb);
|
||||
}));
|
||||
|
@ -28,6 +28,8 @@ using Teigha.Geometry;
|
||||
using Teigha.GraphicsSystem;
|
||||
using Telerik.Windows.Controls;
|
||||
using Unity;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
|
||||
//using static ImTools.Union<TUnion, T1, T2>;
|
||||
using Visibility = System.Windows.Visibility;
|
||||
|
||||
namespace SWS.Electrical.ViewModels
|
||||
@ -99,6 +101,7 @@ namespace SWS.Electrical.ViewModels
|
||||
PlotBOMService _ServicePlotBOM;
|
||||
private bool isGenerate = false;//是否正在生成材料表
|
||||
private string dwgName = string.Empty;
|
||||
int time = 10;
|
||||
public DialogGenerateBOMViewModel()
|
||||
{
|
||||
Command_StartGenerate = new DelegateCommand(onStartGenerate);
|
||||
@ -410,6 +413,89 @@ namespace SWS.Electrical.ViewModels
|
||||
listBomDrawings = new ObservableCollection<DtoBomDrawings>(listBom);
|
||||
isGenerate = true;
|
||||
listMsg.Clear();
|
||||
var progress = new Progress<MessageModel>(UpdateProgress);
|
||||
await DoWorkAsync(progress, new CancellationTokenSource());
|
||||
|
||||
//foreach (var dwg in listBomDrawings)
|
||||
//{
|
||||
// if (dwg.AutoGenerate == "已生成")
|
||||
// {
|
||||
// AddMsg($"当前图纸[{dwg.DrawingFileName}]的材料表已绘制,跳至下一个图纸");
|
||||
// continue;
|
||||
// }
|
||||
// if (dwg.AutoGenerate == "已存在")
|
||||
// {
|
||||
// AddMsg($"当前图纸[{dwg.DrawingFileName}]的材料表已存在,跳至下一个图纸");
|
||||
// //continue;
|
||||
// }
|
||||
// if (dwg.AutoGenerate == "无材料信息")
|
||||
// {
|
||||
// AddMsg($"当前图纸[{dwg.DrawingFileName}]无材料信息,跳至下一个图纸");
|
||||
// continue;
|
||||
// }
|
||||
// string folderpath = GlobalObject.GetDwgPath(dwg.DrawingFileID);
|
||||
// string filepath = Path.Combine(GlobalObj.LocalWorkDir, GlobalObject.curProject.ProjectName, folderpath, $"材料表\\{dwg.DrawingFileName}");
|
||||
// if (File.Exists(filepath))
|
||||
// {
|
||||
// AddMsg($"当前图纸[{dwg.DrawingFileName}]的材料表已存在,跳至下一个图纸", false);
|
||||
// dwg.AutoGenerate = "已存在";
|
||||
// //continue;
|
||||
// }
|
||||
// var listBomGroup = await _ServicePlotBOM.GetBOMGroupInfo(dwg.DrawingFileID);
|
||||
|
||||
// dwg.AutoGenerate = "正在生成...";
|
||||
// AddMsg($"开始生成图纸[{dwg.DrawingFileName}]的材料表...");
|
||||
// if (listBomGroup == null || !listBomGroup.Any())
|
||||
// {
|
||||
// AddMsg($"当前图纸无材料分组信息,跳至下一个图纸");
|
||||
// dwg.AutoGenerate = "无材料信息";
|
||||
// continue;
|
||||
// }
|
||||
// msg = GenerateBOM(dwg, filepath, listBomGroup);
|
||||
// if (!string.IsNullOrEmpty(msg))
|
||||
// {
|
||||
// AddMsg($"材料表生成失败,信息:" + msg, false);
|
||||
// continue;
|
||||
// }
|
||||
|
||||
// //下载图标图纸文件
|
||||
// //filePath = Path.Combine(GlobalObject.GetCacheFolder(), $"{tag.TagNumber}.dwg");
|
||||
// //AddMsg($"元件图纸:{tag.TagNumber}, 开始下载...");
|
||||
// //msg = await _ServiceAnnexes.DownloadFile(filePath, obj.FolderId);
|
||||
// //if (!string.IsNullOrEmpty(msg))
|
||||
// //{
|
||||
// // AddMsg($"元件图纸下载失败,信息:" + msg, false);
|
||||
// // continue;
|
||||
// //}
|
||||
// //AddMsg($"元件图纸:{tag.TagNumber}, 下载成功");
|
||||
// //filePath = "D:\\BricsCAD\\Temp\\测试11.dwg";
|
||||
|
||||
|
||||
// dwg.AutoGenerate = "已生成";
|
||||
// AddMsg($"材料表生成成功!");
|
||||
//}
|
||||
//AddMsg("操作已完成!");
|
||||
//isGenerate = false;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("异常:" + ex.Message);
|
||||
isGenerate = false;
|
||||
}
|
||||
}
|
||||
#region dowork
|
||||
private void UpdateProgress(MessageModel dto)
|
||||
{
|
||||
System.Windows.Application.Current.Dispatcher.Invoke(new System.Action(() =>
|
||||
{
|
||||
AddMsg(dto.Message, dto.IsSuccess);
|
||||
}));
|
||||
}
|
||||
private async Task DoWorkAsync(IProgress<MessageModel> progress, CancellationTokenSource cts)
|
||||
{
|
||||
try
|
||||
{
|
||||
var msg = string.Empty;
|
||||
foreach (var dwg in listBomDrawings)
|
||||
{
|
||||
if (dwg.AutoGenerate == "已生成")
|
||||
@ -419,8 +505,8 @@ namespace SWS.Electrical.ViewModels
|
||||
}
|
||||
if (dwg.AutoGenerate == "已存在")
|
||||
{
|
||||
AddMsg($"当前图纸[{dwg.DrawingFileName}]的材料表已存在,跳至下一个图纸");
|
||||
continue;
|
||||
//AddMsg($"当前图纸[{dwg.DrawingFileName}]的材料表已存在,跳至下一个图纸");
|
||||
//continue;
|
||||
}
|
||||
if (dwg.AutoGenerate == "无材料信息")
|
||||
{
|
||||
@ -431,9 +517,9 @@ namespace SWS.Electrical.ViewModels
|
||||
string filepath = Path.Combine(GlobalObj.LocalWorkDir, GlobalObject.curProject.ProjectName, folderpath, $"材料表\\{dwg.DrawingFileName}");
|
||||
if (File.Exists(filepath))
|
||||
{
|
||||
AddMsg($"当前图纸[{dwg.DrawingFileName}]的材料表已存在,跳至下一个图纸", false);
|
||||
dwg.AutoGenerate = "已存在";
|
||||
continue;
|
||||
//AddMsg($"当前图纸[{dwg.DrawingFileName}]的材料表已存在,跳至下一个图纸", false);
|
||||
//dwg.AutoGenerate = "已存在";
|
||||
//continue;
|
||||
}
|
||||
var listBomGroup = await _ServicePlotBOM.GetBOMGroupInfo(dwg.DrawingFileID);
|
||||
|
||||
@ -445,7 +531,7 @@ namespace SWS.Electrical.ViewModels
|
||||
dwg.AutoGenerate = "无材料信息";
|
||||
continue;
|
||||
}
|
||||
msg = GenerateBOM(dwg, filepath, listBomGroup);
|
||||
msg = await GenerateBOM(dwg, filepath, listBomGroup, cts);
|
||||
if (!string.IsNullOrEmpty(msg))
|
||||
{
|
||||
AddMsg($"材料表生成失败,信息:" + msg, false);
|
||||
@ -477,13 +563,14 @@ namespace SWS.Electrical.ViewModels
|
||||
isGenerate = false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
/// <summary>
|
||||
/// 生成BOM表图纸
|
||||
/// </summary>
|
||||
/// <param name="filepath">材料表文件路径</param>
|
||||
/// <param name="listBomGroup">位号分组信息</param>
|
||||
/// <returns></returns>
|
||||
private string GenerateBOM(DtoBomDrawings dtoBOM, string filepath, List<BOMGroupInfo> listBomGroup)
|
||||
private async Task<string> GenerateBOM(DtoBomDrawings dtoBOM, string filepath, List<BOMGroupInfo> listBomGroup, CancellationTokenSource cts)
|
||||
{
|
||||
string msg = string.Empty;
|
||||
//1.创建材料表图纸文件
|
||||
@ -491,91 +578,139 @@ namespace SWS.Electrical.ViewModels
|
||||
string bomName = Path.Combine(folderpath, "BomTemp.dwg");
|
||||
string dwgName = dtoBOM.DrawingFileName.Substring(0, dtoBOM.DrawingFileName.Length - 4);
|
||||
var flag = General.CreateDwg(folderpath, dwgName);
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
msg = $"材料表图纸创建失败,路径:{filepath}";
|
||||
return msg;
|
||||
}
|
||||
//2.读取BOM表配置文件
|
||||
string strJson = File.ReadAllText("Template\\BomConfig.json");
|
||||
string strJson = File.ReadAllText(Path.Combine(GlobalObject.GetDllPath(), "Template\\BomConfig.json"));
|
||||
BomConfig bomComfig = JsonConvert.DeserializeObject<BomConfig>(strJson);
|
||||
//3.判断位号分组信息需要分成几张材料表,分页生成材料表
|
||||
List<DtoCadTextInfo> listTextInfo = new List<DtoCadTextInfo>();
|
||||
List<DtoTextInfo> listTextInfo = new List<DtoTextInfo>();
|
||||
List<DtoSymbolInfo> listSymbolInfo = new List<DtoSymbolInfo>();
|
||||
decimal mod = (decimal)listBomGroup.Count / (decimal)bomComfig.RowCount;
|
||||
var page = Math.Ceiling(mod);//总的A4表格页数 小数点向上取整数
|
||||
#region 1
|
||||
|
||||
//for (int i = 0; i < page; i++)
|
||||
//{
|
||||
// listTextInfo = new List<DtoTextInfo>();
|
||||
// listSymbolInfo = new List<DtoSymbolInfo>();
|
||||
// int count = (i + 1) == page ? (listBomGroup.Count % bomComfig.RowCount) : bomComfig.RowCount;
|
||||
// for (int j = 0; j < count; j++)
|
||||
// {
|
||||
// var index = i * bomComfig.RowCount + j;
|
||||
// var bomInfo = listBomGroup[index];
|
||||
// #region 序号
|
||||
// var dto = new DtoTextInfo();
|
||||
// dto.Text = (j + 1).ToString();
|
||||
// dto.Position = new Point3d(bomComfig.Column1X, bomComfig.Column1Y - (j * bomComfig.RowHeight), 0);
|
||||
// dto.IsMText = false;
|
||||
// dto.Height = 4;
|
||||
// dto.Width = 20;
|
||||
// dto.Align = 1;
|
||||
// listTextInfo.Add(dto);
|
||||
// #endregion
|
||||
|
||||
// #region 图标
|
||||
// var symbol = new DtoSymbolInfo();
|
||||
// symbol.Upper_Text = bomInfo.upper_text;
|
||||
// symbol.Lower_Text = bomInfo.lower_text;
|
||||
// symbol.Position = new Point3d(bomComfig.Column2X, bomComfig.Column2Y - (j * bomComfig.RowHeight), 0);
|
||||
// symbol.Scale = 0.02;
|
||||
// listSymbolInfo.Add(symbol);
|
||||
// #endregion
|
||||
|
||||
// #region 数量
|
||||
// dto = new DtoTextInfo();
|
||||
// dto.Text = (bomInfo.Count).ToString();
|
||||
// dto.Position = new Point3d(bomComfig.Column3X, bomComfig.Column3Y - (j * bomComfig.RowHeight), 0);
|
||||
// dto.IsMText = false;
|
||||
// dto.Height = 4;
|
||||
// dto.Width = 20;
|
||||
// dto.Align = 1;
|
||||
// listTextInfo.Add(dto);
|
||||
// #endregion
|
||||
|
||||
// #region 型号
|
||||
// dto = new DtoTextInfo();
|
||||
// dto.Text = (bomInfo.Model).ToString();
|
||||
// dto.Position = new Point3d(bomComfig.Column4X, bomComfig.Column4Y - (j * bomComfig.RowHeight), 0);
|
||||
// dto.IsMText = false;
|
||||
// dto.Height = 4;
|
||||
// dto.Width = 20;
|
||||
// dto.Align = 1;
|
||||
// listTextInfo.Add(dto);
|
||||
// #endregion
|
||||
|
||||
// #region 规格
|
||||
// dto = new DtoTextInfo();
|
||||
// dto.Text = (bomInfo.Spec).ToString();
|
||||
// dto.Position = new Point3d(bomComfig.Column5X, bomComfig.Column5Y - (j * bomComfig.RowHeight), 0);
|
||||
// dto.IsMText = false;
|
||||
// dto.Height = 4;
|
||||
// dto.Width = 20;
|
||||
// dto.Align = 1;
|
||||
// listTextInfo.Add(dto);
|
||||
// #endregion
|
||||
|
||||
// #region 备注
|
||||
// dto = new DtoTextInfo();
|
||||
// dto.Text = (bomInfo.Remark).ToString();
|
||||
// dto.Position = new Point3d(bomComfig.Column6X, bomComfig.Column6Y - (j * bomComfig.RowHeight), 0);
|
||||
// dto.IsMText = false;
|
||||
// dto.Height = 4;
|
||||
// dto.Width = 20;
|
||||
// dto.Align = 1;
|
||||
// listTextInfo.Add(dto);
|
||||
// #endregion
|
||||
// }
|
||||
// #region 把材料信息插入材料表图纸里
|
||||
// var filename = bomName.Replace("BomTemp", "BomTemp" + (i + 1));
|
||||
// File.Copy("Template\\材料表.dwg", filename, true);
|
||||
// General.OpenDwg(filename);
|
||||
// General.InsertTextInfo(listTextInfo);
|
||||
// Thread.Sleep(1000);
|
||||
// InsertSymbol(listSymbolInfo);
|
||||
// listSymbolInfo.Clear();
|
||||
// General.SaveAndCloseDwg(filename);
|
||||
// Thread.Sleep(1000);
|
||||
// //计算该页材料表是第几行第几列的
|
||||
// //double x, y = 0;//坐标x,y
|
||||
// //decimal row = (decimal)i / (decimal)bomComfig.RowPageCount;//row表示行数,在第几行
|
||||
// //row = Math.Floor(row);
|
||||
// //var column = i % bomComfig.RowPageCount;//column表示列数,在第几列
|
||||
// //x = column == 0 ? 0 : (double)column * bomComfig.Width;
|
||||
// //y = row == 0 ? 0 : 0 - (double)row * bomComfig.Height;
|
||||
// //var position = new Point3d(x, y, 0);
|
||||
// //General.AddBlockDWG(filename, $"材料表{i + 1}", position);
|
||||
// //Thread.Sleep(1000);
|
||||
// #endregion
|
||||
//}
|
||||
//General.OpenDwg(filepath);
|
||||
//Thread.Sleep(1000);
|
||||
//for (int i = 0; i < page; i++)
|
||||
//{
|
||||
// var filename = bomName.Replace("BomTemp", "BomTemp" + (i + 1));
|
||||
// //计算该页材料表是第几行第几列的
|
||||
// double x, y = 0;//坐标x,y
|
||||
// decimal row = (decimal)i / (decimal)bomComfig.RowPageCount;//row表示行数,在第几行
|
||||
// row = Math.Floor(row);
|
||||
// var column = i % bomComfig.RowPageCount;//column表示列数,在第几列
|
||||
// x = column == 0 ? 0 : (double)column * bomComfig.Width;
|
||||
// y = row == 0 ? 0 : 0 - (double)row * bomComfig.Height;
|
||||
// var position = new Point3d(x, y, 0);
|
||||
// General.AddBlockDWG(filename, $"材料表{i + 1}", position);
|
||||
// Thread.Sleep(1000);
|
||||
//}
|
||||
//General.SaveAndCloseDwg(filepath);
|
||||
#endregion
|
||||
#region 2
|
||||
General.OpenDwg(filepath);
|
||||
for (int i = 0; i < page; i++)
|
||||
{
|
||||
listTextInfo = new List<DtoCadTextInfo>();
|
||||
int count = (i + 1) == page ? (listBomGroup.Count % bomComfig.RowCount) : bomComfig.RowCount;
|
||||
for (int j = 0; j < count; j++)
|
||||
{
|
||||
var index = i * bomComfig.RowCount + j;
|
||||
var bomInfo = listBomGroup[index];
|
||||
#region 序号
|
||||
var dto = new DtoCadTextInfo();
|
||||
dto.Text = (j + 1).ToString();
|
||||
dto.Position = new Point3d(bomComfig.Column1X, bomComfig.Column1Y - (j * bomComfig.RowHeight), 0);
|
||||
dto.IsMText = false;
|
||||
dto.Height = 4;
|
||||
dto.Width = 20;
|
||||
dto.Align = 1;
|
||||
listTextInfo.Add(dto);
|
||||
#endregion
|
||||
|
||||
#region 图标
|
||||
|
||||
#endregion
|
||||
|
||||
#region 数量
|
||||
dto = new DtoCadTextInfo();
|
||||
dto.Text = (bomInfo.Count).ToString();
|
||||
dto.Position = new Point3d(bomComfig.Column3X, bomComfig.Column3Y - (j * bomComfig.RowHeight), 0);
|
||||
dto.IsMText = false;
|
||||
dto.Height = 4;
|
||||
dto.Width = 20;
|
||||
dto.Align = 1;
|
||||
listTextInfo.Add(dto);
|
||||
#endregion
|
||||
|
||||
#region 型号
|
||||
dto = new DtoCadTextInfo();
|
||||
dto.Text = (bomInfo.Model).ToString();
|
||||
dto.Position = new Point3d(bomComfig.Column4X, bomComfig.Column4Y - (j * bomComfig.RowHeight), 0);
|
||||
dto.IsMText = false;
|
||||
dto.Height = 4;
|
||||
dto.Width = 20;
|
||||
dto.Align = 1;
|
||||
listTextInfo.Add(dto);
|
||||
#endregion
|
||||
|
||||
#region 规格
|
||||
dto = new DtoCadTextInfo();
|
||||
dto.Text = (bomInfo.Spec).ToString();
|
||||
dto.Position = new Point3d(bomComfig.Column5X, bomComfig.Column5Y - (j * bomComfig.RowHeight), 0);
|
||||
dto.IsMText = false;
|
||||
dto.Height = 4;
|
||||
dto.Width = 20;
|
||||
dto.Align = 1;
|
||||
listTextInfo.Add(dto);
|
||||
#endregion
|
||||
|
||||
#region 备注
|
||||
dto = new DtoCadTextInfo();
|
||||
dto.Text = (bomInfo.Remark).ToString();
|
||||
dto.Position = new Point3d(bomComfig.Column6X, bomComfig.Column6Y - (j * bomComfig.RowHeight), 0);
|
||||
dto.IsMText = false;
|
||||
dto.Height = 4;
|
||||
dto.Width = 20;
|
||||
dto.Align = 1;
|
||||
listTextInfo.Add(dto);
|
||||
#endregion
|
||||
}
|
||||
#region 把材料信息插入材料表图纸里
|
||||
File.Copy("Template\\材料表.dwg", bomName, true);
|
||||
General.OpenDwg(bomName);
|
||||
General.InsertTextInfo(listTextInfo);
|
||||
General.SaveAndCloseDwg(bomName);
|
||||
General.OpenDwg(filepath);
|
||||
//计算该页材料表是第几行第几列的
|
||||
double x, y = 0;//坐标x,y
|
||||
decimal row = (decimal)i / (decimal)bomComfig.RowPageCount;//row表示行数,在第几行
|
||||
@ -584,14 +719,131 @@ namespace SWS.Electrical.ViewModels
|
||||
x = column == 0 ? 0 : (double)column * bomComfig.Width;
|
||||
y = row == 0 ? 0 : 0 - (double)row * bomComfig.Height;
|
||||
var position = new Point3d(x, y, 0);
|
||||
File.Copy(Path.Combine(GlobalObject.GetDllPath(), "Template\\材料表.dwg"), bomName, true);
|
||||
General.AddBlockDWG(bomName, $"材料表{i + 1}", position);
|
||||
General.SaveAndCloseDwg(filepath);
|
||||
listTextInfo = new List<DtoTextInfo>();
|
||||
listSymbolInfo = new List<DtoSymbolInfo>();
|
||||
int count = (i + 1) == page ? (listBomGroup.Count % bomComfig.RowCount) : bomComfig.RowCount;
|
||||
for (int j = 0; j < count; j++)
|
||||
{
|
||||
var index = i * bomComfig.RowCount + j;
|
||||
var bomInfo = listBomGroup[index];
|
||||
#region 序号
|
||||
var dto = new DtoTextInfo();
|
||||
dto.Text = (j + 1).ToString();
|
||||
dto.Position = new Point3d(bomComfig.Column1X + x, bomComfig.Column1Y - (j * bomComfig.RowHeight) + y, 0);
|
||||
dto.IsMText = false;
|
||||
dto.Height = 4;
|
||||
dto.Width = 20;
|
||||
dto.Align = 1;
|
||||
listTextInfo.Add(dto);
|
||||
#endregion
|
||||
|
||||
#region 图标
|
||||
var symbol = new DtoSymbolInfo();
|
||||
symbol.Upper_Text = bomInfo.upper_text;
|
||||
symbol.Lower_Text = bomInfo.lower_text;
|
||||
symbol.Position = new Point3d(bomComfig.Column2X + x, bomComfig.Column2Y - (j * bomComfig.RowHeight) + y, 0);
|
||||
symbol.Scale = string.IsNullOrWhiteSpace(bomInfo.lower_text) ? 1 : 0.02;
|
||||
listSymbolInfo.Add(symbol);
|
||||
#endregion
|
||||
|
||||
#region 数量
|
||||
dto = new DtoTextInfo();
|
||||
dto.Text = (bomInfo.Count).ToString();
|
||||
dto.Position = new Point3d(bomComfig.Column3X + x, bomComfig.Column3Y - (j * bomComfig.RowHeight) + y, 0);
|
||||
dto.IsMText = false;
|
||||
dto.Height = 4;
|
||||
dto.Width = 20;
|
||||
dto.Align = 1;
|
||||
listTextInfo.Add(dto);
|
||||
#endregion
|
||||
|
||||
#region 型号
|
||||
dto = new DtoTextInfo();
|
||||
dto.Text = (bomInfo.Model).ToString();
|
||||
dto.Position = new Point3d(bomComfig.Column4X + x, bomComfig.Column4Y - (j * bomComfig.RowHeight) + y, 0);
|
||||
dto.IsMText = false;
|
||||
dto.Height = 4;
|
||||
dto.Width = 20;
|
||||
dto.Align = 1;
|
||||
listTextInfo.Add(dto);
|
||||
#endregion
|
||||
|
||||
#region 规格
|
||||
dto = new DtoTextInfo();
|
||||
dto.Text = (bomInfo.Spec).ToString();
|
||||
dto.Position = new Point3d(bomComfig.Column5X + x, bomComfig.Column5Y - (j * bomComfig.RowHeight) + y, 0);
|
||||
dto.IsMText = false;
|
||||
dto.Height = 4;
|
||||
dto.Width = 20;
|
||||
dto.Align = 1;
|
||||
listTextInfo.Add(dto);
|
||||
#endregion
|
||||
|
||||
#region 备注
|
||||
dto = new DtoTextInfo();
|
||||
dto.Text = (bomInfo.Remark).ToString();
|
||||
dto.Position = new Point3d(bomComfig.Column6X + x, bomComfig.Column6Y - (j * bomComfig.RowHeight) + y, 0);
|
||||
dto.IsMText = false;
|
||||
dto.Height = 4;
|
||||
dto.Width = 20;
|
||||
dto.Align = 1;
|
||||
listTextInfo.Add(dto);
|
||||
#endregion
|
||||
}
|
||||
#region 把材料信息插入材料表图纸里
|
||||
General.InsertTextInfo(listTextInfo); //插入文本信息
|
||||
await InsertSymbol(listSymbolInfo, cts);//插入图标信息
|
||||
listSymbolInfo.Clear();
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
General.SaveAndCloseDwg(filepath);
|
||||
File.Delete(bomName);
|
||||
General.OpenDwg(filepath);
|
||||
return msg;
|
||||
}
|
||||
/// <summary>
|
||||
/// 插入图标
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task<bool> InsertSymbol(List<DtoSymbolInfo> listSymbolInfo, CancellationTokenSource cts)
|
||||
{
|
||||
#region 插入图标
|
||||
var filePath = Path.Combine(GlobalObject.GetCacheFolder(), $"symbol.dwg");
|
||||
|
||||
//默认上下图块
|
||||
var blockName = "图标图块";
|
||||
string msg = string.Empty;
|
||||
foreach (var symbol in listSymbolInfo)
|
||||
{
|
||||
var symbolPath = Path.Combine(GlobalObject.GetDllPath(), "Template\\常规矩形两行图块.dwg");
|
||||
if (string.IsNullOrWhiteSpace(symbol.Lower_Text))
|
||||
{ symbolPath = Path.Combine(GlobalObject.GetDllPath(), "Template\\常规矩形单行图块.dwg"); }
|
||||
if (!File.Exists(symbolPath))
|
||||
{
|
||||
AddMsg($"默认图标图块找不到:{symbolPath}", false);
|
||||
continue;
|
||||
}
|
||||
File.Copy(symbolPath, filePath, true);
|
||||
AddMsg($"开始插入图标,上:{symbol.Upper_Text},下:{symbol.Lower_Text}...");
|
||||
msg = General.UpdateCableNo(filePath, new List<string>(), "", true, symbol.Upper_Text, symbol.Lower_Text);
|
||||
if (!string.IsNullOrEmpty(msg))
|
||||
{
|
||||
AddMsg($"图标修改上下信息失败,上:{symbol.Upper_Text},下:{symbol.Lower_Text},信息:{msg}", false);
|
||||
continue;
|
||||
}
|
||||
var objId = General.AddBomSymbolDWG(filePath, blockName, symbol.Scale, symbol.Position);
|
||||
if (!objId.IsNull)
|
||||
{ AddMsg($"图标插入成功!"); }
|
||||
else { AddMsg($"图标插入失败", false); }
|
||||
await Task.Delay(time, cts.Token);
|
||||
}
|
||||
#endregion
|
||||
return true;
|
||||
}
|
||||
|
||||
#region 添加提示信息
|
||||
|
||||
/// <summary>
|
||||
|
@ -0,0 +1,394 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Media3D;
|
||||
using Bricscad.EditorInput;
|
||||
using ImTools;
|
||||
using Newtonsoft.Json;
|
||||
using Prism.Services.Dialogs;
|
||||
using SWS.CAD.Base;
|
||||
using SWS.Commons;
|
||||
using SWS.Electrical.Models;
|
||||
using SWS.Model;
|
||||
using SWS.Service;
|
||||
using SWS.Share;
|
||||
using SWS.WPF.ViewModels;
|
||||
using Teigha.DatabaseServices;
|
||||
using Teigha.Geometry;
|
||||
using Teigha.GraphicsSystem;
|
||||
using Telerik.Windows.Controls;
|
||||
using Unity;
|
||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement.TaskbarClock;
|
||||
//using static ImTools.Union<TUnion, T1, T2>;
|
||||
using Visibility = System.Windows.Visibility;
|
||||
|
||||
namespace SWS.Electrical.ViewModels
|
||||
{
|
||||
|
||||
public class DialogRefreshAnnotationViewModel : DialogBase, IDialogAware
|
||||
{
|
||||
|
||||
private ObservableCollection<DtoAnnotation> _listAnnotation = new ObservableCollection<DtoAnnotation>();
|
||||
/// <summary>
|
||||
/// 正常标注列表
|
||||
/// </summary>
|
||||
public ObservableCollection<DtoAnnotation> listAnnotation
|
||||
{
|
||||
get { return this._listAnnotation; }
|
||||
set
|
||||
{
|
||||
if (value != this._listAnnotation)
|
||||
{
|
||||
this._listAnnotation = value;
|
||||
RaisePropertyChanged(nameof(listAnnotation));
|
||||
}
|
||||
}
|
||||
}
|
||||
private ObservableCollection<DtoAnnotation> _listErrAnnotation = new ObservableCollection<DtoAnnotation>();
|
||||
/// <summary>
|
||||
/// 异常标注列表
|
||||
/// </summary>
|
||||
public ObservableCollection<DtoAnnotation> listErrAnnotation
|
||||
{
|
||||
get { return this._listErrAnnotation; }
|
||||
set
|
||||
{
|
||||
if (value != this._listErrAnnotation)
|
||||
{
|
||||
this._listErrAnnotation = value;
|
||||
RaisePropertyChanged(nameof(listErrAnnotation));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private ObservableCollection<TextBlock> _listMsg = new ObservableCollection<TextBlock>();
|
||||
/// <summary>
|
||||
/// 信息列表
|
||||
/// </summary>
|
||||
public ObservableCollection<TextBlock> listMsg
|
||||
{
|
||||
get { return this._listMsg; }
|
||||
set
|
||||
{
|
||||
if (value != this._listMsg)
|
||||
{
|
||||
this._listMsg = value;
|
||||
RaisePropertyChanged(nameof(listMsg));
|
||||
}
|
||||
}
|
||||
}
|
||||
private string _NormalTagCount = "正常标注";
|
||||
/// <summary>
|
||||
/// 正常标注
|
||||
/// </summary>
|
||||
public string NormalTagCount
|
||||
{
|
||||
get { return _NormalTagCount; }
|
||||
set { _NormalTagCount = value; OnPropertyChanged(nameof(NormalTagCount)); }
|
||||
}
|
||||
private string _ErrTagCount = "异常标注";
|
||||
/// <summary>
|
||||
/// 异常标注
|
||||
/// </summary>
|
||||
public string ErrTagCount
|
||||
{
|
||||
get { return _ErrTagCount; }
|
||||
set { _ErrTagCount = value; OnPropertyChanged(nameof(ErrTagCount)); }
|
||||
}
|
||||
private bool _IsEnableGetAttribute = true;
|
||||
/// <summary>
|
||||
/// 获取元件属性值 是否可用
|
||||
/// </summary>
|
||||
public bool IsEnableGetAttribute
|
||||
{
|
||||
get { return _IsEnableGetAttribute; }
|
||||
set { _IsEnableGetAttribute = value; OnPropertyChanged(nameof(IsEnableGetAttribute)); }
|
||||
}
|
||||
private bool _IsEnableRefreshAnnotation = true;
|
||||
/// <summary>
|
||||
/// 刷新标注 是否可用
|
||||
/// </summary>
|
||||
public bool IsEnableRefreshAnnotation
|
||||
{
|
||||
get { return _IsEnableRefreshAnnotation; }
|
||||
set { _IsEnableRefreshAnnotation = value; OnPropertyChanged(nameof(IsEnableRefreshAnnotation)); }
|
||||
}
|
||||
/// <summary>
|
||||
/// 命令事件 获取元件属性值
|
||||
/// </summary>
|
||||
public ICommand Command_GetAttribute { get; set; }
|
||||
/// <summary>
|
||||
/// 命令事件 刷新标注
|
||||
/// </summary>
|
||||
public ICommand Command_RefreshAnnotation { get; set; }
|
||||
|
||||
DrawingServce _ServiceDrawing;
|
||||
DrawingCatalogueService _ServiceDrawingCatalogue;
|
||||
ObjectTypeService _ServiceObjectType;
|
||||
private TreeModel dwgNode;
|
||||
int time = 10;
|
||||
public DialogRefreshAnnotationViewModel()
|
||||
{
|
||||
Command_GetAttribute = new DelegateCommand(onGetAttribute);
|
||||
Command_RefreshAnnotation = new DelegateCommand(onRefreshAnnotation);
|
||||
title = "刷新标注";
|
||||
_ServiceDrawing = GlobalObject.container.Resolve<DrawingServce>();
|
||||
_ServiceObjectType = GlobalObject.container.Resolve<ObjectTypeService>();
|
||||
_ServiceDrawingCatalogue = GlobalObject.container.Resolve<DrawingCatalogueService>();
|
||||
}
|
||||
|
||||
public string Title => "";
|
||||
|
||||
public event Action<IDialogResult> RequestClose;
|
||||
|
||||
public bool CanCloseDialog()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void OnDialogClosed()
|
||||
{
|
||||
|
||||
}
|
||||
public void OnDialogOpened(IDialogParameters parameters)
|
||||
{
|
||||
try
|
||||
{
|
||||
dwgNode = parameters.GetValue<TreeModel>(GlobalObject.dialogPar.para1.ToString());
|
||||
title += " - " + dwgNode.Text;
|
||||
IsBusy = true;
|
||||
BusyContent = "数据加载中...";
|
||||
AddMsg($"数据加载中...");
|
||||
var listMtext = General.GetAllMText();
|
||||
var listTag = General.GetAllAnnotation();
|
||||
List<DtoAnnotation> listSuccess = new List<DtoAnnotation>();
|
||||
List<DtoAnnotation> listFailed = new List<DtoAnnotation>();
|
||||
foreach (var item in listTag)
|
||||
{
|
||||
DtoAnnotation dto = new DtoAnnotation();
|
||||
dto.TagHandid = item.TagHandId;
|
||||
dto.AttributeName = item.Name;
|
||||
dto.AnnotationHandid = item.LabelHandId;
|
||||
dto.Status = "未刷新";
|
||||
var mtext = listMtext.FirstOrDefault(a => a.HandId == dto.AnnotationHandid);
|
||||
if (mtext != null)
|
||||
{
|
||||
dto.AnnotationValue = mtext.Text;
|
||||
listSuccess.Add(dto);
|
||||
}
|
||||
else
|
||||
{
|
||||
dto.Status = "未匹配";
|
||||
listFailed.Add(dto);
|
||||
}
|
||||
}
|
||||
listAnnotation = new ObservableCollection<DtoAnnotation>(listSuccess);
|
||||
listErrAnnotation = new ObservableCollection<DtoAnnotation>(listFailed);
|
||||
NormalTagCount = $"正常标注({listSuccess.Count}个)";
|
||||
ErrTagCount = $"异常标注({listFailed.Count}个)";
|
||||
AddMsg($"数据加载完成");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("DialogOpened异常:" + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsBusy = false;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取元件属性值
|
||||
/// </summary>
|
||||
/// <param name="o"></param>
|
||||
public async void onGetAttribute(object o)
|
||||
{
|
||||
//if (isRefresh)
|
||||
//{
|
||||
// MessageBox.Show("正在刷新标注,请勿操作...");
|
||||
// return;
|
||||
//}
|
||||
//if (isGetAttribute)
|
||||
//{
|
||||
// MessageBox.Show("正在获取属性值,请勿操作...");
|
||||
// return;
|
||||
//}
|
||||
|
||||
try
|
||||
{
|
||||
IsEnableGetAttribute = IsEnableRefreshAnnotation = false;
|
||||
listMsg.Clear();
|
||||
AddMsg("开始查询元件属性值信息...");
|
||||
List<string> listTagHandid = new List<string>();
|
||||
listTagHandid = listAnnotation.Select(a => a.TagHandid).Distinct().ToList();
|
||||
foreach (string handid in listTagHandid)
|
||||
{
|
||||
AddMsg($"查询元件句柄[{handid}]属性值......");
|
||||
var res = await _ServiceObjectType.GetTagInfosByPixels(dwgNode.ID, handid);
|
||||
if (res == null || !res.Any())
|
||||
{
|
||||
AddMsg($"元件句柄[{handid}]获取属性值失败!", false);
|
||||
continue;
|
||||
}
|
||||
if (res.Count == 1)
|
||||
{
|
||||
var objectTypeName = res[0].ObjectTypeName;
|
||||
var tagNumber = res[0].tags[0].TagNumber;
|
||||
var props = res[0].tags[0].EngineDataProperty;
|
||||
var listAnno = listAnnotation.Where(a => a.TagHandid == handid).ToList();
|
||||
foreach (var anno in listAnno)
|
||||
{
|
||||
var pro = props.FirstOrDefault(a => a.PropertyName == anno.AttributeName);
|
||||
if (pro != null)
|
||||
{
|
||||
anno.ObjectTypeName = objectTypeName;
|
||||
anno.TagNumber = tagNumber;
|
||||
anno.AttributeValue = pro.PropertyValue.ToString();
|
||||
AddMsg($"获取属性值成功,类型:{objectTypeName},位号:{tagNumber},属性名:{anno.AttributeName},属性值:{anno.AttributeValue}");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddMsg($"元件句柄({handid})获取属性值异常!", false);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
AddMsg("元件属性值信息查询完成!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddMsg("基点元件信息查询异常:" + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsEnableGetAttribute = IsEnableRefreshAnnotation = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 刷新标注
|
||||
/// </summary>
|
||||
/// <param name="o"></param>
|
||||
public async void onRefreshAnnotation(object o)
|
||||
{
|
||||
//if (isRefresh)
|
||||
//{
|
||||
// MessageBox.Show("正在刷新标注,请勿操作...");
|
||||
// return;
|
||||
//}
|
||||
|
||||
var msg = string.Empty;
|
||||
try
|
||||
{
|
||||
|
||||
IsEnableGetAttribute = IsEnableRefreshAnnotation = false;
|
||||
listMsg.Clear();
|
||||
if (!listAnnotation.Any())
|
||||
{
|
||||
AddMsg($"没有正常匹配的标注数据,无需刷新!", false);
|
||||
return;
|
||||
}
|
||||
var progress = new Progress<MessageModel>(UpdateProgress);
|
||||
await DoWorkAsync(progress, new CancellationTokenSource());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("异常:" + ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsEnableGetAttribute = IsEnableRefreshAnnotation = true;
|
||||
}
|
||||
}
|
||||
#region dowork
|
||||
private void UpdateProgress(MessageModel dto)
|
||||
{
|
||||
System.Windows.Application.Current.Dispatcher.Invoke(new System.Action(() =>
|
||||
{
|
||||
AddMsg(dto.Message, dto.IsSuccess);
|
||||
}));
|
||||
}
|
||||
private async Task DoWorkAsync(IProgress<MessageModel> progress, CancellationTokenSource cts)
|
||||
{
|
||||
try
|
||||
{
|
||||
List<KeyValueModel> listValue = new List<KeyValueModel>();
|
||||
var msg = string.Empty;
|
||||
foreach (var anno in listAnnotation)
|
||||
{
|
||||
if (anno.Status == "已刷新")
|
||||
{
|
||||
AddMsg($"当前标注[{anno.AnnotationHandid}]的已刷新,跳至下一个");
|
||||
continue;
|
||||
}
|
||||
if (anno.AttributeValue == anno.AnnotationValue)
|
||||
{
|
||||
AddMsg($"当前标注[{anno.AnnotationHandid}]的属性值和标注值一致,无需刷新,跳至下一个");
|
||||
anno.Status = "无需刷新";
|
||||
continue;
|
||||
}
|
||||
listValue.Add(new KeyValueModel() { Key = anno.AnnotationHandid, Value = anno.AttributeValue });
|
||||
AddMsg($"当前标注句柄:{anno.AnnotationHandid},属性值:{anno.AttributeValue},已加入刷新列表");
|
||||
anno.Status = "等待刷新";
|
||||
await Task.Delay(100);
|
||||
}
|
||||
if (!listValue.Any())
|
||||
{ AddMsg($"所有标注值与属性值一致,无需刷新!", false); return; }
|
||||
msg = General.RefreshMTextInfo(listValue);
|
||||
if (string.IsNullOrWhiteSpace(msg))
|
||||
{
|
||||
foreach (var anno in listValue)
|
||||
{
|
||||
var dto = listAnnotation.FirstOrDefault(a => a.AnnotationHandid == anno.Key);
|
||||
if (dto != null)
|
||||
{
|
||||
dto.Status = "已刷新";
|
||||
}
|
||||
}
|
||||
AddMsg("操作已完成!");
|
||||
}
|
||||
else { AddMsg($"刷新标注列表异常:{msg}",false); }
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("异常:" + ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 添加提示信息
|
||||
|
||||
/// <summary>
|
||||
/// 添加提示信息
|
||||
/// </summary>
|
||||
/// <param name="msg">信息</param>
|
||||
/// <param name="isSucc">是否成功</param>
|
||||
private void AddMsg(string msg, bool isSucc = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
TextBlock tb = new TextBlock();
|
||||
tb.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:ffff") + "==>> " + msg;
|
||||
tb.Foreground = isSucc ? Brushes.LightSeaGreen : Brushes.Red;
|
||||
listMsg.Add(tb);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show("添加提示信息异常:" + ex.Message);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
290
newFront/c#前端/SWS.Electrical/Views/DialogRefreshAnnotation.xaml
Normal file
290
newFront/c#前端/SWS.Electrical/Views/DialogRefreshAnnotation.xaml
Normal file
@ -0,0 +1,290 @@
|
||||
<UserControl
|
||||
x:Class="SWS.Electrical.Views.DialogRefreshAnnotation"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:Custom="http://www.galasoft.ch/mvvmlight"
|
||||
xmlns:CustomControl="clr-namespace:SWS.CustomControl;assembly=SWS.CustomControl"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:local="clr-namespace:SWS.Electrical"
|
||||
xmlns:local2="clr-namespace:SWS.Model;assembly=SWS.Model"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:prism="http://prismlibrary.com/"
|
||||
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
||||
Width="900"
|
||||
Height="700"
|
||||
Background="#2D3135"
|
||||
mc:Ignorable="d">
|
||||
<prism:Dialog.WindowStyle>
|
||||
<Style TargetType="Window">
|
||||
<Setter Property="Width" Value="{Binding Source={x:Static SystemParameters.WorkArea}, Path=Width}" />
|
||||
<Setter Property="Height" Value="{Binding Source={x:Static SystemParameters.WorkArea}, Path=Height}" />
|
||||
|
||||
<Setter Property="WindowState" Value="Normal" />
|
||||
<Setter Property="WindowStyle" Value="None" />
|
||||
<Setter Property="ResizeMode" Value="NoResize" />
|
||||
</Style>
|
||||
</prism:Dialog.WindowStyle>
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<Style TargetType="DataGrid">
|
||||
<Setter Property="RowHeaderWidth" Value="0" />
|
||||
<Setter Property="AutoGenerateColumns" Value="False" />
|
||||
<Setter Property="CanUserAddRows" Value="False" />
|
||||
<Setter Property="CanUserResizeColumns" Value="False" />
|
||||
<Setter Property="CanUserResizeRows" Value="False" />
|
||||
<Setter Property="HorizontalGridLinesBrush" Value="LightGray" />
|
||||
<Setter Property="VerticalGridLinesBrush" Value="LightGray" />
|
||||
<Setter Property="IsReadOnly" Value="False" />
|
||||
<Setter Property="BorderThickness" Value="1,0" />
|
||||
<Setter Property="BorderBrush" Value="LightGray" />
|
||||
<Setter Property="RowHeight" Value="30" />
|
||||
<Setter Property="VerticalScrollBarVisibility" Value="Auto" />
|
||||
</Style>
|
||||
|
||||
<!-- DataGrid表头样式 -->
|
||||
<Style TargetType="DataGridColumnHeader">
|
||||
<Setter Property="FontSize" Value="13" />
|
||||
<Setter Property="Background" Value="White" />
|
||||
<Setter Property="BorderThickness" Value="1,1,1,1" />
|
||||
<Setter Property="BorderBrush" Value="LightGray" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<!-- DataGrid复选框样式 -->
|
||||
<Style x:Key="VerticalCheckBox" TargetType="CheckBox">
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="FontSize" Value="16" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type CheckBox}">
|
||||
<StackPanel Name="sp" HorizontalAlignment="Center">
|
||||
<ContentPresenter Margin="2" HorizontalAlignment="Center" />
|
||||
<Border
|
||||
x:Name="bd"
|
||||
Width="20"
|
||||
Height="20"
|
||||
BorderBrush="Gray"
|
||||
BorderThickness="1.5">
|
||||
<Border.Background>
|
||||
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
|
||||
<GradientStop Offset="0.05" Color="LightGray" />
|
||||
<GradientStop Offset="1" Color="White" />
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
<Path
|
||||
Name="checkPath"
|
||||
Width="18"
|
||||
Height="16"
|
||||
Stroke="Black"
|
||||
StrokeThickness="2" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="True">
|
||||
<Setter TargetName="checkPath" Property="Data" Value="M 1.5,5 L 7,13 17,0" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="bd" Property="Background" Value="LightGray" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- DataGrid单元格选中样式 #6495ED -->
|
||||
<Style TargetType="DataGridCell">
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Foreground" Value="#6495ED" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<telerik:RadBusyIndicator BusyContent="{Binding BusyContent}" IsBusy="{Binding IsBusy}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="auto" />
|
||||
<RowDefinition Height="70" />
|
||||
<RowDefinition Height="300" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<CustomControl:customWindowTitleBar x:Name="titleBar" Grid.Row="0" />
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
Height="30"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
Width="150"
|
||||
Margin="60,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
Command="{Binding Command_GetAttribute}"
|
||||
Content="获取元件属性值"
|
||||
FontSize="16"
|
||||
IsEnabled="{Binding IsEnableGetAttribute}" />
|
||||
<Button
|
||||
Width="140"
|
||||
Margin="40,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
Command="{Binding Command_RefreshAnnotation}"
|
||||
Content="刷新标注"
|
||||
FontSize="16"
|
||||
IsEnabled="{Binding IsEnableRefreshAnnotation}" />
|
||||
</StackPanel>
|
||||
<TabControl Grid.Row="2" Height="auto">
|
||||
<TabItem Header="{Binding NormalTagCount}">
|
||||
<DataGrid
|
||||
x:Name="dgTag"
|
||||
Height="auto"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserAddRows="False"
|
||||
CanUserResizeColumns="True"
|
||||
HeadersVisibility="Column"
|
||||
ItemsSource="{Binding listAnnotation, Mode=TwoWay}"
|
||||
RowHeight="22"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
SelectionMode="Single">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="auto"
|
||||
Binding="{Binding ObjectTypeName}"
|
||||
Header="元件类型"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="auto"
|
||||
Binding="{Binding TagNumber}"
|
||||
Header="元件位号"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="80"
|
||||
Binding="{Binding TagHandid}"
|
||||
Header="元件句柄"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="150"
|
||||
Binding="{Binding AttributeName}"
|
||||
Header="属性名"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding AttributeValue}"
|
||||
Header="属性值"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="80"
|
||||
Binding="{Binding AnnotationHandid}"
|
||||
Header="标注句柄"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding AnnotationValue}"
|
||||
Header="图纸标注值"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="100"
|
||||
Binding="{Binding Status}"
|
||||
Header="状态"
|
||||
IsReadOnly="True" />
|
||||
</DataGrid.Columns>
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Setter Property="Background" Value="White" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Status}" Value="已刷新">
|
||||
<Setter Property="Background" Value="LightGreen" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Status}" Value="无需刷新">
|
||||
<Setter Property="Background" Value="LightGreen" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
</DataGrid>
|
||||
</TabItem>
|
||||
<TabItem Header="{Binding ErrTagCount}">
|
||||
<DataGrid
|
||||
Height="auto"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserAddRows="False"
|
||||
CanUserResizeColumns="True"
|
||||
HeadersVisibility="Column"
|
||||
ItemsSource="{Binding listErrAnnotation, Mode=TwoWay}"
|
||||
RowHeight="22"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
SelectionMode="Single">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn
|
||||
Width="auto"
|
||||
Binding="{Binding ObjectTypeName}"
|
||||
Header="元件类型"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="auto"
|
||||
Binding="{Binding TagNumber}"
|
||||
Header="元件位号"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="80"
|
||||
Binding="{Binding TagHandid}"
|
||||
Header="元件句柄"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="150"
|
||||
Binding="{Binding AttributeName}"
|
||||
Header="属性名"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding AttributeValue}"
|
||||
Header="属性值"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="80"
|
||||
Binding="{Binding AnnotationHandid}"
|
||||
Header="标注句柄"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="*"
|
||||
Binding="{Binding AnnotationValue}"
|
||||
Header="图纸标注值"
|
||||
IsReadOnly="True" />
|
||||
<DataGridTextColumn
|
||||
Width="100"
|
||||
Binding="{Binding Status}"
|
||||
Header="状态"
|
||||
IsReadOnly="True" />
|
||||
</DataGrid.Columns>
|
||||
<DataGrid.RowStyle>
|
||||
<Style TargetType="DataGridRow">
|
||||
<Setter Property="Background" Value="White" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Status}" Value="已刷新">
|
||||
<Setter Property="Background" Value="LightGreen" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.RowStyle>
|
||||
</DataGrid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
<ListBox
|
||||
Grid.Row="3"
|
||||
Background="Black"
|
||||
ItemsSource="{Binding listMsg}"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Visible">
|
||||
<i:Interaction.Behaviors>
|
||||
<local:ListBoxScrollToBottomBehavior />
|
||||
</i:Interaction.Behaviors>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
</telerik:RadBusyIndicator>
|
||||
</UserControl>
|
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using SWS.Electrical.ViewModels;
|
||||
using SWS.Model;
|
||||
|
||||
namespace SWS.Electrical.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// 刷新标注
|
||||
/// </summary>
|
||||
public partial class DialogRefreshAnnotation : UserControl
|
||||
{
|
||||
public DialogRefreshAnnotation()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user