This commit is contained in:
chenjinbu 2025-10-09 17:52:17 +08:00
commit 38e5331d09
58 changed files with 1643 additions and 767 deletions

View File

@ -1,4 +1,6 @@
using DocumentFormat.OpenXml.Drawing.Spreadsheet;
using DocumentFormat.OpenXml.Math;
using DocumentFormat.OpenXml.Spreadsheet;
using Learun.Application.Organization;
using Learun.Application.TwoDevelopment.ZZDT_EC;
using Learun.Application.TwoDevelopment.ZZDT_EC.Frame;
@ -10,6 +12,10 @@ using Learun.Util.SqlSugar;
using log4net.Config;
using Microsoft.Practices.ObjectBuilder2;
using Newtonsoft.Json;
using NPOI.POIFS.Crypt;
using NPOI.SS.Formula.Functions;
using OfficeOpenXml;
using OfficeOpenXml.Style;
using Org.BouncyCastle.Bcpg.OpenPgp;
using Pipelines.Sockets.Unofficial.Arenas;
using SqlSugar;
@ -17,9 +23,13 @@ using System;
using System.Collections.Generic;
using System.Data.Entity.Infrastructure;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Web.Http;
using System.Windows;
using System.Windows.Input;
using static Learun.Application.TwoDevelopment.ZZDT_EC.IO_WorkFlowService;
using static Learun.Application.Web.Areas.ZZDT_EC.Controllers.ec_objecttypeController;
namespace Learun.Application.Web.AppApi
{
@ -44,10 +54,63 @@ namespace Learun.Application.Web.AppApi
#endregion
/// <summary>
/// 找到某一个预分配箱子 附近的某一个箱子
/// 根据模板自动创建端子排
/// </summary>
/// <param name="projId"></param>
/// <param name="panelObj"></param>
/// <param name="seq"></param>
/// <param name="TSname"></param>
/// <param name="iOType"></param>
private ec_PanelStripEntity CreatePanelStripByProfile2(string projId, ec_PanelEntity panelObj, int seq, GlobalEnum.IOType iOType)
{
var setTb = ProjectSugar.TableName<ec_projectSettingsEntity>(projId);
var allSettings = SqlSugarHelper.Db.Queryable<ec_projectSettingsEntity>().AS(setTb).ToList();
allSettings = allSettings.FindAll(x => x.SettingName.StartsWith(GlobalObject.projSetting_IOCardProfile + iOType.ToString()));
//IO_CardProfile
//IO_CardProfile_DO_TermNoPerCh
//IO_CardProfile_DO_CHNoPerStrip
//IO_CardProfile_DO_ChNamePrefix
//IO_CardProfile_DO_ChNameStartIndex
var sName = GlobalObject.projSetting_IOCardProfile + iOType.ToString() + "_TermNoPerCh";
var TermNoPerCh = allSettings.FirstOrDefault(x => x.SettingName == sName)?.SettingValue;
sName = GlobalObject.projSetting_IOCardProfile + iOType.ToString() + "_CHNoPerStrip";
var CHNoPerStrip = allSettings.FirstOrDefault(x => x.SettingName == sName)?.SettingValue;
sName = GlobalObject.projSetting_IOCardProfile + iOType.ToString() + "_ChNamePrefix";
var ChNamePrefix = allSettings.FirstOrDefault(x => x.SettingName == sName)?.SettingValue;
if (int.TryParse(TermNoPerCh, out int iTermNoPerCh))
{
//err
}
if (int.TryParse(CHNoPerStrip, out int iCHNoPerStrip))
{
//err
}
var newTs = new ec_PanelStripEntity()
{
IO_TYPE = iOType.ToString(),
PanelID = panelObj.PanelID,
Panel_Strip_Seq = seq,
StripName = "TS_" + iOType.ToString() + "_" + seq,
TagNumber = "CreatePanelStripByProfile2"
};
newTs.Create();
for (int i = 0; i < iCHNoPerStrip; i++)
{
var newCh = new ec_PanelChannelEntity()
{
ChannelName = ChNamePrefix + (i + 1).ToString(),
Channel_Seq = i + 1,
StripID = newTs.StripID,
};
newCh.Create();
newTs.Channels.Add(newCh);
}
return newTs;
}
/// <summary>
/// 找到某一个预分配箱子 附近的某一个箱子。且io类型能匹配上
/// <param name="curPanelId"/>
/// <param name="frameLists"/>
/// <param name="allPanel"/>
@ -55,9 +118,10 @@ namespace Learun.Application.Web.AppApi
/// <param name="IOTypeOnCable">Digital,4-20mA,10v,pt100,pulse</param>
/// </summary>
private ec_PanelEntity FindPanelNearby(string curPanelId, List<FrameBll.FrameList> frameLists, List<ec_PanelEntity> allPanel,
private ec_PanelEntity FindPanelNearby(ec_CableEntity cableObj, List<FrameBll.FrameList> frameLists, List<ec_PanelEntity> allPanel,
Dictionary<string, List<ec_enginedata_propertyEntity>> allPanelProps, string IOTypeOnCable)
{
var curPanelId = cableObj.PanelID;
double GetPanelXYDistance2Target(string panelId, double targetX, double targetY)
{
var nearPanel = allPanel.FirstOrDefault(x => x.PanelID == panelId);
@ -88,7 +152,7 @@ namespace Learun.Application.Web.AppApi
return -1;//无效的x off导致的
}
if (double.TryParse(nearPanelProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_YOff)?.PropertyValue,
, out double YOffValue))
out double YOffValue))
{
}
@ -129,7 +193,7 @@ namespace Learun.Application.Web.AppApi
return null;//无效的x off导致的
}
if (double.TryParse(curPanelProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_YOff)?.PropertyValue,
, out double AssignPanelYValue))
out double AssignPanelYValue))
{
}
@ -141,8 +205,31 @@ namespace Learun.Application.Web.AppApi
foreach (var panel in allPanel.Where(x => x.PanelID != curPanelId))
{
#region io
var IOMatched = true;
var IOsOnPanel = panel.allowedIOTypes.Split(',').ToList();
//剩下的感觉都可以是set上的参数
foreach (var set in cableObj.Sets)
{
#region io匹配程度
var setNew = ec_CableBLL.SetIOMatchPanel(cableObj.PreAssignIOType, set, IOsOnPanel);
if (IOsOnPanel.Contains(setNew.IOType.ToString()))
{
setNew.IOTypeMatch = true;
}
else
{
setNew.IOTypeMatch = false; IOMatched = false;
//不匹配
break;
}
#endregion
}
#endregion
if (IOMatched)
{
//如果io匹配了再找附近的
#region distance
//拿到每一个的xy属性
//然后和预分配箱子进行对比
@ -157,16 +244,9 @@ namespace Learun.Application.Web.AppApi
minDistance = DISTANCE; nearestPanel = panel;
}
#endregion
}
//根据电缆上的信号,去找匹配的排序第一位(已经按照距离排序过)的箱子
switch (IOTypeOnCable.ToUpper())
{
case "DIGITAL":
//其他就近箱子的 allowIOTypes里有DI DO
break;
default:
break;
}
return nearestPanel;
}
@ -365,6 +445,36 @@ namespace Learun.Application.Web.AppApi
}
ICache redisObj = CacheFactory.CaChe();
/// <summary>
/// 导出分配结果
/// </summary>
/// <param name="projectId"></param>
/// <param name="flg">是否为真实结果。step2时为falsestep3后为true</param>
[HttpGet]
public void AutoAssignCable2Channel_ResExport(string projectId, bool flg)
{
var BLL = new ec_Wire_GroupBLL();
var bytes = new byte[] { };
try
{
ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
using (var package = new ExcelPackage())//新建
{
var sheet = package.Workbook.Worksheets.Add("test");
sheet.Cells[1, 1].Value = "test";
bytes = package.GetAsByteArray();
}
}
catch (Exception ex)
{
log4net.LogManager.GetLogger("ERROR").Error("ec_PanelChannelBLLIOModuleExportExcel 监控系统表导出" + ex.Message + ex.StackTrace);
bytes = System.Text.Encoding.UTF8.GetBytes(ex.Message + ex.StackTrace);
}
var stream = new MemoryStream(bytes);
FileDownHelper.DownLoad(stream, $"自动分配结果{DateTime.Now.ToString("yyyyMMddHHmmss")}.xlsx");//自动化平台导出excel
}
/// <summary>
/// 自动分配通道(点表信号自动分配)。
///
@ -396,10 +506,22 @@ namespace Learun.Application.Web.AppApi
cablesNeedAssigned = cablesNeedAssigned.Where(x => CableIds.Contains(x.CableID)).ToList();
#endregion
//涉及到哪些箱子
var allPanel = SqlSugarHelper.Db.Queryable<ec_PanelEntity>().AS(panelTable).
List<ec_PanelEntity> allPanel = SqlSugarHelper.Db.Queryable<ec_PanelEntity>().AS(panelTable).
InnerJoin<ec_enginedataEntity>((a, b) => a.EngineerDataID == b.EngineDataID).AS<ec_enginedataEntity>(tagTable).
InnerJoin<ec_objecttypeEntity>((a, b, c) => b.ObjectTypeID == c.ObjectTypeID).AS<ec_objecttypeEntity>(typeTable).
Where((a, b, c) => c.specialType == GlobalEnum.specialType.).
Select((a, b, c) => new ec_PanelEntity
{
allowedIOTypes = a.allowedIOTypes,
DefaultBreakerType = a.DefaultBreakerType,
EngineerDataID = a.EngineerDataID,
MaxStripNumber = a.MaxStripNumber,
ObjectTypeName = c.ObjectTypeName,
PanelID = a.PanelID,
Panel_Loc_ID = a.Panel_Loc_ID,
TagNumber = b.TagNumber,
}).
ToList();//这里要过滤一下根据object type里的specialType而不是所有的panel
var allPanelProp = SqlSugarHelper.Db.Queryable<ec_enginedata_propertyEntity>().AS(propTable)
@ -418,27 +540,25 @@ namespace Learun.Application.Web.AppApi
{
//有不匹配的,但是用户允许继续
//如果选是则在之后的自动分配过程中会自动寻找匹配的采集箱原则上从就近的开始找如果没有匹配的采集箱则提示“未找到具有XX类型的采集箱请新增后再次分配是否取消自动分配进程
bool nearbyFound = false;
foreach (var cable in cablesNotMatchIO)
{
var nearPanel = FindPanelNearby(cable.PanelID, allFrames, allPanel, allPanelProp, cable.PreAssignIOType);
if (nearPanel == null)
var nearPanel = FindPanelNearby(cable, allFrames, allPanel, allPanelProp, cable.PreAssignIOType);
cable.AssignedPanel = nearPanel;
}
var cableNotFoundNearPanel = cablesNotMatchIO.FindAll(x => x.AssignedPanel == null);
if (cableNotFoundNearPanel != null && cableNotFoundNearPanel.Count > 0)
{
nearbyFound = false;
//必要的数据存入redis以便后续步骤使用
redisObj.Remove("IOModule_AutoAssign2Ch_" + projId, CacheId.IOModule_AutoAssign2Ch);
redisObj.Write<List<ec_CableEntity>>("IOModule_AutoAssign2Ch_" + projId, cablesNeedAssigned, CacheId.IOModule_AutoAssign2Ch);
return Fail($"在附近未找到具有{cable.PreAssignIOType}类型的采集箱,请新增后再次分配,是否取消自动分配进程?");
return Fail($"在电缆{string.Join(",", cableNotFoundNearPanel.Select(x => x.TagNumber))}附近未找到具有IO类型匹配的采集箱请新增后再次分配是否取消自动分配进程");
//之后插件端进行选择。
//如果不想新增,则选择否,继续自动分配,没有分配到的信号在备注上填写由于何种原因没有被分配,弹出未被分配的信号列表供查看。
//也就是这里要等所有循环结束后才能return结果而不是目前一个nearByFound = false时就退出了。
}
else
{
nearbyFound = true;
}
}
}
@ -483,63 +603,664 @@ namespace Learun.Application.Web.AppApi
ICache redisObj = CacheFactory.CaChe();
var cablesNeedAssigned = redisObj.Read<List<ec_CableEntity>>("IOModule_AutoAssign2Ch_" + projId, CacheId.IOModule_AutoAssign2Ch);
//#region 1.2 开始自动分配(不保存到数据库)
#region 1.2.2
var cablesGrouped = cablesNeedAssigned.OrderBy(x => x.PanelID).ThenBy(x => x.PreAssignIOType).ThenBy(x => x.System).ToList();
foreach (var item in cablesNeedAssigned)
var signalTb = ProjectSugar.TableName<ec_Wire_GroupEntity>(projId);
var allSignals = SqlSugarHelper.Db.Queryable<ec_Wire_GroupEntity>().AS(signalTb).ToList();
var connTb = ProjectSugar.TableName<ec_WireTerminalEntity>(projId);
var termTb = ProjectSugar.TableName<ec_PanelStripTermEntity>(projId);
var allConnedTerms = SqlSugarHelper.Db.Queryable<ec_WireTerminalEntity>().AS(connTb)
.InnerJoin<ec_PanelStripTermEntity>((a, b) => a.TermID == b.TermID).AS<ec_PanelStripTermEntity>(termTb)
.Select((a, b) => b.ChannelID).Distinct().ToList();
//包括2部分1是已经被信号占用的通道2是已经被接线端子占用的通道
var allUsedCHBySignalOrSet = allSignals.Where(x => !string.IsNullOrEmpty(x.ChannelID)).Select(x => x.ChannelID).Distinct().ToList();
allUsedCHBySignalOrSet.AddRange(allConnedTerms);
//??这里有问题。通道是否被占用需要看signal和set双重在io分配界面
//1. 信号有, 电缆set有占了
//2.信号no电缆set有占了
//3.信号有电缆setno没占
//4.信号no电缆setno没占
//1.2 流程图 分组原则为同一信号类型、同一系统的为一组
var cablesGrouped = cablesNeedAssigned.OrderBy(x => x.AssignedPanel?.PanelID).ThenBy(x => x.PreAssignIOType).ThenBy(x => x.System).ToList();
var cNotPanel = cablesGrouped.FindAll(x => x.AssignedPanel == null);
cablesGrouped = cablesNeedAssigned.FindAll(x => x.AssignedPanel != null);
//cablesGrouped = cablesGrouped.Where(x => x.Sets != null && x.Sets.Count() > 0 && x.AssignedPanel != null).ToList();//过滤掉没有set的或者没有找到箱子的
//cablesGrouped = cablesGrouped.Where(x => x.Sets.Where(xx => !string.IsNullOrEmpty(xx.PreAssignGroup_Desc)).Count() > 0).ToList();//过滤掉set没有分配信号的
var allPanelIds = cablesGrouped.Select(x => x.AssignedPanel).Select(x => x.PanelID).Distinct().ToList();
var stripBll = new ec_PanelStripBLL();
var allStrips = stripBll.GetList("{ProjectId:\"" + projId + "\"}", OnlySelf: false)
.Where(x => allPanelIds.Contains(x.PanelID))
.GroupBy(x => x.PanelID)
.ToDictionary(x => x.Key, x => x.ToList());//带出strip下的channel
foreach (var c in cNotPanel)
{
if (item.Sets == null || item.Sets.Count() == 0)
foreach (var set in c.Sets)
{
//也归类到未成功
set.ConnectionInfo = "err没有找到合适的采集箱";
}
}
foreach (var curPanelId in allPanelIds)
{
int newTSSeq = 10001;
var existedStrips = allStrips[curPanelId];//已经存在的所有模块
var cablesOnThisPanel = cablesGrouped.Where(x => x.AssignedPanel.PanelID == curPanelId).ToList();
if (cablesOnThisPanel == null || cablesOnThisPanel.Count == 0) continue;//next panel
var lastUsedStrip = (ec_PanelStripEntity)null;
foreach (var cable in cablesOnThisPanel)
{
//1.2.2 分组原则为同一信号类型、同一系统的为一组系统属性从电缆的from端上的设备中取设备的系统同组的优先放到同一个箱子的同一个模块里面
//如果一组放完后发现模块还有多余的通道可以放则下一个系统继续从这个模块开始分配。
//???总感觉这句话,总结后:可以无脑用上一个模块,直到模块满了再用下一个模块。
#region
//bool sameGroup = true;
//if (lastCableSystemAndIOType != cable.System + cable.PreAssignIOType)
//{
// sameGroup = false;//换组了
//}
#endregion
//1.2 流程图 读取有提前选好箱子的信号
var setsSpared = cable.Sets.Where(x => string.IsNullOrEmpty(x.PreAssignGroup_Desc) || string.IsNullOrEmpty(x.PreAssignInOrOut)).ToList();
var setsIn = cable.Sets.Where(x => !string.IsNullOrEmpty(x.PreAssignGroup_Desc) && x.PreAssignInOrOut == SWS.Share.Enum.inOrOut..ToString()).ToList();
var setsOut = cable.Sets.Where(x => !string.IsNullOrEmpty(x.PreAssignGroup_Desc) && x.PreAssignInOrOut == SWS.Share.Enum.inOrOut..ToString()).ToList();
#region 1.2.4
if (cable.PreAssignIOType.ToLower() == GlobalEnum.signalType.Digital.ToString().ToLower())
{
if (setsIn.Count > 0 && setsOut.Count > 0)
{
foreach (var set in setsIn)
{
set.ConnectionInfo = "errdigital类型的电缆无法同时配置输入和输出。";
}
foreach (var set in setsOut)
{
set.ConnectionInfo = "errdigital类型的电缆无法同时配置输入和输出。";
}
continue;
//from cjj 25 09 23 wechat:一根电缆可能会出现既有输入也有输出,如果碰到就放到两个端子排里面,公共端不会出现一个输出,一个输入的
}
}
#endregion
#region inputNew
if (setsIn.Count > 0)
{
var resIn = AutoAssignCore(GlobalEnum.inOrOut., setsIn);
}
#endregion
#region output
else if (setsOut.Count > 0)
{
var resOut = AutoAssignCore(GlobalEnum.inOrOut., setsOut);
}
else
{
foreach (var set in item.Sets)
//all zero
foreach (var set in cable.Sets.Where(x => !setsSpared.Select(c => c.CableSetID).Contains(x.CableSetID)))
{
set.ConnectionInfo = $"采集箱:{item.ToPanel.TagNumber}/模块(端子排){"test_ts"}/通道:{"test_ch"}";
set.AssignedTerms = set.Wires.Select(x => x.PreAssignChannelTermNo).ToList();// new List<string>() { "test_term1", "test_term2" };//假数据
set.ConnectionInfo = "err信号描述为空";
}
foreach (var set in setsSpared)
{
set.ConnectionInfo = "err电缆无任一set被分配";
}
}
}
//var curPanel = new ec_PanelEntity();
//curPanel = panelsNeed.FirstOrDefault(x => x.PanelID == cablesNeedAssigned[0].PanelID);//先定位到第一个电缆所在的箱子
//curPanel.strips = stripsNeed.Where(x => x.PanelID == curPanel.PanelID).ToList();
//var curStrip = new ec_PanelStripEntity();
#endregion
//for (var i = 0; i < cablesNeedAssigned.Count; i++)
//{
// #region 是否有端子排 1.2.1
// if (curPanel.PanelID != cablesNeedAssigned[i].PanelID)
// {
// curPanel = panelsNeed.FirstOrDefault(x => x.PanelID == cablesNeedAssigned[0].PanelID);//切换箱子
// curPanel.strips = stripsNeed.Where(x => x.PanelID == curPanel.PanelID).ToList();
// }
// foreach (var set in cablesNeedAssigned[i].Sets)
// {
// var availableStrips = curPanel.strips.Where(x => x.IO_TYPE.ToUpper() == set.IOType.ToString().ToUpper()).ToList();
//in 和 out都会执行这个
bool AutoAssignCore(GlobalEnum.inOrOut inOrOut, List<ec_CableSetEntity> sets)
{
GlobalEnum.IOType ioTypeOnC = default;
switch (cable.PreAssignIOType.ToLower())
{
case "digital":
//数字量
if (inOrOut == GlobalEnum.inOrOut.)
{
ioTypeOnC = GlobalEnum.IOType.DI;
}
else
{
ioTypeOnC = GlobalEnum.IOType.DO;
}
break;
case "4~20ma":
//模拟量4-20mA
if (inOrOut == GlobalEnum.inOrOut.)
{
ioTypeOnC = GlobalEnum.IOType.AI;
}
else
{
ioTypeOnC = GlobalEnum.IOType.AO;
}
// if (availableStrips != null && availableStrips.Count > 0)
break;
case "10v":
ioTypeOnC = GlobalEnum.IOType.TenVolt;
break;
case "pt100":
ioTypeOnC = GlobalEnum.IOType.PT100;
break;
case "pulse":
ioTypeOnC = GlobalEnum.IOType.PULSE;
break;
default:
//通讯类 485 422啥的
return false;
}
var matchedStrips = existedStrips.Where(x => x.IO_TYPE == ioTypeOnC.ToString()).ToList();//这个电缆下符合的模块
if (matchedStrips != null && lastUsedStrip != null && lastUsedStrip.IO_TYPE == ioTypeOnC.ToString())
{
//1.2.2 优先使用上一个模块,直到模块满了再用下一个模块。
matchedStrips.Remove(lastUsedStrip);
matchedStrips.Insert(0, lastUsedStrip);//
}
if (matchedStrips == null || matchedStrips.Count == 0)
{
#region NewTS
//1.2 流程图 根据信号数里自动新建端子排,端子排通道数里根据箱子模板中的默认值获得
var newTS = CreatePanelStripByProfile2(projId, cable.AssignedPanel, newTSSeq++, ioTypeOnC);
matchedStrips.Add(newTS);
#endregion
}
string PanelName = cable.AssignedPanel.TagNumber;//当前电缆预分配的箱子名称
if (sets.Count == 0) return false;
//1.2 流程图 箱子里是否已经存在端子排io匹配
List<ec_PanelChannelEntity> usedChs = new List<ec_PanelChannelEntity>();
List<ec_PanelChannelEntity> notUsedChs = new List<ec_PanelChannelEntity>();
#region 1.2
//if (cable.Sets.Count > 10)
//{
// //已经存在端子排
// //另外如果电缆对数大于10对即像12 * 2 * 0.75这种无论它预分配了多少根电缆对永远预留4个以下的空白通道。意思就是一个模块里面够4个或4个以上空白通道就留4个空白通道如果不够4个就留4个以下即可。
// #region FindNextAvailableTS可能多个
// //还分2种情况判断模块是否符合
// //case1. 占满可用通道后还剩至少一个预分配的set和spared的set。 //这种时候要spared不用考虑
// //case2. 占满可用通道后或者没占满通道预分配set已经没了只剩下spared的set。 //这种时候要确保spared也能放下
// bool NeedNextTS = false;
// do
// {
// #region FindNextAvailableTS
// var availableTS = new List<ec_PanelStripEntity>();
// foreach (var TS in matchedStrips)
// {
// var allCh = TS.Channels;
// //被占用的(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();
// if (notUsedChs.Count < sets.Count)
// {
// //case1能顺利接完set还有多
// //这种时候不需要考虑spared
// }
// else
// {
// //没有端子排根据信号数里自动新建端子排通道数里根据端子io模板的默认值获得
// //
// //case2,占满可用通道后或者没占满通道预分配set已经没了只剩下spared的set
// //想办法留出4个
// //这种时候要确保spared也能放下
// if (notUsedChs.Count < sets.Count + setsSpared.Count)
// {
// //放不下,换下一个模块
// continue;
// }
// var sparedSetFor10 = notUsedChs.Count - sets.Count - setsSpared.Count;//16-9-5=2
// if (sparedSetFor10 > 4)
// {
// //固定流出后面4个相当于不要了
// var last4 = allCh.Skip(allCh.Count - 4).ToList();
// usedChs = allCh.Take(allCh.Count - 4).Where(x => allUsedCHBySignalOrSet.Contains(x.ChannelID) || x.lock_flg == 1).ToList();
// usedChs.AddRange(last4);
// notUsedChs = allCh.Take(allCh.Count - 4).Where(x => !usedChs.Select(c => c.ChannelID).Contains(x.ChannelID)).ToList();
// }
// else
// {
// //不够4个就留多少是多少
// var lastN = allCh.Skip(allCh.Count - sparedSetFor10).ToList();
// usedChs = allCh.Take(allCh.Count - sparedSetFor10).Where(x => allUsedCHBySignalOrSet.Contains(x.ChannelID) || x.lock_flg == 1).ToList();
// usedChs.AddRange(lastN);
// notUsedChs = allCh.Take(allCh.Count - sparedSetFor10).Where(x => !usedChs.Select(c => c.ChannelID).Contains(x.ChannelID)).ToList();
// }
// }
// //可能要换一下循环主体评估下是按照cable循环好还是按strip循环好
// #endregion
// //1.2 流程图 空的通道数够不够
// double sparedRate = notUsedChs.Count * 1.0 / allCh.Count * 1.0;
// if (sparedRate < 0.05)
// {
// //没有空闲通道 next
// //或者空闲通道不够放下这个电缆的所有set
// }
// else
// {
// TS.Channels = allCh.OrderBy(X => X.Channel_Seq).ToList();//不能像之前一样过滤掉,否则下一个电缆进来时,总数就不对了。
// TS.ChannelsSpared = notUsedChs.Count;
// TS.ChannelsUsed = usedChs.Count;
// availableTS.Add(TS);//所有5%以上空闲通道的模块
// break;
// }
// }
// #endregion
// #region NewTS
// if (availableTS.Count() == 0)
// {
// //1.2 流程图 根据信号数里自动新建端子排,端子排通道数里根据箱子模板中的默认值获得
// var newTS = CreatePanelStripByProfile2(projId, cable.AssignedPanel, newTSSeq++, ioTypeOnC);
// //matchedStrips.Add(newTS);
// var allCh = newTS.Channels;
// notUsedChs = newTS.Channels.ToList();
// newTS.ChannelsSpared = notUsedChs.Count;
// newTS.ChannelsUsed = 0;
// usedChs = new List<ec_PanelChannelEntity>();//新建的没有被占用的
// availableTS.Add(newTS);
// if (notUsedChs.Count < sets.Count)
// {
// //case1能顺利接完set还有多
// //这种时候不需要考虑spared
// }
// else
// {
// //case2,占满可用通道后或者没占满通道预分配set已经没了只剩下spared的set
// //想办法留出4个
// //这种时候要确保spared也能放下
// if (notUsedChs.Count < sets.Count + setsSpared.Count)
// {
// //放不下,换下一个模块
// continue;
// }
// var sparedSetFor10 = notUsedChs.Count - sets.Count - setsSpared.Count;//16-9-5=2
// if (sparedSetFor10 > 4)
// {
// //固定流出后面4个相当于不要了
// var last4 = allCh.Skip(allCh.Count - 4).ToList();
// usedChs = allCh.Take(allCh.Count - 4).Where(x => allUsedCHBySignalOrSet.Contains(x.ChannelID) || x.lock_flg == 1).ToList();
// usedChs.AddRange(last4);
// notUsedChs = allCh.Take(allCh.Count - 4).Where(x => !usedChs.Select(c => c.ChannelID).Contains(x.ChannelID)).ToList();
// }
// else
// {
// //不够4个就留多少是多少
// var lastN = allCh.Skip(allCh.Count - sparedSetFor10).ToList();
// usedChs = allCh.Take(allCh.Count - sparedSetFor10).Where(x => allUsedCHBySignalOrSet.Contains(x.ChannelID) || x.lock_flg == 1).ToList();
// usedChs.AddRange(lastN);
// notUsedChs = allCh.Take(allCh.Count - sparedSetFor10).Where(x => !usedChs.Select(c => c.ChannelID).Contains(x.ChannelID)).ToList();
// }
// }
// }
// #endregion
// lastUsedStrip = availableTS.Last();
// if (notUsedChs.Count < sets.Count)
// {
// //case1分配完后还有多的set和可能的spared
// //先这部分填完
// //到5%为止的数量
// var countOnThisTS = Math.Round(0.5 + notUsedChs.Count * 0.95);
// for (int i = 0; i < countOnThisTS; i++)
// {
// var set = sets[i];
// var ch = notUsedChs[i];
// if (lastUsedStrip.TagNumber == "CreatePanelStripByProfile2")
// {
// set.ConnectionInfo = $"采集箱:{PanelName}/模块(端子排)(自动创建){lastUsedStrip.StripName}/通道:{ch.ChannelName}";
// }
// else
// {
// set.ConnectionInfo = $"采集箱:{PanelName}/模块(端子排)(原本存在){lastUsedStrip.StripName}/通道:{ch.ChannelName}";
// }
// ch.FakeGroupDesc = set.PreAssignGroup_Desc;
// ch.FakeSignalType = set.IOType.ToString();
// ch.lock_flg = 1;
// set.IsConned = true;
// //更新全局已使用通道
// allUsedCHBySignalOrSet.Add(ch.ChannelID);
// }
// //set会剩
// NeedNextTS = true;
// }
// else
// {
// //case2分配完后没有多的set了可能还有spared
// //上面已经判断过了确保spared也是够的
// var countMin = Math.Min(sets.Count, notUsedChs.Count);
// for (int i = 0; i < countMin; i++)
// {
// var set = sets[i];
// var ch = notUsedChs[i];
// if (lastUsedStrip.TagNumber == "CreatePanelStripByProfile2")
// {
// set.ConnectionInfo = $"采集箱:{PanelName}/模块(端子排)(自动创建){lastUsedStrip.StripName}/通道:{ch.ChannelName}";
// }
// else
// {
// set.ConnectionInfo = $"采集箱:{PanelName}/模块(端子排)(原本存在){lastUsedStrip.StripName}/通道:{ch.ChannelName}";
// }
// ch.FakeGroupDesc = set.PreAssignGroup_Desc;
// ch.FakeSignalType = set.IOType.ToString();
// ch.lock_flg = 1;
// set.IsConned = true;
// //更新全局已使用通道
// allUsedCHBySignalOrSet.Add(ch.ChannelID);
// }
// #region spared
// for (int i = 0; i < setsSpared.Count(); i++)
// {
// var set = setsSpared[i];
// var ch = notUsedChs[countMin + i];
// if (lastUsedStrip.TagNumber == "CreatePanelStripByProfile2")
// {
// set.ConnectionInfo = $"采集箱:{PanelName}/模块(端子排)(自动创建){lastUsedStrip.StripName}/通道:{ch.ChannelName}/冗余";
// }
// else
// {
// set.ConnectionInfo = $"采集箱:{PanelName}/模块(端子排)(原本存在){lastUsedStrip.StripName}/通道:{ch.ChannelName}/冗余";
// }
// ch.FakeGroupDesc = "预留";
// ch.lock_flg = 1;
// //更新全局已使用通道
// allUsedCHBySignalOrSet.Add(ch.ChannelID);
// }
// NeedNextTS = false;
// #endregion
// }
// sets = sets.Where(x => !x.IsConned).ToList();//移除已经分配过的set
// } while (NeedNextTS);
// #endregion
//}
//else
//{
//5%的空白通道
#region FindNextAvailableTS
//还分2种情况判断模块是否符合
//case1. 占满可用通道后还剩至少一个预分配的set和spared的set。 //这种时候要spared不用考虑
//case2. 占满可用通道后或者没占满通道预分配set已经没了只剩下spared的set。 //这种时候要确保spared也能放下
//case3, 刚好只有spared可能多
bool NeedNextTS = false;
#region FindNextAvailableTS
int idx = 0;
while (idx < matchedStrips.Count)
{
NeedNextTS = false;
var TS = matchedStrips[idx];
var allCh = TS.Channels;
var allChCount = allCh.Count;
if (allChCount == 0)
{
NeedNextTS = true;
//同时又是最后一个了
if (idx == matchedStrips.Count - 1)
{
var newTS = CreatePanelStripByProfile2(projId, cable.AssignedPanel, newTSSeq++, ioTypeOnC);
if (newTS.Channels.Count() < setsSpared.Count + 1)//1代表至少要放一个set
{
//有问题了 panel的io模板估计会导致无限循环了
break;
}
matchedStrips.Add(newTS);
}
idx++; continue;//本模块没有一个ch
}
//被占用的(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();
var ChNeedConn = 0;
var SparedNeedConn = 0;
if (cable.CableClass.ToLower() == SWS.Share.Enum.cableClass.homerun.ToString())
{
//1.2.32如果模块是通讯信号像RS485这种就是通讯信号则不用管预留空白通道这个事情看到有空的通道就放。
if (allChCount < sets.Count)
{
//case1能顺利接完set还有多,还要再do循环一次,多余的set和spared都要放到下一个模块
NeedNextTS = true;
ChNeedConn = allChCount; SparedNeedConn = 0;
}
else if (allChCount == sets.Count)
{
//case3,刚好只有spared可能多
ChNeedConn = allChCount;
SparedNeedConn = 0; //homerun不用考虑预留一个set去配合后续的spared
}
else
{
ChNeedConn = sets.Count;
SparedNeedConn = 0;
}
}
else
{
//1.2 流程图 空的通道数够不够
double sparedRate = notUsedChs.Count * 1.0 / allChCount * 1.0;
if (sparedRate < 0.05)
{
NeedNextTS = true;
//同时又是最后一个了
if (idx == matchedStrips.Count - 1)
{
var newTS = CreatePanelStripByProfile2(projId, cable.AssignedPanel, newTSSeq++, ioTypeOnC);
if (newTS.Channels.Count() < setsSpared.Count + 1)//1代表至少要放一个set
{
//有问题了 panel的io模板估计会导致无限循环了
break;
}
matchedStrips.Add(newTS);
}
idx++; continue;//本模块可用的模块小于5%
}
//没有空闲通道 next
//或者空闲通道不够放下这个电缆的所有set
//算一下5%是多少个通道
var trueAvailableChs = notUsedChs.Count - (allChCount - FindMaxNumberChannel(allChCount));//真正能用的没接过的然后去掉5%
if (trueAvailableChs < sets.Count)
{
//case1能顺利接完set还有多,还要再do循环一次,多余的set和spared都要放到下一个模块
NeedNextTS = true;
ChNeedConn = trueAvailableChs; SparedNeedConn = 0;
}
else if (trueAvailableChs == sets.Count)
{
//case3,刚好只有spared可能多
if (setsSpared.Count > 0)
{
//自己的感觉非客户word需求里的原话spared不能自己单独占用一个模块
NeedNextTS = true;
ChNeedConn = trueAvailableChs - 1;//留一个给spared
SparedNeedConn = 0;
}
else
{
ChNeedConn = trueAvailableChs; SparedNeedConn = 0;
}
}
else
{
//maxCh > sets.Count
//case2,占满可用通道后或者没占满通道预分配set已经没了只剩下spared的set
if (setsSpared.Count == 0)
{
//ok
ChNeedConn = sets.Count; SparedNeedConn = 0;
}
//这种时候要确保spared也能放下
else if (trueAvailableChs < sets.Count + setsSpared.Count)
{
//自己的感觉非客户word需求里的原话spared不能自己单独占用一个模块
ChNeedConn = sets.Count - 1;//留一个给spared
NeedNextTS = true;
SparedNeedConn = 0;
}
else
{
//ok,set和spared都能放下
ChNeedConn = sets.Count;
SparedNeedConn = setsSpared.Count;
}
}
}
//到这里,说明本模块至少都是可用的
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];
if (lastUsedStrip.TagNumber == "CreatePanelStripByProfile2")
{
set.ConnectionInfo = $"采集箱:{PanelName}/模块(端子排)(自动创建){lastUsedStrip.StripName}/通道:{ch.ChannelName}";
}
else
{
set.ConnectionInfo = $"采集箱:{PanelName}/模块(端子排)(原本存在){lastUsedStrip.StripName}/通道:{ch.ChannelName}";
}
ch.FakeGroupDesc = set.PreAssignGroup_Desc;
ch.FakeSignalType = set.IOType.ToString();
ch.lock_flg = 1;
set.IsConned = true;
//更新全局已使用通道
allUsedCHBySignalOrSet.Add(ch.ChannelID);
}
#endregion
#region spared
for (int i = 0; i < SparedNeedConn; i++)
{
var set = setsSpared[i];
var ch = notUsedChs[ChNeedConn + i];
if (lastUsedStrip.TagNumber == "CreatePanelStripByProfile2")
{
set.ConnectionInfo = $"采集箱:{PanelName}/模块(端子排)(自动创建){lastUsedStrip.StripName}/通道:{ch.ChannelName}/冗余";
}
else
{
set.ConnectionInfo = $"采集箱:{PanelName}/模块(端子排)(原本存在){lastUsedStrip.StripName}/通道:{ch.ChannelName}/冗余";
}
ch.lock_flg = 1;
//更新全局已使用通道
allUsedCHBySignalOrSet.Add(ch.ChannelID);
}
#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());
if (NeedNextTS)
{
sets = sets.Where(x => !x.IsConned ?? false).ToList();//移除已经分配过的set
//同时又是最后一个了
if (idx == matchedStrips.Count - 1)
{
var newTS = CreatePanelStripByProfile2(projId, cable.AssignedPanel, newTSSeq++, ioTypeOnC);
if (newTS.Channels.Count() < setsSpared.Count + 1)//1代表至少要放一个set
{
//有问题了 panel的io模板估计会导致无限循环了
break;
}
matchedStrips.Add(newTS);
}
idx++; continue;// 需要下一个模块接着放本电缆
// 手动递增索引,避免无限循环
}
else
{
break;
}
}
#endregion
#endregion
//}
#endregion
return true;
}
}
}
return Success(cablesNeedAssigned);
}
/// <summary>
/// 找到满足5%空闲通道的最大数
/// </summary>
/// <param name="ChCount">模块的所有通道数</param>
/// <returns></returns>
/// <exception cref="ArgumentException"></exception>
/// <exception cref="InvalidOperationException"></exception>
static int FindMaxNumberChannel(int ChCount)
{
if (ChCount < 1)
{
throw new ArgumentException("模块数量必须大于等于1", nameof(ChCount));
}
// 从A-1开始向下寻找
for (int i = 0; i < ChCount; i++)
{
// 检查是否大于5%
if ((double)i / ChCount < 0.05 && (double)(i + 1) / ChCount > 0.05)
{
return ChCount - i;
}
}
return ChCount;
}
/// <summary>
/// 根据step2的预分配结果进行实际的分配修改数据库。
@ -732,9 +1453,8 @@ namespace Learun.Application.Web.AppApi
}
}
/// <summary>
/// 通过预设模式,批量创建端子排 通道 端子
/// 通过预设模式,批量创建端子排 通道 端子。此时strip数里 set数里已经根据profile给定好了。
/// </summary>
/// <param name="entity"></param>
/// <param name="projId"></param>
[HttpPost]
[HandlerApiLogin(FilterMode.Enforce)]

View File

@ -630,12 +630,19 @@ namespace Learun.Application.Web.AppApi
//每个位号的属性信息
foreach (var tag in objectType.tags)
{
if (!string.IsNullOrEmpty(tag.CreateUserID))
{
if (userDict.TryGetValue(tag.CreateUserID, out string createUserName))
{
tag.CreateUserName = createUserName;// allUser.FirstOrDefault(x => x.F_UserId == item.CreateUserID)?.F_RealName;
}
}
else
{
tag.CreateUserName = string.Empty;
}
tag.EngineDataProperty = tagPropDictByTag[tag.EngineDataID];// tagPropAll.Where(x => x.EngineDataID == tag.EngineDataID).ToList();
tag.ObjectTypeName = objectType.ObjectTypeName;

View File

@ -61,11 +61,17 @@ namespace Learun.Application.Web.AppApi
{
return Fail("项目数据字典中,没有找到【肋位号】的下拉项中。");// 或者 无法从数据字典中找到对应的那个下拉
}
ec_dataitemBLL ec_DataitemBLL = new ec_dataitemBLL();
var roomLists = ec_DataitemBLL.GetDetailList("RoomNo", "", ProjectId, false);
if (roomLists == null)
{
return Fail("项目数据字典中,没有找到【房间号】的下拉项中。");// 或者 无法从数据字典中找到对应的那个下拉
}
#endregion
var pointsOnDwg = SqlSugarHelper.Db.Queryable<ec_enginedata_pixelEntity>().AS(pixelTbName).
Where(x => x.DrawingFileID == drawingId).ToList();
Where(x => x.DrawingFileID == drawingId && x.DeleteFlg==0).ToList();
var pointTags = SqlSugarHelper.Db.Queryable<ec_enginedataEntity>().AS(tagTbName).
Where(x => pointsOnDwg.Select(y => y.EngineDataID).Distinct().Contains(x.EngineDataID)
&& x.ObjectTypeID == pointType.ObjectTypeID).ToList();
@ -85,10 +91,17 @@ namespace Learun.Application.Web.AppApi
{
Prop_Frame = Prop_Frame.Split(new string[] { GlobalObject.enum_separator }, StringSplitOptions.None)[0];//插件端对于下拉列表 都是 name || nameEN
}
var Prop_Room = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_Room)?.PropertyValue;
if (Prop_Room != null)
{
Prop_Room = Prop_Room.Split(new string[] { GlobalObject.enum_separator }, StringSplitOptions.None)[0];//插件端对于下拉列表 都是 name || nameEN
}
var matchedFrame = frameLists.FirstOrDefault(X => X.Num == Prop_Frame);
if (matchedFrame == null)
var matchedRoom = roomLists.FirstOrDefault(X => X.DataItemName == Prop_Room);
if (matchedFrame == null && matchedRoom == null)
{
//没有
//无效的基点
@ -104,12 +117,22 @@ namespace Learun.Application.Web.AppApi
res.Add(layoutTagInvalid);
continue;
}
var xValue = frameLists.FirstOrDefault(X => X.Num == Prop_Frame).Value;
double xValue = 0 ;
if (matchedFrame != null)
{
xValue = frameLists.FirstOrDefault(X => X.Num == Prop_Frame).Value;
if (xValue < 400)
{
// 小于400我几乎可以认为此时肋位号用的是m这个单位。因为如果用的是mm400mm的肋位号似乎也太小了。
xValue = 1000 * xValue; // 转成mm
}
}
string strRoom = string.Empty;
if (matchedRoom != null)
{
strRoom = matchedRoom.DataItemName;
}
var Prop_FrameOff = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_FrameOff)?.PropertyValue;
var Prop_YOff = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_YOff)?.PropertyValue;
var DECK = tagProps.FirstOrDefault(x => x.PropertyName == "甲板号")?.PropertyValue;
@ -128,9 +151,10 @@ namespace Learun.Application.Web.AppApi
YOff = Prop_YOff,
deck = DECK,
area = AREA,
Scale = BasePointProp_scale == null ? 1 : (double.TryParse(BasePointProp_scale.PropertyValue, out double scale) ? scale : 1)
Scale = BasePointProp_scale == null ? 1 : (double.TryParse(BasePointProp_scale.PropertyValue, out double scale) ? scale : 1),
RoomNo = strRoom
};
layoutTag.Scale = 1.0 / layoutTag.Scale; // 这里的比例是放大多少倍,所以取倒数。
@ -138,12 +162,12 @@ namespace Learun.Application.Web.AppApi
}
// 找出area和deck列组合重复的行
var duplicateGroups = res
.GroupBy(r => new { r.area, r.deck })
.GroupBy(r => new { r.area, r.deck, r.RoomNo })
.Where(g => g.Count() > 1)
.ToList();
if (duplicateGroups.Any())
{
return Fail("该图纸上有区域和甲板信息重复的基点存在。");
return Fail("该图纸上有甲板、房间号信息重复的基点存在。");
}
//这里要考虑下拉列表 带 ||的问题
@ -181,7 +205,7 @@ namespace Learun.Application.Web.AppApi
{
#region
//甲板 区域都和基点一致的设备
var DeckMatchedTagIds = EquipPropAll.Where(x => x.PropertyName == "甲板号" && x.PropertyValue == basePoint.deck).Select(X => X.EngineDataID).ToList();
var DeckMatchedTagIds = EquipPropAll.Where(x => x.PropertyName == "甲板号" && (x.PropertyValue?.Split(new[] { "||" }, StringSplitOptions.None)[0] == basePoint.deck)).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();
@ -195,8 +219,14 @@ namespace Learun.Application.Web.AppApi
{
Prop_Frame = Prop_Frame.Split(new string[] { GlobalObject.enum_separator }, StringSplitOptions.None)[0];//插件端对于下拉列表 都是 name || nameEN
}
var Prop_RoomNo = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_Room)?.PropertyValue;
if (Prop_RoomNo != null)
{
Prop_RoomNo = Prop_RoomNo.Split(new string[] { GlobalObject.enum_separator }, StringSplitOptions.None)[0];//插件端对于下拉列表 都是 name || nameEN
}
var matchedFrame = frameLists.FirstOrDefault(X => X.Num == Prop_Frame);
if (matchedFrame == null)
var matchedRoom = roomLists.FirstOrDefault(x => x.DataItemName == Prop_RoomNo);
if (matchedFrame == null && matchedRoom == null)
{
var layoutTagInfoInvalid = new layoutTagInfoBrief()
{
@ -208,12 +238,21 @@ namespace Learun.Application.Web.AppApi
basePoint.Tags.Add(layoutTagInfoInvalid);
continue;
}
var xValue = frameLists.FirstOrDefault(X => X.Num == Prop_Frame).Value;
double xValue = 0;
if (matchedFrame != null)
{
xValue = frameLists.FirstOrDefault(X => X.Num == Prop_Frame).Value;
if (xValue < 400)
{
// 小于400我几乎可以认为此时肋位号用的是m这个单位。因为如果用的是mm400mm的肋位号似乎也太小了。
xValue = 1000 * xValue; // 转成mm
}
}
string strRoom = string.Empty;
if (matchedRoom != null)
{
strRoom = matchedRoom.DataItemName;
}
var Prop_FrameOff = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_FrameOff)?.PropertyValue;
var Prop_YOff = tagProps.FirstOrDefault(x => x.PropertyName == GlobalObject.propName_YOff)?.PropertyValue;
@ -309,7 +348,8 @@ namespace Learun.Application.Web.AppApi
YOff = Prop_YOff,
deck = basePoint.deck,
area = basePoint.area,
Scale = basePoint.Scale
Scale = basePoint.Scale,
RoomNo = strRoom
};
basePoint.Tags.Add(layoutTagInfo);
}

View File

@ -80,6 +80,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
public const string propName_FrameOff = "肋位号偏移量(mm)";
public const string propName_YOff = "纵骨偏移量(mm)";
public const string propName_TagNumber = "TagNumber";
public const string propName_Room = "房间号";
#endregion
#region projSetting

View File

@ -1,4 +1,5 @@
using DocumentFormat.OpenXml.Drawing.Spreadsheet;
using DocumentFormat.OpenXml.Spreadsheet;
using Learun.Util;
using Learun.Util.SqlSugar;
using SqlSugar;
@ -7,6 +8,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Data;
using System.Linq;
using System.Windows;
namespace Learun.Application.TwoDevelopment.ZZDT_EC
{
@ -307,77 +309,34 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
cable.ToPanel = panelObj;//暂用一下topanel属性相当于电缆预分配的采集箱背后的Panel对象。
cable.AssignedPanel = panelObj;
var IOsOnPanel = panelObj.allowedIOTypes.Split(',').ToList();
//剩下的感觉都可以是set上的参数
foreach (var set in sets)
{
#region io匹配程度
if (set.PreAssignInOrOut == GlobalEnum.inOrOut..ToString() && cable.PreAssignIOType.ToLower() == "digital")
{
set.IOType = GlobalEnum.IOType.DI;
}
else if (set.PreAssignInOrOut == GlobalEnum.inOrOut..ToString() && cable.PreAssignIOType.ToLower() == "digital")
{
set.IOType = GlobalEnum.IOType.DO;
}
else if (set.PreAssignInOrOut == GlobalEnum.inOrOut..ToString() && cable.PreAssignIOType == "4~20mA")
{
set.IOType = GlobalEnum.IOType.AI;
}
else if (set.PreAssignInOrOut == GlobalEnum.inOrOut..ToString() && cable.PreAssignIOType == "4~20mA")
{
set.IOType = GlobalEnum.IOType.AO;
}
else if (cable.PreAssignIOType == "10v")
{
set.IOType = GlobalEnum.IOType.TenVolt;
}
else if (cable.PreAssignIOType == GlobalEnum.signalType.PT100.ToString())
{
set.IOType = GlobalEnum.IOType.PT100;
}
else if (cable.PreAssignIOType.ToUpper() == GlobalEnum.signalType.PULSE.ToString())
{
set.IOType = GlobalEnum.IOType.PULSE;
}
else if (cable.PreAssignIOType == GlobalEnum.signalType.PT100.ToString())
{
set.IOType = GlobalEnum.IOType.PT100;
}
//下面是通讯的
else
{
var setNew = SetIOMatchPanel(cable.PreAssignIOType, set, IOsOnPanel);
}
if (IOsOnPanel.Contains(set.IOType.ToString()))
if (IOsOnPanel.Contains(setNew.IOType.ToString()))
{
set.IOTypeMatch = true;
setNew.IOTypeMatch = true;
}
else
{
set.IOTypeMatch = false;
cable.IOTypesNotMatchedList.Add(set.IOType.ToString());//从电缆上就能知道哪些io是匹配补上的
setNew.IOTypeMatch = false;
cable.IOTypesNotMatchedList.Add(setNew.IOType.ToString());//从电缆上就能知道哪些io是匹配补上的
}
#endregion
var wires = Wires.Where(x => x.CableSetID == set.CableSetID);
set.Wires = wires.ToList();
var wires = Wires.Where(x => x.CableSetID == setNew.CableSetID);
setNew.Wires = wires.ToList();
cable.Sets.Add(setNew);
}
cable.Sets = sets;
//if (cable.Sets.Any(x => !x.IOTypeMatch))
//{
// cable.IOTypeMatch = true;
//}
//else
//{
// cable.IOTypeMatch = false;
//}
//cable.Sets = sets;
}
//分组
//排序
preAssignedCables = preAssignedCables.OrderBy(x => x.PreAssignIOType).ToList();
@ -397,7 +356,59 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
else { ec_CableService.DeleteEntity(ProjectId, CableID); }
}
/// <summary>
/// 预分配的电缆上的io是否和电缆上的io能匹配
/// </summary>
/// <returns></returns>
public static ec_CableSetEntity SetIOMatchPanel(string signalOnCable, ec_CableSetEntity set, List<string> IOsOnPanel)
{
//var IOsOnPanel = panelObj.allowedIOTypes.Split(',').ToList();
//剩下的感觉都可以是set上的参数
#region io匹配程度
if (set.PreAssignInOrOut == GlobalEnum.inOrOut..ToString() && signalOnCable.ToLower() == "digital")
{
set.IOType = GlobalEnum.IOType.DI;
}
else if (set.PreAssignInOrOut == GlobalEnum.inOrOut..ToString() && signalOnCable.ToLower() == "digital")
{
set.IOType = GlobalEnum.IOType.DO;
}
else if (set.PreAssignInOrOut == GlobalEnum.inOrOut..ToString() && signalOnCable == "4~20mA")
{
set.IOType = GlobalEnum.IOType.AI;
}
else if (set.PreAssignInOrOut == GlobalEnum.inOrOut..ToString() && signalOnCable == "4~20mA")
{
set.IOType = GlobalEnum.IOType.AO;
}
else if (signalOnCable == "10v")
{
set.IOType = GlobalEnum.IOType.TenVolt;
}
else if (signalOnCable == GlobalEnum.signalType.PT100.ToString())
{
set.IOType = GlobalEnum.IOType.PT100;
}
else if (signalOnCable.ToUpper() == GlobalEnum.signalType.PULSE.ToString())
{
set.IOType = GlobalEnum.IOType.PULSE;
}
else if (signalOnCable == GlobalEnum.signalType.PT100.ToString())
{
set.IOType = GlobalEnum.IOType.PT100;
}
//下面是通讯的
else
{
}
#endregion
return set;
}
/// <summary>
/// 保存实体数据(新增、修改)
/// <param name="keyValue">主键</param>

View File

@ -87,6 +87,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
}
/// <summary>
/// 编辑调用
/// </summary>
@ -109,7 +110,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
///
/// </summary>
[SugarColumn(IsIgnore = true)]
public List<ec_CableSetEntity> Sets { set; get; }
public List<ec_CableSetEntity> Sets { set; get; } = new List<ec_CableSetEntity>();
/// <summary>
/// 平行电缆数据
@ -147,12 +148,15 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
/// <summary>
/// From连接处的工程位号信息。同时也表达下预分配电缆panelid对应的柜子信息。
/// From连接处的工程位号信息。
/// </summary>
[SugarColumn(IsIgnore = true)]
public ec_PanelEntity ToPanel { set; get; }
/// <summary>
/// 根据<see cref="PanelID"/>算出来的实际分配的箱子当然也能和panelid不同而是就近的另外一个采集箱
/// </summary>
[SugarColumn(IsIgnore = true)]
public ec_PanelEntity AssignedPanel { set; get; }
#endregion
}
}

View File

@ -148,7 +148,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
/// 是否被连接
/// </summary>
[SugarColumn(IsIgnore = true)]
public bool? IsConned { set; get; }
public bool? IsConned { set; get; } = false;
/// <summary>
/// 当前这个set的连接情况
@ -169,7 +169,6 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
public ec_CableSetEntity()
{
IsConned = null;
}
}
}

View File

@ -986,7 +986,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
#region
var resourcePixelList = ec_enginedata_pixelService.GetList("{ProjectId:\"" + item.ProjectId + "\",DrawingFileID:\"" + item.DrawingFileID + "\"}",ProjectId).ToList();
var resourcePixelList = ec_enginedata_pixelService.GetList("{ProjectId:\"" + item.ProjectId + "\",DrawingFileID:\"" + item.DrawingFileID + "\"}", item.ProjectId).ToList();
if (resourcePixelList != null && resourcePixelList.Count() > 0)//不包含deleteflg的
{
//获取拷贝图纸所有的工程数据ID

View File

@ -59,6 +59,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
/// 基点从属的、或者说附近的设备位号
/// </summary>
public List<layoutTagInfoBrief> Tags { get; set; } = new List<layoutTagInfoBrief>();
public string RoomNo { get; set; }
#endregion

View File

@ -117,7 +117,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
this.ChannelID = Guid.NewGuid().ToString();
this.CreateTime = Time.MySqlTime;
UserInfo userInfo = LoginUserInfo.Get();
this.CreateUserID = userInfo.userId;
this.CreateUserID = userInfo?.userId;
}

View File

@ -73,7 +73,7 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
this.StripID = Guid.NewGuid().ToString();
this.CreateTime = Time.MySqlTime;
UserInfo userInfo = LoginUserInfo.Get();
this.CreateUserID = userInfo.userId;
this.CreateUserID = userInfo?.userId;
}
@ -96,15 +96,23 @@ namespace Learun.Application.TwoDevelopment.ZZDT_EC
/// </summary>
[SugarColumn(IsIgnore = true)]
public List<ec_PanelChannelEntity> Channels { set; get; } = new List<ec_PanelChannelEntity>();
/// <summary>
/// channel在<see cref="ec_WireTerminalEntity"/>里有,同时<see cref="ec_Wire_GroupEntity.ChannelID"/>也有
/// </summary>
[SugarColumn(IsIgnore = true)]
public int ChannelsUsed { set; get; } = 0;
/// <summary>
/// channel在<see cref="ec_WireTerminalEntity"/>里有,但是没有信号
/// </summary>
[SugarColumn(IsIgnore = true)]
public int ChannelsUsedNoSignal { set; get; } = 0;
/// <summary>
/// channel在<see cref="ec_WireTerminalEntity"/>里没有
/// </summary>
[SugarColumn(IsIgnore = true)]
public int ChannelsSpared { set; get; } = 0;
[SugarColumn(IsIgnore = true)]
public string TagNumber { set; get; }

View File

@ -1,5 +1,5 @@

FD:\陈进步\项目\009\SWSDBSchemeUpgradeTool\MainWindow.xaml;;
FD:\陈进步\项目\009\SWSDBSchemeUpgradeTool\SQLPreview.xaml;;
FE:\Di-Electrical\SWSDBSchemeUpgradeTool\MainWindow.xaml;;
FE:\Di-Electrical\SWSDBSchemeUpgradeTool\SQLPreview.xaml;;

View File

@ -5,6 +5,7 @@ using Bricscad.Global;
using SWS.CAD.CADFunc.Editor;
using SWS.CAD.Helper;
using SWS.CAD.Views.CustomControl;
using SWS.Commons;
using System;
using System.Collections.Generic;
using System.Drawing;

View File

@ -181,12 +181,8 @@
<Compile Include="Helper\Converter\RadGridViewRowToBoolConverter.cs" />
<Compile Include="Helper\Converter\StatusToColourConverter.cs" />
<Compile Include="Helper\Converter\YesNotConverter.cs" />
<Compile Include="Helper\FileHelper.cs" />
<Compile Include="Helper\Behavior\PasswordHelper.cs" />
<Compile Include="Helper\TreeHelper.cs" />
<Compile Include="Start.cs" />
<Compile Include="GlobalObje.cs" />
<Compile Include="Helper\LoggerHelper.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ViewModels\CheckInApproveViewModel.cs" />
<Compile Include="ViewModels\DialogCableConnectionVM\DialogCableConnection_NewStripViewModel.cs" />
@ -534,11 +530,17 @@
<Project>{51cb6f5b-16e9-4ee0-baa4-144dd1ec8580}</Project>
<Name>SWS.Service</Name>
</ProjectReference>
<ProjectReference Include="..\SWS.Share\SWS.Share.csproj">
<Project>{87E71797-E60A-4637-BA32-C8B57154ABC3}</Project>
<Name>SWS.Share</Name>
</ProjectReference>
<ProjectReference Include="..\SWS.WPF\SWS.WPF.csproj">
<Project>{7aff9117-78e7-4395-9f23-6dcfe09f9299}</Project>
<Name>SWS.WPF</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Folder Include="Helper\Behavior\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -53,7 +53,7 @@ namespace SWS.CAD.ViewModels
}
private List<ec_Cable> CablePreAssigns;
public async void OnDialogOpened(IDialogParameters parameters)
public void OnDialogOpened(IDialogParameters parameters)
{
//title = parameters.GetValue<string>(GlobalObject.dialogPar.title.ToString());
title = "待分配的信号预览和统计";
@ -128,7 +128,7 @@ namespace SWS.CAD.ViewModels
IDialogParameters para = new Prism.Services.Dialogs.DialogParameters();
para.Add(GlobalObject.dialogPar.para1.ToString(), PreAssignCables);
var _dialogService = GlobalObject._prismContainer.Resolve<IDialogService>();
_dialogService.ShowDialog(nameof(DialogCablePreAssignResult), para, async (RES) =>
_dialogService.ShowDialog(nameof(DialogCablePreAssignResult), para, (RES) =>
{
if (RES.Result == ButtonResult.Yes)
{
@ -182,7 +182,7 @@ namespace SWS.CAD.ViewModels
/// 页面左侧按钮
/// </summary>
/// <param name="parameter"></param>
public virtual async void Button_Click(object parameter)
public virtual void Button_Click(object parameter)
{
if (parameter.ToString().Equals("全选"))
{
@ -288,7 +288,7 @@ namespace SWS.CAD.ViewModels
TagNumber = ec_Cable.TagNumber;
PreAssignIOType = ec_Cable.PreAssignIOType;
CableClass = ec_Cable.CableClass.Equals("homerun") ? "是" : "否";
ToPanel_TagNumber = ec_Cable.ToPanel != null ? ec_Cable.ToPanel.TagNumber : null;
ToPanel_TagNumber = ec_Cable.AssignedPanel != null ? ec_Cable.AssignedPanel.TagNumber : null;
}
#endregion

View File

@ -108,6 +108,7 @@ namespace SWS.CAD.ViewModels
public override async void ExecuteOKCommandAsync(object para)
{
//只传入分配成功的电缆
var Cables = new List<ec_Cable>();
if (AllPreAssignCables != null)
{
@ -153,7 +154,7 @@ namespace SWS.CAD.ViewModels
{
foreach (var PreAssignCable in AllPreAssignCables)
{
if (PreAssignCable.Sets != null && !string.IsNullOrEmpty(PreAssignCable.Sets.FirstOrDefault().ConnectionInfo))
if (PreAssignCable.AssignedPanel!=null)
{
PreAssignCables.Add(PreAssignCable);
}
@ -163,7 +164,7 @@ namespace SWS.CAD.ViewModels
{
foreach (var PreAssignCable in AllPreAssignCables)
{
if (PreAssignCable.Sets == null || string.IsNullOrEmpty(PreAssignCable.Sets.FirstOrDefault().ConnectionInfo))
if (PreAssignCable.AssignedPanel == null)
{
PreAssignCables.Add(PreAssignCable);
}
@ -179,14 +180,14 @@ namespace SWS.CAD.ViewModels
PreAllocationResultls = new ObservableCollection<PreAllocationResult>();
if (cable == null) return;
if (cable.Sets != null)
if (cable.AssignedPanel != null)
{
foreach (var Set in cable.Sets)
{
PreAllocationResult preAllocationResult = new PreAllocationResult();
preAllocationResult.CablePair = Set.CableSetName;
preAllocationResult.IOType = cable.PreAssignIOType;
preAllocationResult.ToPanel_TagNumber = cable.ToPanel == null ? "" : cable.ToPanel.TagNumber;
preAllocationResult.ToPanel_TagNumber = cable.AssignedPanel == null ? "" : cable.AssignedPanel.TagNumber;
preAllocationResult.Panel_TagNumber = string.IsNullOrEmpty(Set.ConnectionInfo) ? "" : Set.ConnectionInfo.Split('/')[0].Split('')[1].Trim();
preAllocationResult.StripName = string.IsNullOrEmpty(Set.ConnectionInfo) ? "" : Set.ConnectionInfo.Split('/')[1].Split('')[1].Trim();
preAllocationResult.Terms = new ObservableCollection<ec_PanelStripTerm>(Set.AssignedTerms);
@ -220,7 +221,9 @@ namespace SWS.CAD.ViewModels
public string CablePair
{
get { return _CablePair; }
set { _CablePair = value; }
set { _CablePair = value;
RaisePropertyChanged(nameof(CablePair));
}
}
private string _IOType;
@ -230,7 +233,9 @@ namespace SWS.CAD.ViewModels
public string IOType
{
get { return _IOType; }
set { _IOType = value; }
set { _IOType = value;
RaisePropertyChanged(nameof(IOType));
}
}
@ -241,7 +246,9 @@ namespace SWS.CAD.ViewModels
public string ToPanel_TagNumber
{
get { return _ToPanel_TagNumber; }
set { _ToPanel_TagNumber = value; }
set { _ToPanel_TagNumber = value;
RaisePropertyChanged(nameof(ToPanel_TagNumber));
}
}
private string _Panel_TagNumber;
@ -251,7 +258,9 @@ namespace SWS.CAD.ViewModels
public string Panel_TagNumber
{
get { return _Panel_TagNumber; }
set { _Panel_TagNumber = value; }
set { _Panel_TagNumber = value;
RaisePropertyChanged(nameof(Panel_TagNumber));
}
}
private string _StripName;
@ -261,7 +270,9 @@ namespace SWS.CAD.ViewModels
public string StripName
{
get { return _StripName; }
set { _StripName = value; }
set { _StripName = value;
RaisePropertyChanged(nameof(StripName));
}
}
private ObservableCollection<ec_PanelStripTerm> _Terms;
@ -271,7 +282,9 @@ namespace SWS.CAD.ViewModels
public ObservableCollection<ec_PanelStripTerm> Terms
{
get { return _Terms; }
set { _Terms = value; }
set { _Terms = value;
RaisePropertyChanged(nameof(Terms));
}
}

View File

@ -410,7 +410,7 @@ namespace SWS.CAD.ViewModels
#endregion
#region
private async void UpdateButtonEnabled()
private void UpdateButtonEnabled()
{
if (SelectedChannelInfo != null)
{
@ -2723,7 +2723,7 @@ namespace SWS.CAD.ViewModels
IDialogParameters para = new Prism.Services.Dialogs.DialogParameters();
para.Add(GlobalObject.dialogPar.para1.ToString(), PreAssignCables);
var _dialogService = GlobalObject._prismContainer.Resolve<IDialogService>();
_dialogService.ShowDialog(nameof(DialogCablePreAssignPreview), para, async (RES) =>
_dialogService.ShowDialog(nameof(DialogCablePreAssignPreview), para, (RES) =>
{
if (RES.Result == ButtonResult.Yes)
{

View File

@ -22,6 +22,9 @@ using Unity;
namespace SWS.CAD.ViewModels
{
/// <summary>
/// 信号预分配页面的模型类
/// </summary>
public class DialogSignalPredistributionViewModel : DialogBase, IDialogAware
{
#region

View File

@ -506,7 +506,7 @@ namespace SWS.CAD.ViewModels
foreach (var id in listObjectTypeId)
{
//获取节点
Model.TreeModel node = Helper.TreeHelper.GetTreeModel(GlobalObject.objectTypeTree, id);
Model.TreeModel node = TreeHelper.GetTreeModel(GlobalObject.objectTypeTree, id);
if (node != null)
{
var node1 = (Model.TreeModel)node.Clone();
@ -531,7 +531,7 @@ namespace SWS.CAD.ViewModels
GlobalObject.AllDwgName.Clear();
foreach (var dwg in Drawings)
{
Helper.TreeHelper.GetTreeText(dwg);
TreeHelper.GetTreeText(dwg);
}
#endregion
@ -1975,7 +1975,7 @@ namespace SWS.CAD.ViewModels
foreach (var dto in historyDrawingsTree)
{
//获取节点下的图纸
node = Helper.TreeHelper.GetTreeModel(dto, item.DrawingFileID);
node = TreeHelper.GetTreeModel(dto, item.DrawingFileID);
if (node != null)
{
break;
@ -2283,7 +2283,7 @@ namespace SWS.CAD.ViewModels
if (string.IsNullOrEmpty(strRecentObjectType))
{
//获取节点
Model.TreeModel node = Helper.TreeHelper.GetTreeModel(GlobalObject.objectTypeTree, selectType.ID);
Model.TreeModel node = TreeHelper.GetTreeModel(GlobalObject.objectTypeTree, selectType.ID);
var addNode = (Model.TreeModel)node.Clone();
var firstNode = objectTypeTree[0];
//UI添加到最近使用
@ -2304,7 +2304,7 @@ namespace SWS.CAD.ViewModels
}
listObjectTypeId.Insert(0, selectType.ID);
//获取节点
Model.TreeModel node = Helper.TreeHelper.GetTreeModel(GlobalObject.objectTypeTree, selectType.ID);
Model.TreeModel node = TreeHelper.GetTreeModel(GlobalObject.objectTypeTree, selectType.ID);
var addNode = (Model.TreeModel)node.Clone();
firstNode.ChildNodes.Insert(0, addNode);//UI添加到最近使用
ids = string.Join(",", listObjectTypeId);

View File

@ -254,7 +254,7 @@ namespace SWS.CAD.ViewModels
//所属系统下拉框
foreach (var item in dwgSystem)
{
var node = Helper.TreeHelper.GetTreeModel(item, dwgFile.DrawingSystem);
var node = TreeHelper.GetTreeModel(item, dwgFile.DrawingSystem);
if (node != null)
{
SelectedSystemItem = node;
@ -264,7 +264,7 @@ namespace SWS.CAD.ViewModels
//图纸目录下拉框
foreach (var item in dwgCatalogueID)
{
var node = Helper.TreeHelper.GetTreeModel(item, dwgFile.DrawingCatalogueID);
var node = TreeHelper.GetTreeModel(item, dwgFile.DrawingCatalogueID);
if (node != null)
{
SelectedCatalogueIDItem = node;
@ -476,7 +476,7 @@ namespace SWS.CAD.ViewModels
foreach (var catalogueId in tempCatalogueID)
{
//遍历获取当前节点数据
node = Helper.TreeHelper.GetTreeModel(catalogueId, dwgNode.ID);
node = TreeHelper.GetTreeModel(catalogueId, dwgNode.ID);
if (node != null)
{ break; }
}

View File

@ -92,6 +92,12 @@
ShowGroupPanel="False" telerik:StyleManager.Theme="Office_Blue"
ItemsSource="{Binding PreAllocationResultls}" SelectedItem="{Binding SelectedChannelInfo, Mode=TwoWay}"
>
<telerik:EventToCommandBehavior.EventBindings>
<telerik:EventBinding
Command="{Binding EditEndCmd}"
EventName="CellEditEnded"
PassEventArgsToCommand="True" />
</telerik:EventToCommandBehavior.EventBindings>
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="电缆对" DataMemberBinding="{Binding CablePair}" IsReadOnly="True"/>
<telerik:GridViewDataColumn Header="IO类型" DataMemberBinding="{Binding IOType}" IsReadOnly="True"/>

View File

@ -540,18 +540,18 @@
<telerik:RadPathButton PathGeometry="{telerik:RadGlyph Glyph=&#xe649;}"
ToolTip="端子排模版设置" Padding="0"
Command="{Binding HeadButtonCmd}" CommandParameter="{Binding ToolTip,RelativeSource={RelativeSource Self}}"/>
<telerik:RadButton Content="上移通道(L)" Command="{Binding TableButtonCmd}" CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}" Margin="5"/>
<telerik:RadButton Content="下移通道(D)" Command="{Binding TableButtonCmd}" CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}" Margin="5"/>
<telerik:RadButton Content="迁移通道(M)" Command="{Binding TableButtonCmd}" CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}" Margin="5"/>
<telerik:RadButton Content="锁定通道(L)" Command="{Binding TableButtonCmd}" CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}" Margin="5"/>
<telerik:RadButton Content="上移通道(L)" Width="auto" Style="{StaticResource sysBtn}" Command="{Binding TableButtonCmd}" CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}" Margin="5"/>
<telerik:RadButton Content="下移通道(D)" Width="auto" Style="{StaticResource sysBtn}" Command="{Binding TableButtonCmd}" CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}" Margin="5"/>
<telerik:RadButton Content="迁移通道(M)" Width="auto" Style="{StaticResource sysBtn}" Command="{Binding TableButtonCmd}" CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}" Margin="5"/>
<telerik:RadButton Content="锁定通道(L)" Width="auto" Style="{StaticResource sysBtn}" Command="{Binding TableButtonCmd}" CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}" Margin="5"/>
<telerik:RadButton Content="解锁通道(L)" Command="{Binding TableButtonCmd}" CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}" Margin="5"/>
<telerik:RadButton Content="关联信号" Command="{Binding TableButtonCmd}" CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}" IsEnabled="{Binding IsEnabledASButton}" Margin="5">
<telerik:RadButton Content="关联信号" Style="{StaticResource sysBtn}" Command="{Binding TableButtonCmd}" CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}" IsEnabled="{Binding IsEnabledASButton}" Margin="5">
</telerik:RadButton>
<telerik:RadButton Content="解除信号" Command="{Binding TableButtonCmd}" CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}" IsEnabled="{Binding IsEnabledClearButton}" Margin="5"/>
<telerik:RadButton Content="母线详情" Command="{Binding TableButtonCmd}" CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}" Margin="5"/>
<telerik:RadButton Content="批量分配" Command="{Binding TableButtonCmd}" CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}" Margin="5"/>
<telerik:RadButton Content="保存" HorizontalAlignment="Right" Width="50" Command="{Binding TableButtonCmd}" CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}" Margin="5,5,0,5"/>
<telerik:RadButton Content="批量分配" Style="{StaticResource sysBtn}" Command="{Binding TableButtonCmd}" CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}" Margin="5"/>
<telerik:RadButton Style="{StaticResource sysBtn}" Content="保存" HorizontalAlignment="Right" Width="50" Command="{Binding TableButtonCmd}" CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}" Margin="5,5,0,5"/>
</DockPanel>
<Border BorderThickness="0 0 0 1">
<TextBlock Text="通道详细信息" Foreground="White" />
@ -564,13 +564,19 @@
ShowGroupPanel="False" telerik:StyleManager.Theme="Office_Blue"
ItemsSource="{Binding ChannelInfos}" SelectedItem="{Binding SelectedChannelInfo, Mode=TwoWay}"
>
<telerik:EventToCommandBehavior.EventBindings>
<telerik:EventBinding
Command="{Binding EditEndCmd}"
EventName="CellEditEnded"
PassEventArgsToCommand="True" />
</telerik:EventToCommandBehavior.EventBindings>
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="序号" CellTemplate="{StaticResource CellTemplate1}" CellStyle="{StaticResource CellTyle1}" IsReadOnly="True"/>
<telerik:GridViewDataColumn Header="通道号" DataMemberBinding="{Binding ChannelNumber}"
IsCellMergingEnabled="True"/>
<telerik:GridViewDataColumn Header="端子号" CellTemplate="{StaticResource CellTemplate2}" CellEditTemplate="{StaticResource CellEditTemplate2}"/>
<telerik:GridViewDataColumn Header="占用人" DataMemberBinding="{Binding Occupant}" IsReadOnly="True"/>
<telerik:GridViewDataColumn Header="电缆位号" DataMemberBinding="{Binding CableTag}" IsReadOnly="True" Width="100">
<telerik:GridViewDataColumn Header="占用人" DataMemberBinding="{Binding Occupant}" IsReadOnly="True" Width="100" Background="#f0f0f0"/>
<telerik:GridViewDataColumn Header="电缆位号" DataMemberBinding="{Binding CableTag}" IsReadOnly="True" Width="100" Background="#f0f0f0">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding CableTag}"
@ -583,8 +589,8 @@
<telerik:GridViewDataColumn Header="电缆线号" CellTemplate="{StaticResource CellTemplate3}" CellEditTemplate="{StaticResource CellEditTemplate3}"/>
<telerik:GridViewDataColumn Header="极性" CellTemplate="{StaticResource CellTemplate4}" CellEditTemplate="{StaticResource CellEditTemplate4}"/>
<telerik:GridViewDataColumn Header="信号名称" DataMemberBinding="{Binding SignalName}"/>
<telerik:GridViewDataColumn Header="信号组别" DataMemberBinding="{Binding GroupOther}" IsReadOnly="True"/>
<telerik:GridViewDataColumn Header="信号编码" DataMemberBinding="{Binding SignalCode}" IsReadOnly="True"/>
<telerik:GridViewDataColumn Header="信号组别" DataMemberBinding="{Binding GroupOther}" IsReadOnly="True" Background="#f0f0f0"/>
<telerik:GridViewDataColumn Header="信号编码" DataMemberBinding="{Binding SignalCode}" IsReadOnly="True" Background="#f0f0f0"/>
<telerik:GridViewDataColumn Header="中文描述" DataMemberBinding="{Binding ChineseDescription}" Width="120">
<telerik:GridViewDataColumn.CellTemplate>
<DataTemplate>

View File

@ -0,0 +1,12 @@
<UserControl x:Class="SWS.CAD.Views.Dialog.DialogSectionBox"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:SWS.CAD.Views.Dialog"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Grid>
</Grid>
</UserControl>

View File

@ -0,0 +1,28 @@
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;
namespace SWS.CAD.Views.Dialog
{
/// <summary>
/// DialogSectionBox.xaml 的交互逻辑
/// </summary>
public partial class DialogSectionBox : UserControl
{
public DialogSectionBox()
{
InitializeComponent();
}
}
}

View File

@ -4,7 +4,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:local="clr-namespace:SWS.CAD.Views.CustomControl"
xmlns:local2="clr-namespace:SWS.CAD.Helper"
xmlns:local2="clr-namespace:SWS.Commons;assembly=SWS.Commons"
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
Width="300"
Height="250"

View File

@ -39,6 +39,10 @@
<Setter Property="Foreground" Value="Black" />
</DataTrigger>
<!-- 按钮禁用时 -->
<DataTrigger Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false">
<Setter Property="Foreground" Value="Black" />
</DataTrigger>
</Style.Triggers>
</Style>
<Style x:Key="sysBtn2" TargetType="Button">

View File

@ -130,6 +130,10 @@
<Project>{1995385b-d1b0-4c55-835e-d3e769972a6a}</Project>
<Name>SWS.Model</Name>
</ProjectReference>
<ProjectReference Include="..\SWS.Share\SWS.Share.csproj">
<Project>{87E71797-E60A-4637-BA32-C8B57154ABC3}</Project>
<Name>SWS.Share</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Images\OpenProject.png" />

View File

@ -1,159 +0,0 @@
#pragma checksum "..\..\..\Views\DialogAutoArrangeLayout.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "8E0302C7B31AF0BFE57DDCDA7BD9F7E1B53C3458B14B24E3C31D70FADF66C1B2"
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
using Microsoft.Xaml.Behaviors;
using Microsoft.Xaml.Behaviors.Core;
using Microsoft.Xaml.Behaviors.Input;
using Microsoft.Xaml.Behaviors.Layout;
using Microsoft.Xaml.Behaviors.Media;
using Prism.DryIoc;
using Prism.Interactivity;
using Prism.Ioc;
using Prism.Mvvm;
using Prism.Regions;
using Prism.Regions.Behaviors;
using Prism.Services.Dialogs;
using Prism.Unity;
using SWS.CustomControl;
using SWS.Electrical;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Effects;
using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Media.TextFormatting;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Shell;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.Animation;
using Telerik.Windows.Controls.Behaviors;
using Telerik.Windows.Controls.Carousel;
using Telerik.Windows.Controls.ComboBox;
using Telerik.Windows.Controls.Data.PropertyGrid;
using Telerik.Windows.Controls.DragDrop;
using Telerik.Windows.Controls.GridView;
using Telerik.Windows.Controls.LayoutControl;
using Telerik.Windows.Controls.Legend;
using Telerik.Windows.Controls.MultiColumnComboBox;
using Telerik.Windows.Controls.Primitives;
using Telerik.Windows.Controls.RadialMenu;
using Telerik.Windows.Controls.TransitionEffects;
using Telerik.Windows.Controls.TreeListView;
using Telerik.Windows.Controls.TreeView;
using Telerik.Windows.Controls.Wizard;
using Telerik.Windows.Data;
using Telerik.Windows.DragDrop;
using Telerik.Windows.DragDrop.Behaviors;
using Telerik.Windows.Input.Touch;
using Telerik.Windows.Shapes;
namespace SWS.Electrical.Views {
/// <summary>
/// DialogAutoArrangeLayout
/// </summary>
public partial class DialogAutoArrangeLayout : System.Windows.Controls.UserControl, System.Windows.Markup.IComponentConnector {
#line 122 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal SWS.CustomControl.customWindowTitleBar titleBar;
#line default
#line hidden
#line 245 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.DataGrid dgTag;
#line default
#line hidden
#line 351 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal System.Windows.Controls.DataGrid dgErrTag;
#line default
#line hidden
private bool _contentLoaded;
/// <summary>
/// InitializeComponent
/// </summary>
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/SWS.Electrical;component/views/dialogautoarrangelayout.xaml", System.UriKind.Relative);
#line 1 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);
#line default
#line hidden
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
this.titleBar = ((SWS.CustomControl.customWindowTitleBar)(target));
return;
case 2:
this.dgTag = ((System.Windows.Controls.DataGrid)(target));
#line 251 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
this.dgTag.LoadingRow += new System.EventHandler<System.Windows.Controls.DataGridRowEventArgs>(this.dgTag_LoadingRow);
#line default
#line hidden
return;
case 3:
this.dgErrTag = ((System.Windows.Controls.DataGrid)(target));
#line 357 "..\..\..\Views\DialogAutoArrangeLayout.xaml"
this.dgErrTag.LoadingRow += new System.EventHandler<System.Windows.Controls.DataGridRowEventArgs>(this.dgTag_LoadingRow);
#line default
#line hidden
return;
}
this._contentLoaded = true;
}
}
}

View File

@ -1,125 +0,0 @@
#pragma checksum "..\..\..\Views\DialogTest2.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "6D6B0D2E8B29B2F4DE2F7CF02D2382F69B7F06455C4BC9504C7F76B8C7D980B6"
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
using Microsoft.Xaml.Behaviors;
using Microsoft.Xaml.Behaviors.Core;
using Microsoft.Xaml.Behaviors.Input;
using Microsoft.Xaml.Behaviors.Layout;
using Microsoft.Xaml.Behaviors.Media;
using Prism.DryIoc;
using Prism.Interactivity;
using Prism.Ioc;
using Prism.Mvvm;
using Prism.Regions;
using Prism.Regions.Behaviors;
using Prism.Services.Dialogs;
using Prism.Unity;
using SWS.CustomControl;
using SWS.Electrical.Views;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Automation;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Effects;
using System.Windows.Media.Imaging;
using System.Windows.Media.Media3D;
using System.Windows.Media.TextFormatting;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Shell;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.Animation;
using Telerik.Windows.Controls.Behaviors;
using Telerik.Windows.Controls.Carousel;
using Telerik.Windows.Controls.ComboBox;
using Telerik.Windows.Controls.Data.PropertyGrid;
using Telerik.Windows.Controls.DragDrop;
using Telerik.Windows.Controls.GridView;
using Telerik.Windows.Controls.LayoutControl;
using Telerik.Windows.Controls.Legend;
using Telerik.Windows.Controls.MultiColumnComboBox;
using Telerik.Windows.Controls.Primitives;
using Telerik.Windows.Controls.RadialMenu;
using Telerik.Windows.Controls.TransitionEffects;
using Telerik.Windows.Controls.TreeListView;
using Telerik.Windows.Controls.TreeView;
using Telerik.Windows.Controls.Wizard;
using Telerik.Windows.Data;
using Telerik.Windows.DragDrop;
using Telerik.Windows.DragDrop.Behaviors;
using Telerik.Windows.Input.Touch;
using Telerik.Windows.Shapes;
namespace SWS.Electrical.Views {
/// <summary>
/// DialogTest2
/// </summary>
public partial class DialogTest2 : System.Windows.Controls.UserControl, System.Windows.Markup.IComponentConnector {
#line 33 "..\..\..\Views\DialogTest2.xaml"
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
internal SWS.CustomControl.customWindowTitleBar titleBar;
#line default
#line hidden
private bool _contentLoaded;
/// <summary>
/// InitializeComponent
/// </summary>
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;
System.Uri resourceLocater = new System.Uri("/SWS.Electrical;component/views/dialogtest2.xaml", System.UriKind.Relative);
#line 1 "..\..\..\Views\DialogTest2.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);
#line default
#line hidden
}
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
switch (connectionId)
{
case 1:
this.titleBar = ((SWS.CustomControl.customWindowTitleBar)(target));
return;
}
this._contentLoaded = true;
}
}
}

View File

@ -23,6 +23,7 @@ using Prism.Regions.Behaviors;
using Prism.Services.Dialogs;
using Prism.Unity;
using SWS.CustomControl;
using SWS.Electrical;
using SWS.Electrical.Views;
using System;
using System.Diagnostics;

View File

@ -9,6 +9,23 @@
// </auto-generated>
//------------------------------------------------------------------------------
using Microsoft.Xaml.Behaviors;
using Microsoft.Xaml.Behaviors.Core;
using Microsoft.Xaml.Behaviors.Input;
using Microsoft.Xaml.Behaviors.Layout;
using Microsoft.Xaml.Behaviors.Media;
using Prism.DryIoc;
using Prism.Interactivity;
using Prism.Ioc;
using Prism.Mvvm;
using Prism.Regions;
using Prism.Regions.Behaviors;
using Prism.Services.Dialogs;
using Prism.Unity;
using SWS.CustomControl;
using SWS.Electrical;
using SWS.Electrical.Views;
using SWS.Model;
using System;
using System.Diagnostics;
using System.Windows;
@ -29,6 +46,28 @@ using System.Windows.Media.TextFormatting;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Shell;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.Animation;
using Telerik.Windows.Controls.Behaviors;
using Telerik.Windows.Controls.Carousel;
using Telerik.Windows.Controls.ComboBox;
using Telerik.Windows.Controls.Data.PropertyGrid;
using Telerik.Windows.Controls.DragDrop;
using Telerik.Windows.Controls.GridView;
using Telerik.Windows.Controls.LayoutControl;
using Telerik.Windows.Controls.Legend;
using Telerik.Windows.Controls.MultiColumnComboBox;
using Telerik.Windows.Controls.Primitives;
using Telerik.Windows.Controls.RadialMenu;
using Telerik.Windows.Controls.TransitionEffects;
using Telerik.Windows.Controls.TreeListView;
using Telerik.Windows.Controls.TreeView;
using Telerik.Windows.Controls.Wizard;
using Telerik.Windows.Data;
using Telerik.Windows.DragDrop;
using Telerik.Windows.DragDrop.Behaviors;
using Telerik.Windows.Input.Touch;
using Telerik.Windows.Shapes;
namespace SWS.Electrical.Views {

View File

@ -9,6 +9,23 @@
// </auto-generated>
//------------------------------------------------------------------------------
using Microsoft.Xaml.Behaviors;
using Microsoft.Xaml.Behaviors.Core;
using Microsoft.Xaml.Behaviors.Input;
using Microsoft.Xaml.Behaviors.Layout;
using Microsoft.Xaml.Behaviors.Media;
using Prism.DryIoc;
using Prism.Interactivity;
using Prism.Ioc;
using Prism.Mvvm;
using Prism.Regions;
using Prism.Regions.Behaviors;
using Prism.Services.Dialogs;
using Prism.Unity;
using SWS.CustomControl;
using SWS.Electrical;
using SWS.Electrical.Views;
using SWS.Model;
using System;
using System.Diagnostics;
using System.Windows;
@ -29,6 +46,28 @@ using System.Windows.Media.TextFormatting;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Shell;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.Animation;
using Telerik.Windows.Controls.Behaviors;
using Telerik.Windows.Controls.Carousel;
using Telerik.Windows.Controls.ComboBox;
using Telerik.Windows.Controls.Data.PropertyGrid;
using Telerik.Windows.Controls.DragDrop;
using Telerik.Windows.Controls.GridView;
using Telerik.Windows.Controls.LayoutControl;
using Telerik.Windows.Controls.Legend;
using Telerik.Windows.Controls.MultiColumnComboBox;
using Telerik.Windows.Controls.Primitives;
using Telerik.Windows.Controls.RadialMenu;
using Telerik.Windows.Controls.TransitionEffects;
using Telerik.Windows.Controls.TreeListView;
using Telerik.Windows.Controls.TreeView;
using Telerik.Windows.Controls.Wizard;
using Telerik.Windows.Data;
using Telerik.Windows.DragDrop;
using Telerik.Windows.DragDrop.Behaviors;
using Telerik.Windows.Input.Touch;
using Telerik.Windows.Shapes;
namespace SWS.Electrical.Views {

View File

@ -115,7 +115,6 @@
<Compile Include="ec_wire_group_notice.cs" />
<Compile Include="ec_wire_group_propertyhis.cs" />
<Compile Include="KeyValueModel.cs" />
<Compile Include="LayoutTagInfoBrief.cs" />
<Compile Include="NoEntity\BomConfig.cs" />
<Compile Include="NoEntity\CheckInLogNeedApproveModel.cs" />
<Compile Include="NoEntity\CheckInModel.cs" />
@ -141,5 +140,11 @@
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SWS.Share\SWS.Share.csproj">
<Project>{87e71797-e60a-4637-ba32-c8b57154abc3}</Project>
<Name>SWS.Share</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
</Project>

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using SWS.Model;
using SWS.Share;
using Telerik.Windows.Controls;
using Telerik.Windows.Data;

View File

@ -67,11 +67,11 @@ namespace SWS.Model
set { _IO_Type = value; }
}
private Model.Action _ActionID;
private Share.Action _ActionID;
/// <summary>
/// 操作ID
/// </summary>
public Model.Action ActionID
public Share.Action ActionID
{
get { return _ActionID; }
set { _ActionID = value; }

View File

@ -107,6 +107,8 @@ namespace SWS.Model
/// </summary>
public ec_Panel ToPanel { set; get; }
public ec_Panel AssignedPanel { set; get; }
#endregion
}
}

View File

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using SWS.Share;
namespace SWS.Model
{
@ -393,43 +394,4 @@ namespace SWS.Model
public List<ec_wire_group_log> Logs { get; set; }
#endregion
}
public enum WireGroupStatusEnum
{
/// <summary>
/// 待删除
/// </summary>
[Description("待删除")]
ToDelete = 01,
/// <summary>
/// 新增的
/// </summary>
[Description("新增的")]
New = 02,
/// <summary>
/// 已关联
/// </summary>
[Description("已使用(关联)")]
Used = 03,
/// <summary>
/// 已审核
/// </summary>
[Description("已确认(审核)")]
Confirmed = 04,
/// <summary>
/// 重新打开
/// </summary>
[Description("重新打开")]
Reopen = 05,
/// <summary>
/// 彻底删除
/// </summary>
[Description("彻底删除")]
deleted = 06
}
public class ActionHistory
{
public DateTime? ActionTime { get; set; }
public Action ActionType { get; set; }
public string reason { get; set; }
}
}

View File

@ -10,7 +10,7 @@ namespace SWS.Model
{
}
public ec_wire_group_log(Action OperateType, string WireGroupID)
public ec_wire_group_log(Share.Action OperateType, string WireGroupID)
{
this.OperateType = OperateType;
this.WireGroupID = WireGroupID;
@ -22,7 +22,7 @@ namespace SWS.Model
/// <param name="OperateType"></param>
/// <param name="WireGroupID"></param>
/// <param name="createtime">因为<see cref="ec_Wire_GroupEntity.ActionHistorys"/>的关系,所以时间是有值的</param>
public ec_wire_group_log(Action OperateType, string WireGroupID, DateTime? createtime)
public ec_wire_group_log(Share.Action OperateType, string WireGroupID, DateTime? createtime)
{
this.OperateType = OperateType;
this.WireGroupID = WireGroupID;
@ -50,7 +50,7 @@ namespace SWS.Model
/// </summary>
/// <returns></returns>
[JsonConverter(typeof(StringEnumConverter))]
public Action OperateType { get; set; }
public Share.Action OperateType { get; set; }
/// <summary>
/// 备注
/// </summary>

View File

@ -3,24 +3,6 @@
namespace SWS.Model
{
/// <summary>
/// 动作。和状态是两码事情。
/// </summary>
public enum Action
{
= 0,
= 1,
= 2,
= 3,
= 4,
= 5,
= 6,
= 7,
= 8,
= 9
}
public enum Department
{
= 0,

View File

@ -3,6 +3,7 @@ using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
using SWS.Commons;
using SWS.Model;
using SWS.Share;
namespace SWS.Service
{

View File

@ -62,7 +62,7 @@ namespace SWS.Service
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public async Task<string> CanSaveSignals(WireGroups entity ,Model.Action ActionType)
public async Task<string> CanSaveSignals(WireGroups entity ,Share.Action ActionType)
{
var res = await this.PostBodyAsync<List<ec_Wire_Group>, WireGroups>($"WireGroupApi/CanSaveSignals?projId={GlobalObject.curProject?.ProjectId}&ActionType={ActionType}", entity);
if (res.code == 200)

View File

@ -0,0 +1 @@
{"RootPath":"E:\\Di-Electrical\\newFront\\c#前端\\SWS.Share","ProjectFileName":"SWS.Share.csproj","Configuration":"Debug|AnyCPU","FrameworkPath":"","Sources":[{"SourceFile":"BOMGroupInfo.cs"},{"SourceFile":"Properties\\AssemblyInfo.cs"},{"SourceFile":"obj\\Debug\\.NETFramework,Version=v4.6.1.AssemblyAttributes.cs"}],"References":[{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\Microsoft.CSharp.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\mscorlib.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\System.Core.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\System.Data.DataSetExtensions.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\System.Data.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\System.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\System.Net.Http.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\System.Xml.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""},{"Reference":"C:\\Program Files (x86)\\Reference Assemblies\\Microsoft\\Framework\\.NETFramework\\v4.6.1\\System.Xml.Linq.dll","ResolvedFrom":"","OriginalItemSpec":"","Name":"","EmbedInteropTypes":false,"CopyLocal":false,"IsProjectReference":false,"ProjectPath":""}],"Analyzers":[],"Outputs":[{"OutputItemFullPath":"E:\\Di-Electrical\\newFront\\c#前端\\SWS.Share\\bin\\Debug\\SWS.Share.dll","OutputItemRelativePath":"SWS.Share.dll"},{"OutputItemFullPath":"","OutputItemRelativePath":""}],"CopyToOutputEntries":[]}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.Share
{
public class ActionHistory
{
public DateTime? ActionTime { get; set; }
public Action ActionType { get; set; }
public string reason { get; set; }
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.Share
{
public class ConstString
{
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.Share
{
public class Enum
{
public enum inOrOut
{
= 0,
= 1
}
public enum cableClass
{
conventional = 0,
homerun = 1
}
}
}

View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.Share
{
/// <summary>
/// 动作。和状态是两码事情。
/// </summary>
public enum Action
{
= 0,
= 1,
= 2,
= 3,
= 4,
= 5,
= 6,
= 7,
= 8,
= 9
}
}

View File

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.Share
{
public enum WireGroupStatusEnum
{
/// <summary>
/// 待删除
/// </summary>
[Description("待删除")]
ToDelete = 01,
/// <summary>
/// 新增的
/// </summary>
[Description("新增的")]
New = 02,
/// <summary>
/// 已关联
/// </summary>
[Description("已使用(关联)")]
Used = 03,
/// <summary>
/// 已审核
/// </summary>
[Description("已确认(审核)")]
Confirmed = 04,
/// <summary>
/// 重新打开
/// </summary>
[Description("重新打开")]
Reopen = 05,
/// <summary>
/// 彻底删除
/// </summary>
[Description("彻底删除")]
deleted = 06
}
}

View File

@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SWS.Share
{
/// <summary>
/// 精简的类,用于布置图绘制
/// </summary>
public class LayoutTagInfoBrief
{
public LayoutTagInfoBrief()
{
}
#region
/// <summary>
/// 工程数据ID
/// </summary>
public string EngineDataID { get; set; }
/// <summary>
/// 位号
/// </summary>
public string TagNumber { get; set; } = "";
/// <summary>
/// tag
/// </summary>
public string TagNumber_Upper { get; set; } = "";
/// <summary>
/// system
/// </summary>
public string TagNumber_Lower { get; set; } = "";
/// <summary>
/// 图元文件Id
/// </summary>
public string FileId { get; set; }
/// <summary>
/// 基点在布置图上的句柄
/// </summary>
public string PixelOnDwg { get; set; }
/// <summary>
/// 比例
/// </summary>
public double Scale { get; set; }
/// <summary>
/// true:默认块false异性块
/// </summary>
public bool IsNotDefaultSymbol { get; set; }
/// <summary>
/// 肋位号 和 偏移量
/// </summary>
public double X { get; set; }
private string _XOff;
public string XOff
{
get { return string.IsNullOrEmpty(_XOff) ? "0" : _XOff; }
set { _XOff = value; }
}
/// <summary>
/// 纵骨号 偏移量
/// </summary>
private string _YOff;
public string YOff
{
get { return string.IsNullOrEmpty(_YOff) ? "0" : _YOff; }
set { _YOff = value; }
}
public string deck { get; set; }
public string area { get; set; }
/// <summary>
/// 基点从属的、或者说附近的设备位号
/// </summary>
public List<LayoutTagInfoBrief> Tags { get; set; } = new List<LayoutTagInfoBrief>();
#endregion
}
}

View File

@ -42,8 +42,14 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Enums\Action.cs" />
<Compile Include="ActionHistory.cs" />
<Compile Include="BOMGroupInfo.cs" />
<Compile Include="LayoutTagInfoBrief.cs" />
<Compile Include="ConstString.cs" />
<Compile Include="Enum.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Enums\WireGroupStatusEnum.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
</Project>

View File

@ -191,6 +191,10 @@
<Project>{51cb6f5b-16e9-4ee0-baa4-144dd1ec8580}</Project>
<Name>SWS.Service</Name>
</ProjectReference>
<ProjectReference Include="..\SWS.Share\SWS.Share.csproj">
<Project>{87E71797-E60A-4637-BA32-C8B57154ABC3}</Project>
<Name>SWS.Share</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Style\StyleSelectors\" />

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
</Project>

View File

@ -20,6 +20,7 @@ using DryIoc;
using ImTools;
using System.Timers;
using System.Windows.Threading;
using SWS.Share;
namespace SWS.WPF.ViewModels
{
@ -903,7 +904,7 @@ namespace SWS.WPF.ViewModels
new ActionHistory()
{
ActionTime= DateTime.Now,
ActionType = SWS.Model.Action.,
ActionType = Share.Action.,
reason = Reason
}
@ -961,7 +962,7 @@ namespace SWS.WPF.ViewModels
new ActionHistory()
{
ActionTime= DateTime.Now,
ActionType = Model.Action.,
ActionType = Share.Action.,
}
};
@ -1022,7 +1023,7 @@ namespace SWS.WPF.ViewModels
WireGroups ent = new WireGroups();
ent.Signals = Signals;
string message = await _wireGroupService.CanSaveSignals(ent, Model.Action.);
string message = await _wireGroupService.CanSaveSignals(ent, Share.Action.);
if (message != "OK")
{
// 显示消息框
@ -1036,7 +1037,7 @@ namespace SWS.WPF.ViewModels
new ActionHistory()
{
ActionTime= DateTime.Now,
ActionType = Model.Action.,
ActionType = Share.Action.,
reason = ""
}
@ -1113,7 +1114,7 @@ namespace SWS.WPF.ViewModels
new ActionHistory()
{
ActionTime= DateTime.Now,
ActionType = Model.Action.,
ActionType = Share.Action.,
reason = Reason
}
@ -1166,7 +1167,7 @@ namespace SWS.WPF.ViewModels
};
WireGroups ent = new WireGroups();
ent.Signals = Signals;
string message = await _wireGroupService.CanSaveSignals(ent, Model.Action.);
string message = await _wireGroupService.CanSaveSignals(ent, Share.Action.);
if (message != "OK")
{
// 显示消息框
@ -1180,7 +1181,7 @@ namespace SWS.WPF.ViewModels
new ActionHistory()
{
ActionTime= DateTime.Now,
ActionType = Model.Action.,
ActionType = Share.Action.,
reason = ""
}
@ -1222,7 +1223,7 @@ namespace SWS.WPF.ViewModels
new ActionHistory()
{
ActionTime= DateTime.Now,
ActionType = Model.Action.,
ActionType = Share.Action.,
reason = Reason
}

View File

@ -212,11 +212,11 @@ namespace SWS.WPF.ViewModels
set { _WireGroupID = value; }
}
[JsonConverter(typeof(StringEnumConverter))]
private Model.Action _OperateType;
private Share.Action _OperateType;
/// <summary>
/// 操作
/// </summary>
public Model.Action OperateType
public Share.Action OperateType
{
get { return _OperateType; }
set { _OperateType = value; }

View File

@ -9,6 +9,8 @@
// </auto-generated>
//------------------------------------------------------------------------------
using SWS.Commons.Helper.Converter;
using SWS.CustomControl;
using System;
using System.Diagnostics;
using System.Windows;
@ -29,6 +31,28 @@ using System.Windows.Media.TextFormatting;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Shell;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.Animation;
using Telerik.Windows.Controls.Behaviors;
using Telerik.Windows.Controls.Carousel;
using Telerik.Windows.Controls.ComboBox;
using Telerik.Windows.Controls.Data.PropertyGrid;
using Telerik.Windows.Controls.DragDrop;
using Telerik.Windows.Controls.GridView;
using Telerik.Windows.Controls.LayoutControl;
using Telerik.Windows.Controls.Legend;
using Telerik.Windows.Controls.MultiColumnComboBox;
using Telerik.Windows.Controls.Primitives;
using Telerik.Windows.Controls.RadialMenu;
using Telerik.Windows.Controls.TransitionEffects;
using Telerik.Windows.Controls.TreeListView;
using Telerik.Windows.Controls.TreeView;
using Telerik.Windows.Controls.Wizard;
using Telerik.Windows.Data;
using Telerik.Windows.DragDrop;
using Telerik.Windows.DragDrop.Behaviors;
using Telerik.Windows.Input.Touch;
using Telerik.Windows.Shapes;
namespace SWS.WPF.Views {

View File

@ -9,6 +9,8 @@
// </auto-generated>
//------------------------------------------------------------------------------
using SWS.Commons.Helper.Converter;
using SWS.CustomControl;
using System;
using System.Diagnostics;
using System.Windows;
@ -29,6 +31,28 @@ using System.Windows.Media.TextFormatting;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Shell;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.Animation;
using Telerik.Windows.Controls.Behaviors;
using Telerik.Windows.Controls.Carousel;
using Telerik.Windows.Controls.ComboBox;
using Telerik.Windows.Controls.Data.PropertyGrid;
using Telerik.Windows.Controls.DragDrop;
using Telerik.Windows.Controls.GridView;
using Telerik.Windows.Controls.LayoutControl;
using Telerik.Windows.Controls.Legend;
using Telerik.Windows.Controls.MultiColumnComboBox;
using Telerik.Windows.Controls.Primitives;
using Telerik.Windows.Controls.RadialMenu;
using Telerik.Windows.Controls.TransitionEffects;
using Telerik.Windows.Controls.TreeListView;
using Telerik.Windows.Controls.TreeView;
using Telerik.Windows.Controls.Wizard;
using Telerik.Windows.Data;
using Telerik.Windows.DragDrop;
using Telerik.Windows.DragDrop.Behaviors;
using Telerik.Windows.Input.Touch;
using Telerik.Windows.Shapes;
namespace SWS.WPF.Views {