Compare commits
2 Commits
4eddfe1f59
...
50f581ba36
Author | SHA1 | Date | |
---|---|---|---|
![]() |
50f581ba36 | ||
![]() |
8a2c73eabb |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -24,6 +24,7 @@ using Panel = Bricscad.Windows.Panel;
|
|||||||
using GlobalObject = SWS.Commons.GlobalObject;
|
using GlobalObject = SWS.Commons.GlobalObject;
|
||||||
using SWS.Model;
|
using SWS.Model;
|
||||||
using SWS.Service;
|
using SWS.Service;
|
||||||
|
using OfficeOpenXml.FormulaParsing.Excel.Functions.Information;
|
||||||
|
|
||||||
|
|
||||||
[assembly: CommandClass(typeof(Commands))]
|
[assembly: CommandClass(typeof(Commands))]
|
||||||
@ -540,6 +541,8 @@ namespace SWS.CAD
|
|||||||
//选择的元素返回的属性信息
|
//选择的元素返回的属性信息
|
||||||
var ResTagInfosByPixels = new Model.ec_objecttype();
|
var ResTagInfosByPixels = new Model.ec_objecttype();
|
||||||
var listPropertys = new List<propertyModel>();
|
var listPropertys = new List<propertyModel>();
|
||||||
|
var _objectTypeService = GlobalObject.container.Resolve<ObjectTypeService>();
|
||||||
|
var _iOModuleService = GlobalObject.container.Resolve<IOModuleService>();
|
||||||
// 持续选择直到获取有效电缆
|
// 持续选择直到获取有效电缆
|
||||||
bool isValidCable = false;
|
bool isValidCable = false;
|
||||||
|
|
||||||
@ -564,7 +567,7 @@ namespace SWS.CAD
|
|||||||
{
|
{
|
||||||
// 获取句柄(Handle 是字符串类型)
|
// 获取句柄(Handle 是字符串类型)
|
||||||
var handId = (cable.Handle.ToString());
|
var handId = (cable.Handle.ToString());
|
||||||
var _objectTypeService = GlobalObject.container.Resolve<ObjectTypeService>();
|
_objectTypeService = GlobalObject.container.Resolve<ObjectTypeService>();
|
||||||
var res = await _objectTypeService.GetTagInfosByPixels(dwgFile.Id, handId);
|
var res = await _objectTypeService.GetTagInfosByPixels(dwgFile.Id, handId);
|
||||||
if (res != null)
|
if (res != null)
|
||||||
{
|
{
|
||||||
@ -600,8 +603,20 @@ namespace SWS.CAD
|
|||||||
//Thread.Sleep(2000);
|
//Thread.Sleep(2000);
|
||||||
if (isValidCable)
|
if (isValidCable)
|
||||||
{
|
{
|
||||||
var _iOModuleService = GlobalObject.container.Resolve<IOModuleService>();
|
var ResTagNumberById = await _objectTypeService.GetTagNumberById(ResTagInfosByPixels.tags.FirstOrDefault().ObjectTypeID);
|
||||||
|
var ObjectTypePListBy = await _objectTypeService.GetObjectTypePListByIds(ResTagInfosByPixels.tags.FirstOrDefault().ObjectTypeID);
|
||||||
|
string CableSpecification = ObjectTypePListBy.Where(q => q.PropertyName.Equals("电缆规格")).Select(s => s.EnumDataCode).FirstOrDefault();
|
||||||
|
CableSpecification = CableSpecification.Substring(0, CableSpecification.Length - 1);
|
||||||
|
var LatestSerialNumber = await _objectTypeService.GetLatestSerialNumber(ResTagInfosByPixels.tags.FirstOrDefault().ObjectTypeID);
|
||||||
|
//获取位号的电缆属性,判断是否设置电缆规格
|
||||||
|
var TagNumberBys = await _objectTypeService.GetEngineDataListByTags(ResTagInfosByPixels.tags.FirstOrDefault().TagNumber);
|
||||||
|
var TagNumberBy = TagNumberBys.Where(t => t.TagNumber.Equals(ResTagInfosByPixels.tags.FirstOrDefault().TagNumber)).FirstOrDefault();
|
||||||
|
if (string.IsNullOrEmpty(TagNumberBy.EngineDataProperty.Where(e => e.PropertyName.Equals("电缆规格")).Select(e => e.PropertyValue).FirstOrDefault()))
|
||||||
|
//if (!CableSpecification.Split(',').ToList().Contains(TagNumberBy.EngineDataProperty.Where(e => e.PropertyName.Equals("电缆规格")).Select(e => e.PropertyValue).FirstOrDefault()))
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("无法获取电缆对信息,请在电缆\"属性面版“输入电缆”电缆规格”属性\r\n如:“1x2x0.75”", "KunHengCAD", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Warning); return;
|
||||||
|
|
||||||
|
}
|
||||||
var ResCableEngID = await _iOModuleService.GetCableByEngID(ResTagInfosByPixels.tags.FirstOrDefault().EngineDataID);
|
var ResCableEngID = await _iOModuleService.GetCableByEngID(ResTagInfosByPixels.tags.FirstOrDefault().EngineDataID);
|
||||||
//如果配置不存在
|
//如果配置不存在
|
||||||
if (ResCableEngID == null)
|
if (ResCableEngID == null)
|
||||||
@ -636,6 +651,7 @@ namespace SWS.CAD
|
|||||||
ec_Cable.EngineerDataID = ResTagInfosByPixels.tags.FirstOrDefault().EngineDataID;
|
ec_Cable.EngineerDataID = ResTagInfosByPixels.tags.FirstOrDefault().EngineDataID;
|
||||||
ec_Cable.Sets = new List<ec_CableSet>();
|
ec_Cable.Sets = new List<ec_CableSet>();
|
||||||
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
|
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
|
||||||
|
int n = 0;
|
||||||
for (int i = 0; i < CableSetCount; i++)
|
for (int i = 0; i < CableSetCount; i++)
|
||||||
{
|
{
|
||||||
ec_CableSet ec_CableSet = new ec_CableSet();
|
ec_CableSet ec_CableSet = new ec_CableSet();
|
||||||
@ -645,6 +661,7 @@ namespace SWS.CAD
|
|||||||
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
|
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
|
||||||
for (int j = 0; j < WireCount; j++)
|
for (int j = 0; j < WireCount; j++)
|
||||||
{
|
{
|
||||||
|
n++;
|
||||||
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
|
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
|
||||||
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
|
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
|
||||||
ec_CableSetWire.SetLevel = j + 1;
|
ec_CableSetWire.SetLevel = j + 1;
|
||||||
@ -653,6 +670,20 @@ namespace SWS.CAD
|
|||||||
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
|
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
|
||||||
{
|
{
|
||||||
case "按电缆编号":
|
case "按电缆编号":
|
||||||
|
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
||||||
|
{
|
||||||
|
Tag = n.ToString();
|
||||||
|
}
|
||||||
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("字母"))
|
||||||
|
{
|
||||||
|
Tag = Tag + (char)('A' + (n - 1));
|
||||||
|
}
|
||||||
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
||||||
|
{
|
||||||
|
Tag = (i + 1) + "-" + n.ToString();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "按电缆对编号":
|
||||||
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
||||||
{
|
{
|
||||||
Tag = (j + 1).ToString();
|
Tag = (j + 1).ToString();
|
||||||
@ -663,12 +694,9 @@ namespace SWS.CAD
|
|||||||
}
|
}
|
||||||
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
||||||
{
|
{
|
||||||
Tag = (i + 1).ToString();
|
Tag = (i + 1) + "-" + (j + 1).ToString();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "按电缆对编号":
|
|
||||||
a = ResTagInfosByPixels.tags.FirstOrDefault().TagNumber;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
ec_CableSetWire.Wire_Tag = a + Tag;
|
ec_CableSetWire.Wire_Tag = a + Tag;
|
||||||
ec_CableSet.Wires.Add(ec_CableSetWire);
|
ec_CableSet.Wires.Add(ec_CableSetWire);
|
||||||
@ -705,6 +733,7 @@ namespace SWS.CAD
|
|||||||
ec_Cable.EngineerDataID = ResTagInfosByPixels.tags.FirstOrDefault().EngineDataID;
|
ec_Cable.EngineerDataID = ResTagInfosByPixels.tags.FirstOrDefault().EngineDataID;
|
||||||
ec_Cable.Sets = new List<ec_CableSet>();
|
ec_Cable.Sets = new List<ec_CableSet>();
|
||||||
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
|
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
|
||||||
|
int n = 0;
|
||||||
for (int i = 0; i < CableSetCount; i++)
|
for (int i = 0; i < CableSetCount; i++)
|
||||||
{
|
{
|
||||||
ec_CableSet ec_CableSet = new ec_CableSet();
|
ec_CableSet ec_CableSet = new ec_CableSet();
|
||||||
@ -714,6 +743,7 @@ namespace SWS.CAD
|
|||||||
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
|
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
|
||||||
for (int j = 0; j < WireCount; j++)
|
for (int j = 0; j < WireCount; j++)
|
||||||
{
|
{
|
||||||
|
n++;
|
||||||
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
|
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
|
||||||
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
|
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
|
||||||
ec_CableSetWire.SetLevel = j + 1;
|
ec_CableSetWire.SetLevel = j + 1;
|
||||||
@ -722,6 +752,20 @@ namespace SWS.CAD
|
|||||||
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
|
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
|
||||||
{
|
{
|
||||||
case "按电缆编号":
|
case "按电缆编号":
|
||||||
|
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
||||||
|
{
|
||||||
|
Tag = n.ToString();
|
||||||
|
}
|
||||||
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("字母"))
|
||||||
|
{
|
||||||
|
Tag = Tag + (char)('A' + (n - 1));
|
||||||
|
}
|
||||||
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
||||||
|
{
|
||||||
|
Tag = (i + 1) + "-" + n.ToString();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "按电缆对编号":
|
||||||
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
||||||
{
|
{
|
||||||
Tag = (j + 1).ToString();
|
Tag = (j + 1).ToString();
|
||||||
@ -732,12 +776,9 @@ namespace SWS.CAD
|
|||||||
}
|
}
|
||||||
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
||||||
{
|
{
|
||||||
Tag = (i + 1).ToString();
|
Tag = (i + 1) + "-" + (j + 1).ToString();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "按电缆对编号":
|
|
||||||
a = ResTagInfosByPixels.tags.FirstOrDefault().TagNumber;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
ec_CableSetWire.Wire_Tag = a + Tag;
|
ec_CableSetWire.Wire_Tag = a + Tag;
|
||||||
ec_CableSet.Wires.Add(ec_CableSetWire);
|
ec_CableSet.Wires.Add(ec_CableSetWire);
|
||||||
@ -849,20 +890,305 @@ namespace SWS.CAD
|
|||||||
btnCableSinal.ToolTip = "信号预分配";
|
btnCableSinal.ToolTip = "信号预分配";
|
||||||
btnCableSinal.Text = "信号预分配";
|
btnCableSinal.Text = "信号预分配";
|
||||||
btnCableSinal.ButtonStyle = RibbonButtonStyle.SmallWithText;
|
btnCableSinal.ButtonStyle = RibbonButtonStyle.SmallWithText;
|
||||||
btnCableSinal.CommandHandler = new DelegateCommand(x =>
|
btnCableSinal.CommandHandler = new DelegateCommand(async x =>
|
||||||
{
|
{
|
||||||
//打开窗体
|
if (GlobalObject.userInfo == null || GlobalObject.curProject == null)
|
||||||
var para = new Prism.Services.Dialogs.DialogParameters();
|
|
||||||
var _dialogService = GlobalObject._prismContainer.Resolve<IDialogService>();
|
|
||||||
_dialogService.ShowDialog(nameof(DialogSignalPredistribution), para, (RES) =>
|
|
||||||
{
|
{
|
||||||
if (RES.Result == ButtonResult.Yes)
|
MessageBox.Show("请先登录系统并选择项目!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//在SWS系统内打开且不是只读的图纸才可
|
||||||
|
var dwgName = General.GetDwgName();
|
||||||
|
var dwgFile = GlobalObject.ListDwgOpened.FirstOrDefault(a => a.Path == dwgName && a.IsReadOnly == false);
|
||||||
|
if (dwgFile == null)
|
||||||
|
{ return; }
|
||||||
|
Document doc = Application.DocumentManager.MdiActiveDocument;
|
||||||
|
Database db = doc.Database;
|
||||||
|
Editor ed = doc.Editor;
|
||||||
|
//选择的元素返回的属性信息
|
||||||
|
var ResTagInfosByPixels = new Model.ec_objecttype();
|
||||||
|
var listPropertys = new List<propertyModel>();
|
||||||
|
var _objectTypeService = GlobalObject.container.Resolve<ObjectTypeService>();
|
||||||
|
var _iOModuleService = GlobalObject.container.Resolve<IOModuleService>();
|
||||||
|
// 持续选择直到获取有效电缆
|
||||||
|
bool isValidCable = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
#region 选择电缆
|
||||||
|
// 创建选择选项(禁用回车确认)
|
||||||
|
PromptEntityOptions options = new PromptEntityOptions("\n请单击选择电缆: ");
|
||||||
|
options.AllowNone = false; // 禁止空选
|
||||||
|
|
||||||
|
// 执行选择(直接单击生效)
|
||||||
|
PromptEntityResult resultEntity = ed.GetEntity(options);
|
||||||
|
//WindowVisibility = System.Windows.Visibility.Hidden;
|
||||||
|
|
||||||
|
while (resultEntity.Status == PromptStatus.OK)
|
||||||
{
|
{
|
||||||
|
using (Transaction tr = db.TransactionManager.StartTransaction())
|
||||||
|
{
|
||||||
|
// 获取选中的电缆实体
|
||||||
|
Entity cable = tr.GetObject(resultEntity.ObjectId, OpenMode.ForRead) as Entity;
|
||||||
|
//if (cable != null&&cable.XData != null)
|
||||||
|
if (cable != null)
|
||||||
|
{
|
||||||
|
// 获取句柄(Handle 是字符串类型)
|
||||||
|
var handId = (cable.Handle.ToString());
|
||||||
|
var res = await _objectTypeService.GetTagInfosByPixels(dwgFile.Id, handId);
|
||||||
|
if (res != null)
|
||||||
|
{
|
||||||
|
if (res.Count == 1)
|
||||||
|
{
|
||||||
|
var item = res[0];
|
||||||
|
var objTypeName = item.ObjectTypeName;
|
||||||
|
if (objTypeName.Contains("电缆"))
|
||||||
|
{
|
||||||
|
ResTagInfosByPixels = item;
|
||||||
|
isValidCable = true; // 校验通过
|
||||||
|
ed.WriteMessage($"\n已选择电缆:{ResTagInfosByPixels.tags.FirstOrDefault().TagNumber}");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
tr.Commit();
|
||||||
|
}
|
||||||
|
if (isValidCable)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ed.WriteMessage($"\n已选择电缆:");
|
||||||
|
resultEntity = ed.GetEntity(options);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (RES.Result == ButtonResult.No)
|
#endregion
|
||||||
{ }
|
|
||||||
});
|
|
||||||
|
//Thread.Sleep(2000);
|
||||||
|
if (isValidCable)
|
||||||
|
{
|
||||||
|
var ResTagNumberById = await _objectTypeService.GetTagNumberById(ResTagInfosByPixels.tags.FirstOrDefault().ObjectTypeID);
|
||||||
|
var ObjectTypePListBy = await _objectTypeService.GetObjectTypePListByIds(ResTagInfosByPixels.tags.FirstOrDefault().ObjectTypeID);
|
||||||
|
string CableSpecification = ObjectTypePListBy.Where(q => q.PropertyName.Equals("电缆规格")).Select(s => s.EnumDataCode).FirstOrDefault();
|
||||||
|
CableSpecification = CableSpecification.Substring(0, CableSpecification.Length - 1);
|
||||||
|
var LatestSerialNumber = await _objectTypeService.GetLatestSerialNumber(ResTagInfosByPixels.tags.FirstOrDefault().ObjectTypeID);
|
||||||
|
//获取位号的电缆属性,判断是否设置电缆规格
|
||||||
|
var TagNumberBys = await _objectTypeService.GetEngineDataListByTags(ResTagInfosByPixels.tags.FirstOrDefault().TagNumber);
|
||||||
|
var TagNumberBy = TagNumberBys.Where(t => t.TagNumber.Equals(ResTagInfosByPixels.tags.FirstOrDefault().TagNumber)).FirstOrDefault();
|
||||||
|
if(string.IsNullOrEmpty(TagNumberBy.EngineDataProperty.Where(e => e.PropertyName.Equals("电缆规格")).Select(e => e.PropertyValue).FirstOrDefault()))
|
||||||
|
//if (!CableSpecification.Split(',').ToList().Contains(TagNumberBy.EngineDataProperty.Where(e => e.PropertyName.Equals("电缆规格")).Select(e => e.PropertyValue).FirstOrDefault()))
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("无法获取电缆对信息,请在电缆\"属性面版“输入电缆”电缆规格”属性\r\n如:“1x2x0.75”", "KunHengCAD", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Warning); return;
|
||||||
|
|
||||||
|
}
|
||||||
|
var ResCableEngID = await _iOModuleService.GetCableByEngID(ResTagInfosByPixels.tags.FirstOrDefault().EngineDataID);
|
||||||
|
//如果配置不存在
|
||||||
|
if (ResCableEngID == null)
|
||||||
|
{
|
||||||
|
listPropertys = new List<propertyModel>();
|
||||||
|
System.Windows.MessageBoxResult result = System.Windows.MessageBox.Show($"是否为通讯母线?", "KunHengCAD", System.Windows.MessageBoxButton.OKCancel, System.Windows.MessageBoxImage.Question);
|
||||||
|
if (result == System.Windows.MessageBoxResult.OK)
|
||||||
|
{
|
||||||
|
listPropertys = new List<propertyModel>();
|
||||||
|
Dictionary<string, string> pulldownlist;
|
||||||
|
|
||||||
|
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电缆对数", GroupName = "基本参数", PropertyValue = "1", ControlTypeName = PROPERTYType.TextBox, });
|
||||||
|
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "每电缆对芯数", GroupName = "基本参数", PropertyValue = "2", ControlTypeName = PROPERTYType.TextBox, });
|
||||||
|
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电缆对编号前缀", GroupName = "基本参数", PropertyValue = "Set", ControlTypeName = PROPERTYType.TextBox, });
|
||||||
|
pulldownlist = new Dictionary<string, string>();
|
||||||
|
pulldownlist.Add("数字", "数字");
|
||||||
|
pulldownlist.Add("字母", "字母");
|
||||||
|
pulldownlist.Add("电缆对序号", "电缆对序号");
|
||||||
|
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "编号类型", GroupName = "电芯参数", PropertyValue = "数字", ControlTypeName = PROPERTYType.ComboBox, Item = pulldownlist, });
|
||||||
|
pulldownlist = new Dictionary<string, string>();
|
||||||
|
pulldownlist.Add("按电缆编号", "按电缆编号");
|
||||||
|
pulldownlist.Add("按电缆对编号", "按电缆对编号");
|
||||||
|
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "编号规则", GroupName = "电芯参数", PropertyValue = "按电缆对编号", ControlTypeName = PROPERTYType.ComboBox, Item = pulldownlist, });
|
||||||
|
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电芯编号前缀", GroupName = "电芯参数", PropertyValue = "C", ControlTypeName = PROPERTYType.TextBox, });
|
||||||
|
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "极性", GroupName = "电芯参数", PropertyValue = "+,-,s", ControlTypeName = PROPERTYType.TextBox, });
|
||||||
|
//显示属性弹窗
|
||||||
|
var ReslistPro = ShowPropertyMessage("新建" + ResTagInfosByPixels.tags.FirstOrDefault().TagNumber + "电缆配置", listPropertys);
|
||||||
|
if (ReslistPro == null || ReslistPro.Count() == 0) return;
|
||||||
|
ec_Cable ec_Cable = new ec_Cable();
|
||||||
|
ec_Cable.CableClass = "homerun";//母线
|
||||||
|
ec_Cable.Cable_Format = ResTagInfosByPixels.tags.FirstOrDefault().EngineDataProperty.Where(e => e.PropertyName.Equals("电缆规格")).Select(e => e.PropertyValue).FirstOrDefault();
|
||||||
|
ec_Cable.EngineerDataID = ResTagInfosByPixels.tags.FirstOrDefault().EngineDataID;
|
||||||
|
ec_Cable.Sets = new List<ec_CableSet>();
|
||||||
|
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
|
||||||
|
int n = 0;
|
||||||
|
for (int i = 0; i < CableSetCount; i++)
|
||||||
|
{
|
||||||
|
ec_CableSet ec_CableSet = new ec_CableSet();
|
||||||
|
ec_CableSet.CableSetName = ReslistPro.Where(p => p.DisplayText.Equals("电缆对编号前缀")).Select(p => p.PropertyValue).FirstOrDefault() + (i + 1);
|
||||||
|
ec_CableSet.CableSetSeq = i + 1;
|
||||||
|
ec_CableSet.Wires = new List<ec_CableSetWire>();
|
||||||
|
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
|
||||||
|
for (int j = 0; j < WireCount; j++)
|
||||||
|
{
|
||||||
|
n++;
|
||||||
|
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
|
||||||
|
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
|
||||||
|
ec_CableSetWire.SetLevel = j + 1;
|
||||||
|
string a = ReslistPro.Where(p => p.DisplayText.Equals("电芯编号前缀")).Select(p => p.PropertyValue).FirstOrDefault();//组成线号名的前缀
|
||||||
|
string Tag = "";//线号名的中间部分
|
||||||
|
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
|
||||||
|
{
|
||||||
|
case "按电缆编号":
|
||||||
|
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
||||||
|
{
|
||||||
|
Tag = n.ToString();
|
||||||
|
}
|
||||||
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("字母"))
|
||||||
|
{
|
||||||
|
Tag = Tag + (char)('A' + (n - 1));
|
||||||
|
}
|
||||||
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
||||||
|
{
|
||||||
|
Tag = (i + 1) + "-" + n.ToString();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "按电缆对编号":
|
||||||
|
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
||||||
|
{
|
||||||
|
Tag = (j + 1).ToString();
|
||||||
|
}
|
||||||
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("字母"))
|
||||||
|
{
|
||||||
|
Tag = Tag + (char)('A' + j);
|
||||||
|
}
|
||||||
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
||||||
|
{
|
||||||
|
Tag = (i + 1) + "-" + (j + 1).ToString();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ec_CableSetWire.Wire_Tag = a + Tag;
|
||||||
|
ec_CableSet.Wires.Add(ec_CableSetWire);
|
||||||
|
}
|
||||||
|
ec_Cable.Sets.Add(ec_CableSet);
|
||||||
|
}
|
||||||
|
var httpres = await _iOModuleService.CreateCableByProfile(ec_Cable);
|
||||||
|
ResCableEngID = await _iOModuleService.GetCableByEngID(ResTagInfosByPixels.tags.FirstOrDefault().EngineDataID);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
listPropertys = new List<propertyModel>();
|
||||||
|
Dictionary<string, string> pulldownlist;
|
||||||
|
|
||||||
|
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电缆对数", GroupName = "基本参数", PropertyValue = "10", ControlTypeName = PROPERTYType.TextBox, });
|
||||||
|
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "每电缆对芯数", GroupName = "基本参数", PropertyValue = "2", ControlTypeName = PROPERTYType.TextBox, });
|
||||||
|
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电缆对编号前缀", GroupName = "基本参数", PropertyValue = "Set", ControlTypeName = PROPERTYType.TextBox, });
|
||||||
|
pulldownlist = new Dictionary<string, string>();
|
||||||
|
pulldownlist.Add("数字", "数字");
|
||||||
|
pulldownlist.Add("字母", "字母");
|
||||||
|
pulldownlist.Add("电缆对序号", "电缆对序号");
|
||||||
|
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "编号类型", GroupName = "电芯参数", PropertyValue = "数字", ControlTypeName = PROPERTYType.ComboBox, Item = pulldownlist, });
|
||||||
|
pulldownlist = new Dictionary<string, string>();
|
||||||
|
pulldownlist.Add("按电缆编号", "按电缆编号");
|
||||||
|
pulldownlist.Add("按电缆对编号", "按电缆对编号");
|
||||||
|
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "编号规则", GroupName = "电芯参数", PropertyValue = "按电缆对编号", ControlTypeName = PROPERTYType.ComboBox, Item = pulldownlist, });
|
||||||
|
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "电芯编号前缀", GroupName = "电芯参数", PropertyValue = "C", ControlTypeName = PROPERTYType.TextBox, });
|
||||||
|
listPropertys.Add(new propertyModel() { Id = "1", DisplayText = "极性", GroupName = "电芯参数", PropertyValue = "+,-,s", ControlTypeName = PROPERTYType.TextBox, });
|
||||||
|
//显示属性弹窗
|
||||||
|
var ReslistPro = ShowPropertyMessage("新建" + ResTagInfosByPixels.tags.FirstOrDefault().TagNumber + "电缆配置", listPropertys);
|
||||||
|
if (ReslistPro == null || ReslistPro.Count() == 0) return;
|
||||||
|
ec_Cable ec_Cable = new ec_Cable();
|
||||||
|
ec_Cable.CableClass = "conventional";//常规电缆
|
||||||
|
ec_Cable.EngineerDataID = ResTagInfosByPixels.tags.FirstOrDefault().EngineDataID;
|
||||||
|
ec_Cable.Sets = new List<ec_CableSet>();
|
||||||
|
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
|
||||||
|
int n = 0;
|
||||||
|
for (int i = 0; i < CableSetCount; i++)
|
||||||
|
{
|
||||||
|
ec_CableSet ec_CableSet = new ec_CableSet();
|
||||||
|
ec_CableSet.CableSetName = ReslistPro.Where(p => p.DisplayText.Equals("电缆对编号前缀")).Select(p => p.PropertyValue).FirstOrDefault() + (i + 1);
|
||||||
|
ec_CableSet.CableSetSeq = i + 1;
|
||||||
|
ec_CableSet.Wires = new List<ec_CableSetWire>();
|
||||||
|
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
|
||||||
|
for (int j = 0; j < WireCount; j++)
|
||||||
|
{
|
||||||
|
n++;
|
||||||
|
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
|
||||||
|
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
|
||||||
|
ec_CableSetWire.SetLevel = j + 1;
|
||||||
|
string a = ReslistPro.Where(p => p.DisplayText.Equals("电芯编号前缀")).Select(p => p.PropertyValue).FirstOrDefault();//组成线号名的前缀
|
||||||
|
string Tag = "";//线号名的中间部分
|
||||||
|
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
|
||||||
|
{
|
||||||
|
case "按电缆编号"://所有的电缆对中的电芯一起编号
|
||||||
|
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
||||||
|
{
|
||||||
|
Tag = n.ToString();
|
||||||
|
}
|
||||||
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("字母"))
|
||||||
|
{
|
||||||
|
Tag = Tag + (char)('A' + (n-1));
|
||||||
|
}
|
||||||
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
||||||
|
{
|
||||||
|
Tag = (i+1)+"-"+ n.ToString();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "按电缆对编号"://一个电缆对中线号按顺序编号,另一个电缆对中线号重新从1开始编号
|
||||||
|
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
||||||
|
{
|
||||||
|
Tag = (j + 1).ToString();
|
||||||
|
}
|
||||||
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("字母"))
|
||||||
|
{
|
||||||
|
Tag = Tag + (char)('A' + j);
|
||||||
|
}
|
||||||
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
||||||
|
{
|
||||||
|
Tag = (i+1) + "-" + (j+1).ToString();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ec_CableSetWire.Wire_Tag = a + Tag;
|
||||||
|
ec_CableSet.Wires.Add(ec_CableSetWire);
|
||||||
|
}
|
||||||
|
ec_Cable.Sets.Add(ec_CableSet);
|
||||||
|
}
|
||||||
|
var httpres = await _iOModuleService.CreateCableByProfile(ec_Cable);
|
||||||
|
ResCableEngID = await _iOModuleService.GetCableByEngID(ResTagInfosByPixels.tags.FirstOrDefault().EngineDataID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ResCableEngID != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
IntPtr cadHandle = Bricscad.ApplicationServices.Application.MainWindow.Handle;
|
||||||
|
//打开窗体
|
||||||
|
var para = new Prism.Services.Dialogs.DialogParameters();
|
||||||
|
//para.Add(GlobalObject.dialogPar.para1.ToString(), "6e2919e4-28cd-4fb6-9035-10b2ff0e30fb");
|
||||||
|
para.Add(GlobalObject.dialogPar.info.ToString(), cadHandle);
|
||||||
|
|
||||||
|
para.Add(GlobalObject.dialogPar.para1.ToString(), ResCableEngID);
|
||||||
|
para.Add(GlobalObject.dialogPar.para2.ToString(), ResTagInfosByPixels.tags.FirstOrDefault().TagNumber);
|
||||||
|
var _dialogService = GlobalObject._prismContainer.Resolve<IDialogService>();
|
||||||
|
_dialogService.ShowDialog(nameof(DialogSignalPredistribution), para, (RES) =>
|
||||||
|
{
|
||||||
|
if (RES.Result == ButtonResult.Yes)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (RES.Result == ButtonResult.No)
|
||||||
|
{ }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (System.Exception ex)
|
||||||
|
{
|
||||||
|
ed.WriteMessage($"\n错误: {ex.Message}");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
btnCableSinal.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"CableSinal.png");
|
btnCableSinal.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"CableSinal.png");
|
||||||
btnCableSinal.Id = "信号预分配";
|
btnCableSinal.Id = "信号预分配";
|
||||||
|
9
newFront/c#前端/SWS.CAD/Event/ScrollToItemEvent.cs
Normal file
9
newFront/c#前端/SWS.CAD/Event/ScrollToItemEvent.cs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using Prism.Events;
|
||||||
|
|
||||||
|
namespace SWS.CAD.Event
|
||||||
|
{
|
||||||
|
public class ScrollToItemEvent: PubSubEvent<object>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
using IniParser;
|
using IniParser;
|
||||||
using Prism.Ioc;
|
using Prism.Ioc;
|
||||||
|
using SWS.Commons;
|
||||||
using SWS.Model;
|
using SWS.Model;
|
||||||
using SWS.Service;
|
using SWS.Service;
|
||||||
using System;
|
using System;
|
||||||
@ -59,7 +60,7 @@ namespace SWS.CAD
|
|||||||
|
|
||||||
if (_dwgType == null)
|
if (_dwgType == null)
|
||||||
{
|
{
|
||||||
var serv = GlobalObje.container.Resolve<DataItemService>();
|
var serv = GlobalObject.container.Resolve<DataItemService>();
|
||||||
var res = Task.Run(() => serv.GetDetails(DBConst.Be_DrawingType.ToString()));
|
var res = Task.Run(() => serv.GetDetails(DBConst.Be_DrawingType.ToString()));
|
||||||
var res2 = res.Result;
|
var res2 = res.Result;
|
||||||
return res2;
|
return res2;
|
||||||
@ -83,7 +84,7 @@ namespace SWS.CAD
|
|||||||
|
|
||||||
if (_dwgMaterialRange == null)
|
if (_dwgMaterialRange == null)
|
||||||
{
|
{
|
||||||
var serv = GlobalObje.container.Resolve<DataItemService>();
|
var serv = GlobalObject.container.Resolve<DataItemService>();
|
||||||
var res = Task.Run(() => serv.GetDetails(DBConst.Be_MaterialRange.ToString()));
|
var res = Task.Run(() => serv.GetDetails(DBConst.Be_MaterialRange.ToString()));
|
||||||
var res2 = res.Result;
|
var res2 = res.Result;
|
||||||
return res2;
|
return res2;
|
||||||
@ -107,7 +108,7 @@ namespace SWS.CAD
|
|||||||
|
|
||||||
if (_dwgMaterialCensus == null)
|
if (_dwgMaterialCensus == null)
|
||||||
{
|
{
|
||||||
var serv = GlobalObje.container.Resolve<DataItemService>();
|
var serv = GlobalObject.container.Resolve<DataItemService>();
|
||||||
var res = Task.Run(() => serv.GetDetails(DBConst.Be_MaterialCensus.ToString()));
|
var res = Task.Run(() => serv.GetDetails(DBConst.Be_MaterialCensus.ToString()));
|
||||||
var res2 = res.Result;
|
var res2 = res.Result;
|
||||||
return res2;
|
return res2;
|
||||||
@ -131,7 +132,7 @@ namespace SWS.CAD
|
|||||||
|
|
||||||
if (_dwgStage == null)
|
if (_dwgStage == null)
|
||||||
{
|
{
|
||||||
var serv = GlobalObje.container.Resolve<DataItemService>();
|
var serv =GlobalObject.container.Resolve<DataItemService>();
|
||||||
var res = Task.Run(() => serv.GetDetails(DBConst.Be_DrawingStage.ToString()));
|
var res = Task.Run(() => serv.GetDetails(DBConst.Be_DrawingStage.ToString()));
|
||||||
var res2 = res.Result;
|
var res2 = res.Result;
|
||||||
return res2;
|
return res2;
|
||||||
@ -155,7 +156,7 @@ namespace SWS.CAD
|
|||||||
|
|
||||||
if (_dwgSystem == null)
|
if (_dwgSystem == null)
|
||||||
{
|
{
|
||||||
var serv = GlobalObje.container.Resolve<DataItemService>();
|
var serv = GlobalObject.container.Resolve<DataItemService>();
|
||||||
var res = Task.Run(() => serv.GetDetails(DBConst.Be_DrawingSystem.ToString()));
|
var res = Task.Run(() => serv.GetDetails(DBConst.Be_DrawingSystem.ToString()));
|
||||||
var res2 = res.Result;
|
var res2 = res.Result;
|
||||||
var res3 = DataItemDetailsToTree(res2);
|
var res3 = DataItemDetailsToTree(res2);
|
||||||
@ -243,11 +244,11 @@ namespace SWS.CAD
|
|||||||
para1,
|
para1,
|
||||||
para2
|
para2
|
||||||
}
|
}
|
||||||
public static IUnityContainer container;
|
//public static IUnityContainer container;
|
||||||
public static IContainerExtension _prismContainer;
|
//public static IContainerExtension _prismContainer;
|
||||||
public static HttpClient client;
|
//public static HttpClient client;
|
||||||
public static loginRes userInfo;
|
//public static loginRes userInfo;
|
||||||
public static List<User> Users;
|
//public static List<User> Users;
|
||||||
|
|
||||||
public static bool isConfigIniCreateBySys = true;
|
public static bool isConfigIniCreateBySys = true;
|
||||||
//public static string drawingFileId;
|
//public static string drawingFileId;
|
||||||
@ -321,27 +322,27 @@ namespace SWS.CAD
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 根据ID获取用户名称
|
//#region 根据ID获取用户名称
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// 根据ID获取用户名称
|
///// 根据ID获取用户名称
|
||||||
/// </summary>
|
///// </summary>
|
||||||
/// <param name="id"></param>
|
///// <param name="id"></param>
|
||||||
/// <returns></returns>
|
///// <returns></returns>
|
||||||
public static string GetUserNameById(string id)
|
//public static string GetUserNameById(string id)
|
||||||
{
|
//{
|
||||||
if (string.IsNullOrEmpty(id))
|
// if (string.IsNullOrEmpty(id))
|
||||||
{ return ""; }
|
// { return ""; }
|
||||||
var user = Users.FirstOrDefault(a => a.F_UserId == id || a.F_Account == id);
|
// var user = Users.FirstOrDefault(a => a.F_UserId == id || a.F_Account == id);
|
||||||
if (user != null)
|
// if (user != null)
|
||||||
{ return user.F_RealName; }
|
// { return user.F_RealName; }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
return "";
|
// return "";
|
||||||
//user = GlobalObject.Users.FirstOrDefault(a => a.F_Account == id);
|
// //user = GlobalObject.Users.FirstOrDefault(a => a.F_Account == id);
|
||||||
//return user != null ? user.F_RealName : "";
|
// //return user != null ? user.F_RealName : "";
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
#endregion
|
//#endregion
|
||||||
|
|
||||||
#region 查找子控件
|
#region 查找子控件
|
||||||
|
|
||||||
|
@ -167,6 +167,7 @@
|
|||||||
<Compile Include="Event\propertyChangeEvent.cs" />
|
<Compile Include="Event\propertyChangeEvent.cs" />
|
||||||
<Compile Include="Event\IORelationEvent.cs" />
|
<Compile Include="Event\IORelationEvent.cs" />
|
||||||
<Compile Include="Event\tagChangeEvent.cs" />
|
<Compile Include="Event\tagChangeEvent.cs" />
|
||||||
|
<Compile Include="Event\ScrollToItemEvent.cs" />
|
||||||
<Compile Include="Event\treeNodeChangeEvent.cs" />
|
<Compile Include="Event\treeNodeChangeEvent.cs" />
|
||||||
<Compile Include="Event\SelectProjectEvent.cs" />
|
<Compile Include="Event\SelectProjectEvent.cs" />
|
||||||
<Compile Include="Helper\Converter\ComboBoxFilterConverter.cs" />
|
<Compile Include="Helper\Converter\ComboBoxFilterConverter.cs" />
|
||||||
|
@ -10,6 +10,7 @@ using System.Windows.Threading;
|
|||||||
using Bricscad.ApplicationServices;
|
using Bricscad.ApplicationServices;
|
||||||
using Bricscad.EditorInput;
|
using Bricscad.EditorInput;
|
||||||
using OfficeOpenXml;
|
using OfficeOpenXml;
|
||||||
|
using OfficeOpenXml.FormulaParsing.Excel.Functions.Information;
|
||||||
using Prism.Events;
|
using Prism.Events;
|
||||||
using Prism.Ioc;
|
using Prism.Ioc;
|
||||||
using Prism.Services.Dialogs;
|
using Prism.Services.Dialogs;
|
||||||
@ -56,6 +57,8 @@ namespace SWS.CAD.ViewModels
|
|||||||
|
|
||||||
RaisePropertyChanged(nameof(SelectedTreeNode));
|
RaisePropertyChanged(nameof(SelectedTreeNode));
|
||||||
UpdateChannelInfos();
|
UpdateChannelInfos();
|
||||||
|
var path = FindNodePath(PanelTreels, _SelectedTreeNode);
|
||||||
|
_eventAggregator.GetEvent<ScrollToItemEvent>().Publish(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,7 +282,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
{
|
{
|
||||||
ChannelInfo c = new ChannelInfo();
|
ChannelInfo c = new ChannelInfo();
|
||||||
//电缆位号,电缆对,电缆线号,极性
|
//电缆位号,电缆对,电缆线号,极性
|
||||||
foreach (var Term in child.Terms)
|
foreach (var Term in child.Terms.OrderBy(p => p.Term_Seq).ToList())
|
||||||
{
|
{
|
||||||
index++;
|
index++;
|
||||||
c.Index.Add(index.ToString());
|
c.Index.Add(index.ToString());
|
||||||
@ -302,7 +305,8 @@ namespace SWS.CAD.ViewModels
|
|||||||
c.Polaritys.Add(new ec_WireTerminal());
|
c.Polaritys.Add(new ec_WireTerminal());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
c.Terms.AddRange(child.Terms);
|
//端子号
|
||||||
|
c.Terms.AddRange(child.Terms.OrderBy(p => p.Term_Seq).ToList());
|
||||||
//关联信号
|
//关联信号
|
||||||
c.Signal = child.Signal;
|
c.Signal = child.Signal;
|
||||||
if (child.Signal != null)
|
if (child.Signal != null)
|
||||||
@ -333,14 +337,14 @@ namespace SWS.CAD.ViewModels
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
System.Windows.MessageBox.Show(ex.Message, "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
System.Windows.MessageBox.Show(ex.Message, "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
IsBusy = false;
|
IsBusy = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -523,6 +527,44 @@ namespace SWS.CAD.ViewModels
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region 查找节点路径
|
||||||
|
public List<string> FindNodePath(ObservableCollection<TreeModel> nodes, TreeModel targetNode)
|
||||||
|
{
|
||||||
|
List<string> path = new List<string>();
|
||||||
|
FindNodePathRecursive(nodes, targetNode, path);
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool FindNodePathRecursive(IEnumerable<TreeModel> nodes, TreeModel targetNode, List<string> currentPath)
|
||||||
|
{
|
||||||
|
foreach (var node in nodes)
|
||||||
|
{
|
||||||
|
currentPath.Add(node.Text);
|
||||||
|
if (node == targetNode) return true; // 找到目标节点,返回True并结束搜索
|
||||||
|
if (node.ChildNodes.Count > 0 && FindNodePathRecursive(node.ChildNodes, targetNode, currentPath))
|
||||||
|
return true; // 在子节点中继续搜索并找到目标节点,返回True并结束搜索
|
||||||
|
currentPath.RemoveAt(currentPath.Count - 1); // 回溯,尝试下一个兄弟节点或父节点的其他兄弟节点
|
||||||
|
}
|
||||||
|
return false; // 没有找到目标节点,返回False
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 通过id查找项
|
||||||
|
private TreeModel FindTreeModelById(IEnumerable<TreeModel> TreeModels, string id)
|
||||||
|
{
|
||||||
|
foreach (var Tree in TreeModels)
|
||||||
|
{
|
||||||
|
if (Tree.ID == id)
|
||||||
|
return Tree;
|
||||||
|
|
||||||
|
var foundInChildren = FindTreeModelById(Tree.ChildNodes, id);
|
||||||
|
if (foundInChildren != null)
|
||||||
|
return foundInChildren;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region 树形结构右键点击事件
|
#region 树形结构右键点击事件
|
||||||
public ICommand MouseRightCmd => new DelegateCommand(MouseRight_Click);
|
public ICommand MouseRightCmd => new DelegateCommand(MouseRight_Click);
|
||||||
@ -685,13 +727,14 @@ namespace SWS.CAD.ViewModels
|
|||||||
DataItemName = listPro.Where(p => p.DisplayText.Equals("位置名称")).Select(p => p.PropertyValue).FirstOrDefault(),
|
DataItemName = listPro.Where(p => p.DisplayText.Equals("位置名称")).Select(p => p.PropertyValue).FirstOrDefault(),
|
||||||
OrderID = int.Parse(listPro.Where(p => p.DisplayText.Equals("排序号")).Select(p => p.PropertyValue).FirstOrDefault()),
|
OrderID = int.Parse(listPro.Where(p => p.DisplayText.Equals("排序号")).Select(p => p.PropertyValue).FirstOrDefault()),
|
||||||
};
|
};
|
||||||
var httpres = await _dataItemService.SaveDetailForm(ent);
|
var httpres = await _dataItemService.SaveDetailForm(ent) as learunHttpRes<ec_dataitemdetail>;
|
||||||
if (httpres != null)
|
if (httpres.code != 200)
|
||||||
{
|
{
|
||||||
System.Windows.MessageBox.Show(httpres.ToString(), "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
|
System.Windows.MessageBox.Show(httpres.info.ToString(), "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
|
||||||
}
|
}
|
||||||
PanelTreels.Clear();
|
PanelTreels.Clear();
|
||||||
PanelTreels.AddRange(await _iOModuleService.GetPanelTree());
|
PanelTreels.AddRange(await _iOModuleService.GetPanelTree());
|
||||||
|
SelectedTreeNode = FindNodeByNodeId(PanelTreels, httpres.data.DataItemID);
|
||||||
}
|
}
|
||||||
else if (RES.Result == ButtonResult.No)
|
else if (RES.Result == ButtonResult.No)
|
||||||
{ }
|
{ }
|
||||||
@ -881,13 +924,15 @@ namespace SWS.CAD.ViewModels
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
var httpres = await _iOModuleService.CreatePanelStripByProfile(e);
|
var httpres = await _iOModuleService.CreatePanelStripByProfile(e) as learunHttpRes<ec_PanelStrip>;
|
||||||
if (httpres != null)
|
if (httpres.code != 200)
|
||||||
{
|
{
|
||||||
System.Windows.MessageBox.Show(httpres.ToString(), "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
|
System.Windows.MessageBox.Show(httpres.info.ToString(), "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
|
||||||
}
|
}
|
||||||
PanelTreels.Clear();
|
PanelTreels.Clear();
|
||||||
PanelTreels.AddRange(await _iOModuleService.GetPanelTree());
|
PanelTreels.AddRange(await _iOModuleService.GetPanelTree());
|
||||||
|
SelectedTreeNode = FindTreeModelById(PanelTreels, httpres.data.StripID);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (RES.Result == ButtonResult.No)
|
else if (RES.Result == ButtonResult.No)
|
||||||
{ }
|
{ }
|
||||||
@ -940,13 +985,14 @@ namespace SWS.CAD.ViewModels
|
|||||||
DataItemName = listPro.Where(p => p.DisplayText.Equals("位置名称")).Select(p => p.PropertyValue).FirstOrDefault(),
|
DataItemName = listPro.Where(p => p.DisplayText.Equals("位置名称")).Select(p => p.PropertyValue).FirstOrDefault(),
|
||||||
OrderID = int.Parse(listPro.Where(p => p.DisplayText.Equals("排序号")).Select(p => p.PropertyValue).FirstOrDefault()),
|
OrderID = int.Parse(listPro.Where(p => p.DisplayText.Equals("排序号")).Select(p => p.PropertyValue).FirstOrDefault()),
|
||||||
};
|
};
|
||||||
var httpres = await _dataItemService.SaveDetailForm(ent);
|
var httpres = await _dataItemService.SaveDetailForm(ent) as learunHttpRes<ec_dataitemdetail>;
|
||||||
if (httpres != null)
|
if (httpres.code != 200)
|
||||||
{
|
{
|
||||||
System.Windows.MessageBox.Show(httpres.ToString(), "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
|
System.Windows.MessageBox.Show(httpres.info.ToString(), "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
|
||||||
}
|
}
|
||||||
PanelTreels.Clear();
|
PanelTreels.Clear();
|
||||||
PanelTreels.AddRange(await _iOModuleService.GetPanelTree());
|
PanelTreels.AddRange(await _iOModuleService.GetPanelTree());
|
||||||
|
SelectedTreeNode = FindNodeByNodeId(PanelTreels, httpres.info);
|
||||||
}
|
}
|
||||||
else if (RES.Result == ButtonResult.No)
|
else if (RES.Result == ButtonResult.No)
|
||||||
{ }
|
{ }
|
||||||
@ -974,6 +1020,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
{
|
{
|
||||||
if (RES.Result == ButtonResult.Yes)
|
if (RES.Result == ButtonResult.Yes)
|
||||||
{
|
{
|
||||||
|
var tempID = SelectedTreeNode.ID;
|
||||||
var listPro = RES.Parameters.GetValue<ObservableCollection<propertyModel>>(GlobalObject.dialogPar.para1.ToString());
|
var listPro = RES.Parameters.GetValue<ObservableCollection<propertyModel>>(GlobalObject.dialogPar.para1.ToString());
|
||||||
|
|
||||||
ec_PanelStrip ent = new ec_PanelStrip()
|
ec_PanelStrip ent = new ec_PanelStrip()
|
||||||
@ -985,12 +1032,13 @@ namespace SWS.CAD.ViewModels
|
|||||||
StripID = StripIDValue,
|
StripID = StripIDValue,
|
||||||
};
|
};
|
||||||
var httpres = await _iOModuleService.SavePanelStrip(ent);
|
var httpres = await _iOModuleService.SavePanelStrip(ent);
|
||||||
if (httpres != null)
|
if (httpres!= null)
|
||||||
{
|
{
|
||||||
System.Windows.MessageBox.Show(httpres.ToString(), "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
|
System.Windows.MessageBox.Show(httpres.ToString(), "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
|
||||||
}
|
}
|
||||||
PanelTreels.Clear();
|
PanelTreels.Clear();
|
||||||
PanelTreels.AddRange(await _iOModuleService.GetPanelTree());
|
PanelTreels.AddRange(await _iOModuleService.GetPanelTree());
|
||||||
|
SelectedTreeNode = FindNodeByNodeId(PanelTreels, tempID);
|
||||||
}
|
}
|
||||||
else if (RES.Result == ButtonResult.No)
|
else if (RES.Result == ButtonResult.No)
|
||||||
{ }
|
{ }
|
||||||
@ -1017,7 +1065,15 @@ namespace SWS.CAD.ViewModels
|
|||||||
MessageBoxResult result = System.Windows.MessageBox.Show($"确定删除[{SelectedTreeNode.Text}]节点以及子节点吗", "KunHengCAD", MessageBoxButton.OKCancel, MessageBoxImage.Question);
|
MessageBoxResult result = System.Windows.MessageBox.Show($"确定删除[{SelectedTreeNode.Text}]节点以及子节点吗", "KunHengCAD", MessageBoxButton.OKCancel, MessageBoxImage.Question);
|
||||||
if (result == MessageBoxResult.OK)
|
if (result == MessageBoxResult.OK)
|
||||||
{
|
{
|
||||||
|
var tempParentId = SelectedTreeNode.parentId;
|
||||||
var httpres = await _iOModuleService.DeletePanelStrip(SelectedTreeNode.ID);
|
var httpres = await _iOModuleService.DeletePanelStrip(SelectedTreeNode.ID);
|
||||||
|
if (httpres!=null)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show(httpres.ToString(), "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
|
||||||
|
}
|
||||||
|
PanelTreels.Clear();
|
||||||
|
PanelTreels.AddRange(await _iOModuleService.GetPanelTree());
|
||||||
|
SelectedTreeNode = FindTreeModelById(PanelTreels, tempParentId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -1069,7 +1125,8 @@ namespace SWS.CAD.ViewModels
|
|||||||
//获取位号的电缆属性,判断是否设置电缆规格
|
//获取位号的电缆属性,判断是否设置电缆规格
|
||||||
var TagNumberBys = await _objectTypeService.GetEngineDataListByTags(selectTagNumberOB.TagNumber);
|
var TagNumberBys = await _objectTypeService.GetEngineDataListByTags(selectTagNumberOB.TagNumber);
|
||||||
var TagNumberBy = TagNumberBys.Where(t => t.TagNumber.Equals(selectTagNumberOB.TagNumber)).FirstOrDefault();
|
var TagNumberBy = TagNumberBys.Where(t => t.TagNumber.Equals(selectTagNumberOB.TagNumber)).FirstOrDefault();
|
||||||
if (!CableSpecification.Split(',').ToList().Contains(TagNumberBy.EngineDataProperty.Where(e => e.PropertyName.Equals("电缆规格")).Select(e => e.PropertyValue).FirstOrDefault()))
|
if (string.IsNullOrEmpty(TagNumberBy.EngineDataProperty.Where(e => e.PropertyName.Equals("电缆规格")).Select(e => e.PropertyValue).FirstOrDefault()))
|
||||||
|
//if (!CableSpecification.Split(',').ToList().Contains(TagNumberBy.EngineDataProperty.Where(e => e.PropertyName.Equals("电缆规格")).Select(e => e.PropertyValue).FirstOrDefault()))
|
||||||
{
|
{
|
||||||
System.Windows.MessageBox.Show("无法获取电缆对信息,请在电缆\"属性面版“输入电缆”电缆规格”属性\r\n如:“1x2x0.75”", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
|
System.Windows.MessageBox.Show("无法获取电缆对信息,请在电缆\"属性面版“输入电缆”电缆规格”属性\r\n如:“1x2x0.75”", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
|
||||||
|
|
||||||
@ -1108,6 +1165,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
ec_Cable.EngineerDataID = selectTagNumberOB.EngineDataID;
|
ec_Cable.EngineerDataID = selectTagNumberOB.EngineDataID;
|
||||||
ec_Cable.Sets = new List<ec_CableSet>();
|
ec_Cable.Sets = new List<ec_CableSet>();
|
||||||
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
|
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
|
||||||
|
int n = 0;
|
||||||
for (int i = 0; i < CableSetCount; i++)
|
for (int i = 0; i < CableSetCount; i++)
|
||||||
{
|
{
|
||||||
ec_CableSet ec_CableSet = new ec_CableSet();
|
ec_CableSet ec_CableSet = new ec_CableSet();
|
||||||
@ -1117,6 +1175,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
|
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
|
||||||
for (int j = 0; j < WireCount; j++)
|
for (int j = 0; j < WireCount; j++)
|
||||||
{
|
{
|
||||||
|
n++;
|
||||||
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
|
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
|
||||||
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
|
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
|
||||||
ec_CableSetWire.SetLevel = j + 1;
|
ec_CableSetWire.SetLevel = j + 1;
|
||||||
@ -1125,6 +1184,20 @@ namespace SWS.CAD.ViewModels
|
|||||||
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
|
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
|
||||||
{
|
{
|
||||||
case "按电缆编号":
|
case "按电缆编号":
|
||||||
|
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
||||||
|
{
|
||||||
|
Tag = n.ToString();
|
||||||
|
}
|
||||||
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("字母"))
|
||||||
|
{
|
||||||
|
Tag = Tag + (char)('A' + (n - 1));
|
||||||
|
}
|
||||||
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
||||||
|
{
|
||||||
|
Tag = (i + 1) + "-" + n.ToString();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "按电缆对编号":
|
||||||
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
||||||
{
|
{
|
||||||
Tag = (j + 1).ToString();
|
Tag = (j + 1).ToString();
|
||||||
@ -1135,12 +1208,9 @@ namespace SWS.CAD.ViewModels
|
|||||||
}
|
}
|
||||||
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
||||||
{
|
{
|
||||||
Tag = (i + 1).ToString();
|
Tag = (i + 1) + "-" + (j + 1).ToString();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "按电缆对编号":
|
|
||||||
a = selectTagNumberOB.TagNumber;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
ec_CableSetWire.Wire_Tag = a + Tag;
|
ec_CableSetWire.Wire_Tag = a + Tag;
|
||||||
ec_CableSet.Wires.Add(ec_CableSetWire);
|
ec_CableSet.Wires.Add(ec_CableSetWire);
|
||||||
@ -1177,6 +1247,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
ec_Cable.EngineerDataID = selectTagNumberOB.EngineDataID;
|
ec_Cable.EngineerDataID = selectTagNumberOB.EngineDataID;
|
||||||
ec_Cable.Sets = new List<ec_CableSet>();
|
ec_Cable.Sets = new List<ec_CableSet>();
|
||||||
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
|
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
|
||||||
|
int n = 0;
|
||||||
for (int i = 0; i < CableSetCount; i++)
|
for (int i = 0; i < CableSetCount; i++)
|
||||||
{
|
{
|
||||||
ec_CableSet ec_CableSet = new ec_CableSet();
|
ec_CableSet ec_CableSet = new ec_CableSet();
|
||||||
@ -1186,6 +1257,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
|
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
|
||||||
for (int j = 0; j < WireCount; j++)
|
for (int j = 0; j < WireCount; j++)
|
||||||
{
|
{
|
||||||
|
n++;
|
||||||
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
|
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
|
||||||
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
|
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
|
||||||
ec_CableSetWire.SetLevel = j + 1;
|
ec_CableSetWire.SetLevel = j + 1;
|
||||||
@ -1194,6 +1266,20 @@ namespace SWS.CAD.ViewModels
|
|||||||
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
|
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
|
||||||
{
|
{
|
||||||
case "按电缆编号":
|
case "按电缆编号":
|
||||||
|
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
||||||
|
{
|
||||||
|
Tag = n.ToString();
|
||||||
|
}
|
||||||
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("字母"))
|
||||||
|
{
|
||||||
|
Tag = Tag + (char)('A' + (n - 1));
|
||||||
|
}
|
||||||
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
||||||
|
{
|
||||||
|
Tag = (i + 1) + "-" + n.ToString();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "按电缆对编号":
|
||||||
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
||||||
{
|
{
|
||||||
Tag = (j + 1).ToString();
|
Tag = (j + 1).ToString();
|
||||||
@ -1204,12 +1290,9 @@ namespace SWS.CAD.ViewModels
|
|||||||
}
|
}
|
||||||
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
||||||
{
|
{
|
||||||
Tag = (i + 1).ToString();
|
Tag = (i + 1) + "-" + (j + 1).ToString();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "按电缆对编号":
|
|
||||||
a = selectTagNumberOB.TagNumber;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
ec_CableSetWire.Wire_Tag = a + Tag;
|
ec_CableSetWire.Wire_Tag = a + Tag;
|
||||||
ec_CableSet.Wires.Add(ec_CableSetWire);
|
ec_CableSet.Wires.Add(ec_CableSetWire);
|
||||||
@ -1502,11 +1585,12 @@ namespace SWS.CAD.ViewModels
|
|||||||
//获取位号的电缆属性,判断是否设置电缆规格
|
//获取位号的电缆属性,判断是否设置电缆规格
|
||||||
var TagNumberBys = await _objectTypeService.GetEngineDataListByTags(resTagNumberListByPixels.TagNumber);
|
var TagNumberBys = await _objectTypeService.GetEngineDataListByTags(resTagNumberListByPixels.TagNumber);
|
||||||
var TagNumberBy = TagNumberBys.Where(t => t.TagNumber.Equals(resTagNumberListByPixels.TagNumber)).FirstOrDefault();
|
var TagNumberBy = TagNumberBys.Where(t => t.TagNumber.Equals(resTagNumberListByPixels.TagNumber)).FirstOrDefault();
|
||||||
|
if (string.IsNullOrEmpty(TagNumberBy.EngineDataProperty.Where(e => e.PropertyName.Equals("电缆规格")).Select(e => e.PropertyValue).FirstOrDefault()))
|
||||||
//if (!CableSpecification.Split(',').ToList().Contains(TagNumberBy.EngineDataProperty.Where(e => e.PropertyName.Equals("电缆规格")).Select(e => e.PropertyValue).FirstOrDefault()))
|
//if (!CableSpecification.Split(',').ToList().Contains(TagNumberBy.EngineDataProperty.Where(e => e.PropertyName.Equals("电缆规格")).Select(e => e.PropertyValue).FirstOrDefault()))
|
||||||
//{
|
{
|
||||||
// System.Windows.MessageBox.Show("无法获取电缆对信息,请在电缆\"属性面版“输入电缆”电缆规格”属性\r\n如:“1x2x0.75”", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
|
System.Windows.MessageBox.Show("无法获取电缆对信息,请在电缆\"属性面版“输入电缆”电缆规格”属性\r\n如:“1x2x0.75”", "KunHengCAD", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Warning); return;
|
||||||
|
|
||||||
//}
|
}
|
||||||
//获取电缆的配置,没有则创建新配置
|
//获取电缆的配置,没有则创建新配置
|
||||||
var CableBy = await _iOModuleService.GetCableByEngID(resTagNumberListByPixels?.EngineDataID);
|
var CableBy = await _iOModuleService.GetCableByEngID(resTagNumberListByPixels?.EngineDataID);
|
||||||
if (CableBy == null)
|
if (CableBy == null)
|
||||||
@ -1540,6 +1624,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
ec_Cable.EngineerDataID = resTagNumberListByPixels.EngineDataID;
|
ec_Cable.EngineerDataID = resTagNumberListByPixels.EngineDataID;
|
||||||
ec_Cable.Sets = new List<ec_CableSet>();
|
ec_Cable.Sets = new List<ec_CableSet>();
|
||||||
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
|
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
|
||||||
|
int n = 0;
|
||||||
for (int i = 0; i < CableSetCount; i++)
|
for (int i = 0; i < CableSetCount; i++)
|
||||||
{
|
{
|
||||||
ec_CableSet ec_CableSet = new ec_CableSet();
|
ec_CableSet ec_CableSet = new ec_CableSet();
|
||||||
@ -1549,6 +1634,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
|
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
|
||||||
for (int j = 0; j < WireCount; j++)
|
for (int j = 0; j < WireCount; j++)
|
||||||
{
|
{
|
||||||
|
n++;
|
||||||
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
|
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
|
||||||
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
|
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
|
||||||
ec_CableSetWire.SetLevel = j + 1;
|
ec_CableSetWire.SetLevel = j + 1;
|
||||||
@ -1557,6 +1643,20 @@ namespace SWS.CAD.ViewModels
|
|||||||
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
|
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
|
||||||
{
|
{
|
||||||
case "按电缆编号":
|
case "按电缆编号":
|
||||||
|
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
||||||
|
{
|
||||||
|
Tag = n.ToString();
|
||||||
|
}
|
||||||
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("字母"))
|
||||||
|
{
|
||||||
|
Tag = Tag + (char)('A' + (n - 1));
|
||||||
|
}
|
||||||
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
||||||
|
{
|
||||||
|
Tag = (i + 1) + "-" + n.ToString();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "按电缆对编号":
|
||||||
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
||||||
{
|
{
|
||||||
Tag = (j + 1).ToString();
|
Tag = (j + 1).ToString();
|
||||||
@ -1567,12 +1667,9 @@ namespace SWS.CAD.ViewModels
|
|||||||
}
|
}
|
||||||
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
||||||
{
|
{
|
||||||
Tag = (i + 1).ToString();
|
Tag = (i + 1) + "-" + (j + 1).ToString();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "按电缆对编号":
|
|
||||||
a = resTagNumberListByPixels.TagNumber;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
ec_CableSetWire.Wire_Tag = a + Tag;
|
ec_CableSetWire.Wire_Tag = a + Tag;
|
||||||
ec_CableSet.Wires.Add(ec_CableSetWire);
|
ec_CableSet.Wires.Add(ec_CableSetWire);
|
||||||
@ -1609,6 +1706,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
ec_Cable.EngineerDataID = resTagNumberListByPixels.EngineDataID;
|
ec_Cable.EngineerDataID = resTagNumberListByPixels.EngineDataID;
|
||||||
ec_Cable.Sets = new List<ec_CableSet>();
|
ec_Cable.Sets = new List<ec_CableSet>();
|
||||||
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
|
int CableSetCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("电缆对数")).Select(p => p.PropertyValue).FirstOrDefault(), out CableSetCount) ? CableSetCount : 0;
|
||||||
|
int n = 0;
|
||||||
for (int i = 0; i < CableSetCount; i++)
|
for (int i = 0; i < CableSetCount; i++)
|
||||||
{
|
{
|
||||||
ec_CableSet ec_CableSet = new ec_CableSet();
|
ec_CableSet ec_CableSet = new ec_CableSet();
|
||||||
@ -1618,6 +1716,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
|
int WireCount = int.TryParse(ReslistPro.Where(p => p.DisplayText.Equals("每电缆对芯数")).Select(p => p.PropertyValue).FirstOrDefault(), out WireCount) ? WireCount : 0;
|
||||||
for (int j = 0; j < WireCount; j++)
|
for (int j = 0; j < WireCount; j++)
|
||||||
{
|
{
|
||||||
|
n++;
|
||||||
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
|
ec_CableSetWire ec_CableSetWire = new ec_CableSetWire();
|
||||||
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
|
ec_CableSetWire.Polarity = ReslistPro.Where(p => p.DisplayText.Equals("极性")).Select(p => p.PropertyValue).FirstOrDefault().Split(',')[Math.Abs(j % 3)];
|
||||||
ec_CableSetWire.SetLevel = j + 1;
|
ec_CableSetWire.SetLevel = j + 1;
|
||||||
@ -1626,6 +1725,20 @@ namespace SWS.CAD.ViewModels
|
|||||||
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
|
switch (ReslistPro.Where(p => p.DisplayText.Equals("编号规则")).Select(p => p.PropertyValue).FirstOrDefault())
|
||||||
{
|
{
|
||||||
case "按电缆编号":
|
case "按电缆编号":
|
||||||
|
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
||||||
|
{
|
||||||
|
Tag = n.ToString();
|
||||||
|
}
|
||||||
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("字母"))
|
||||||
|
{
|
||||||
|
Tag = Tag + (char)('A' + (n - 1));
|
||||||
|
}
|
||||||
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
||||||
|
{
|
||||||
|
Tag = (i + 1) + "-" + n.ToString();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "按电缆对编号":
|
||||||
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("数字"))
|
||||||
{
|
{
|
||||||
Tag = (j + 1).ToString();
|
Tag = (j + 1).ToString();
|
||||||
@ -1636,12 +1749,9 @@ namespace SWS.CAD.ViewModels
|
|||||||
}
|
}
|
||||||
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
else if (ReslistPro.Where(p => p.DisplayText.Equals("编号类型")).Select(p => p.PropertyValue).FirstOrDefault().Equals("电缆对序号"))
|
||||||
{
|
{
|
||||||
Tag = (i + 1).ToString();
|
Tag = (i + 1) + "-" + (j + 1).ToString();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "按电缆对编号":
|
|
||||||
a = resTagNumberListByPixels.TagNumber;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
ec_CableSetWire.Wire_Tag = a + Tag;
|
ec_CableSetWire.Wire_Tag = a + Tag;
|
||||||
ec_CableSet.Wires.Add(ec_CableSetWire);
|
ec_CableSet.Wires.Add(ec_CableSetWire);
|
||||||
@ -2055,7 +2165,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
if (result == MessageBoxResult.OK)
|
if (result == MessageBoxResult.OK)
|
||||||
{
|
{
|
||||||
var httpres = await _iOModuleService.DeletePanelChannel(SelectedChannelInfo.ChannelID);
|
var httpres = await _iOModuleService.DeletePanelChannel(SelectedChannelInfo.ChannelID);
|
||||||
if (httpres!=null)
|
if (httpres != null)
|
||||||
{
|
{
|
||||||
System.Windows.MessageBox.Show(httpres, "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
|
System.Windows.MessageBox.Show(httpres, "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
|
||||||
|
|
||||||
@ -2531,8 +2641,8 @@ namespace SWS.CAD.ViewModels
|
|||||||
ent.Signals = new List<SWS.Model.ec_Wire_Group>();
|
ent.Signals = new List<SWS.Model.ec_Wire_Group>();
|
||||||
ent.Signals.Add(SelectedChannelInfo.Signal);
|
ent.Signals.Add(SelectedChannelInfo.Signal);
|
||||||
//解除信号
|
//解除信号
|
||||||
var data = await _wireGroupService.SaveSignals(ent);
|
var data = await _wireGroupService.SaveSignals(ent) as learunHttpRes<List<ec_Wire_Group>>;
|
||||||
if (data != null)
|
if (data.code ==200)
|
||||||
{
|
{
|
||||||
ChannelInfos.Clear();
|
ChannelInfos.Clear();
|
||||||
UpdateChannelInfos();
|
UpdateChannelInfos();
|
||||||
|
@ -1,29 +1,208 @@
|
|||||||
|
|
||||||
|
using Prism.Events;
|
||||||
using Prism.Ioc;
|
using Prism.Ioc;
|
||||||
using Prism.Services.Dialogs;
|
using Prism.Services.Dialogs;
|
||||||
|
using SWS.CAD.Event;
|
||||||
using SWS.CAD.ViewModels.myViewModelBase;
|
using SWS.CAD.ViewModels.myViewModelBase;
|
||||||
using SWS.CAD.Views;
|
using SWS.CAD.Views;
|
||||||
using SWS.CAD.Views.CustomControl;
|
using SWS.CAD.Views.CustomControl;
|
||||||
using SWS.Commons;
|
using SWS.Commons;
|
||||||
|
using SWS.Model;
|
||||||
|
using SWS.Service;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Documents;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using Telerik.Windows.Controls;
|
||||||
using Unity;
|
using Unity;
|
||||||
using DelegateCommand = Prism.Commands.DelegateCommand;
|
|
||||||
|
|
||||||
namespace SWS.CAD.ViewModels
|
namespace SWS.CAD.ViewModels
|
||||||
{
|
{
|
||||||
public class DialogSignalPredistributionViewModel : DialogBase, IDialogAware
|
public class DialogSignalPredistributionViewModel : DialogBase, IDialogAware
|
||||||
{
|
{
|
||||||
private string objectTypeId;
|
#region 字段
|
||||||
|
private ObservableCollection<Model.TreeModel> _PanelTreels = new ObservableCollection<Model.TreeModel>();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 新建位号
|
/// 页面左侧树形结构数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ICommand Command_NewTagNumber { get; set; }
|
public ObservableCollection<Model.TreeModel> PanelTreels
|
||||||
|
{
|
||||||
|
get { return _PanelTreels; }
|
||||||
|
set { _PanelTreels = value; RaisePropertyChanged(nameof(PanelTreels)); }
|
||||||
|
}
|
||||||
|
|
||||||
|
private Model.TreeModel _SelectedTreeNode;
|
||||||
|
/// <summary>
|
||||||
|
/// 当前选中的树形节点
|
||||||
|
/// </summary>
|
||||||
|
public Model.TreeModel SelectedTreeNode
|
||||||
|
{
|
||||||
|
get { return _SelectedTreeNode; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_SelectedTreeNode = value;
|
||||||
|
RaisePropertyChanged(nameof(SelectedTreeNode));
|
||||||
|
var path= FindNodePath(PanelTreels, _SelectedTreeNode);
|
||||||
|
_eventAggregator.GetEvent<ScrollToItemEvent>().Publish(path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ObservableCollection<SignalPredistributionInfo> _SignalPredistributionInfos = new ObservableCollection<SignalPredistributionInfo>();
|
||||||
|
/// <summary>
|
||||||
|
/// 表格数据
|
||||||
|
/// </summary>
|
||||||
|
public ObservableCollection<SignalPredistributionInfo> SignalPredistributionInfos
|
||||||
|
{
|
||||||
|
get { return _SignalPredistributionInfos; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_SignalPredistributionInfos = value;
|
||||||
|
RaisePropertyChanged(nameof(SignalPredistributionInfos));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private string _SelectedOption1;
|
||||||
|
/// <summary>
|
||||||
|
/// 是否通讯母线
|
||||||
|
/// </summary>
|
||||||
|
public string SelectedOption1
|
||||||
|
{
|
||||||
|
get { return _SelectedOption1; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_SelectedOption1 = value;
|
||||||
|
RaisePropertyChanged(nameof(SelectedOption1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _SelectedOption2;
|
||||||
|
/// <summary>
|
||||||
|
/// 选择的信号类型
|
||||||
|
/// </summary>
|
||||||
|
public string SelectedOption2
|
||||||
|
{
|
||||||
|
get { return _SelectedOption2; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_SelectedOption2 = value;
|
||||||
|
SignalColumnName = value;
|
||||||
|
RaisePropertyChanged(nameof(SelectedOption2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _SignalColumnName;
|
||||||
|
/// <summary>
|
||||||
|
/// 信号类型列的列名
|
||||||
|
/// </summary>
|
||||||
|
public string SignalColumnName
|
||||||
|
{
|
||||||
|
get { return _SignalColumnName; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_SignalColumnName = value;
|
||||||
|
RaisePropertyChanged(nameof(SignalColumnName));
|
||||||
|
if (value.Equals("Digital"))
|
||||||
|
{
|
||||||
|
SignalTypeColumn = new ObservableCollection<string>() { "无公共端接线(断开报警NC)", "无公共端接线(闭合报警NO)", "带公共端接线(断开报警NC)", "带公共端接线(闭合报警NO)" };
|
||||||
|
}
|
||||||
|
else if (value.Equals("4-20mA"))
|
||||||
|
{
|
||||||
|
SignalTypeColumn = new ObservableCollection<string>() { "无源", "有源" };
|
||||||
|
}
|
||||||
|
else if (value.Equals("-10V-10V"))
|
||||||
|
{
|
||||||
|
SignalTypeColumn = new ObservableCollection<string>() { "无源", "有源" };
|
||||||
|
}
|
||||||
|
else if (value.Equals("PT100"))
|
||||||
|
{
|
||||||
|
SignalTypeColumn = new ObservableCollection<string>() { "量程100", "量程150", "量程200", "量程600" };
|
||||||
|
}
|
||||||
|
else if (value.Equals("Pulse"))
|
||||||
|
{
|
||||||
|
SignalTypeColumn = new ObservableCollection<string>() { "脉冲信号" };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private List<string> _CommunicationFormats = new List<string>() { "RS485", "RS482", "TCP/IP", "MQTT" };
|
||||||
|
/// <summary>
|
||||||
|
/// 通讯格式集合
|
||||||
|
/// </summary>
|
||||||
|
public List<string> CommunicationFormats
|
||||||
|
{
|
||||||
|
get { return _CommunicationFormats; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_CommunicationFormats = value;
|
||||||
|
RaisePropertyChanged(nameof(CommunicationFormats));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _CommunicationFormat = "RS485";
|
||||||
|
/// <summary>
|
||||||
|
/// 通讯格式
|
||||||
|
/// </summary>
|
||||||
|
public string CommunicationFormat
|
||||||
|
{
|
||||||
|
get { return _CommunicationFormat; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_CommunicationFormat = value;
|
||||||
|
RaisePropertyChanged(nameof(CommunicationFormat));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private ObservableCollection<string> _SignalTypeColumn;
|
||||||
|
/// <summary>
|
||||||
|
/// 信号类型列的下拉列表
|
||||||
|
/// </summary>
|
||||||
|
public ObservableCollection<string> SignalTypeColumn
|
||||||
|
{
|
||||||
|
get { return _SignalTypeColumn; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_SignalTypeColumn = value;
|
||||||
|
RaisePropertyChanged(nameof(SignalTypeColumn));
|
||||||
|
if (SignalPredistributionInfos != null)
|
||||||
|
{
|
||||||
|
foreach (var item in SignalPredistributionInfos)
|
||||||
|
{
|
||||||
|
item.SignalType = _SignalTypeColumn.FirstOrDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private List<string> _InorOuts = new List<string>() { "输出", "输入" };
|
||||||
|
/// <summary>
|
||||||
|
/// 输入/输出列的下拉列表
|
||||||
|
/// </summary>
|
||||||
|
public List<string> InorOuts
|
||||||
|
{
|
||||||
|
get { return _InorOuts; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_InorOuts = value;
|
||||||
|
RaisePropertyChanged(nameof(InorOuts));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
IOModuleService _iOModuleService;
|
||||||
|
IEventAggregator _eventAggregator;
|
||||||
|
|
||||||
public DialogSignalPredistributionViewModel()
|
public DialogSignalPredistributionViewModel()
|
||||||
{
|
{
|
||||||
title = "电缆信号预分配";
|
_iOModuleService = GlobalObject.container.Resolve<IOModuleService>();
|
||||||
|
_eventAggregator = GlobalObject.container.Resolve<IEventAggregator>();
|
||||||
|
|
||||||
}
|
}
|
||||||
public string Title => "";
|
public string Title => "";
|
||||||
|
|
||||||
@ -38,16 +217,157 @@ namespace SWS.CAD.ViewModels
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ec_Cable CableBy;
|
||||||
public void OnDialogOpened(IDialogParameters parameters)
|
public async void OnDialogOpened(IDialogParameters parameters)
|
||||||
{
|
{
|
||||||
//listTags = parameters.GetValue<ObservableCollection<KeyValueModel>>(GlobalObject.dialogPar.info.ToString());
|
title = $"电缆信号({parameters.GetValue<string>(GlobalObject.dialogPar.para2.ToString())})预分配";
|
||||||
objectTypeId = parameters.GetValue<string>(GlobalObject.dialogPar.id.ToString());
|
//树形结构数据
|
||||||
|
PanelTreels.AddRange(await _iOModuleService.GetPanelTree());
|
||||||
|
//电缆信息
|
||||||
|
CableBy = parameters.GetValue<ec_Cable>(GlobalObject.dialogPar.para1.ToString());
|
||||||
|
//是否母线
|
||||||
|
if (CableBy.CableClass.Equals("homerun"))
|
||||||
|
{
|
||||||
|
SelectedOption1 = "是";
|
||||||
|
}
|
||||||
|
else if (CableBy.CableClass.Equals("conventional") || CableBy.CableClass.Equals(""))
|
||||||
|
{
|
||||||
|
SelectedOption1 = "否";
|
||||||
|
|
||||||
|
}
|
||||||
|
//设置默认信号类型
|
||||||
|
if (string.IsNullOrEmpty(CableBy.PreAssignIOType))
|
||||||
|
{
|
||||||
|
SelectedOption2 = "Digital";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SelectedOption2 = CableBy.PreAssignIOType;
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置表格数据
|
||||||
|
int index = 0;
|
||||||
|
foreach (var Set in CableBy.Sets)
|
||||||
|
{
|
||||||
|
SignalPredistributionInfo predistributionInfo = new SignalPredistributionInfo();
|
||||||
|
predistributionInfo.CablePair = Set.CableSetName;
|
||||||
|
foreach (var Wire in Set.Wires)
|
||||||
|
{
|
||||||
|
index++;
|
||||||
|
predistributionInfo.Index.Add(index.ToString());
|
||||||
|
predistributionInfo.CableWires.Add(Wire);
|
||||||
|
predistributionInfo.Polaritys.Add(Wire);
|
||||||
|
}
|
||||||
|
if (string.IsNullOrEmpty(Set.PreAssignIOTypeDetail))
|
||||||
|
{
|
||||||
|
predistributionInfo.SignalType = SignalTypeColumn.FirstOrDefault();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
predistributionInfo.SignalType = Set.PreAssignIOTypeDetail;
|
||||||
|
}
|
||||||
|
predistributionInfo.ChineseDescription = Set.PreAssignGroup_Desc;
|
||||||
|
predistributionInfo.EnglishDescription = Set.PreAssignGroup_Desc_EN;
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(Set.PreAssignInOrOut))
|
||||||
|
{
|
||||||
|
predistributionInfo.InorOut = InorOuts.FirstOrDefault();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
predistributionInfo.InorOut = Set.PreAssignInOrOut;
|
||||||
|
}
|
||||||
|
predistributionInfo.SensorCode = Set.PreAssignSensorCode;
|
||||||
|
|
||||||
|
|
||||||
|
SignalPredistributionInfos.Add(predistributionInfo);
|
||||||
|
}
|
||||||
|
//是否预关联,有则选中节点
|
||||||
|
foreach (var Panel in PanelTreels)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(Panel.ID))
|
||||||
|
{
|
||||||
|
if (Panel.ID.Equals(CableBy.PanelID))
|
||||||
|
{
|
||||||
|
SelectedTreeNode = Panel;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (var Child in Panel.ChildNodes)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(Child.ID))
|
||||||
|
{
|
||||||
|
if (Child.ID.Equals(CableBy.PanelID))
|
||||||
|
{
|
||||||
|
SelectedTreeNode = Child;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public override void ExecuteOKCommandAsync(object para)
|
public override async void ExecuteOKCommandAsync(object para)
|
||||||
{
|
{
|
||||||
|
//创建SaveCable接口实例
|
||||||
|
ec_Cable newCable = new ec_Cable();
|
||||||
|
if (SelectedOption1.Equals("是"))
|
||||||
|
{
|
||||||
|
newCable.CableClass = "homerun";
|
||||||
|
newCable.PreAssignIOType = CommunicationFormat;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
newCable.CableClass = "conventional";
|
||||||
|
newCable.PreAssignIOType = SelectedOption2;
|
||||||
|
}
|
||||||
|
|
||||||
|
newCable.CableID = CableBy.CableID;
|
||||||
|
newCable.EngineerDataID = CableBy.EngineerDataID;
|
||||||
|
if (SelectedTreeNode != null)
|
||||||
|
{
|
||||||
|
newCable.PanelID = SelectedTreeNode.ID;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("请选择系统柜!", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
newCable.UpdateUserID = GlobalObject.userInfo.userId;
|
||||||
|
newCable.Sets = new List<ec_CableSet>();
|
||||||
|
foreach (var CableBySet in CableBy.Sets)
|
||||||
|
{
|
||||||
|
ec_CableSet newCableSet = new ec_CableSet();
|
||||||
|
newCableSet.CableSetID = CableBySet.CableSetID;
|
||||||
|
newCableSet.CableSetName = CableBySet.CableSetName;
|
||||||
|
newCableSet.CableSetSeq = CableBySet.CableSetSeq;
|
||||||
|
newCableSet.IsConned = CableBySet.IsConned;
|
||||||
|
newCableSet.PreAssignGroup_Desc = SignalPredistributionInfos.FirstOrDefault(s => s.CablePair.Equals(CableBySet.CableSetName)).ChineseDescription;
|
||||||
|
newCableSet.PreAssignGroup_Desc_EN = SignalPredistributionInfos.FirstOrDefault(s => s.CablePair.Equals(CableBySet.CableSetName)).EnglishDescription;
|
||||||
|
newCableSet.PreAssignIOTypeDetail = SignalPredistributionInfos.FirstOrDefault(s => s.CablePair.Equals(CableBySet.CableSetName)).SignalType;
|
||||||
|
newCableSet.PreAssignInOrOut = SignalPredistributionInfos.FirstOrDefault(s => s.CablePair.Equals(CableBySet.CableSetName)).InorOut;
|
||||||
|
newCableSet.PreAssignSensorCode = SignalPredistributionInfos.FirstOrDefault(s => s.CablePair.Equals(CableBySet.CableSetName)).SensorCode;
|
||||||
|
newCableSet.Wires = new List<ec_CableSetWire>();
|
||||||
|
foreach (var wire in CableBySet.Wires)
|
||||||
|
{
|
||||||
|
ec_CableSetWire newWire = new ec_CableSetWire();
|
||||||
|
newWire.Polarity = wire.Polarity;
|
||||||
|
newWire.SetLevel = 0;
|
||||||
|
newWire.WireID = wire.WireID;
|
||||||
|
newWire.Wire_Tag = wire.Wire_Tag;
|
||||||
|
newWire.Wire_Color_ID = wire.Wire_Color_ID;
|
||||||
|
newWire.PreAssignChannelTermNo = SignalPredistributionInfos.FirstOrDefault(s => s.CablePair.Equals(CableBySet.CableSetName)).CableWires.FirstOrDefault(c => c.Wire_Tag.Equals(wire.Wire_Tag)).PreAssignChannelTermNo;
|
||||||
|
|
||||||
|
newCableSet.Wires.Add(newWire);
|
||||||
|
}
|
||||||
|
newCable.Sets.Add(newCableSet);
|
||||||
|
}
|
||||||
|
|
||||||
|
var httpres = await _iOModuleService.SaveCable(newCable);
|
||||||
|
|
||||||
IDialogParameters res = new Prism.Services.Dialogs.DialogParameters();
|
IDialogParameters res = new Prism.Services.Dialogs.DialogParameters();
|
||||||
//res.Add(GlobalObject.dialogPar.info.ToString(), TagNumber);
|
//res.Add(GlobalObject.dialogPar.info.ToString(), TagNumber);
|
||||||
RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res));
|
RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res));
|
||||||
@ -65,8 +385,199 @@ namespace SWS.CAD.ViewModels
|
|||||||
}
|
}
|
||||||
this.Dispose();
|
this.Dispose();
|
||||||
}
|
}
|
||||||
|
#region 方法
|
||||||
|
public ICommand ButtonCmd => new DelegateCommand(Button_Click);
|
||||||
|
/// <summary>
|
||||||
|
/// 页面左侧按钮
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parameter"></param>
|
||||||
|
public virtual async void Button_Click(object parameter)
|
||||||
|
{
|
||||||
|
#region 清除配置
|
||||||
|
if (parameter.ToString().Equals("清除配置"))
|
||||||
|
{
|
||||||
|
|
||||||
|
MessageBoxResult result = MessageBox.Show($"确定删除“{ CableBy.TagNumber}”电缆配置?", "KunHengCAD", MessageBoxButton.OKCancel, MessageBoxImage.Question);
|
||||||
|
if (result == MessageBoxResult.OK)
|
||||||
|
{
|
||||||
|
var httpres = await _iOModuleService.DeleteCableProfile(CableBy.CableID);
|
||||||
|
if (httpres == null)
|
||||||
|
{
|
||||||
|
RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
|
||||||
|
this.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 指定中英文
|
||||||
|
if (parameter.ToString().Equals("指定中英文"))
|
||||||
|
{
|
||||||
|
//SelectedTreeNode = PanelTreels[2].ChildNodes.LastOrDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#region 查找节点路径
|
||||||
|
public List<string> FindNodePath(ObservableCollection<TreeModel> nodes, TreeModel targetNode)
|
||||||
|
{
|
||||||
|
List<string> path = new List<string>();
|
||||||
|
FindNodePathRecursive(nodes, targetNode, path);
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool FindNodePathRecursive(IEnumerable<TreeModel> nodes, TreeModel targetNode, List<string> currentPath)
|
||||||
|
{
|
||||||
|
foreach (var node in nodes)
|
||||||
|
{
|
||||||
|
currentPath.Add(node.Text);
|
||||||
|
if (node == targetNode) return true; // 找到目标节点,返回True并结束搜索
|
||||||
|
if (node.ChildNodes.Count > 0 && FindNodePathRecursive(node.ChildNodes, targetNode, currentPath))
|
||||||
|
return true; // 在子节点中继续搜索并找到目标节点,返回True并结束搜索
|
||||||
|
currentPath.RemoveAt(currentPath.Count - 1); // 回溯,尝试下一个兄弟节点或父节点的其他兄弟节点
|
||||||
|
}
|
||||||
|
return false; // 没有找到目标节点,返回False
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SignalPredistributionInfo : DialogBase
|
||||||
|
{
|
||||||
|
#region 字段
|
||||||
|
private ObservableCollection<string> _Index = new ObservableCollection<string>();
|
||||||
|
/// <summary>
|
||||||
|
/// 序号集合
|
||||||
|
/// </summary>
|
||||||
|
public ObservableCollection<string> Index
|
||||||
|
{
|
||||||
|
get { return _Index; }
|
||||||
|
set { _Index = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _CablePair;
|
||||||
|
/// <summary>
|
||||||
|
/// 电缆对
|
||||||
|
/// </summary>
|
||||||
|
public string CablePair
|
||||||
|
{
|
||||||
|
get { return _CablePair; }
|
||||||
|
set { _CablePair = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private ObservableCollection<ec_CableSetWire> _CableWires = new ObservableCollection<ec_CableSetWire>();
|
||||||
|
/// <summary>
|
||||||
|
/// 电缆线号
|
||||||
|
/// </summary>
|
||||||
|
public ObservableCollection<ec_CableSetWire> CableWires
|
||||||
|
{
|
||||||
|
get { return _CableWires; }
|
||||||
|
set { _CableWires = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private ObservableCollection<ec_CableSetWire> _Polaritys = new ObservableCollection<ec_CableSetWire>();
|
||||||
|
/// <summary>
|
||||||
|
/// 极性
|
||||||
|
/// </summary>
|
||||||
|
public ObservableCollection<ec_CableSetWire> Polaritys
|
||||||
|
{
|
||||||
|
get { return _Polaritys; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_Polaritys = value;
|
||||||
|
RaisePropertyChanged(nameof(Polaritys));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _SignalType;
|
||||||
|
/// <summary>
|
||||||
|
/// 信号类型
|
||||||
|
/// </summary>
|
||||||
|
public string SignalType
|
||||||
|
{
|
||||||
|
get { return _SignalType; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_SignalType = value;
|
||||||
|
RaisePropertyChanged(nameof(SignalType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private string _ChineseDescription;
|
||||||
|
/// <summary>
|
||||||
|
/// 中文描述
|
||||||
|
/// </summary>
|
||||||
|
public string ChineseDescription
|
||||||
|
{
|
||||||
|
get { return _ChineseDescription; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_ChineseDescription = value;
|
||||||
|
RaisePropertyChanged(nameof(ChineseDescription));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _EnglishDescription;
|
||||||
|
/// <summary>
|
||||||
|
/// 英文描述
|
||||||
|
/// </summary>
|
||||||
|
public string EnglishDescription
|
||||||
|
{
|
||||||
|
get { return _EnglishDescription; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_EnglishDescription = value;
|
||||||
|
RaisePropertyChanged(nameof(EnglishDescription));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _InorOut;
|
||||||
|
/// <summary>
|
||||||
|
/// 输入/输出
|
||||||
|
/// </summary>
|
||||||
|
public string InorOut
|
||||||
|
{
|
||||||
|
get { return _InorOut; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_InorOut = value;
|
||||||
|
RaisePropertyChanged(nameof(InorOut));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _SensorCode;
|
||||||
|
/// <summary>
|
||||||
|
/// 传感器编号
|
||||||
|
/// </summary>
|
||||||
|
public string SensorCode
|
||||||
|
{
|
||||||
|
get { return _SensorCode; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_SensorCode = value;
|
||||||
|
RaisePropertyChanged(nameof(SensorCode));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private ObservableCollection<ec_PanelStripTerm> _Terms = new ObservableCollection<ec_PanelStripTerm>();
|
||||||
|
/// <summary>
|
||||||
|
/// 端子号集合
|
||||||
|
/// </summary>
|
||||||
|
public ObservableCollection<ec_PanelStripTerm> Terms
|
||||||
|
{
|
||||||
|
get { return _Terms; }
|
||||||
|
set { _Terms = value; }
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,6 @@
|
|||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
<DataTemplate x:Key="CellEditTemplate1">
|
<DataTemplate x:Key="CellEditTemplate1">
|
||||||
<!-- 使用ItemsControl垂直显示多个值 -->
|
|
||||||
<ItemsControl ItemsSource="{Binding Index}">
|
<ItemsControl ItemsSource="{Binding Index}">
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsControl.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
@ -265,7 +264,6 @@
|
|||||||
|
|
||||||
<!-- 使用ItemsControl垂直显示多个值 -->
|
<!-- 使用ItemsControl垂直显示多个值 -->
|
||||||
<DataTemplate x:Key="CellTemplate2">
|
<DataTemplate x:Key="CellTemplate2">
|
||||||
<!-- 使用ItemsControl垂直显示多个值 -->
|
|
||||||
<ItemsControl ItemsSource="{Binding Terms}">
|
<ItemsControl ItemsSource="{Binding Terms}">
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsControl.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
@ -283,7 +281,6 @@
|
|||||||
</ItemsControl>
|
</ItemsControl>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
<DataTemplate x:Key="CellEditTemplate2">
|
<DataTemplate x:Key="CellEditTemplate2">
|
||||||
<!-- 使用ItemsControl垂直显示多个值 -->
|
|
||||||
<ItemsControl ItemsSource="{Binding Terms}">
|
<ItemsControl ItemsSource="{Binding Terms}">
|
||||||
<ItemsControl.ItemsPanel>
|
<ItemsControl.ItemsPanel>
|
||||||
<ItemsPanelTemplate>
|
<ItemsPanelTemplate>
|
||||||
@ -503,6 +500,7 @@
|
|||||||
Margin="5" telerik:StyleManager.Theme="Office_Blue" AllowDrop="True"
|
Margin="5" telerik:StyleManager.Theme="Office_Blue" AllowDrop="True"
|
||||||
AutoScrollToSelectedItem="True"
|
AutoScrollToSelectedItem="True"
|
||||||
IsVirtualizing="True"
|
IsVirtualizing="True"
|
||||||
|
telerik:TextSearch.TextPath="Text"
|
||||||
>
|
>
|
||||||
<telerik:RadTreeView.ItemTemplate>
|
<telerik:RadTreeView.ItemTemplate>
|
||||||
<HierarchicalDataTemplate ItemsSource="{Binding ChildNodes}">
|
<HierarchicalDataTemplate ItemsSource="{Binding ChildNodes}">
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using Prism.Events;
|
||||||
|
using SWS.CAD.Event;
|
||||||
using SWS.CAD.ViewModels;
|
using SWS.CAD.ViewModels;
|
||||||
|
using SWS.Commons;
|
||||||
using Telerik.Windows.Controls;
|
using Telerik.Windows.Controls;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
namespace SWS.CAD.Views.Dialog
|
namespace SWS.CAD.Views.Dialog
|
||||||
{
|
{
|
||||||
@ -15,10 +20,14 @@ namespace SWS.CAD.Views.Dialog
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class DialogIODistribution : UserControl
|
public partial class DialogIODistribution : UserControl
|
||||||
{
|
{
|
||||||
|
IEventAggregator _eventAggregator;
|
||||||
|
|
||||||
public DialogIODistribution()
|
public DialogIODistribution()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
DataContext = new DialogIODistributionViewModel();
|
DataContext = new DialogIODistributionViewModel();
|
||||||
|
_eventAggregator = GlobalObject.container.Resolve<IEventAggregator>();
|
||||||
|
_eventAggregator.GetEvent<ScrollToItemEvent>().Subscribe(ScrollToSelectedItem, ThreadOption.UIThread, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RadTreeView_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
private void RadTreeView_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
@ -83,5 +92,13 @@ namespace SWS.CAD.Views.Dialog
|
|||||||
return source as T;
|
return source as T;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 滚动到选中项
|
||||||
|
private void ScrollToSelectedItem(object path)
|
||||||
|
{
|
||||||
|
var pathls = path as List<string>;
|
||||||
|
var ph = string.Join("\\", pathls);
|
||||||
|
treeView1.BringPathIntoView(ph);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,9 @@
|
|||||||
xmlns:prism="http://prismlibrary.com/"
|
xmlns:prism="http://prismlibrary.com/"
|
||||||
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
||||||
xmlns:local="clr-namespace:SWS.CAD.Views.Dialog"
|
xmlns:local="clr-namespace:SWS.CAD.Views.Dialog"
|
||||||
|
xmlns:cvt="clr-namespace:SWS.Commons.Helper.Converter;assembly=SWS.Commons"
|
||||||
xmlns:CustomControl="clr-namespace:SWS.CustomControl;assembly=SWS.CustomControl"
|
xmlns:CustomControl="clr-namespace:SWS.CustomControl;assembly=SWS.CustomControl"
|
||||||
Width="1000" Height="800"
|
Width="1000" Height="790"
|
||||||
mc:Ignorable="d" >
|
mc:Ignorable="d" >
|
||||||
<prism:Dialog.WindowStyle>
|
<prism:Dialog.WindowStyle>
|
||||||
<Style TargetType="Window">
|
<Style TargetType="Window">
|
||||||
@ -27,11 +28,225 @@
|
|||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="pack://application:,,,/SWS.WPF;component/Style/CustomStyles.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/SWS.WPF;component/Style/CustomStyles.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
|
||||||
|
<!-- 转换器 -->
|
||||||
|
<cvt:RadioButtonValueConverter x:Key="RadioButtonValueCvt" />
|
||||||
|
|
||||||
|
<!-- 树结构展开按钮样式 -->
|
||||||
|
<Style x:Key="ExpanderStyle" TargetType="{x:Type ToggleButton}">
|
||||||
|
<Setter Property="IsEnabled" Value="True" />
|
||||||
|
<Setter Property="IsTabStop" Value="True" />
|
||||||
|
<Setter Property="Cursor" Value="Hand"/>
|
||||||
|
<Setter Property="Template">
|
||||||
|
<Setter.Value>
|
||||||
|
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||||
|
<Grid>
|
||||||
|
<Grid x:Name="ButtonOver" Opacity="0" Margin="0,4,0,0"
|
||||||
|
HorizontalAlignment="Right" VerticalAlignment="Top"
|
||||||
|
Width="16" Height="16">
|
||||||
|
<Rectangle Stroke="#FF027BA6" HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Stretch" Width="Auto" Height="Auto"
|
||||||
|
RadiusX="3" RadiusY="3">
|
||||||
|
<Rectangle.Fill>
|
||||||
|
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
|
||||||
|
<GradientStop Color="#FF00BCFF" Offset="0" />
|
||||||
|
<GradientStop Color="#FF027BA6" Offset="1" />
|
||||||
|
<GradientStop Color="#FF00A5E0" Offset="0.5" />
|
||||||
|
<GradientStop Color="#FF005674" Offset="0.501" />
|
||||||
|
</LinearGradientBrush>
|
||||||
|
</Rectangle.Fill>
|
||||||
|
</Rectangle>
|
||||||
|
<Rectangle x:Name="CollapsedVisualOver"
|
||||||
|
HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||||
|
Width="2" Height="8" RadiusX="0" RadiusY="0"
|
||||||
|
Fill="#FFFFFFFF" Margin="7,4,0,0" />
|
||||||
|
<Rectangle RadiusX="0" RadiusY="0" Fill="#FFFFFFFF"
|
||||||
|
HorizontalAlignment="Left" VerticalAlignment="Top"
|
||||||
|
Width="8" Height="2" Margin="4,7,0,0" />
|
||||||
|
</Grid>
|
||||||
|
<Grid x:Name="Button" Margin="0,6,5.5,0" HorizontalAlignment="Right"
|
||||||
|
VerticalAlignment="Top" Width="10" Height="10">
|
||||||
|
<Rectangle Stroke="#ffc7defc" HorizontalAlignment="Stretch"
|
||||||
|
VerticalAlignment="Stretch" Width="Auto" Height="Auto"
|
||||||
|
RadiusX="1" RadiusY="1" Fill="#ffc7defc">
|
||||||
|
</Rectangle>
|
||||||
|
<Rectangle x:Name="CollapsedVisual" HorizontalAlignment="Left"
|
||||||
|
VerticalAlignment="Top" Width="2" Height="6" RadiusX="0"
|
||||||
|
RadiusY="0" Fill="#FF3C6AA3" Margin="4,2,0,0" />
|
||||||
|
<Rectangle RadiusX="0" RadiusY="0" Fill="#FF3C6AA3"
|
||||||
|
HorizontalAlignment="Left" Margin="2,3.5,0,0"
|
||||||
|
VerticalAlignment="Top" Width="6" Height="2" />
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
<ControlTemplate.Triggers>
|
||||||
|
<Trigger Property="IsChecked" Value="True">
|
||||||
|
<Trigger.EnterActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="CollapsedVisualOver" Storyboard.TargetProperty="(UIElement.Opacity)" To="0"/>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="CollapsedVisual" Storyboard.TargetProperty="(UIElement.Opacity)" To="0"/>
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</Trigger.EnterActions>
|
||||||
|
<Trigger.ExitActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="CollapsedVisualOver" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/>
|
||||||
|
<DoubleAnimation Storyboard.TargetName="CollapsedVisual" Storyboard.TargetProperty="(UIElement.Opacity)" To="1"/>
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</Trigger.ExitActions>
|
||||||
|
</Trigger>
|
||||||
|
</ControlTemplate.Triggers>
|
||||||
|
</ControlTemplate>
|
||||||
|
</Setter.Value>
|
||||||
|
</Setter>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- 树结构节点默认展开样式设置 -->
|
||||||
|
<Style x:Key="ExpandedTreeViewItemStyle" TargetType="telerik:RadTreeViewItem">
|
||||||
|
<Setter Property="IsExpanded" Value="True"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- GridViewCell样式 -->
|
||||||
|
<Style x:Key="CellTyle1" TargetType="telerik:GridViewCell" >
|
||||||
|
<Setter Property="Background" Value="#F8F9F1" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<!-- 使用ItemsControl垂直显示多个值 -->
|
||||||
|
<DataTemplate x:Key="CellTemplate1">
|
||||||
|
<ItemsControl ItemsSource="{Binding Index}">
|
||||||
|
<ItemsControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<StackPanel Orientation="Vertical"/>
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ItemsControl.ItemsPanel>
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Border BorderBrush="#cccccc" BorderThickness="0,0,0,1" Padding="0">
|
||||||
|
<TextBlock Text="{Binding}" TextAlignment="Center" Padding="4,2" />
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="CellEditTemplate1">
|
||||||
|
<ItemsControl ItemsSource="{Binding Index}">
|
||||||
|
<ItemsControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<StackPanel Orientation="Vertical"/>
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ItemsControl.ItemsPanel>
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBox Text="{Binding}" TextAlignment="Center" Padding="4,2" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<!-- 使用ItemsControl垂直显示多个值 -->
|
||||||
|
<DataTemplate x:Key="CellTemplate2">
|
||||||
|
<ItemsControl ItemsSource="{Binding CableWires}">
|
||||||
|
<ItemsControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<StackPanel Orientation="Vertical"/>
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ItemsControl.ItemsPanel>
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Border BorderBrush="#cccccc" BorderThickness="0,0,0,1" Padding="0"
|
||||||
|
HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
|
||||||
|
<TextBlock Text="{Binding PreAssignChannelTermNo}" TextAlignment="Center" Padding="4,2" />
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="CellEditTemplate2">
|
||||||
|
<ItemsControl ItemsSource="{Binding CableWires}">
|
||||||
|
<ItemsControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<StackPanel Orientation="Vertical"/>
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ItemsControl.ItemsPanel>
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBox Text="{Binding PreAssignChannelTermNo}" TextAlignment="Center" Padding="4,2" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<!-- 使用ItemsControl垂直显示多个值 -->
|
||||||
|
<DataTemplate x:Key="CellTemplate3">
|
||||||
|
<ItemsControl ItemsSource="{Binding CableWires}">
|
||||||
|
<ItemsControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<StackPanel Orientation="Vertical"/>
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ItemsControl.ItemsPanel>
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Border BorderBrush="#cccccc" BorderThickness="0,0,0,1" Padding="0">
|
||||||
|
<TextBlock Text="{Binding Wire_Tag}" TextAlignment="Center" Padding="4,2" Width="auto"/>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="CellEditTemplate3">
|
||||||
|
<ItemsControl ItemsSource="{Binding CableWires}">
|
||||||
|
<ItemsControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<StackPanel Orientation="Vertical"/>
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ItemsControl.ItemsPanel>
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBox Text="{Binding Wire_Tag}" TextAlignment="Center" Padding="4,2" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
</DataTemplate>
|
||||||
|
|
||||||
|
<!-- 使用ItemsControl垂直显示多个值 -->
|
||||||
|
<DataTemplate x:Key="CellTemplate4">
|
||||||
|
<ItemsControl ItemsSource="{Binding Polaritys}">
|
||||||
|
<ItemsControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<StackPanel Orientation="Vertical"/>
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ItemsControl.ItemsPanel>
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<Border BorderBrush="#cccccc" BorderThickness="0,0,0,1" Padding="0">
|
||||||
|
<TextBlock Text="{Binding Polarity}" TextAlignment="Center" Padding="4,2" />
|
||||||
|
</Border>
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
</DataTemplate>
|
||||||
|
<DataTemplate x:Key="CellEditTemplate4">
|
||||||
|
<ItemsControl ItemsSource="{Binding Polaritys}">
|
||||||
|
<ItemsControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<StackPanel Orientation="Vertical"/>
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</ItemsControl.ItemsPanel>
|
||||||
|
<ItemsControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBox Text="{Binding Polarity}" TextAlignment="Center" Padding="4,2" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ItemsControl.ItemTemplate>
|
||||||
|
</ItemsControl>
|
||||||
|
</DataTemplate>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</UserControl.Resources>
|
</UserControl.Resources>
|
||||||
<telerik:RadBusyIndicator BusyContent="{Binding BusyContent}" IsBusy="{Binding IsBusy}">
|
<telerik:RadBusyIndicator BusyContent="{Binding BusyContent}" IsBusy="{Binding IsBusy}">
|
||||||
<StackPanel Background="#f0f0f0">
|
<StackPanel Background="#f0f0f0">
|
||||||
|
|
||||||
<CustomControl:customWindowTitleBar x:Name="titleBar" />
|
<CustomControl:customWindowTitleBar x:Name="titleBar" />
|
||||||
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
<StackPanel Grid.Row="1" Orientation="Horizontal">
|
||||||
<GroupBox Margin="5,10,5,5"
|
<GroupBox Margin="5,10,5,5"
|
||||||
@ -39,25 +254,46 @@
|
|||||||
Header="通讯信号">
|
Header="通讯信号">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock Text="是否通讯母线" Margin="5"/>
|
<TextBlock Text="是否通讯母线" Margin="5"/>
|
||||||
<RadioButton Content="是" GroupName="OptionGroup1" Margin="5"/>
|
<RadioButton x:Name="RadioButton2"
|
||||||
<RadioButton x:Name="RadioButton1" Content="否" GroupName="OptionGroup1" Margin="5"/>
|
Content="是"
|
||||||
|
GroupName="OptionGroup1"
|
||||||
|
Margin="5"
|
||||||
|
IsChecked="{Binding SelectedOption1 ,Converter={StaticResource RadioButtonValueCvt},ConverterParameter=是}"/>
|
||||||
|
<RadioButton x:Name="RadioButton1"
|
||||||
|
Content="否"
|
||||||
|
GroupName="OptionGroup1"
|
||||||
|
Margin="5"
|
||||||
|
IsChecked="{Binding SelectedOption1 ,Converter={StaticResource RadioButtonValueCvt},ConverterParameter=否}"/>
|
||||||
<TextBlock Text="通讯格式" Margin="5"/>
|
<TextBlock Text="通讯格式" Margin="5"/>
|
||||||
<ComboBox />
|
<ComboBox Width="100"
|
||||||
|
IsEnabled="{Binding IsChecked,ElementName=RadioButton2}"
|
||||||
|
ItemsSource="{Binding CommunicationFormats}"
|
||||||
|
SelectedItem="{Binding CommunicationFormat }"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
<GroupBox Margin="5,0,5,5"
|
<GroupBox Margin="5,0,5,5"
|
||||||
VerticalAlignment="Bottom"
|
VerticalAlignment="Bottom"
|
||||||
Header="信号类型">
|
Header="信号类型">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<RadioButton IsEnabled="{Binding IsChecked,ElementName=RadioButton1}" Content="Digital" GroupName="OptionGroup2" Margin="5"/>
|
<RadioButton IsEnabled="{Binding IsChecked,ElementName=RadioButton1}"
|
||||||
<RadioButton IsEnabled="{Binding IsChecked,ElementName=RadioButton1}" Content="4-20mA" GroupName="OptionGroup2" Margin="5"/>
|
IsChecked="{Binding SelectedOption2 ,Converter={StaticResource RadioButtonValueCvt},ConverterParameter=Digital}"
|
||||||
<RadioButton IsEnabled="{Binding IsChecked,ElementName=RadioButton1}" Content="-10V-10V" GroupName="OptionGroup2" Margin="5"/>
|
Content="Digital" GroupName="OptionGroup2" Margin="5"/>
|
||||||
<RadioButton IsEnabled="{Binding IsChecked,ElementName=RadioButton1}" Content="PT100" GroupName="OptionGroup2" Margin="5"/>
|
<RadioButton IsEnabled="{Binding IsChecked,ElementName=RadioButton1}"
|
||||||
<RadioButton IsEnabled="{Binding IsChecked,ElementName=RadioButton1}" Content="Pulse" GroupName="OptionGroup2" Margin="5"/>
|
IsChecked="{Binding SelectedOption2 ,Converter={StaticResource RadioButtonValueCvt},ConverterParameter=4-20mA}"
|
||||||
|
Content="4-20mA" GroupName="OptionGroup2" Margin="5"/>
|
||||||
|
<RadioButton IsEnabled="{Binding IsChecked,ElementName=RadioButton1}"
|
||||||
|
IsChecked="{Binding SelectedOption2 ,Converter={StaticResource RadioButtonValueCvt},ConverterParameter=-10V-10V}"
|
||||||
|
Content="-10V-10V" GroupName="OptionGroup2" Margin="5"/>
|
||||||
|
<RadioButton IsEnabled="{Binding IsChecked,ElementName=RadioButton1}"
|
||||||
|
IsChecked="{Binding SelectedOption2 ,Converter={StaticResource RadioButtonValueCvt},ConverterParameter=PT100}"
|
||||||
|
Content="PT100" GroupName="OptionGroup2" Margin="5"/>
|
||||||
|
<RadioButton IsEnabled="{Binding IsChecked,ElementName=RadioButton1}"
|
||||||
|
IsChecked="{Binding SelectedOption2 ,Converter={StaticResource RadioButtonValueCvt},ConverterParameter=Pulse}"
|
||||||
|
Content="Pulse" GroupName="OptionGroup2" Margin="5"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<GroupBox Margin="5,0,5,5"
|
<GroupBox Margin="5,0,5,0"
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
VerticalAlignment="Bottom"
|
VerticalAlignment="Bottom"
|
||||||
Header="电缆配置信息">
|
Header="电缆配置信息">
|
||||||
@ -67,23 +303,26 @@
|
|||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<Border BorderThickness="0 0 0 1" Margin="10,0,0,0">
|
<Border BorderThickness="0 0 0 1" Margin="0,0,0,0">
|
||||||
<TextBlock Text="选择系统柜" Foreground="Black" />
|
<Label Height="30" Content="选择系统柜" Foreground="Black" VerticalContentAlignment="Bottom"/>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- 左侧树形结构 -->
|
<!-- 左侧树形结构 -->
|
||||||
<Border>
|
<Border>
|
||||||
<telerik:RadTreeView x:Name="treeView1"
|
<telerik:RadTreeView x:Name="treeView1"
|
||||||
Height="660"
|
Height="600"
|
||||||
|
Width="200"
|
||||||
Background="White"
|
Background="White"
|
||||||
IsLineEnabled="True"
|
IsLineEnabled="True"
|
||||||
|
ItemContainerStyle="{StaticResource ExpandedTreeViewItemStyle}"
|
||||||
|
ExpanderStyle="{StaticResource ExpanderStyle}"
|
||||||
ItemsSource="{Binding PanelTreels}"
|
ItemsSource="{Binding PanelTreels}"
|
||||||
SelectedItem="{Binding SelectedTreeNode,Mode=TwoWay}"
|
SelectedItem="{Binding SelectedTreeNode,Mode=TwoWay}"
|
||||||
Margin="5"
|
|
||||||
telerik:StyleManager.Theme="Office_Blue"
|
telerik:StyleManager.Theme="Office_Blue"
|
||||||
AllowDrop="True"
|
AllowDrop="True"
|
||||||
AutoScrollToSelectedItem="True"
|
AutoScrollToSelectedItem="True"
|
||||||
IsVirtualizing="True"
|
IsVirtualizing="True"
|
||||||
|
telerik:TextSearch.TextPath="Text"
|
||||||
>
|
>
|
||||||
<telerik:RadTreeView.ItemTemplate>
|
<telerik:RadTreeView.ItemTemplate>
|
||||||
<HierarchicalDataTemplate ItemsSource="{Binding ChildNodes}">
|
<HierarchicalDataTemplate ItemsSource="{Binding ChildNodes}">
|
||||||
@ -109,8 +348,106 @@
|
|||||||
</telerik:RadTreeView>
|
</telerik:RadTreeView>
|
||||||
</Border>
|
</Border>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
<!-- 数据表格 -->
|
||||||
|
<Grid Grid.Column="1">
|
||||||
|
<telerik:RadGridView x:Name="RadGridView1" SelectionMode="Single" Width="auto" Height="630"
|
||||||
|
AutoGenerateColumns="False" IsFilteringAllowed="False" Background="#a0a0a0"
|
||||||
|
IsReadOnly="False" RowIndicatorVisibility="Collapsed"
|
||||||
|
ShowGroupPanel="False" telerik:StyleManager.Theme="Office_Blue"
|
||||||
|
ItemsSource="{Binding SignalPredistributionInfos}" SelectedItem="{Binding SelectedChannelInfo, Mode=TwoWay}"
|
||||||
|
>
|
||||||
|
<telerik:RadGridView.Columns>
|
||||||
|
<telerik:GridViewDataColumn Header="序号" CellTemplate="{StaticResource CellTemplate1}" CellStyle="{StaticResource CellTyle1}" IsReadOnly="True"/>
|
||||||
|
|
||||||
|
<telerik:GridViewDataColumn Header="电缆对" DataMemberBinding="{Binding CablePair}"/>
|
||||||
|
<telerik:GridViewDataColumn Header="电缆线芯" CellTemplate="{StaticResource CellTemplate3}" CellEditTemplate="{StaticResource CellEditTemplate3}"/>
|
||||||
|
<telerik:GridViewDataColumn Header="极性" CellTemplate="{StaticResource CellTemplate4}" CellEditTemplate="{StaticResource CellEditTemplate4}"/>
|
||||||
|
<telerik:GridViewComboBoxColumn Header="{Binding SignalColumnName,Mode=TwoWay}"
|
||||||
|
IsVisible="{Binding IsChecked,ElementName=RadioButton1}"
|
||||||
|
ItemsSource="{Binding DataContext.SignalTypeColumn, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadGridView}}}"
|
||||||
|
DataMemberBinding="{Binding SignalType}"
|
||||||
|
Width="120">
|
||||||
|
<telerik:GridViewComboBoxColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding SignalType}"
|
||||||
|
TextTrimming="CharacterEllipsis"
|
||||||
|
ToolTip="{Binding SignalType}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</telerik:GridViewComboBoxColumn.CellTemplate>
|
||||||
|
</telerik:GridViewComboBoxColumn>
|
||||||
|
<telerik:GridViewDataColumn Header="中文描述" DataMemberBinding="{Binding ChineseDescription}" Width="120">
|
||||||
|
<telerik:GridViewDataColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding ChineseDescription}"
|
||||||
|
TextTrimming="CharacterEllipsis"
|
||||||
|
ToolTip="{Binding ChineseDescription}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</telerik:GridViewDataColumn.CellTemplate>
|
||||||
|
</telerik:GridViewDataColumn>
|
||||||
|
<telerik:GridViewDataColumn Header="英文描述" DataMemberBinding="{Binding EnglishDescription}" Width="120">
|
||||||
|
<telerik:GridViewDataColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding EnglishDescription}"
|
||||||
|
TextTrimming="CharacterEllipsis"
|
||||||
|
ToolTip="{Binding EnglishDescription}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</telerik:GridViewDataColumn.CellTemplate>
|
||||||
|
</telerik:GridViewDataColumn>
|
||||||
|
<telerik:GridViewComboBoxColumn Header="输入/输出"
|
||||||
|
ItemsSource="{Binding DataContext.InorOuts, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadGridView}}}"
|
||||||
|
DataMemberBinding="{Binding InorOut}"
|
||||||
|
Width="60">
|
||||||
|
|
||||||
|
</telerik:GridViewComboBoxColumn>
|
||||||
|
<telerik:GridViewDataColumn Header="传感器编号" DataMemberBinding="{Binding EnglishDescription}" Width="auto">
|
||||||
|
<telerik:GridViewDataColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding SensorCode}"
|
||||||
|
TextTrimming="CharacterEllipsis"
|
||||||
|
ToolTip="{Binding SensorCode}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</telerik:GridViewDataColumn.CellTemplate>
|
||||||
|
</telerik:GridViewDataColumn>
|
||||||
|
<telerik:GridViewDataColumn Header="端子号" Width="*" CellTemplate="{StaticResource CellTemplate2}" CellEditTemplate="{StaticResource CellEditTemplate2}"/>
|
||||||
|
</telerik:RadGridView.Columns>
|
||||||
|
</telerik:RadGridView>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
|
<Grid>
|
||||||
|
<StackPanel Margin="5" Orientation="Horizontal" HorizontalAlignment="Left">
|
||||||
|
<telerik:RadButton Margin="0,0,20,0"
|
||||||
|
Width="100"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Style="{StaticResource sysBtn4}"
|
||||||
|
Command="{Binding ButtonCmd}"
|
||||||
|
CommandParameter="清除配置"
|
||||||
|
Content="清除配置" />
|
||||||
|
<telerik:RadButton Margin="0,0,0,0"
|
||||||
|
Width="100"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Style="{StaticResource sysBtn2}"
|
||||||
|
Command="{Binding ButtonCmd}"
|
||||||
|
CommandParameter="指定中英文"
|
||||||
|
Content="指定中英文" />
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Margin="5" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
|
<telerik:RadButton Margin="0,0,20,0"
|
||||||
|
Width="100"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Style="{StaticResource sysBtn}"
|
||||||
|
Command="{Binding OKCommand}"
|
||||||
|
CommandParameter="确定"
|
||||||
|
Content="确定" />
|
||||||
|
<telerik:RadButton Margin="0,0,0,0"
|
||||||
|
Width="100"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Style="{StaticResource sysBtn2}"
|
||||||
|
Command="{Binding CloseCommand}"
|
||||||
|
CommandParameter="取消"
|
||||||
|
Content="取消" />
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</telerik:RadBusyIndicator>
|
</telerik:RadBusyIndicator>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
@ -12,6 +12,13 @@ using System.Windows.Media;
|
|||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
using Prism.Events;
|
||||||
|
using SWS.CAD.Event;
|
||||||
|
using SWS.Commons;
|
||||||
|
using SWS.Model;
|
||||||
|
using Telerik.Windows.Controls;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
namespace SWS.CAD.Views.Dialog
|
namespace SWS.CAD.Views.Dialog
|
||||||
{
|
{
|
||||||
@ -20,9 +27,23 @@ namespace SWS.CAD.Views.Dialog
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class DialogSignalPredistribution : UserControl
|
public partial class DialogSignalPredistribution : UserControl
|
||||||
{
|
{
|
||||||
|
IEventAggregator _eventAggregator;
|
||||||
|
|
||||||
public DialogSignalPredistribution()
|
public DialogSignalPredistribution()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
_eventAggregator = GlobalObject.container.Resolve<IEventAggregator>();
|
||||||
|
_eventAggregator.GetEvent<ScrollToItemEvent>().Subscribe(ScrollToSelectedItem, ThreadOption.UIThread, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 滚动到选中项
|
||||||
|
private void ScrollToSelectedItem(object path)
|
||||||
|
{
|
||||||
|
var pathls = path as List<string>;
|
||||||
|
var ph = string.Join("\\", pathls);
|
||||||
|
treeView1.BringPathIntoView(ph);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -84,6 +84,7 @@ namespace SWS.Commons
|
|||||||
public static List<TreeModel> designTree = new List<TreeModel>();
|
public static List<TreeModel> designTree = new List<TreeModel>();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
public enum DBConst
|
public enum DBConst
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -0,0 +1,36 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using SWS.Model;
|
||||||
|
|
||||||
|
namespace SWS.Commons.Helper.Converter
|
||||||
|
{
|
||||||
|
public class RadioButtonValueConverter : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is string isChecked)
|
||||||
|
{
|
||||||
|
if (isChecked.Equals(parameter.ToString()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
if (value is bool isChecked)
|
||||||
|
{
|
||||||
|
return parameter.ToString();
|
||||||
|
}
|
||||||
|
return parameter.ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -106,6 +106,7 @@
|
|||||||
<Compile Include="GlobalObject.cs" />
|
<Compile Include="GlobalObject.cs" />
|
||||||
<Compile Include="Helper\Converter\CollectionToStringConverter.cs" />
|
<Compile Include="Helper\Converter\CollectionToStringConverter.cs" />
|
||||||
<Compile Include="Helper\Converter\TimeSpanToColourValueConverter.cs" />
|
<Compile Include="Helper\Converter\TimeSpanToColourValueConverter.cs" />
|
||||||
|
<Compile Include="Helper\Converter\RadioButtonValueConverter.cs" />
|
||||||
<Compile Include="Helper\Converter\TimeSpanValueConverter.cs" />
|
<Compile Include="Helper\Converter\TimeSpanValueConverter.cs" />
|
||||||
<Compile Include="Helper\Converter\RadGridViewRowToBoolConverter.cs" />
|
<Compile Include="Helper\Converter\RadGridViewRowToBoolConverter.cs" />
|
||||||
<Compile Include="Helper\Converter\ColumnValueConverter.cs" />
|
<Compile Include="Helper\Converter\ColumnValueConverter.cs" />
|
||||||
|
@ -50,16 +50,16 @@ namespace SWS.Service
|
|||||||
public async Task<object> SaveDetailForm(ec_dataitemdetail entity)
|
public async Task<object> SaveDetailForm(ec_dataitemdetail entity)
|
||||||
{
|
{
|
||||||
var res = await this.PostBodyAsync<ec_dataitemdetail, ec_dataitemdetail>($"DataItemApi/SaveDetailForm?ProjectId={GlobalObject.curProject?.ProjectId}", entity);
|
var res = await this.PostBodyAsync<ec_dataitemdetail, ec_dataitemdetail>($"DataItemApi/SaveDetailForm?ProjectId={GlobalObject.curProject?.ProjectId}", entity);
|
||||||
if (res.code == 200)
|
//if (res.code == 200)
|
||||||
{
|
//{
|
||||||
//return res.info;
|
// //return res.info;
|
||||||
return null;
|
// return null;
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
return res.info; // 返回错误信息
|
// return res.info; // 返回错误信息
|
||||||
}
|
//}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,16 +139,16 @@ namespace SWS.Service
|
|||||||
public async Task<object> CreatePanelStripByProfile(ec_PanelStrip entity)
|
public async Task<object> CreatePanelStripByProfile(ec_PanelStrip entity)
|
||||||
{
|
{
|
||||||
var res = await this.PostBodyAsync<ec_PanelStrip, ec_PanelStrip>($"IOModuleApi/CreatePanelStripByProfile?projId={GlobalObject.curProject?.ProjectId}", entity);
|
var res = await this.PostBodyAsync<ec_PanelStrip, ec_PanelStrip>($"IOModuleApi/CreatePanelStripByProfile?projId={GlobalObject.curProject?.ProjectId}", entity);
|
||||||
if (res.code == 200)
|
//if (res.code == 200)
|
||||||
{
|
//{
|
||||||
//return res.info;
|
// //return res.info;
|
||||||
return null;
|
// return null;
|
||||||
}
|
//}
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
return res.info; // 返回错误信息
|
// return res.info; // 返回错误信息
|
||||||
}
|
//}
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<string> DeletePanel(string PanelID)
|
public async Task<string> DeletePanel(string PanelID)
|
||||||
|
@ -423,6 +423,10 @@ namespace SWS.WPF.ViewModels
|
|||||||
//DateTime startTime = DateTime.Now;
|
//DateTime startTime = DateTime.Now;
|
||||||
//设置信号源
|
//设置信号源
|
||||||
signals = await _wireGroupService.GetSignals(GlobalObject.curProject.ProjectId, false);
|
signals = await _wireGroupService.GetSignals(GlobalObject.curProject.ProjectId, false);
|
||||||
|
if (signals == null)
|
||||||
|
{
|
||||||
|
signals = new List<ec_Wire_Group>();
|
||||||
|
}
|
||||||
//TimeSpan duration = DateTime.Now - startTime;
|
//TimeSpan duration = DateTime.Now - startTime;
|
||||||
//System.Windows.MessageBox.Show($"Time taken: {duration.Seconds} milliseconds");
|
//System.Windows.MessageBox.Show($"Time taken: {duration.Seconds} milliseconds");
|
||||||
count = signals.Count().ToString();
|
count = signals.Count().ToString();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user