Compare commits
2 Commits
c78178035f
...
c76c8ada14
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c76c8ada14 | ||
![]() |
9f83439704 |
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ProjectView>ProjectFiles</ProjectView>
|
<ProjectView>ShowAllFiles</ProjectView>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
@ -25,6 +25,8 @@ using GlobalObject = SWS.Commons.GlobalObject;
|
|||||||
using SWS.Model;
|
using SWS.Model;
|
||||||
using SWS.Service;
|
using SWS.Service;
|
||||||
using OfficeOpenXml.FormulaParsing.Excel.Functions.Information;
|
using OfficeOpenXml.FormulaParsing.Excel.Functions.Information;
|
||||||
|
using SWS.CAD.ViewModels;
|
||||||
|
using SWS.CAD.Base;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using MessageBox = System.Windows.Forms.MessageBox;
|
using MessageBox = System.Windows.Forms.MessageBox;
|
||||||
|
|
||||||
@ -202,9 +204,17 @@ namespace SWS.CAD
|
|||||||
login.ButtonStyle = RibbonButtonStyle.SmallWithText;
|
login.ButtonStyle = RibbonButtonStyle.SmallWithText;
|
||||||
login.CommandHandler = new DelegateCommand(x =>
|
login.CommandHandler = new DelegateCommand(x =>
|
||||||
{
|
{
|
||||||
var loginView = GlobalObject.container.Resolve<Login>();
|
try
|
||||||
//Application.ShowModalDialog(Application.MainWindow,);// 用来显示WinForms对话框
|
{
|
||||||
Application.ShowModalWindow(Application.MainWindow.Handle, loginView);//用来显示WPF的对话框,任务栏里可以看到2个Windows
|
var loginView = GlobalObject.container.Resolve<Login>();
|
||||||
|
//Application.ShowModalDialog(Application.MainWindow,);// 用来显示WinForms对话框
|
||||||
|
Application.ShowModalWindow(Application.MainWindow.Handle, loginView);//用来显示WPF的对话框,任务栏里可以看到2个Windows
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (System.Exception ex)
|
||||||
|
{
|
||||||
|
MessageBox.Show(ex.Message);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
login.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"Login.png");
|
login.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"Login.png");
|
||||||
login.Id = "用户登录";
|
login.Id = "用户登录";
|
||||||
@ -425,9 +435,106 @@ namespace SWS.CAD
|
|||||||
btnSwitchbox.ToolTip = "分电箱";
|
btnSwitchbox.ToolTip = "分电箱";
|
||||||
btnSwitchbox.Text = "分电箱";
|
btnSwitchbox.Text = "分电箱";
|
||||||
btnSwitchbox.ButtonStyle = RibbonButtonStyle.LargeWithText;
|
btnSwitchbox.ButtonStyle = RibbonButtonStyle.LargeWithText;
|
||||||
btnSwitchbox.CommandHandler = new DelegateCommand(x =>
|
btnSwitchbox.CommandHandler = new DelegateCommand(async x =>
|
||||||
{
|
{
|
||||||
MessageBox.Show("功能开发中...");
|
//if (GlobalObject.userInfo == null || GlobalObject.curProject == null)
|
||||||
|
//{
|
||||||
|
// 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);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// }
|
||||||
|
// #endregion
|
||||||
|
//}
|
||||||
|
//catch (System.Exception ex)
|
||||||
|
//{
|
||||||
|
// ed.WriteMessage($"\n错误: {ex.Message}");
|
||||||
|
//}
|
||||||
|
|
||||||
|
if (true)
|
||||||
|
{
|
||||||
|
//打开窗体
|
||||||
|
var para = new Prism.Services.Dialogs.DialogParameters();
|
||||||
|
var _dialogService = GlobalObject._prismContainer.Resolve<IDialogService>();
|
||||||
|
_dialogService.ShowDialog(nameof(DialogSectionBox), para, (RES) =>
|
||||||
|
{
|
||||||
|
if (RES.Result == ButtonResult.Yes)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (RES.Result == ButtonResult.No)
|
||||||
|
{ }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
btnSwitchbox.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"Switchbox.png");
|
btnSwitchbox.Image = GlobalObject.ImageSourceFromEmbeddedResourceStream(@"Switchbox.png");
|
||||||
btnSwitchbox.Id = "分电箱";
|
btnSwitchbox.Id = "分电箱";
|
||||||
@ -580,7 +687,7 @@ namespace SWS.CAD
|
|||||||
var handId = (cable.Handle.ToString());
|
var handId = (cable.Handle.ToString());
|
||||||
_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)
|
||||||
{
|
{
|
||||||
if (res.Count == 1)
|
if (res.Count == 1)
|
||||||
{
|
{
|
||||||
@ -595,7 +702,7 @@ namespace SWS.CAD
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
tr.Commit();
|
tr.Commit();
|
||||||
}
|
}
|
||||||
@ -920,6 +1027,7 @@ 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 _objectTypeService = GlobalObject.container.Resolve<ObjectTypeService>();
|
||||||
var _iOModuleService = GlobalObject.container.Resolve<IOModuleService>();
|
var _iOModuleService = GlobalObject.container.Resolve<IOModuleService>();
|
||||||
// 持续选择直到获取有效电缆
|
// 持续选择直到获取有效电缆
|
||||||
@ -992,7 +1100,7 @@ namespace SWS.CAD
|
|||||||
//获取位号的电缆属性,判断是否设置电缆规格
|
//获取位号的电缆属性,判断是否设置电缆规格
|
||||||
var TagNumberBys = await _objectTypeService.GetEngineDataListByTags(ResTagInfosByPixels.tags.FirstOrDefault().TagNumber);
|
var TagNumberBys = await _objectTypeService.GetEngineDataListByTags(ResTagInfosByPixels.tags.FirstOrDefault().TagNumber);
|
||||||
var TagNumberBy = TagNumberBys.Where(t => t.TagNumber.Equals(ResTagInfosByPixels.tags.FirstOrDefault().TagNumber)).FirstOrDefault();
|
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 (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", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Warning); return;
|
System.Windows.MessageBox.Show("无法获取电缆对信息,请在电缆\"属性面版“输入电缆”电缆规格”属性\r\n如:“1x2x0.75”", "KunHengCAD", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Warning); return;
|
||||||
@ -1139,11 +1247,11 @@ 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 = Tag + (char)('A' + (n-1));
|
Tag = Tag + (char)('A' + (n - 1));
|
||||||
}
|
}
|
||||||
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)+"-"+ n.ToString();
|
Tag = (i + 1) + "-" + n.ToString();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "按电缆对编号"://一个电缆对中线号按顺序编号,另一个电缆对中线号重新从1开始编号
|
case "按电缆对编号"://一个电缆对中线号按顺序编号,另一个电缆对中线号重新从1开始编号
|
||||||
@ -1157,7 +1265,7 @@ 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) + "-" + (j+1).ToString();
|
Tag = (i + 1) + "-" + (j + 1).ToString();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
1643
newFront/c#前端/SWS.CAD/Commands_BACKUP_547.cs
Normal file
1643
newFront/c#前端/SWS.CAD/Commands_BACKUP_547.cs
Normal file
File diff suppressed because it is too large
Load Diff
1643
newFront/c#前端/SWS.CAD/Commands_BACKUP_608.cs
Normal file
1643
newFront/c#前端/SWS.CAD/Commands_BACKUP_608.cs
Normal file
File diff suppressed because it is too large
Load Diff
1643
newFront/c#前端/SWS.CAD/Commands_BACKUP_669.cs
Normal file
1643
newFront/c#前端/SWS.CAD/Commands_BACKUP_669.cs
Normal file
File diff suppressed because it is too large
Load Diff
1521
newFront/c#前端/SWS.CAD/Commands_BASE_547.cs
Normal file
1521
newFront/c#前端/SWS.CAD/Commands_BASE_547.cs
Normal file
File diff suppressed because it is too large
Load Diff
1521
newFront/c#前端/SWS.CAD/Commands_BASE_608.cs
Normal file
1521
newFront/c#前端/SWS.CAD/Commands_BASE_608.cs
Normal file
File diff suppressed because it is too large
Load Diff
1521
newFront/c#前端/SWS.CAD/Commands_BASE_669.cs
Normal file
1521
newFront/c#前端/SWS.CAD/Commands_BASE_669.cs
Normal file
File diff suppressed because it is too large
Load Diff
1629
newFront/c#前端/SWS.CAD/Commands_LOCAL_547.cs
Normal file
1629
newFront/c#前端/SWS.CAD/Commands_LOCAL_547.cs
Normal file
File diff suppressed because it is too large
Load Diff
1629
newFront/c#前端/SWS.CAD/Commands_LOCAL_608.cs
Normal file
1629
newFront/c#前端/SWS.CAD/Commands_LOCAL_608.cs
Normal file
File diff suppressed because it is too large
Load Diff
1629
newFront/c#前端/SWS.CAD/Commands_LOCAL_669.cs
Normal file
1629
newFront/c#前端/SWS.CAD/Commands_LOCAL_669.cs
Normal file
File diff suppressed because it is too large
Load Diff
1532
newFront/c#前端/SWS.CAD/Commands_REMOTE_547.cs
Normal file
1532
newFront/c#前端/SWS.CAD/Commands_REMOTE_547.cs
Normal file
File diff suppressed because it is too large
Load Diff
1532
newFront/c#前端/SWS.CAD/Commands_REMOTE_608.cs
Normal file
1532
newFront/c#前端/SWS.CAD/Commands_REMOTE_608.cs
Normal file
File diff suppressed because it is too large
Load Diff
1532
newFront/c#前端/SWS.CAD/Commands_REMOTE_669.cs
Normal file
1532
newFront/c#前端/SWS.CAD/Commands_REMOTE_669.cs
Normal file
File diff suppressed because it is too large
Load Diff
@ -150,9 +150,7 @@
|
|||||||
<Reference Include="WindowsBase" />
|
<Reference Include="WindowsBase" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="CADFunc\BlockDragJig.cs" />
|
|
||||||
<Compile Include="CADFunc\Editor\EditorHelper.cs" />
|
<Compile Include="CADFunc\Editor\EditorHelper.cs" />
|
||||||
<Compile Include="CADFunc\General.cs" />
|
|
||||||
<Compile Include="Commands.cs" />
|
<Compile Include="Commands.cs" />
|
||||||
<Compile Include="Event\checkInResultEvent.cs" />
|
<Compile Include="Event\checkInResultEvent.cs" />
|
||||||
<Compile Include="Event\drawingChangeEvent.cs" />
|
<Compile Include="Event\drawingChangeEvent.cs" />
|
||||||
@ -205,6 +203,7 @@
|
|||||||
<Compile Include="ViewModels\DialogPreCheckInViewModel.cs" />
|
<Compile Include="ViewModels\DialogPreCheckInViewModel.cs" />
|
||||||
<Compile Include="ViewModels\DialogParallelCableViewModel.cs" />
|
<Compile Include="ViewModels\DialogParallelCableViewModel.cs" />
|
||||||
<Compile Include="ViewModels\DialogNewTagNumberViewModel.cs" />
|
<Compile Include="ViewModels\DialogNewTagNumberViewModel.cs" />
|
||||||
|
<Compile Include="ViewModels\DialogSectionBoxViewModel.cs" />
|
||||||
<Compile Include="ViewModels\DialogSignalPredistributionViewModel.cs" />
|
<Compile Include="ViewModels\DialogSignalPredistributionViewModel.cs" />
|
||||||
<Compile Include="ViewModels\DialogTagSelectViewModel.cs" />
|
<Compile Include="ViewModels\DialogTagSelectViewModel.cs" />
|
||||||
<Compile Include="ViewModels\DialogUnitSelectViewModel.cs" />
|
<Compile Include="ViewModels\DialogUnitSelectViewModel.cs" />
|
||||||
@ -286,7 +285,6 @@
|
|||||||
<Compile Include="Views\CustomControl\NumericBox\PackIconKind.cs" />
|
<Compile Include="Views\CustomControl\NumericBox\PackIconKind.cs" />
|
||||||
<Compile Include="Views\CustomControl\NumericBox\PathIcon.cs" />
|
<Compile Include="Views\CustomControl\NumericBox\PathIcon.cs" />
|
||||||
<Compile Include="Views\CustomControl\NumericBox\TextBoxHelper.cs" />
|
<Compile Include="Views\CustomControl\NumericBox\TextBoxHelper.cs" />
|
||||||
<Compile Include="Views\CustomControl\PropertyGrid\KeyValueModel.cs" />
|
|
||||||
<Compile Include="Views\CustomControl\PropertyGrid\LsPropertyGridAttribute.cs" />
|
<Compile Include="Views\CustomControl\PropertyGrid\LsPropertyGridAttribute.cs" />
|
||||||
<Compile Include="Views\CustomControl\PropertyGrid\PropertyGrid.cs" />
|
<Compile Include="Views\CustomControl\PropertyGrid\PropertyGrid.cs" />
|
||||||
<Compile Include="Views\CustomControl\PropertyGrid\propertyModel.cs" />
|
<Compile Include="Views\CustomControl\PropertyGrid\propertyModel.cs" />
|
||||||
@ -313,6 +311,9 @@
|
|||||||
<Compile Include="Views\Dialog\DialogNewTagNumber.xaml.cs">
|
<Compile Include="Views\Dialog\DialogNewTagNumber.xaml.cs">
|
||||||
<DependentUpon>DialogNewTagNumber.xaml</DependentUpon>
|
<DependentUpon>DialogNewTagNumber.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Views\Dialog\DialogSectionBox.xaml.cs">
|
||||||
|
<DependentUpon>DialogSectionBox.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Views\Dialog\DialogSignalPredistribution.xaml.cs">
|
<Compile Include="Views\Dialog\DialogSignalPredistribution.xaml.cs">
|
||||||
<DependentUpon>DialogSignalPredistribution.xaml</DependentUpon>
|
<DependentUpon>DialogSignalPredistribution.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -448,6 +449,10 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Views\Dialog\DialogSectionBox.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Views\Dialog\DialogSignalPredistribution.xaml">
|
<Page Include="Views\Dialog\DialogSignalPredistribution.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
@ -37,6 +37,10 @@ namespace SWS.CAD
|
|||||||
GlobalObject.container.RegisterSingleton<DrawingCatalogueService>();
|
GlobalObject.container.RegisterSingleton<DrawingCatalogueService>();
|
||||||
GlobalObject.container.RegisterSingleton<WireGroupService>();
|
GlobalObject.container.RegisterSingleton<WireGroupService>();
|
||||||
GlobalObject.container.RegisterSingleton<IOModuleService>();
|
GlobalObject.container.RegisterSingleton<IOModuleService>();
|
||||||
|
GlobalObject.container.RegisterSingleton<PDBService>();
|
||||||
|
GlobalObject.container.RegisterSingleton<RelService>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
GlobalObject._prismContainer = new DryIocContainerExtension();
|
GlobalObject._prismContainer = new DryIocContainerExtension();
|
||||||
GlobalObject._prismContainer.Register<IDialogService, DialogService>();
|
GlobalObject._prismContainer.Register<IDialogService, DialogService>();
|
||||||
@ -73,6 +77,7 @@ namespace SWS.CAD
|
|||||||
GlobalObject._prismContainer.RegisterDialog<DialogCableConnection, DialogCableConnectionViewModel>();
|
GlobalObject._prismContainer.RegisterDialog<DialogCableConnection, DialogCableConnectionViewModel>();
|
||||||
GlobalObject._prismContainer.RegisterDialog<DialogCableConnection_NewStrip, DialogCableConnection_NewStripViewModel>();
|
GlobalObject._prismContainer.RegisterDialog<DialogCableConnection_NewStrip, DialogCableConnection_NewStripViewModel>();
|
||||||
GlobalObject._prismContainer.RegisterDialog<DialogSignalPredistribution, DialogSignalPredistributionViewModel>();
|
GlobalObject._prismContainer.RegisterDialog<DialogSignalPredistribution, DialogSignalPredistributionViewModel>();
|
||||||
|
GlobalObject._prismContainer.RegisterDialog<DialogSectionBox, DialogSectionBoxViewModel>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ using SWS.Service;
|
|||||||
using Unity;
|
using Unity;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Telerik.Windows.Controls.MaskedInput.Tokens.Numeric;
|
using Telerik.Windows.Controls.MaskedInput.Tokens.Numeric;
|
||||||
|
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
|
||||||
|
|
||||||
namespace SWS.CAD.ViewModels
|
namespace SWS.CAD.ViewModels
|
||||||
{
|
{
|
||||||
@ -156,7 +157,11 @@ namespace SWS.CAD.ViewModels
|
|||||||
{
|
{
|
||||||
if (PreAssignCable.AssignedPanel!=null)
|
if (PreAssignCable.AssignedPanel!=null)
|
||||||
{
|
{
|
||||||
PreAssignCables.Add(PreAssignCable);
|
if (PreAssignCable.Sets!=null&&!string.IsNullOrEmpty(PreAssignCable.Sets.FirstOrDefault().ConnectionInfo))
|
||||||
|
{
|
||||||
|
PreAssignCables.Add(PreAssignCable);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -164,10 +169,17 @@ namespace SWS.CAD.ViewModels
|
|||||||
{
|
{
|
||||||
foreach (var PreAssignCable in AllPreAssignCables)
|
foreach (var PreAssignCable in AllPreAssignCables)
|
||||||
{
|
{
|
||||||
if (PreAssignCable.AssignedPanel == null)
|
if (PreAssignCable.Sets == null || PreAssignCable.Sets.Count()==0)
|
||||||
{
|
{
|
||||||
PreAssignCables.Add(PreAssignCable);
|
PreAssignCables.Add(PreAssignCable);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(PreAssignCable.Sets.FirstOrDefault().ConnectionInfo))
|
||||||
|
{
|
||||||
|
PreAssignCables.Add(PreAssignCable);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -188,15 +200,54 @@ namespace SWS.CAD.ViewModels
|
|||||||
preAllocationResult.CablePair = Set.CableSetName;
|
preAllocationResult.CablePair = Set.CableSetName;
|
||||||
preAllocationResult.IOType = cable.PreAssignIOType;
|
preAllocationResult.IOType = cable.PreAssignIOType;
|
||||||
preAllocationResult.ToPanel_TagNumber = cable.AssignedPanel == null ? "" : cable.AssignedPanel.TagNumber;
|
preAllocationResult.ToPanel_TagNumber = cable.AssignedPanel == null ? "" : cable.AssignedPanel.TagNumber;
|
||||||
preAllocationResult.Panel_TagNumber = string.IsNullOrEmpty(Set.ConnectionInfo) ? "" : Set.ConnectionInfo.Split('/')[0].Split(':')[1].Trim();
|
if (!string.IsNullOrEmpty(Set.ConnectionInfo))
|
||||||
preAllocationResult.StripName = string.IsNullOrEmpty(Set.ConnectionInfo) ? "" : Set.ConnectionInfo.Split('/')[1].Split(':')[1].Trim();
|
{
|
||||||
preAllocationResult.Terms = new ObservableCollection<ec_PanelStripTerm>(Set.AssignedTerms);
|
preAllocationResult.Panel_TagNumber = string.IsNullOrEmpty(Set.ConnectionInfo) ? "" : Set.ConnectionInfo.Split('/')[0].Split(':')[1].Trim();
|
||||||
|
|
||||||
|
if (Set.ConnectionInfo.Split('/').Count()>1)
|
||||||
|
{
|
||||||
|
preAllocationResult.StripName = string.IsNullOrEmpty(Set.ConnectionInfo) ? "" : Set.ConnectionInfo.Split('/')[1].Split(':')[1].Trim();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
preAllocationResult.Terms = Set.AssignedTerms==null?new ObservableCollection<ec_PanelStripTerm>(): new ObservableCollection<ec_PanelStripTerm>(Set.AssignedTerms);
|
||||||
PreAllocationResultls.Add(preAllocationResult);
|
PreAllocationResultls.Add(preAllocationResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ICommand HeadButtonCmd => new DelegateCommand(HeadButton_Click);
|
||||||
|
/// <summary>
|
||||||
|
/// 导出按钮
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parameter"></param>
|
||||||
|
public virtual async void HeadButton_Click(object parameter)
|
||||||
|
{
|
||||||
|
if (parameter.Equals("导出电缆预分配结果明细表"))
|
||||||
|
{
|
||||||
|
System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog();
|
||||||
|
saveFileDialog.Filter = "Excel文件 (*.xlsx)|*.xlsx|所有文件 (*.*)|*.*";
|
||||||
|
saveFileDialog.Title = "选择保存路径";
|
||||||
|
|
||||||
|
if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
||||||
|
{
|
||||||
|
|
||||||
|
string selectedPath = saveFileDialog.FileName;
|
||||||
|
if (System.IO.File.Exists(selectedPath))
|
||||||
|
{ System.IO.File.Delete(selectedPath); }
|
||||||
|
|
||||||
|
var msg = await _iOModuleService.AutoAssignCable2Channel_ResExport(selectedPath);
|
||||||
|
if (string.IsNullOrEmpty(msg))
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("下载文件成功!");
|
||||||
|
}
|
||||||
|
else { System.Windows.MessageBox.Show("下载文件异常:" + msg); }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public ICommand EditEndCmd => new DelegateCommand(EditEnd);
|
public ICommand EditEndCmd => new DelegateCommand(EditEnd);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 编辑结束事件
|
/// 编辑结束事件
|
||||||
|
@ -14,6 +14,7 @@ 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;
|
||||||
|
using SWS.CAD.Base;
|
||||||
using SWS.CAD.CADFunc;
|
using SWS.CAD.CADFunc;
|
||||||
using SWS.CAD.Event;
|
using SWS.CAD.Event;
|
||||||
using SWS.CAD.ViewModels.myViewModelBase;
|
using SWS.CAD.ViewModels.myViewModelBase;
|
||||||
@ -180,9 +181,20 @@ namespace SWS.CAD.ViewModels
|
|||||||
}
|
}
|
||||||
public async void OnDialogOpened(IDialogParameters parameters)
|
public async void OnDialogOpened(IDialogParameters parameters)
|
||||||
{
|
{
|
||||||
IsBusy = true;
|
try
|
||||||
PanelTreels.AddRange(await _iOModuleService.GetPanelTree());
|
{
|
||||||
IsBusy = false;
|
IsBusy = true;
|
||||||
|
var resPanelTreels = await _iOModuleService.GetPanelTree();
|
||||||
|
PanelTreels.AddRange(resPanelTreels);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("网络连接失败", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
IsBusy = false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ using SWS.Commons;
|
|||||||
using SWS.Model;
|
using SWS.Model;
|
||||||
using SWS.WPF.ViewModels;
|
using SWS.WPF.ViewModels;
|
||||||
using SWS.Service;
|
using SWS.Service;
|
||||||
|
using SWS.CAD.Base;
|
||||||
|
|
||||||
namespace SWS.CAD.ViewModels
|
namespace SWS.CAD.ViewModels
|
||||||
{
|
{
|
||||||
|
559
newFront/c#前端/SWS.CAD/ViewModels/DialogSectionBoxViewModel.cs
Normal file
559
newFront/c#前端/SWS.CAD/ViewModels/DialogSectionBoxViewModel.cs
Normal file
@ -0,0 +1,559 @@
|
|||||||
|
|
||||||
|
using Bricscad.ApplicationServices;
|
||||||
|
using Bricscad.EditorInput;
|
||||||
|
using Prism.Events;
|
||||||
|
using Prism.Ioc;
|
||||||
|
using Prism.Services.Dialogs;
|
||||||
|
using SWS.CAD.Base;
|
||||||
|
using SWS.CAD.Event;
|
||||||
|
using SWS.CAD.ViewModels.myViewModelBase;
|
||||||
|
using SWS.CAD.Views;
|
||||||
|
using SWS.CAD.Views.CustomControl;
|
||||||
|
using SWS.Commons;
|
||||||
|
using SWS.Model;
|
||||||
|
using SWS.Service;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using Teigha.DatabaseServices;
|
||||||
|
using Telerik.Windows.Controls;
|
||||||
|
using Unity;
|
||||||
|
|
||||||
|
namespace SWS.CAD.ViewModels
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 信号预分配页面的模型类
|
||||||
|
/// </summary>
|
||||||
|
public class DialogSectionBoxViewModel : DialogBase, IDialogAware
|
||||||
|
{
|
||||||
|
#region 字段
|
||||||
|
private ObservableCollection<CircuitBreakerInfo> _CircuitBreakerInfos = new ObservableCollection<CircuitBreakerInfo>();
|
||||||
|
/// <summary>
|
||||||
|
/// 表格数据
|
||||||
|
/// </summary>
|
||||||
|
public ObservableCollection<CircuitBreakerInfo> CircuitBreakerInfos
|
||||||
|
{
|
||||||
|
get { return _CircuitBreakerInfos; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_CircuitBreakerInfos = value;
|
||||||
|
RaisePropertyChanged(nameof(CircuitBreakerInfos));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private CircuitBreakerInfo _SelectCircuitBreaker;
|
||||||
|
/// <summary>
|
||||||
|
/// 表格选中行
|
||||||
|
/// </summary>
|
||||||
|
public CircuitBreakerInfo SelectCircuitBreaker
|
||||||
|
{
|
||||||
|
get { return _SelectCircuitBreaker; }
|
||||||
|
set { _SelectCircuitBreaker = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _DefaultBreakerType;
|
||||||
|
/// <summary>
|
||||||
|
/// 开关类型
|
||||||
|
/// </summary>
|
||||||
|
public string DefaultBreakerType
|
||||||
|
{
|
||||||
|
get { return _DefaultBreakerType; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_DefaultBreakerType = value;
|
||||||
|
RaisePropertyChanged(nameof(DefaultBreakerType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<string> _BreakerTypels = new List<string>() { "MCCB", "ACB" };
|
||||||
|
/// <summary>
|
||||||
|
/// 开关类型的下拉列表
|
||||||
|
/// </summary>
|
||||||
|
public List<string> BreakerTypels
|
||||||
|
{
|
||||||
|
get { return _BreakerTypels; }
|
||||||
|
set { _BreakerTypels = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<string> _CB_Typels = new List<string>() { "输入", "输出" };
|
||||||
|
/// <summary>
|
||||||
|
/// 分电箱类型列的下拉列表
|
||||||
|
/// </summary>
|
||||||
|
public List<string> CB_Typels
|
||||||
|
{
|
||||||
|
get { return _CB_Typels; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_CB_Typels = value;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 表示要删除的开关id集合
|
||||||
|
/// </summary>
|
||||||
|
public List<string> DeleBreakerIds = new List<string>();
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
IOModuleService _iOModuleService;
|
||||||
|
ObjectTypeService _objectTypeService;
|
||||||
|
RelService _relService;
|
||||||
|
PDBService _pDBService;
|
||||||
|
IEventAggregator _eventAggregator;
|
||||||
|
|
||||||
|
public DialogSectionBoxViewModel()
|
||||||
|
{
|
||||||
|
_iOModuleService = GlobalObject.container.Resolve<IOModuleService>();
|
||||||
|
_pDBService = GlobalObject.container.Resolve<PDBService>();
|
||||||
|
_relService = GlobalObject.container.Resolve<RelService>();
|
||||||
|
_objectTypeService = GlobalObject.container.Resolve<ObjectTypeService>();
|
||||||
|
_eventAggregator = GlobalObject.container.Resolve<IEventAggregator>();
|
||||||
|
|
||||||
|
}
|
||||||
|
public string Title => "";
|
||||||
|
|
||||||
|
public event Action<IDialogResult> RequestClose;
|
||||||
|
|
||||||
|
public bool CanCloseDialog()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDialogClosed()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private ec_Panel resBreakers;
|
||||||
|
public async void OnDialogOpened(IDialogParameters parameters)
|
||||||
|
{
|
||||||
|
//title = $"电缆信号({parameters.GetValue<string>(GlobalObject.dialogPar.para2.ToString())})预分配";
|
||||||
|
var resTagInfos = await _objectTypeService.GetTagInfosByPixels("857e8ae5-d9b4-4dc7-8ebc-d7e752a4b31c", "2C01C");
|
||||||
|
|
||||||
|
//var resRel = await _relService.GetRelDefByName("主配电板");
|
||||||
|
//获取分电箱的开关信息
|
||||||
|
IsBusy = true;
|
||||||
|
resBreakers = await _pDBService.GetBreakers(resTagInfos.FirstOrDefault().tags.FirstOrDefault().EngineDataID);
|
||||||
|
if (resBreakers != null)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
foreach (var Breaker in resBreakers.Breakers)
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
CircuitBreakerInfo breakerInfo = new CircuitBreakerInfo(Breaker);
|
||||||
|
breakerInfo.Index = i;
|
||||||
|
CircuitBreakerInfos.Add(breakerInfo);
|
||||||
|
}
|
||||||
|
DefaultBreakerType = resBreakers.DefaultBreakerType;
|
||||||
|
}
|
||||||
|
|
||||||
|
title = $"{resTagInfos.FirstOrDefault().tags.FirstOrDefault().ObjectTypeName + resTagInfos.FirstOrDefault().tags.FirstOrDefault().TagNumber}开关管理";
|
||||||
|
IsBusy = false;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public override async void ExecuteOKCommandAsync(object para)
|
||||||
|
{
|
||||||
|
await SavePanelAndBreaker();
|
||||||
|
|
||||||
|
IDialogParameters res = new Prism.Services.Dialogs.DialogParameters();
|
||||||
|
//res.Add(GlobalObject.dialogPar.info.ToString(), TagNumber);
|
||||||
|
RequestClose.Invoke(new DialogResult(ButtonResult.Yes, res));
|
||||||
|
}
|
||||||
|
public override void ExecuteCloseCommand(object parameter)
|
||||||
|
{
|
||||||
|
if (parameter as string == "ClickNo")
|
||||||
|
{
|
||||||
|
DialogResult res = new DialogResult(ButtonResult.No);
|
||||||
|
RequestClose.Invoke(res);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
|
||||||
|
}
|
||||||
|
this.Dispose();
|
||||||
|
}
|
||||||
|
#region 方法
|
||||||
|
|
||||||
|
#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("新增"))
|
||||||
|
{
|
||||||
|
CircuitBreakerInfo breakerInfo = new CircuitBreakerInfo();
|
||||||
|
breakerInfo.Index = CircuitBreakerInfos.Count() + 1;
|
||||||
|
breakerInfo.Name = "开关" + (CircuitBreakerInfos.Count() + 1);
|
||||||
|
breakerInfo.Phase = 1;
|
||||||
|
breakerInfo.OrderId = CircuitBreakerInfos.Count();
|
||||||
|
breakerInfo.CB_Type = "输出";
|
||||||
|
breakerInfo.IsModified = true;
|
||||||
|
CircuitBreakerInfos.Add(breakerInfo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 删除
|
||||||
|
if (parameter.ToString().Equals("删除"))
|
||||||
|
{
|
||||||
|
//当前选择不为空
|
||||||
|
if (SelectCircuitBreaker != null)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(SelectCircuitBreaker.EngineerDataID))
|
||||||
|
{
|
||||||
|
DeleBreakerIds.Add(SelectCircuitBreaker.EngineerDataID);
|
||||||
|
}
|
||||||
|
CircuitBreakerInfos.Remove(SelectCircuitBreaker);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请先选择删除行", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
|
||||||
|
}
|
||||||
|
//删除之后重新排序
|
||||||
|
int i = 0;
|
||||||
|
foreach (var CircuitBreakerInfo in CircuitBreakerInfos)
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
CircuitBreakerInfo.Index = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 关联电缆
|
||||||
|
if (parameter.ToString().Equals("关联电缆"))
|
||||||
|
{
|
||||||
|
//当前选择不为空
|
||||||
|
if (SelectCircuitBreaker != null)
|
||||||
|
{
|
||||||
|
//在SWS系统内打开且不是只读的图纸才可
|
||||||
|
var dwgName = General.GetDwgName();
|
||||||
|
var dwgFile = GlobalObject.ListDwgOpened.FirstOrDefault(a => a.Path == dwgName && a.IsReadOnly == false);
|
||||||
|
if (dwgFile == null)
|
||||||
|
{ return; }
|
||||||
|
Document doc = Bricscad.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
|
||||||
|
Database db = doc.Database;
|
||||||
|
Editor ed = doc.Editor;
|
||||||
|
//选择的元素返回的属性信息
|
||||||
|
var ResTagInfosByPixels = new Model.ec_objecttype();
|
||||||
|
var listPropertys = new List<propertyModel>();
|
||||||
|
// 持续选择直到获取有效电缆
|
||||||
|
bool isValidCable = false;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
// 创建选择选项(禁用回车确认)
|
||||||
|
PromptEntityOptions options = new PromptEntityOptions("\n请单击选择电缆: ");
|
||||||
|
options.AllowNone = false; // 禁止空选
|
||||||
|
|
||||||
|
// 执行选择(直接单击生效)
|
||||||
|
PromptEntityResult resultEntity = ed.GetEntity(options);
|
||||||
|
|
||||||
|
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());
|
||||||
|
_objectTypeService = GlobalObject.container.Resolve<ObjectTypeService>();
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ed.WriteMessage($"\n错误: {ex.Message}");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请先选择行", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 放置开关
|
||||||
|
if (parameter.ToString().Equals("放置开关"))
|
||||||
|
{
|
||||||
|
|
||||||
|
//当前选择不为空
|
||||||
|
if (SelectCircuitBreaker != null)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.Windows.MessageBox.Show("请先选择行", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning); return;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 表格编辑结束事件
|
||||||
|
public ICommand EditEndCmd => new DelegateCommand(EditEnd);
|
||||||
|
/// <summary>
|
||||||
|
/// 编辑结束事件
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parameter"></param>
|
||||||
|
public virtual void EditEnd(object parameter)
|
||||||
|
{
|
||||||
|
//做个标记表示该项修改过
|
||||||
|
SelectCircuitBreaker.IsModified = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 保存
|
||||||
|
/// <summary>
|
||||||
|
/// 保存
|
||||||
|
/// </summary>
|
||||||
|
public async Task SavePanelAndBreaker()
|
||||||
|
{
|
||||||
|
//SavePanel
|
||||||
|
ec_Panel panel = new ec_Panel();
|
||||||
|
panel.CreateTime = resBreakers.CreateTime;
|
||||||
|
panel.CreateUserID = resBreakers.CreateUserID;
|
||||||
|
panel.DefaultBreakerType = DefaultBreakerType;
|
||||||
|
panel.EngineerDataID = resBreakers.EngineerDataID;
|
||||||
|
panel.MaxStripNumber = resBreakers.MaxStripNumber;
|
||||||
|
panel.ObjectTypeName = resBreakers.ObjectTypeName;
|
||||||
|
panel.PanelID = resBreakers.PanelID;
|
||||||
|
panel.Panel_Loc_ID = resBreakers.Panel_Loc_ID;
|
||||||
|
panel.TagNumber = resBreakers.TagNumber;
|
||||||
|
panel.UpdateTime = resBreakers.UpdateTime;
|
||||||
|
panel.UpdateUserID = resBreakers.UpdateUserID;
|
||||||
|
panel.allowedIOTypes = resBreakers.allowedIOTypes;
|
||||||
|
panel.strips = resBreakers.strips;
|
||||||
|
panel.systempanel = resBreakers.systempanel;
|
||||||
|
var resSavePanel = await _iOModuleService.SavePanel(panel);
|
||||||
|
|
||||||
|
//SaveBreakers
|
||||||
|
List<ec_CircuitBreaker> circuitBreakerls = new List<ec_CircuitBreaker>();
|
||||||
|
foreach (var CircuitBreakerInfo in CircuitBreakerInfos)
|
||||||
|
{
|
||||||
|
if (CircuitBreakerInfo.IsModified)
|
||||||
|
{
|
||||||
|
ec_CircuitBreaker circuitBreaker = new ec_CircuitBreaker();
|
||||||
|
circuitBreaker.Name = CircuitBreakerInfo.Name;
|
||||||
|
circuitBreaker.Phase = CircuitBreakerInfo.Phase;
|
||||||
|
circuitBreaker.CB_Type = CircuitBreakerInfo.CB_Type;
|
||||||
|
circuitBreaker.Capacity_Act = CircuitBreakerInfo.Capacity_Act;
|
||||||
|
circuitBreaker.Capacity_Max = CircuitBreakerInfo.Capacity_Max;
|
||||||
|
circuitBreaker.Capacity_Set = CircuitBreakerInfo.Capacity_Set;
|
||||||
|
circuitBreaker.EngineerDataID = CircuitBreakerInfo.EngineerDataID;
|
||||||
|
circuitBreaker.OrderId = CircuitBreakerInfo.OrderId;
|
||||||
|
circuitBreakerls.Add(circuitBreaker);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var resSaveBreaker = await _pDBService.SaveBreakers(resBreakers.EngineerDataID, circuitBreakerls);
|
||||||
|
|
||||||
|
//DeleteBreaker
|
||||||
|
if (DeleBreakerIds.Count > 0)
|
||||||
|
{
|
||||||
|
var BreakerIds = string.Join(",", DeleBreakerIds);
|
||||||
|
var resDele = await _pDBService.Delete(BreakerIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class CircuitBreakerInfo : ViewBase
|
||||||
|
{
|
||||||
|
#region 页面显示字段
|
||||||
|
private int _Index;
|
||||||
|
/// <summary>
|
||||||
|
/// 序号
|
||||||
|
/// </summary>
|
||||||
|
public int Index
|
||||||
|
{
|
||||||
|
get { return _Index; }
|
||||||
|
set { _Index = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _Name;
|
||||||
|
/// <summary>
|
||||||
|
/// 开关名字
|
||||||
|
/// </summary>
|
||||||
|
public string Name
|
||||||
|
{
|
||||||
|
get { return _Name; }
|
||||||
|
set { _Name = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private int _Phase;
|
||||||
|
/// <summary>
|
||||||
|
/// 相数
|
||||||
|
/// </summary>
|
||||||
|
public int Phase
|
||||||
|
{
|
||||||
|
get { return _Phase; }
|
||||||
|
set { _Phase = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _CB_Type;
|
||||||
|
/// <summary>
|
||||||
|
/// 分电箱类型
|
||||||
|
/// 输出或输入
|
||||||
|
/// </summary>
|
||||||
|
public string CB_Type
|
||||||
|
{
|
||||||
|
get { return _CB_Type; }
|
||||||
|
set { _CB_Type = value; }
|
||||||
|
}
|
||||||
|
private string _Capacity_Max;
|
||||||
|
/// <summary>
|
||||||
|
/// 额定电流
|
||||||
|
/// </summary>
|
||||||
|
public string Capacity_Max
|
||||||
|
{
|
||||||
|
get { return _Capacity_Max; }
|
||||||
|
set { _Capacity_Max = value; }
|
||||||
|
}
|
||||||
|
private string _Capacity_Set;
|
||||||
|
/// <summary>
|
||||||
|
/// 整定电流
|
||||||
|
/// </summary>
|
||||||
|
public string Capacity_Set
|
||||||
|
{
|
||||||
|
get { return _Capacity_Set; }
|
||||||
|
set { _Capacity_Set = value; }
|
||||||
|
}
|
||||||
|
private string _Capacity_Act;
|
||||||
|
/// <summary>
|
||||||
|
/// 实际电流
|
||||||
|
/// </summary>
|
||||||
|
public string Capacity_Act
|
||||||
|
{
|
||||||
|
get { return _Capacity_Act; }
|
||||||
|
set { _Capacity_Act = value; }
|
||||||
|
}
|
||||||
|
private string _CableTagNumber;
|
||||||
|
/// <summary>
|
||||||
|
/// 电缆位号
|
||||||
|
/// </summary>
|
||||||
|
public string CableTagNumber
|
||||||
|
{
|
||||||
|
get { return _CableTagNumber; }
|
||||||
|
set { _CableTagNumber = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private string _RemoteDeviceId;
|
||||||
|
/// <summary>
|
||||||
|
/// 对面的设备信息
|
||||||
|
/// </summary>
|
||||||
|
public string RemoteDeviceId
|
||||||
|
{
|
||||||
|
get { return _RemoteDeviceId; }
|
||||||
|
set { _RemoteDeviceId = value; }
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 扩展字段
|
||||||
|
private string _EngineerDataID;
|
||||||
|
/// <summary>
|
||||||
|
/// 开关工程ID
|
||||||
|
/// </summary>
|
||||||
|
public string EngineerDataID
|
||||||
|
{
|
||||||
|
get { return _EngineerDataID; }
|
||||||
|
set { _EngineerDataID = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private int _OrderId;
|
||||||
|
|
||||||
|
public int OrderId
|
||||||
|
{
|
||||||
|
get { return _OrderId; }
|
||||||
|
set { _OrderId = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private bool _IsModified;
|
||||||
|
/// <summary>
|
||||||
|
/// 标记行数据是否修改
|
||||||
|
/// </summary>
|
||||||
|
public bool IsModified
|
||||||
|
{
|
||||||
|
get { return _IsModified; }
|
||||||
|
set { _IsModified = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
public CircuitBreakerInfo()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
public CircuitBreakerInfo(ec_CircuitBreaker ec_CircuitBreaker)
|
||||||
|
{
|
||||||
|
Name = ec_CircuitBreaker.Name;
|
||||||
|
CB_Type = ec_CircuitBreaker.CB_Type;
|
||||||
|
Phase = ec_CircuitBreaker.Phase;
|
||||||
|
Capacity_Max = ec_CircuitBreaker.Capacity_Max;
|
||||||
|
Capacity_Set = ec_CircuitBreaker.Capacity_Set;
|
||||||
|
Capacity_Act = ec_CircuitBreaker.Capacity_Act;
|
||||||
|
CableTagNumber = ec_CircuitBreaker.CableTagNumbers.FirstOrDefault();
|
||||||
|
|
||||||
|
EngineerDataID = ec_CircuitBreaker.EngineerDataID;
|
||||||
|
OrderId = ec_CircuitBreaker.OrderId;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
|
using Aspose.Cells;
|
||||||
using Prism.Events;
|
using Prism.Events;
|
||||||
using Prism.Ioc;
|
using Prism.Ioc;
|
||||||
using Prism.Services.Dialogs;
|
using Prism.Services.Dialogs;
|
||||||
@ -111,22 +112,37 @@ namespace SWS.CAD.ViewModels
|
|||||||
RaisePropertyChanged(nameof(SignalColumnName));
|
RaisePropertyChanged(nameof(SignalColumnName));
|
||||||
if (value.Equals("Digital"))
|
if (value.Equals("Digital"))
|
||||||
{
|
{
|
||||||
|
//判断是否输入输出是否有值,有值下拉可选项需要设置为已有值
|
||||||
|
string tempIntorOut= SignalPredistributionInfos.Where(s => !string.IsNullOrEmpty(s.InorOut)).Select(s => s.InorOut).FirstOrDefault();
|
||||||
|
if (string.IsNullOrEmpty(tempIntorOut))
|
||||||
|
{
|
||||||
|
InorOuts = new List<string>() { "输出", "输入" };
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
InorOuts = new List<string>() { tempIntorOut };
|
||||||
|
}
|
||||||
|
|
||||||
SignalTypeColumn = new ObservableCollection<string>() { "无公共端接线(断开报警NC)", "无公共端接线(闭合报警NO)", "带公共端接线(断开报警NC)", "带公共端接线(闭合报警NO)" };
|
SignalTypeColumn = new ObservableCollection<string>() { "无公共端接线(断开报警NC)", "无公共端接线(闭合报警NO)", "带公共端接线(断开报警NC)", "带公共端接线(闭合报警NO)" };
|
||||||
}
|
}
|
||||||
else if (value.Equals("4-20mA"))
|
else if (value.Equals("4-20mA"))
|
||||||
{
|
{
|
||||||
|
InorOuts= new List<string>() { "输出", "输入" };
|
||||||
SignalTypeColumn = new ObservableCollection<string>() { "无源", "有源" };
|
SignalTypeColumn = new ObservableCollection<string>() { "无源", "有源" };
|
||||||
}
|
}
|
||||||
else if (value.Equals("-10V-10V"))
|
else if (value.Equals("-10V-10V"))
|
||||||
{
|
{
|
||||||
|
InorOuts = new List<string>() { "输出", "输入" };
|
||||||
SignalTypeColumn = new ObservableCollection<string>() { "无源", "有源" };
|
SignalTypeColumn = new ObservableCollection<string>() { "无源", "有源" };
|
||||||
}
|
}
|
||||||
else if (value.Equals("PT100"))
|
else if (value.Equals("PT100"))
|
||||||
{
|
{
|
||||||
|
InorOuts = new List<string>() { "输出", "输入" };
|
||||||
SignalTypeColumn = new ObservableCollection<string>() { "量程100", "量程150", "量程200", "量程600" };
|
SignalTypeColumn = new ObservableCollection<string>() { "量程100", "量程150", "量程200", "量程600" };
|
||||||
}
|
}
|
||||||
else if (value.Equals("Pulse"))
|
else if (value.Equals("Pulse"))
|
||||||
{
|
{
|
||||||
|
InorOuts = new List<string>() { "输出", "输入" };
|
||||||
SignalTypeColumn = new ObservableCollection<string>() { "脉冲信号" };
|
SignalTypeColumn = new ObservableCollection<string>() { "脉冲信号" };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -275,7 +291,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
|
|
||||||
if (string.IsNullOrEmpty(Set.PreAssignInOrOut))
|
if (string.IsNullOrEmpty(Set.PreAssignInOrOut))
|
||||||
{
|
{
|
||||||
predistributionInfo.InorOut = InorOuts.FirstOrDefault();
|
//predistributionInfo.InorOut = InorOuts.FirstOrDefault();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -283,6 +299,8 @@ namespace SWS.CAD.ViewModels
|
|||||||
}
|
}
|
||||||
predistributionInfo.SensorCode = Set.PreAssignSensorCode;
|
predistributionInfo.SensorCode = Set.PreAssignSensorCode;
|
||||||
|
|
||||||
|
//给每一行添加委托事件
|
||||||
|
predistributionInfo.UpdateInorOutsChanged += (sender, e) => UpdateInorOuts((SignalPredistributionInfo)sender);
|
||||||
|
|
||||||
SignalPredistributionInfos.Add(predistributionInfo);
|
SignalPredistributionInfos.Add(predistributionInfo);
|
||||||
}
|
}
|
||||||
@ -423,6 +441,39 @@ namespace SWS.CAD.ViewModels
|
|||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region 修改输出和输入的可选项
|
||||||
|
public void UpdateInorOuts(SignalPredistributionInfo sender)
|
||||||
|
{
|
||||||
|
if (SignalColumnName.Equals("Digital"))
|
||||||
|
{
|
||||||
|
string tempIntorOut = SignalPredistributionInfos.Where(s => !string.IsNullOrEmpty(s.InorOut)).Select(s => s.InorOut).FirstOrDefault();
|
||||||
|
if (string.IsNullOrEmpty(tempIntorOut))
|
||||||
|
{
|
||||||
|
InorOuts = new List<string>() { sender.InorOut };
|
||||||
|
if (sender.SignalType.Contains("带公共端"))
|
||||||
|
{
|
||||||
|
InorOuts = new List<string>() { "输入" };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (tempIntorOut.Equals("输出"))
|
||||||
|
{
|
||||||
|
if (sender.SignalType.Contains("带公共端"))
|
||||||
|
{
|
||||||
|
MessageBox.Show("带公共端只能跟输入信号搭配", "KunHengCAD", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
|
//需要还原信号类型的选项
|
||||||
|
var Set = CableBy.Sets.FirstOrDefault(s => s.CableSetName.Equals(sender.CablePair));
|
||||||
|
sender.SignalType = SignalTypeColumn.FirstOrDefault();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region 查找节点路径
|
#region 查找节点路径
|
||||||
public List<string> FindNodePath(ObservableCollection<TreeModel> nodes, TreeModel targetNode)
|
public List<string> FindNodePath(ObservableCollection<TreeModel> nodes, TreeModel targetNode)
|
||||||
@ -454,6 +505,8 @@ namespace SWS.CAD.ViewModels
|
|||||||
|
|
||||||
public class SignalPredistributionInfo : DialogBase
|
public class SignalPredistributionInfo : DialogBase
|
||||||
{
|
{
|
||||||
|
public event EventHandler UpdateInorOutsChanged;
|
||||||
|
|
||||||
#region 字段
|
#region 字段
|
||||||
private ObservableCollection<string> _Index = new ObservableCollection<string>();
|
private ObservableCollection<string> _Index = new ObservableCollection<string>();
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -510,6 +563,8 @@ namespace SWS.CAD.ViewModels
|
|||||||
{
|
{
|
||||||
_SignalType = value;
|
_SignalType = value;
|
||||||
RaisePropertyChanged(nameof(SignalType));
|
RaisePropertyChanged(nameof(SignalType));
|
||||||
|
UpdateInorOutsChanged?.Invoke(this, EventArgs.Empty);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,6 +608,8 @@ namespace SWS.CAD.ViewModels
|
|||||||
{
|
{
|
||||||
_InorOut = value;
|
_InorOut = value;
|
||||||
RaisePropertyChanged(nameof(InorOut));
|
RaisePropertyChanged(nameof(InorOut));
|
||||||
|
UpdateInorOutsChanged?.Invoke(this, EventArgs.Empty);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ 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 System;
|
using System;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
@ -36,6 +36,7 @@ using SWS.Commons;
|
|||||||
using SWS.Model;
|
using SWS.Model;
|
||||||
using SWS.Service;
|
using SWS.Service;
|
||||||
using SWS.WPF.Views;
|
using SWS.WPF.Views;
|
||||||
|
using SWS.CAD.Base;
|
||||||
namespace SWS.CAD.ViewModels
|
namespace SWS.CAD.ViewModels
|
||||||
{
|
{
|
||||||
public class LeftPanelViewModel : ViewModelBase
|
public class LeftPanelViewModel : ViewModelBase
|
||||||
@ -833,7 +834,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
{ MessageBox.Show("图纸文件下载失败,信息:" + msg); return; }
|
{ MessageBox.Show("图纸文件下载失败,信息:" + msg); return; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
msg = CADFunc.General.OpenDwg(filePath);//打开编辑图纸
|
msg = General.OpenDwg(filePath);//打开编辑图纸
|
||||||
if (!string.IsNullOrEmpty(msg))
|
if (!string.IsNullOrEmpty(msg))
|
||||||
{
|
{
|
||||||
MessageBox.Show($"本地图纸文件:{model.Text} 打开失败,信息:{msg}");
|
MessageBox.Show($"本地图纸文件:{model.Text} 打开失败,信息:{msg}");
|
||||||
@ -868,7 +869,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
msg = await _annexesService.DownloadFile(filePath, dwgfileDto.F_Id);
|
msg = await _annexesService.DownloadFile(filePath, dwgfileDto.F_Id);
|
||||||
if (!string.IsNullOrEmpty(msg))
|
if (!string.IsNullOrEmpty(msg))
|
||||||
{ MessageBox.Show("图纸文件下载失败,信息:" + msg); return; }
|
{ MessageBox.Show("图纸文件下载失败,信息:" + msg); return; }
|
||||||
msg = CADFunc.General.OpenDwg(filePath, true);//以只读模式打开图纸
|
msg = General.OpenDwg(filePath, true);//以只读模式打开图纸
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(msg))
|
if (!string.IsNullOrEmpty(msg))
|
||||||
{
|
{
|
||||||
@ -996,7 +997,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//以只读模式打开图纸
|
//以只读模式打开图纸
|
||||||
msg = CADFunc.General.OpenDwg(filePath, true);
|
msg = General.OpenDwg(filePath, true);
|
||||||
InitDrawingSelectedAdd(dwgObj, true);
|
InitDrawingSelectedAdd(dwgObj, true);
|
||||||
}
|
}
|
||||||
//获取当前图纸所有句柄
|
//获取当前图纸所有句柄
|
||||||
@ -1191,7 +1192,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
}
|
}
|
||||||
//打开图纸文件
|
//打开图纸文件
|
||||||
filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text);
|
filePath = Path.Combine(GlobalObject.GetDwgFileFolder(), model.Text);
|
||||||
msg = CADFunc.General.OpenDwg(filePath);
|
msg = General.OpenDwg(filePath);
|
||||||
|
|
||||||
//更新图纸节点图标和字体颜色
|
//更新图纸节点图标和字体颜色
|
||||||
dwgObj.CheckOutUserID = GlobalObject.userInfo.userId;
|
dwgObj.CheckOutUserID = GlobalObject.userInfo.userId;
|
||||||
@ -1693,7 +1694,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
#region 当图纸文件已被打开时,直接打开图纸并选中图元
|
#region 当图纸文件已被打开时,直接打开图纸并选中图元
|
||||||
if (FileHelper.IsFileLocked(filePath))
|
if (FileHelper.IsFileLocked(filePath))
|
||||||
{
|
{
|
||||||
msg = CADFunc.General.OpenDwg(filePath);//打开编辑图纸
|
msg = General.OpenDwg(filePath);//打开编辑图纸
|
||||||
if (!string.IsNullOrEmpty(msg))
|
if (!string.IsNullOrEmpty(msg))
|
||||||
{
|
{
|
||||||
MessageBox.Show($"本地图纸文件:{model.Text} 打开失败,信息:{msg}");
|
MessageBox.Show($"本地图纸文件:{model.Text} 打开失败,信息:{msg}");
|
||||||
@ -1716,7 +1717,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
msg = await _annexesService.DownloadFile(filePath, dwgfileDto.F_Id);
|
msg = await _annexesService.DownloadFile(filePath, dwgfileDto.F_Id);
|
||||||
if (!string.IsNullOrEmpty(msg))
|
if (!string.IsNullOrEmpty(msg))
|
||||||
{ MessageBox.Show("图纸文件下载失败,信息:" + msg); return; }
|
{ MessageBox.Show("图纸文件下载失败,信息:" + msg); return; }
|
||||||
msg = CADFunc.General.OpenDwg(filePath);//打开编辑图纸
|
msg = General.OpenDwg(filePath);//打开编辑图纸
|
||||||
if (!string.IsNullOrEmpty(msg))
|
if (!string.IsNullOrEmpty(msg))
|
||||||
{
|
{
|
||||||
MessageBox.Show($"本地图纸文件:{model.Text} 打开失败,信息:{msg}");
|
MessageBox.Show($"本地图纸文件:{model.Text} 打开失败,信息:{msg}");
|
||||||
@ -1740,7 +1741,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
#region 当图纸文件已被打开时,直接打开图纸并选中图元
|
#region 当图纸文件已被打开时,直接打开图纸并选中图元
|
||||||
if (FileHelper.IsFileLocked(filePath))
|
if (FileHelper.IsFileLocked(filePath))
|
||||||
{
|
{
|
||||||
msg = CADFunc.General.OpenDwg(filePath, true);//只读打开图纸
|
msg = General.OpenDwg(filePath, true);//只读打开图纸
|
||||||
if (!string.IsNullOrEmpty(msg))
|
if (!string.IsNullOrEmpty(msg))
|
||||||
{
|
{
|
||||||
MessageBox.Show($"本地图纸文件:{model.Text} 打开失败,信息:{msg}");
|
MessageBox.Show($"本地图纸文件:{model.Text} 打开失败,信息:{msg}");
|
||||||
@ -1764,7 +1765,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
if (!string.IsNullOrEmpty(msg))
|
if (!string.IsNullOrEmpty(msg))
|
||||||
{ MessageBox.Show("图纸文件下载失败,信息:" + msg); return; }
|
{ MessageBox.Show("图纸文件下载失败,信息:" + msg); return; }
|
||||||
|
|
||||||
msg = CADFunc.General.OpenDwg(filePath, true);//只读打开图纸
|
msg = General.OpenDwg(filePath, true);//只读打开图纸
|
||||||
if (!string.IsNullOrEmpty(msg))
|
if (!string.IsNullOrEmpty(msg))
|
||||||
{
|
{
|
||||||
MessageBox.Show($"本地图纸文件:{model.Text} 打开失败,信息:{msg}");
|
MessageBox.Show($"本地图纸文件:{model.Text} 打开失败,信息:{msg}");
|
||||||
@ -2142,7 +2143,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
var dwgPublishObj = JsonConvert.DeserializeObject<ec_drawing_publish>(model.NodeExtData.ToString());
|
var dwgPublishObj = JsonConvert.DeserializeObject<ec_drawing_publish>(model.NodeExtData.ToString());
|
||||||
if (File.Exists(filePath))
|
if (File.Exists(filePath))
|
||||||
{
|
{
|
||||||
msg = CADFunc.General.OpenDwg(filePath, true);//以只读模式打开图纸
|
msg = General.OpenDwg(filePath, true);//以只读模式打开图纸
|
||||||
if (!string.IsNullOrEmpty(msg))
|
if (!string.IsNullOrEmpty(msg))
|
||||||
{
|
{
|
||||||
MessageBox.Show($"本地图纸文件:{model.Text} 打开失败,信息:{msg}");
|
MessageBox.Show($"本地图纸文件:{model.Text} 打开失败,信息:{msg}");
|
||||||
@ -2156,7 +2157,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
msg = await _annexesService.DownloadFile(filePath, dwgfileDto.F_Id);
|
msg = await _annexesService.DownloadFile(filePath, dwgfileDto.F_Id);
|
||||||
if (!string.IsNullOrEmpty(msg))
|
if (!string.IsNullOrEmpty(msg))
|
||||||
{ MessageBox.Show("图纸文件下载失败,信息:" + msg); return; }
|
{ MessageBox.Show("图纸文件下载失败,信息:" + msg); return; }
|
||||||
msg = CADFunc.General.OpenDwg(filePath, true);//以只读模式打开图纸
|
msg = General.OpenDwg(filePath, true);//以只读模式打开图纸
|
||||||
if (!string.IsNullOrEmpty(msg))
|
if (!string.IsNullOrEmpty(msg))
|
||||||
{
|
{
|
||||||
MessageBox.Show($"本地图纸文件:{model.Text} 打开失败,信息:{msg}");
|
MessageBox.Show($"本地图纸文件:{model.Text} 打开失败,信息:{msg}");
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Prism.Services.Dialogs;
|
using Prism.Services.Dialogs;
|
||||||
|
using SWS.CAD.Base;
|
||||||
using SWS.CAD.ViewModels.myViewModelBase;
|
using SWS.CAD.ViewModels.myViewModelBase;
|
||||||
using SWS.Commons;
|
using SWS.Commons;
|
||||||
using SWS.Model;
|
using SWS.Model;
|
||||||
@ -382,7 +383,7 @@ namespace SWS.CAD.ViewModels
|
|||||||
{
|
{
|
||||||
MessageBox.Show("新建图纸成功!");
|
MessageBox.Show("新建图纸成功!");
|
||||||
//新建图纸完,自动打开图纸
|
//新建图纸完,自动打开图纸
|
||||||
msg = CADFunc.General.OpenDwg(filePath);
|
msg = General.OpenDwg(filePath);
|
||||||
if (!string.IsNullOrEmpty(msg))
|
if (!string.IsNullOrEmpty(msg))
|
||||||
{
|
{
|
||||||
MessageBox.Show($"本地图纸文件:{dwgObj.DrawingFileName} 打开失败,信息:{msg}");
|
MessageBox.Show($"本地图纸文件:{dwgObj.DrawingFileName} 打开失败,信息:{msg}");
|
||||||
|
@ -3,6 +3,7 @@ using Bricscad.EditorInput;
|
|||||||
using Prism.Events;
|
using Prism.Events;
|
||||||
using Prism.Ioc;
|
using Prism.Ioc;
|
||||||
using Prism.Services.Dialogs;
|
using Prism.Services.Dialogs;
|
||||||
|
using SWS.CAD.Base;
|
||||||
using SWS.CAD.CADFunc;
|
using SWS.CAD.CADFunc;
|
||||||
using SWS.CAD.Event;
|
using SWS.CAD.Event;
|
||||||
using SWS.CAD.Views;
|
using SWS.CAD.Views;
|
||||||
|
@ -225,7 +225,11 @@ namespace SWS.CAD.Views.CustomControl
|
|||||||
{
|
{
|
||||||
var item = listPro[i];
|
var item = listPro[i];
|
||||||
var list = listPro.Where(a => a.IsBasicGroup = item.IsBasicGroup).ToList();
|
var list = listPro.Where(a => a.IsBasicGroup = item.IsBasicGroup).ToList();
|
||||||
isLast = item.DisplayText == list.Last().DisplayText;
|
if (list != null && list.Count() != 0)
|
||||||
|
{
|
||||||
|
isLast = item.DisplayText == list.Last().DisplayText;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
CreatePropertyControl(sender, listPro[i], i, isLast);
|
CreatePropertyControl(sender, listPro[i], i, isLast);
|
||||||
}
|
}
|
||||||
|
@ -60,19 +60,27 @@
|
|||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid Grid.Row="0">
|
<Grid Grid.Row="0">
|
||||||
<StackPanel >
|
<StackPanel >
|
||||||
<StackPanel Orientation="Horizontal">
|
<DockPanel>
|
||||||
<RadioButton IsChecked="{Binding SuccessOrFailure, Converter={StaticResource RadioButtonValueCvt},ConverterParameter=分配成功}" Content="分配成功" Foreground="White" GroupName="RadioButton1"/>
|
<StackPanel Orientation="Horizontal">
|
||||||
<RadioButton IsChecked="{Binding SuccessOrFailure, Converter={StaticResource RadioButtonValueCvt},ConverterParameter=分配失败}" Content="分配失败" Foreground="White" GroupName="RadioButton1"/>
|
<RadioButton IsChecked="{Binding SuccessOrFailure, Converter={StaticResource RadioButtonValueCvt},ConverterParameter=分配成功}" Content="分配成功" Foreground="White" GroupName="RadioButton1"/>
|
||||||
</StackPanel>
|
<RadioButton IsChecked="{Binding SuccessOrFailure, Converter={StaticResource RadioButtonValueCvt},ConverterParameter=分配失败}" Content="分配失败" Foreground="White" GroupName="RadioButton1"/>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Width="20" HorizontalAlignment="Right">
|
||||||
|
<telerik:RadPathButton PathGeometry="{telerik:RadGlyph Glyph=}"
|
||||||
|
ToolTip="导出电缆预分配结果明细表"
|
||||||
|
Command="{Binding HeadButtonCmd}"
|
||||||
|
CommandParameter="{Binding ToolTip,RelativeSource={RelativeSource Self}}">
|
||||||
|
</telerik:RadPathButton>
|
||||||
|
</StackPanel>
|
||||||
|
</DockPanel>
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<GroupBox Margin="5,0,5,5"
|
<GroupBox Margin="5,0,5,5"
|
||||||
Foreground="White"
|
Foreground="White"
|
||||||
VerticalAlignment="Bottom"
|
VerticalAlignment="Bottom"
|
||||||
Header="预分配电缆列表">
|
Header="预分配电缆列表">
|
||||||
<ListBox x:Name="treeView1" Width="120" Height="490" Background="White"
|
<ListBox x:Name="treeView1" Width="120" Height="490" Background="White"
|
||||||
ItemsSource="{Binding PreAssignCables,Mode=TwoWay}" SelectedItem="{Binding SelectedPreAssignCable,Mode=TwoWay}"
|
ItemsSource="{Binding PreAssignCables,Mode=TwoWay}" SelectedItem="{Binding SelectedPreAssignCable,Mode=TwoWay}"
|
||||||
Margin="5" telerik:StyleManager.Theme="Office_Blue"
|
Margin="5" telerik:StyleManager.Theme="Office_Blue"
|
||||||
|
|
||||||
>
|
>
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<HierarchicalDataTemplate ItemsSource="{Binding PreAssignCables,Mode=TwoWay}">
|
<HierarchicalDataTemplate ItemsSource="{Binding PreAssignCables,Mode=TwoWay}">
|
||||||
@ -82,11 +90,11 @@
|
|||||||
</ListBox.ItemTemplate>
|
</ListBox.ItemTemplate>
|
||||||
</ListBox>
|
</ListBox>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
<GroupBox Margin="5,0,5,5"
|
<GroupBox Margin="5,0,0,5"
|
||||||
Foreground="White"
|
Foreground="White"
|
||||||
Header="预分配信息">
|
Header="预分配信息">
|
||||||
<Grid Width="450" Height="500" Background="White">
|
<Grid Width="480" Height="500" Background="White">
|
||||||
<telerik:RadGridView x:Name="RadGridView1" SelectionMode="Single" Width="auto" Height="660"
|
<telerik:RadGridView x:Name="RadGridView1" SelectionMode="Single" Width="auto" Height="660"
|
||||||
AutoGenerateColumns="False" IsFilteringAllowed="False"
|
AutoGenerateColumns="False" IsFilteringAllowed="False"
|
||||||
IsReadOnly="False" RowIndicatorVisibility="Collapsed"
|
IsReadOnly="False" RowIndicatorVisibility="Collapsed"
|
||||||
ShowGroupPanel="False" telerik:StyleManager.Theme="Office_Blue"
|
ShowGroupPanel="False" telerik:StyleManager.Theme="Office_Blue"
|
||||||
@ -108,9 +116,9 @@
|
|||||||
DataMemberBinding="{Binding Terms}"
|
DataMemberBinding="{Binding Terms}"
|
||||||
Width="*" IsReadOnly="True"
|
Width="*" IsReadOnly="True"
|
||||||
CellTemplate="{StaticResource CellTemplate2}" CellEditTemplate="{StaticResource CellEditTemplate2}"/>
|
CellTemplate="{StaticResource CellTemplate2}" CellEditTemplate="{StaticResource CellEditTemplate2}"/>
|
||||||
</telerik:RadGridView.Columns>
|
</telerik:RadGridView.Columns>
|
||||||
</telerik:RadGridView>
|
</telerik:RadGridView>
|
||||||
</Grid>
|
</Grid>
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<TextBlock Text="{Binding SuccessOrFailure}" Foreground="White" FontSize="12" Margin="0 0 0 10"/>
|
<TextBlock Text="{Binding SuccessOrFailure}" Foreground="White" FontSize="12" Margin="0 0 0 10"/>
|
||||||
|
@ -4,9 +4,109 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:SWS.CAD.Views.Dialog"
|
xmlns:local="clr-namespace:SWS.CAD.Views.Dialog"
|
||||||
mc:Ignorable="d"
|
xmlns:CustomControl="clr-namespace:SWS.CAD.Views.CustomControl"
|
||||||
d:DesignHeight="450" d:DesignWidth="800">
|
xmlns:prism="http://prismlibrary.com/"
|
||||||
<Grid>
|
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
||||||
|
mc:Ignorable="d" >
|
||||||
</Grid>
|
<prism:Dialog.WindowStyle>
|
||||||
|
<Style TargetType="Window">
|
||||||
|
<Setter Property="Width" Value="1200"/>
|
||||||
|
<Setter Property="Height" Value="800"/>
|
||||||
|
|
||||||
|
<Setter Property="WindowState" Value="Normal"/>
|
||||||
|
<Setter Property="WindowStyle" Value="None"/>
|
||||||
|
<Setter Property="ResizeMode" Value="NoResize"/>
|
||||||
|
<Setter Property="ShowInTaskbar" Value="True"/>
|
||||||
|
</Style>
|
||||||
|
</prism:Dialog.WindowStyle>
|
||||||
|
<UserControl.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/SWS.WPF;component/Style/CustomStyles.xaml" />
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</UserControl.Resources>
|
||||||
|
<telerik:RadBusyIndicator BusyContent="{Binding BusyContent}" IsBusy="{Binding IsBusy}">
|
||||||
|
<Grid>
|
||||||
|
<StackPanel Background="#f0f0f0">
|
||||||
|
<CustomControl:customWindowTitleBar/>
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="1*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<StackPanel Grid.Column="0" Width="650">
|
||||||
|
<Label Content="开关配置列" FontSize="13" Margin="0"/>
|
||||||
|
<telerik:RadGridView
|
||||||
|
x:Name="dataGrid1"
|
||||||
|
telerik:StyleManager.Theme="Office_Blue"
|
||||||
|
RowIndicatorVisibility="Collapsed"
|
||||||
|
AutoGenerateColumns="False"
|
||||||
|
IsReadOnly="False"
|
||||||
|
IsFilteringAllowed="False"
|
||||||
|
ItemsSource="{Binding CircuitBreakerInfos}"
|
||||||
|
SelectedItem="{Binding SelectCircuitBreaker,Mode=TwoWay}"
|
||||||
|
SelectionMode="Single"
|
||||||
|
ShowGroupPanel="False"
|
||||||
|
Height="450"
|
||||||
|
Margin="5">
|
||||||
|
<telerik:EventToCommandBehavior.EventBindings>
|
||||||
|
<telerik:EventBinding Command="{Binding EditEndCmd}"
|
||||||
|
EventName="CellEditEnded"
|
||||||
|
PassEventArgsToCommand="True" />
|
||||||
|
</telerik:EventToCommandBehavior.EventBindings>
|
||||||
|
<telerik:RadGridView.Columns>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding Index}" Header="序号"/>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}" Header="开关名称"/>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding Phase}" Header="相数"/>
|
||||||
|
<telerik:GridViewComboBoxColumn Header="类型"
|
||||||
|
ItemsSource="{Binding DataContext.CB_Typels, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadGridView}}}"
|
||||||
|
DataMemberBinding="{Binding CB_Type}"
|
||||||
|
Width="60"/>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding Capacity_Max}" Header="额定电流(A)"/>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding Capacity_Set}" Header="整定电流(A)"/>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding Capacity_Act}" Header="实际电流(A)"/>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding CableTagNumbers}" Header="电缆位号" IsReadOnly="True"/>
|
||||||
|
<telerik:GridViewDataColumn DataMemberBinding="{Binding RemoteDeviceId}" Header="另一端连接信息" IsReadOnly="True" Width="*"/>
|
||||||
|
</telerik:RadGridView.Columns>
|
||||||
|
</telerik:RadGridView>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Grid.Column="1">
|
||||||
|
<telerik:RadButton Content="确定"
|
||||||
|
Style="{StaticResource sysBtn}"
|
||||||
|
Command="{Binding OKCommand}"
|
||||||
|
CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}"
|
||||||
|
Margin="5"/>
|
||||||
|
<telerik:RadButton Content="取消"
|
||||||
|
Style="{StaticResource sysBtn2}"
|
||||||
|
Command="{Binding CloseCommand}"
|
||||||
|
CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}"
|
||||||
|
Margin="5"/>
|
||||||
|
<telerik:RadButton Content="新增"
|
||||||
|
Style="{StaticResource sysBtn}"
|
||||||
|
Command="{Binding ButtonCmd}"
|
||||||
|
CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}"
|
||||||
|
Margin="0,40,0,0"/>
|
||||||
|
<telerik:RadButton Content="删除"
|
||||||
|
Style="{StaticResource sysBtn4}"
|
||||||
|
Command="{Binding ButtonCmd}"
|
||||||
|
CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}"
|
||||||
|
Margin="5"/>
|
||||||
|
<telerik:RadButton Content="关联电缆"
|
||||||
|
Style="{StaticResource sysBtn}"
|
||||||
|
Command="{Binding ButtonCmd}"
|
||||||
|
CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}"
|
||||||
|
Margin="5"/>
|
||||||
|
<telerik:RadButton Content="放置开关"
|
||||||
|
Style="{StaticResource sysBtn}"
|
||||||
|
Command="{Binding ButtonCmd}"
|
||||||
|
CommandParameter="{Binding Content,RelativeSource={RelativeSource Self}}"
|
||||||
|
Margin="5"/>
|
||||||
|
<Label Content="开关类型:" FontSize="12" Margin="0,40,0,0"/>
|
||||||
|
<ComboBox ItemsSource="{Binding BreakerTypels}" SelectedItem="{Binding DefaultBreakerType,Mode=TwoWay}" Margin="5"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</telerik:RadBusyIndicator>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
@ -413,7 +413,7 @@
|
|||||||
</telerik:GridViewDataColumn>
|
</telerik:GridViewDataColumn>
|
||||||
<telerik:GridViewComboBoxColumn Header="输入/输出"
|
<telerik:GridViewComboBoxColumn Header="输入/输出"
|
||||||
ItemsSource="{Binding DataContext.InorOuts, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadGridView}}}"
|
ItemsSource="{Binding DataContext.InorOuts, RelativeSource={RelativeSource AncestorType={x:Type telerik:RadGridView}}}"
|
||||||
DataMemberBinding="{Binding InorOut}"
|
DataMemberBinding="{Binding InorOut,Mode=TwoWay}"
|
||||||
Width="60">
|
Width="60">
|
||||||
|
|
||||||
</telerik:GridViewComboBoxColumn>
|
</telerik:GridViewComboBoxColumn>
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
|
||||||
xmlns:local="clr-namespace:SWS.CAD.Views"
|
xmlns:local="clr-namespace:SWS.CAD.Views"
|
||||||
xmlns:local2="clr-namespace:SWS.Model;assembly=SWS.Model"
|
xmlns:local2="clr-namespace:SWS.Model;assembly=SWS.Model"
|
||||||
|
xmlns:Behaviors="clr-namespace:SWS.Commons.Helper.Behaviours;assembly=SWS.Commons"
|
||||||
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
|
||||||
Width="250"
|
Width="250"
|
||||||
Loaded="UserControl_Loaded">
|
Loaded="UserControl_Loaded">
|
||||||
@ -183,17 +184,17 @@
|
|||||||
TextAlignment="Center" />
|
TextAlignment="Center" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<telerik:RadTreeView
|
<TreeView
|
||||||
x:Name="radTreeView"
|
x:Name="radTreeView"
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Grid.ColumnSpan="2"
|
Grid.ColumnSpan="2"
|
||||||
|
Background="Transparent"
|
||||||
Margin="-5,0,0,0"
|
Margin="-5,0,0,0"
|
||||||
telerik:StyleManager.Theme="Green"
|
|
||||||
FontSize="11"
|
FontSize="11"
|
||||||
ItemsSource="{Binding Drawings}"
|
ItemsSource="{Binding Drawings}"
|
||||||
PreviewMouseRightButtonDown="RadTreeView_PreviewMouseRightButtonDown"
|
PreviewMouseRightButtonDown="RadTreeView_PreviewMouseRightButtonDown"
|
||||||
SelectedItem="{Binding selectedNode, Mode=TwoWay}">
|
Behaviors:TreeViewSelectedItemBehavior.SelectedItem="{Binding selectedNode, Mode=TwoWay}">
|
||||||
<telerik:RadTreeView.ItemTemplate>
|
<TreeView.ItemTemplate>
|
||||||
<HierarchicalDataTemplate DataType="{x:Type local2:TreeModel}" ItemsSource="{Binding ChildNodes}">
|
<HierarchicalDataTemplate DataType="{x:Type local2:TreeModel}" ItemsSource="{Binding ChildNodes}">
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Height="16"
|
Height="16"
|
||||||
@ -211,33 +212,32 @@
|
|||||||
Text="{Binding Text}" />
|
Text="{Binding Text}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</HierarchicalDataTemplate>
|
</HierarchicalDataTemplate>
|
||||||
</telerik:RadTreeView.ItemTemplate>
|
</TreeView.ItemTemplate>
|
||||||
|
|
||||||
<telerik:RadTreeView.ContextMenu>
|
<TreeView.ContextMenu>
|
||||||
<ContextMenu x:Name="TreeItemContextMenu">
|
<ContextMenu x:Name="TreeItemContextMenu">
|
||||||
<!-- 菜单项将会在后台动态填充 -->
|
<!-- 菜单项将会在后台动态填充 -->
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</telerik:RadTreeView.ContextMenu>
|
</TreeView.ContextMenu>
|
||||||
</telerik:RadTreeView>
|
</TreeView>
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="历史版次">
|
<TabItem Header="历史版次">
|
||||||
<Grid Background="Transparent">
|
<Grid Background="Transparent">
|
||||||
<telerik:RadTreeView
|
<TreeView
|
||||||
x:Name="treeDwgHistory"
|
x:Name="treeDwgHistory"
|
||||||
Margin="-5,0,0,0"
|
Margin="-5,0,0,0"
|
||||||
telerik:StyleManager.Theme="Green"
|
|
||||||
Background="Transparent"
|
Background="Transparent"
|
||||||
FontSize="11"
|
FontSize="11"
|
||||||
ItemsSource="{Binding historyDrawings}"
|
ItemsSource="{Binding historyDrawings}"
|
||||||
PreviewMouseRightButtonDown="treeDwgHistory_PreviewMouseRightButtonDown"
|
PreviewMouseRightButtonDown="treeDwgHistory_PreviewMouseRightButtonDown"
|
||||||
SelectedItem="{Binding selectedHistoryDwg, Mode=TwoWay}">
|
Behaviors:TreeViewSelectedItemBehavior.SelectedItem="{Binding selectedHistoryDwg, Mode=TwoWay}">
|
||||||
<telerik:RadTreeView.ItemContainerStyle>
|
<TreeView.ItemContainerStyle>
|
||||||
<Style TargetType="telerik:RadTreeViewItem">
|
<Style TargetType="telerik:RadTreeViewItem">
|
||||||
<Setter Property="IsExpanded" Value="{Binding isexpand, Mode=TwoWay, Converter={StaticResource expandConverter}}" />
|
<Setter Property="IsExpanded" Value="{Binding isexpand, Mode=TwoWay, Converter={StaticResource expandConverter}}" />
|
||||||
</Style>
|
</Style>
|
||||||
</telerik:RadTreeView.ItemContainerStyle>
|
</TreeView.ItemContainerStyle>
|
||||||
<telerik:RadTreeView.ItemTemplate>
|
<TreeView.ItemTemplate>
|
||||||
<HierarchicalDataTemplate DataType="{x:Type local2:TreeModel}" ItemsSource="{Binding ChildNodes}">
|
<HierarchicalDataTemplate DataType="{x:Type local2:TreeModel}" ItemsSource="{Binding ChildNodes}">
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Height="16"
|
Height="16"
|
||||||
@ -252,14 +252,14 @@
|
|||||||
<TextBlock VerticalAlignment="Center" Text="{Binding Text}" />
|
<TextBlock VerticalAlignment="Center" Text="{Binding Text}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</HierarchicalDataTemplate>
|
</HierarchicalDataTemplate>
|
||||||
</telerik:RadTreeView.ItemTemplate>
|
</TreeView.ItemTemplate>
|
||||||
|
|
||||||
<telerik:RadTreeView.ContextMenu>
|
<TreeView.ContextMenu>
|
||||||
<ContextMenu x:Name="treeDwgHistoryItemContextMenu">
|
<ContextMenu x:Name="treeDwgHistoryItemContextMenu">
|
||||||
<!-- 菜单项将会在后台动态填充 -->
|
<!-- 菜单项将会在后台动态填充 -->
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</telerik:RadTreeView.ContextMenu>
|
</TreeView.ContextMenu>
|
||||||
</telerik:RadTreeView>
|
</TreeView>
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
@ -337,15 +337,15 @@
|
|||||||
TextChanged="TextBox_TextChanged" />
|
TextChanged="TextBox_TextChanged" />
|
||||||
<telerik:RadListBox Grid.Row="1" Grid.ColumnSpan="2" />
|
<telerik:RadListBox Grid.Row="1" Grid.ColumnSpan="2" />
|
||||||
<!-- 最近使用 -->
|
<!-- 最近使用 -->
|
||||||
<telerik:RadTreeView
|
<TreeView
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Grid.ColumnSpan="2"
|
Grid.ColumnSpan="2"
|
||||||
Margin="-5,0,0,0"
|
Margin="-5,0,0,0"
|
||||||
telerik:StyleManager.Theme="Green"
|
Background="Transparent"
|
||||||
FontSize="11"
|
FontSize="11"
|
||||||
ItemsSource="{Binding objectTypeTree}"
|
ItemsSource="{Binding objectTypeTree}"
|
||||||
SelectedItem="{Binding selectType, Mode=TwoWay}">
|
Behaviors:TreeViewSelectedItemBehavior.SelectedItem="{Binding selectType, Mode=TwoWay}">
|
||||||
<telerik:RadTreeView.ItemTemplate>
|
<TreeView.ItemTemplate>
|
||||||
<HierarchicalDataTemplate DataType="{x:Type local2:TreeModel}" ItemsSource="{Binding ChildNodes}">
|
<HierarchicalDataTemplate DataType="{x:Type local2:TreeModel}" ItemsSource="{Binding ChildNodes}">
|
||||||
<StackPanel Height="16" Orientation="Horizontal">
|
<StackPanel Height="16" Orientation="Horizontal">
|
||||||
<!-- 图标 -->
|
<!-- 图标 -->
|
||||||
@ -357,8 +357,8 @@
|
|||||||
<TextBlock VerticalAlignment="Center" Text="{Binding Text}" />
|
<TextBlock VerticalAlignment="Center" Text="{Binding Text}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</HierarchicalDataTemplate>
|
</HierarchicalDataTemplate>
|
||||||
</telerik:RadTreeView.ItemTemplate>
|
</TreeView.ItemTemplate>
|
||||||
</telerik:RadTreeView>
|
</TreeView>
|
||||||
<Grid Grid.Row="3" Grid.ColumnSpan="2">
|
<Grid Grid.Row="3" Grid.ColumnSpan="2">
|
||||||
|
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
@ -377,14 +377,21 @@
|
|||||||
VirtualizingPanel.IsVirtualizingWhenGrouping="True"
|
VirtualizingPanel.IsVirtualizingWhenGrouping="True"
|
||||||
VirtualizingPanel.ScrollUnit="Pixel"
|
VirtualizingPanel.ScrollUnit="Pixel"
|
||||||
VirtualizingPanel.VirtualizationMode="Recycling">
|
VirtualizingPanel.VirtualizationMode="Recycling">
|
||||||
<i:Interaction.Triggers>
|
<!--<i:Interaction.Triggers>
|
||||||
<i:EventTrigger EventName="MouseDoubleClick">
|
<i:EventTrigger EventName="MouseDoubleClick">
|
||||||
<i:InvokeCommandAction
|
<i:InvokeCommandAction
|
||||||
Command="{Binding Command_TagDoubleClick}"
|
Command="{Binding Command_TagDoubleClick}"
|
||||||
CommandParameter="{Binding ElementName=tagListBox, Path=SelectedItem}"
|
CommandParameter="{Binding ElementName=tagListBox, Path=SelectedItem}"
|
||||||
PassEventArgsToCommand="True" />
|
PassEventArgsToCommand="True" />
|
||||||
</i:EventTrigger>
|
</i:EventTrigger>
|
||||||
</i:Interaction.Triggers>
|
</i:Interaction.Triggers>-->
|
||||||
|
<telerik:EventToCommandBehavior.EventBindings>
|
||||||
|
<telerik:EventBinding
|
||||||
|
Command="{Binding Command_TagDoubleClick}"
|
||||||
|
EventName="MouseDoubleClick"
|
||||||
|
CommandParameter="{Binding ElementName=tagListBox, Path=SelectedItem}"
|
||||||
|
PassEventArgsToCommand="True" />
|
||||||
|
</telerik:EventToCommandBehavior.EventBindings>
|
||||||
<telerik:RadListBox.GroupStyle>
|
<telerik:RadListBox.GroupStyle>
|
||||||
<GroupStyle>
|
<GroupStyle>
|
||||||
<GroupStyle.HeaderTemplate>
|
<GroupStyle.HeaderTemplate>
|
||||||
@ -431,14 +438,14 @@
|
|||||||
Style="{StaticResource sysTextBox}"
|
Style="{StaticResource sysTextBox}"
|
||||||
Tag="设计浏览"
|
Tag="设计浏览"
|
||||||
TextChanged="TextBox_TextChanged" />
|
TextChanged="TextBox_TextChanged" />
|
||||||
<telerik:RadTreeView
|
<TreeView
|
||||||
x:Name="designTreeView"
|
x:Name="designTreeView"
|
||||||
Margin="-5,0,0,0"
|
Margin="-5,0,0,0"
|
||||||
telerik:StyleManager.Theme="Green"
|
Background="Transparent"
|
||||||
FontSize="11"
|
FontSize="11"
|
||||||
ItemsSource="{Binding designTree}"
|
ItemsSource="{Binding designTree}"
|
||||||
SelectedItem="{Binding selectDesign, Mode=TwoWay}">
|
Behaviors:TreeViewSelectedItemBehavior.SelectedItem="{Binding selectDesign, Mode=TwoWay}">
|
||||||
<i:Interaction.Triggers>
|
<!--<i:Interaction.Triggers>
|
||||||
<i:EventTrigger EventName="SelectionChanged">
|
<i:EventTrigger EventName="SelectionChanged">
|
||||||
<i:InvokeCommandAction
|
<i:InvokeCommandAction
|
||||||
Command="{Binding Common_SelectedDesign}"
|
Command="{Binding Common_SelectedDesign}"
|
||||||
@ -451,13 +458,25 @@
|
|||||||
CommandParameter="{Binding ElementName=designTreeView, Path=SelectedItem}"
|
CommandParameter="{Binding ElementName=designTreeView, Path=SelectedItem}"
|
||||||
PassEventArgsToCommand="True" />
|
PassEventArgsToCommand="True" />
|
||||||
</i:EventTrigger>
|
</i:EventTrigger>
|
||||||
</i:Interaction.Triggers>
|
</i:Interaction.Triggers>-->
|
||||||
<telerik:RadTreeView.ItemContainerStyle>
|
<telerik:EventToCommandBehavior.EventBindings>
|
||||||
<Style TargetType="telerik:RadTreeViewItem">
|
<telerik:EventBinding
|
||||||
|
Command="{Binding Common_SelectedDesign}"
|
||||||
|
EventName="SelectedItemChanged"
|
||||||
|
CommandParameter="{Binding ElementName=designTreeView, Path=SelectedItem}"
|
||||||
|
PassEventArgsToCommand="True" />
|
||||||
|
<telerik:EventBinding
|
||||||
|
Command="{Binding Common_DoubleClickDesign}"
|
||||||
|
EventName="MouseDoubleClick"
|
||||||
|
CommandParameter="{Binding ElementName=designTreeView, Path=SelectedItem}"
|
||||||
|
PassEventArgsToCommand="True" />
|
||||||
|
</telerik:EventToCommandBehavior.EventBindings>
|
||||||
|
<TreeView.ItemContainerStyle>
|
||||||
|
<Style TargetType="TreeViewItem">
|
||||||
<Setter Property="IsExpanded" Value="{Binding isexpand, Mode=TwoWay, Converter={StaticResource expandConverter}}" />
|
<Setter Property="IsExpanded" Value="{Binding isexpand, Mode=TwoWay, Converter={StaticResource expandConverter}}" />
|
||||||
</Style>
|
</Style>
|
||||||
</telerik:RadTreeView.ItemContainerStyle>
|
</TreeView.ItemContainerStyle>
|
||||||
<telerik:RadTreeView.ItemTemplate>
|
<TreeView.ItemTemplate>
|
||||||
<HierarchicalDataTemplate DataType="{x:Type local2:TreeModel}" ItemsSource="{Binding ChildNodes}">
|
<HierarchicalDataTemplate DataType="{x:Type local2:TreeModel}" ItemsSource="{Binding ChildNodes}">
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Height="16"
|
Height="16"
|
||||||
@ -472,8 +491,8 @@
|
|||||||
<TextBlock VerticalAlignment="Center" Text="{Binding Text}" />
|
<TextBlock VerticalAlignment="Center" Text="{Binding Text}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</HierarchicalDataTemplate>
|
</HierarchicalDataTemplate>
|
||||||
</telerik:RadTreeView.ItemTemplate>
|
</TreeView.ItemTemplate>
|
||||||
</telerik:RadTreeView>
|
</TreeView>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</telerik:RadTabItem>
|
</telerik:RadTabItem>
|
||||||
|
|
||||||
|
@ -123,12 +123,12 @@ Text="{Binding objectTypeName}" />-->
|
|||||||
</Style>
|
</Style>
|
||||||
</Button.Style>
|
</Button.Style>
|
||||||
</Button>
|
</Button>
|
||||||
<telerik:RadComboBox
|
<ComboBox
|
||||||
Width="160" Height="20" Margin="10,0,0,0"
|
Width="160" Height="20" Margin="10,0,0,0"
|
||||||
DisplayMemberPath="objectDisplayName"
|
DisplayMemberPath="objectDisplayName"
|
||||||
ItemsSource="{Binding listObjects,Mode=TwoWay}"
|
ItemsSource="{Binding listObjects,Mode=TwoWay}"
|
||||||
SelectedItem="{Binding SelectObject,Mode=TwoWay}"
|
SelectedItem="{Binding SelectObject,Mode=TwoWay}"
|
||||||
Style="{StaticResource sysCombobox}" />
|
/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<ScrollViewer Grid.Row="2" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
<ScrollViewer Grid.Row="2" HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
||||||
<Grid x:Name="gridBasic" IsEnabled="{Binding isEnabledGridProterty}">
|
<Grid x:Name="gridBasic" IsEnabled="{Binding isEnabledGridProterty}">
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using Microsoft.Xaml.Behaviors;
|
||||||
|
|
||||||
|
namespace SWS.Commons.Helper.Behaviours
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 让 WPF TreeView 支持 SelectedItem 双向绑定的行为类。
|
||||||
|
/// 应用于 TreeView 后,可在 ViewModel 中直接使用绑定方式访问/设置选中项。
|
||||||
|
/// </summary>
|
||||||
|
public static class TreeViewSelectedItemBehavior
|
||||||
|
{
|
||||||
|
public static readonly DependencyProperty SelectedItemProperty =
|
||||||
|
DependencyProperty.RegisterAttached(
|
||||||
|
"SelectedItem",
|
||||||
|
typeof(object),
|
||||||
|
typeof(TreeViewSelectedItemBehavior),
|
||||||
|
new FrameworkPropertyMetadata(
|
||||||
|
null,
|
||||||
|
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
|
||||||
|
OnSelectedItemChanged));
|
||||||
|
|
||||||
|
// 获取附加属性值
|
||||||
|
public static object GetSelectedItem(TreeView treeView) =>
|
||||||
|
treeView.GetValue(SelectedItemProperty);
|
||||||
|
|
||||||
|
// 设置附加属性值
|
||||||
|
public static void SetSelectedItem(TreeView treeView, object value) =>
|
||||||
|
treeView.SetValue(SelectedItemProperty, value);
|
||||||
|
|
||||||
|
// 属性变化时的事件处理
|
||||||
|
private static void OnSelectedItemChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (sender is TreeView treeView)
|
||||||
|
{
|
||||||
|
// 解耦旧事件处理器
|
||||||
|
treeView.SelectedItemChanged -= OnTreeViewSelectedItemChanged;
|
||||||
|
// 连接新事件处理器
|
||||||
|
treeView.SelectedItemChanged += OnTreeViewSelectedItemChanged;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TreeView选择项变化时的处理
|
||||||
|
private static void OnTreeViewSelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
|
||||||
|
{
|
||||||
|
var treeView = (TreeView)sender;
|
||||||
|
// 更新附加属性值
|
||||||
|
treeView.SetCurrentValue(SelectedItemProperty, e.NewValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -104,6 +104,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="GlobalObject.cs" />
|
<Compile Include="GlobalObject.cs" />
|
||||||
|
<Compile Include="Helper\Behaviours\TreeViewSelectedItemBehavior.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\RadioButtonValueConverter.cs" />
|
||||||
|
@ -1,125 +0,0 @@
|
|||||||
#pragma checksum "..\..\..\Views\DialogTest2.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "6D6B0D2E8B29B2F4DE2F7CF02D2382F69B7F06455C4BC9504C7F76B8C7D980B6"
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// 此代码由工具生成。
|
|
||||||
// 运行时版本:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
|
||||||
// 重新生成代码,这些更改将会丢失。
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
using Microsoft.Xaml.Behaviors;
|
|
||||||
using Microsoft.Xaml.Behaviors.Core;
|
|
||||||
using Microsoft.Xaml.Behaviors.Input;
|
|
||||||
using Microsoft.Xaml.Behaviors.Layout;
|
|
||||||
using Microsoft.Xaml.Behaviors.Media;
|
|
||||||
using Prism.DryIoc;
|
|
||||||
using Prism.Interactivity;
|
|
||||||
using Prism.Ioc;
|
|
||||||
using Prism.Mvvm;
|
|
||||||
using Prism.Regions;
|
|
||||||
using Prism.Regions.Behaviors;
|
|
||||||
using Prism.Services.Dialogs;
|
|
||||||
using Prism.Unity;
|
|
||||||
using SWS.CustomControl;
|
|
||||||
using SWS.Electrical.Views;
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Automation;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Controls.Primitives;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Ink;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Markup;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Animation;
|
|
||||||
using System.Windows.Media.Effects;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Media.Media3D;
|
|
||||||
using System.Windows.Media.TextFormatting;
|
|
||||||
using System.Windows.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
using System.Windows.Shell;
|
|
||||||
using Telerik.Windows.Controls;
|
|
||||||
using Telerik.Windows.Controls.Animation;
|
|
||||||
using Telerik.Windows.Controls.Behaviors;
|
|
||||||
using Telerik.Windows.Controls.Carousel;
|
|
||||||
using Telerik.Windows.Controls.ComboBox;
|
|
||||||
using Telerik.Windows.Controls.Data.PropertyGrid;
|
|
||||||
using Telerik.Windows.Controls.DragDrop;
|
|
||||||
using Telerik.Windows.Controls.GridView;
|
|
||||||
using Telerik.Windows.Controls.LayoutControl;
|
|
||||||
using Telerik.Windows.Controls.Legend;
|
|
||||||
using Telerik.Windows.Controls.MultiColumnComboBox;
|
|
||||||
using Telerik.Windows.Controls.Primitives;
|
|
||||||
using Telerik.Windows.Controls.RadialMenu;
|
|
||||||
using Telerik.Windows.Controls.TransitionEffects;
|
|
||||||
using Telerik.Windows.Controls.TreeListView;
|
|
||||||
using Telerik.Windows.Controls.TreeView;
|
|
||||||
using Telerik.Windows.Controls.Wizard;
|
|
||||||
using Telerik.Windows.Data;
|
|
||||||
using Telerik.Windows.DragDrop;
|
|
||||||
using Telerik.Windows.DragDrop.Behaviors;
|
|
||||||
using Telerik.Windows.Input.Touch;
|
|
||||||
using Telerik.Windows.Shapes;
|
|
||||||
|
|
||||||
|
|
||||||
namespace SWS.Electrical.Views {
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// DialogTest2
|
|
||||||
/// </summary>
|
|
||||||
public partial class DialogTest2 : System.Windows.Controls.UserControl, System.Windows.Markup.IComponentConnector {
|
|
||||||
|
|
||||||
|
|
||||||
#line 33 "..\..\..\Views\DialogTest2.xaml"
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
|
|
||||||
internal SWS.CustomControl.customWindowTitleBar titleBar;
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
|
|
||||||
private bool _contentLoaded;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// InitializeComponent
|
|
||||||
/// </summary>
|
|
||||||
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
|
||||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
|
|
||||||
public void InitializeComponent() {
|
|
||||||
if (_contentLoaded) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_contentLoaded = true;
|
|
||||||
System.Uri resourceLocater = new System.Uri("/SWS.Electrical;component/views/dialogtest2.xaml", System.UriKind.Relative);
|
|
||||||
|
|
||||||
#line 1 "..\..\..\Views\DialogTest2.xaml"
|
|
||||||
System.Windows.Application.LoadComponent(this, resourceLocater);
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
|
||||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
|
|
||||||
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
|
|
||||||
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
|
|
||||||
switch (connectionId)
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
this.titleBar = ((SWS.CustomControl.customWindowTitleBar)(target));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this._contentLoaded = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
|||||||
#pragma checksum "..\..\..\Views\SWSDialogWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "19EBF686F7537A119FFACC3AB6D95366D243171B5A88B56EFB0FF292F3FD1838"
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// 此代码由工具生成。
|
|
||||||
// 运行时版本:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
|
||||||
// 重新生成代码,这些更改将会丢失。
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Automation;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Controls.Primitives;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Ink;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Markup;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Animation;
|
|
||||||
using System.Windows.Media.Effects;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Media.Media3D;
|
|
||||||
using System.Windows.Media.TextFormatting;
|
|
||||||
using System.Windows.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
using System.Windows.Shell;
|
|
||||||
|
|
||||||
|
|
||||||
namespace SWS.Electrical.Views {
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// SWSDialogWindow
|
|
||||||
/// </summary>
|
|
||||||
public partial class SWSDialogWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector {
|
|
||||||
|
|
||||||
private bool _contentLoaded;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// InitializeComponent
|
|
||||||
/// </summary>
|
|
||||||
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
|
||||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
|
|
||||||
public void InitializeComponent() {
|
|
||||||
if (_contentLoaded) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_contentLoaded = true;
|
|
||||||
System.Uri resourceLocater = new System.Uri("/SWS.Electrical;component/views/swsdialogwindow.xaml", System.UriKind.Relative);
|
|
||||||
|
|
||||||
#line 1 "..\..\..\Views\SWSDialogWindow.xaml"
|
|
||||||
System.Windows.Application.LoadComponent(this, resourceLocater);
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
|
||||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
|
|
||||||
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
|
|
||||||
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
|
|
||||||
this._contentLoaded = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
|||||||
#pragma checksum "..\..\..\Views\SWSDialogWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "19EBF686F7537A119FFACC3AB6D95366D243171B5A88B56EFB0FF292F3FD1838"
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// 此代码由工具生成。
|
|
||||||
// 运行时版本:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
|
||||||
// 重新生成代码,这些更改将会丢失。
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Automation;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Controls.Primitives;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Ink;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Markup;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Animation;
|
|
||||||
using System.Windows.Media.Effects;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Media.Media3D;
|
|
||||||
using System.Windows.Media.TextFormatting;
|
|
||||||
using System.Windows.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
using System.Windows.Shell;
|
|
||||||
|
|
||||||
|
|
||||||
namespace SWS.Electrical.Views {
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// SWSDialogWindow
|
|
||||||
/// </summary>
|
|
||||||
public partial class SWSDialogWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector {
|
|
||||||
|
|
||||||
private bool _contentLoaded;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// InitializeComponent
|
|
||||||
/// </summary>
|
|
||||||
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
|
||||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
|
|
||||||
public void InitializeComponent() {
|
|
||||||
if (_contentLoaded) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_contentLoaded = true;
|
|
||||||
System.Uri resourceLocater = new System.Uri("/SWS.Electrical;component/views/swsdialogwindow.xaml", System.UriKind.Relative);
|
|
||||||
|
|
||||||
#line 1 "..\..\..\Views\SWSDialogWindow.xaml"
|
|
||||||
System.Windows.Application.LoadComponent(this, resourceLocater);
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
|
||||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
|
|
||||||
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
|
|
||||||
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
|
|
||||||
this._contentLoaded = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -108,6 +108,7 @@
|
|||||||
<Compile Include="ec_project.cs" />
|
<Compile Include="ec_project.cs" />
|
||||||
<Compile Include="ec_projectSettings.cs" />
|
<Compile Include="ec_projectSettings.cs" />
|
||||||
<Compile Include="ec_property.cs" />
|
<Compile Include="ec_property.cs" />
|
||||||
|
<Compile Include="ec_reltype.cs" />
|
||||||
<Compile Include="ec_template_file.cs" />
|
<Compile Include="ec_template_file.cs" />
|
||||||
<Compile Include="ec_WireTerminal.cs" />
|
<Compile Include="ec_WireTerminal.cs" />
|
||||||
<Compile Include="ec_Wire_Group.cs" />
|
<Compile Include="ec_Wire_Group.cs" />
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ProjectView>ProjectFiles</ProjectView>
|
<ProjectView>ShowAllFiles</ProjectView>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
78
newFront/c#前端/SWS.Model/ec_reltype.cs
Normal file
78
newFront/c#前端/SWS.Model/ec_reltype.cs
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
|
||||||
|
using System;
|
||||||
|
namespace SWS.Model
|
||||||
|
|
||||||
|
{
|
||||||
|
public enum enum_RelType
|
||||||
|
{
|
||||||
|
//设备指的是在objecttype里的东西
|
||||||
|
设备_电缆 = 0,
|
||||||
|
/// <summary>
|
||||||
|
/// 不用了,circuitbreaker这个表自己解决
|
||||||
|
/// </summary>
|
||||||
|
[Obsolete("不用了")]
|
||||||
|
分电箱_开关 = 1,
|
||||||
|
/// <summary>
|
||||||
|
/// 不用了,circuitbreaker这个表自己解决
|
||||||
|
/// </summary>
|
||||||
|
[Obsolete("不用了")]
|
||||||
|
开关_电缆 = 2
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 版 本 PIT-ADMS V7.0.3 敏捷开发框架
|
||||||
|
/// Copyright (c) 2013-2018 Hexagon PPM
|
||||||
|
/// 创 建:超级管理员
|
||||||
|
/// 日 期:2022-06-21 15:32
|
||||||
|
/// 描 述:关联类型表
|
||||||
|
/// </summary>
|
||||||
|
public class ec_reltype
|
||||||
|
{
|
||||||
|
#region 实体成员
|
||||||
|
/// <summary>
|
||||||
|
/// 关联类型ID
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string RelTypeID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 关联类型名称
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string RelTypeName { get; set; } = "";
|
||||||
|
/// <summary>
|
||||||
|
/// 关联类型缩写
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public enum_RelType RelType { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建人
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string CreateUserID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public DateTime? CreateTime { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 更新人
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string UpdateUserID { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 更新时间
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public DateTime? UpdateTime { get; set; }
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region 扩展字段
|
||||||
|
/// <summary>
|
||||||
|
/// 创建人名称
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public string CreateUserName { get; set; }
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,7 +1,13 @@
|
|||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
using SWS.Commons;
|
using SWS.Commons;
|
||||||
using SWS.Model;
|
using SWS.Model;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Net;
|
||||||
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace SWS.Service
|
namespace SWS.Service
|
||||||
@ -372,6 +378,144 @@ namespace SWS.Service
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 导出信号预分配结果
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="savePath"></param>
|
||||||
|
/// <param name="flg"></param>
|
||||||
|
/// <param name="progress"></param>
|
||||||
|
/// <param name="cancellationToken"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<string> AutoAssignCable2Channel_ResExport(
|
||||||
|
string savePath,
|
||||||
|
bool flg = true,
|
||||||
|
IProgress<double> progress = null,
|
||||||
|
CancellationToken cancellationToken = default)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var p = Path.GetDirectoryName(savePath);
|
||||||
|
if (!Directory.Exists(p))
|
||||||
|
Directory.CreateDirectory(p);
|
||||||
|
string url = $"IOModuleApi/AutoAssignCable2Channel_ResExport?projectId={GlobalObject.curProject?.ProjectId}&flg={flg}";
|
||||||
|
//url = Uri.EscapeDataString(url);
|
||||||
|
//url = Uri.UnescapeDataString(url);
|
||||||
|
// 发送请求并获取响应
|
||||||
|
using (var response = await GlobalObject.client.GetAsync(
|
||||||
|
url,
|
||||||
|
HttpCompletionOption.ResponseHeadersRead,
|
||||||
|
cancellationToken))
|
||||||
|
{
|
||||||
|
|
||||||
|
if (response.StatusCode != HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
string errorMsg = $"服务器地址 [{url}] 文件下载失败, 返回HTTP代码:" + response.StatusCode;
|
||||||
|
LoggerHelper.Current.Error(errorMsg);
|
||||||
|
throw new HttpRequestException(errorMsg);
|
||||||
|
}
|
||||||
|
response.EnsureSuccessStatusCode(); // 确保响应成功
|
||||||
|
var result = await response.Content.ReadAsStringAsync();
|
||||||
|
learunHttpRes<object> resultObj = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
resultObj = JsonConvert.DeserializeObject<learunHttpRes<object>>(result);
|
||||||
|
}
|
||||||
|
catch (JsonException)
|
||||||
|
{
|
||||||
|
//对下载文件来说,如果正常的话,这里反而是合理的,因为返回的就是stream的东西,不能被解析为learunHttpRes
|
||||||
|
await HandleStreamAsync();
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (resultObj.code != 200)
|
||||||
|
{
|
||||||
|
switch (resultObj.code)
|
||||||
|
{
|
||||||
|
case 400:
|
||||||
|
case 500:
|
||||||
|
return resultObj.info.ToString(); //业务错误,不是http本质错误
|
||||||
|
default:
|
||||||
|
string errorMsg = $"服务器地址 [{url}] Get失败, 返回自定义代码:" + resultObj.code;
|
||||||
|
LoggerHelper.Current.Error(errorMsg);
|
||||||
|
throw new HttpRequestException(errorMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
await HandleStreamAsync();
|
||||||
|
return "";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async Task HandleStreamAsync()
|
||||||
|
{
|
||||||
|
#region core
|
||||||
|
// 获取文件总大小(可能为 null)
|
||||||
|
var totalBytes = response.Content.Headers.ContentLength;
|
||||||
|
|
||||||
|
// 创建文件流
|
||||||
|
using (var contentStream = await response.Content.ReadAsStreamAsync())
|
||||||
|
using (var fileStream = new FileStream(
|
||||||
|
savePath,
|
||||||
|
FileMode.Create,
|
||||||
|
FileAccess.Write,
|
||||||
|
FileShare.None,
|
||||||
|
bufferSize: 8192,
|
||||||
|
useAsync: true))
|
||||||
|
{
|
||||||
|
var buffer = new byte[8192];
|
||||||
|
var totalBytesRead = 0L;
|
||||||
|
var bytesRead = 0;
|
||||||
|
|
||||||
|
// 分块读取并写入文件
|
||||||
|
while ((bytesRead = await contentStream.ReadAsync(
|
||||||
|
buffer,
|
||||||
|
0,
|
||||||
|
buffer.Length,
|
||||||
|
cancellationToken)) > 0)
|
||||||
|
{
|
||||||
|
await fileStream.WriteAsync(
|
||||||
|
buffer,
|
||||||
|
0,
|
||||||
|
bytesRead,
|
||||||
|
cancellationToken);
|
||||||
|
|
||||||
|
totalBytesRead += bytesRead;
|
||||||
|
|
||||||
|
// 报告进度(如果有总大小)
|
||||||
|
if (totalBytes.HasValue)
|
||||||
|
{
|
||||||
|
var percent = (double)totalBytesRead / totalBytes.Value * 100;
|
||||||
|
progress?.Report(percent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (HttpRequestException ex)
|
||||||
|
{
|
||||||
|
return ex.Message;
|
||||||
|
//throw new Exception($"下载请求失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
catch (TaskCanceledException ex2)
|
||||||
|
{
|
||||||
|
return ex2.Message;
|
||||||
|
// 取消操作时删除已下载的部分文件
|
||||||
|
//if (File.Exists(savePath)) File.Delete(savePath);
|
||||||
|
//throw;
|
||||||
|
}
|
||||||
|
catch (Exception ex3)
|
||||||
|
{
|
||||||
|
return ex3.Message;
|
||||||
|
//throw new Exception($"下载失败: {ex.Message}");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// SaveConnections 专用
|
/// SaveConnections 专用
|
||||||
|
91
newFront/c#前端/SWS.Service/PDBService.cs
Normal file
91
newFront/c#前端/SWS.Service/PDBService.cs
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using SWS.Commons;
|
||||||
|
using SWS.Model;
|
||||||
|
using SWS.Share;
|
||||||
|
|
||||||
|
namespace SWS.Service
|
||||||
|
{
|
||||||
|
public class PDBService : HttpService
|
||||||
|
{
|
||||||
|
public PDBService() : base()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 查询某个分电箱下的所有开关
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="projId"></param>
|
||||||
|
/// <param name="PDBId">分电箱的工程ID EngineerDataID</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<ec_Panel> GetBreakers(string PDBId)
|
||||||
|
{
|
||||||
|
|
||||||
|
var res = await this.GetAsync<ec_Panel>($"PDBApi/GetBreakers?projId={GlobalObject.curProject.ProjectId}&PDBId={PDBId}");
|
||||||
|
if (res.code == 200)
|
||||||
|
{
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 批量保存(增、改)开关。传入集合。同时建立和rel。
|
||||||
|
/// 只会在开关箱界面里调用(新建)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="projId"></param>
|
||||||
|
/// <param name="PDBId">分电箱的工程ID</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<ec_CircuitBreaker>> SaveBreakers(string PDBId,List<ec_CircuitBreaker> circuitBreakers)
|
||||||
|
{
|
||||||
|
var res = await this.PostBodyAsync<List<ec_CircuitBreaker>, List<ec_CircuitBreaker>>($"PDBApi/SaveBreakers?projId={GlobalObject.curProject?.ProjectId}&PDBId={PDBId}", circuitBreakers);
|
||||||
|
if (res.code == 200)
|
||||||
|
{
|
||||||
|
//return res.info;
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 批量保存开关箱内部开关和电缆的关联关系(也属于<see cref="SaveBreakers(string, string)"/>的一部分)。
|
||||||
|
/// 设备和电缆的关联关系走的是RelApi下的那个SaveCableConn.
|
||||||
|
/// 开关箱管理界面里不用这个。绘制照明系统图会用到这个
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="projId"></param>
|
||||||
|
/// <param name="Breakers">集合(CableID和EngineerDataID)</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<List<ec_CircuitBreaker>> SaveCableConn(List<ec_CircuitBreaker> Breakers)
|
||||||
|
{
|
||||||
|
var res = await this.PostBodyAsync<List<ec_CircuitBreaker>, List<ec_CircuitBreaker>>($"PDBApi/SaveCableConn?projId={GlobalObject.curProject?.ProjectId}", Breakers);
|
||||||
|
if (res.code == 200)
|
||||||
|
{
|
||||||
|
//return res.info;
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除开关
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="projId"></param>
|
||||||
|
/// <param name="BreakerIDs">删除多个</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<string> Delete(string BreakerIDs)
|
||||||
|
{
|
||||||
|
var res = await this.PostBodyAsync<string, string>($"PDBApi/Delete?projId={GlobalObject.curProject?.ProjectId}&BreakerIDs={BreakerIDs}", null);
|
||||||
|
if (res.code == 200)
|
||||||
|
{
|
||||||
|
//return res.info;
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
56
newFront/c#前端/SWS.Service/RelService.cs
Normal file
56
newFront/c#前端/SWS.Service/RelService.cs
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
using SWS.Commons;
|
||||||
|
using SWS.Model;
|
||||||
|
using SWS.Share;
|
||||||
|
|
||||||
|
namespace SWS.Service
|
||||||
|
{
|
||||||
|
public class RelService : HttpService
|
||||||
|
{
|
||||||
|
public RelService() : base()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据关联关系的名字拿关联关系的Id
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="RelName"></param>
|
||||||
|
/// <param name="projId"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public async Task<ec_reltype> GetRelDefByName(string RelName)
|
||||||
|
{
|
||||||
|
|
||||||
|
var res = await this.GetAsync<ec_reltype>($"RelApi/GetRelDefByName?projId={GlobalObject.curProject.ProjectId}&RelName={RelName}");
|
||||||
|
if (res.code == 200)
|
||||||
|
{
|
||||||
|
return res.data;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///// <summary>
|
||||||
|
///// 批量保存(增、改)开关。传入集合。同时建立和rel。
|
||||||
|
///// 只会在开关箱界面里调用(新建)
|
||||||
|
///// </summary>
|
||||||
|
///// <param name="projId"></param>
|
||||||
|
///// <param name="PDBId">分电箱的工程ID</param>
|
||||||
|
///// <returns></returns>
|
||||||
|
//public async Task<List<ec_CircuitBreaker>> SaveBreakers(string PDBId)
|
||||||
|
//{
|
||||||
|
// var res = await this.PostBodyAsync<List<ec_CircuitBreaker>, string>($"PDBApi/SaveBreakers?projId={GlobalObject.curProject?.ProjectId}", PDBId);
|
||||||
|
// if (res.code == 200)
|
||||||
|
// {
|
||||||
|
// //return res.info;
|
||||||
|
// return res.data;
|
||||||
|
// }
|
||||||
|
// return null;
|
||||||
|
//}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -64,6 +64,8 @@
|
|||||||
<Compile Include="NotificationService.cs" />
|
<Compile Include="NotificationService.cs" />
|
||||||
<Compile Include="ObjectTypeService.cs" />
|
<Compile Include="ObjectTypeService.cs" />
|
||||||
<Compile Include="LibraryFileService.cs" />
|
<Compile Include="LibraryFileService.cs" />
|
||||||
|
<Compile Include="RelService.cs" />
|
||||||
|
<Compile Include="PDBService.cs" />
|
||||||
<Compile Include="PlotBOMService.cs" />
|
<Compile Include="PlotBOMService.cs" />
|
||||||
<Compile Include="PlotLayoutService.cs" />
|
<Compile Include="PlotLayoutService.cs" />
|
||||||
<Compile Include="ProjectService.cs" />
|
<Compile Include="ProjectService.cs" />
|
||||||
|
@ -1,74 +0,0 @@
|
|||||||
#pragma checksum "..\..\..\Views\CustomDialogWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "956DCAA69401A5FDB20F966B90D412C75ECA9F3C976EAF72C6FE973675BDDD58"
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// 此代码由工具生成。
|
|
||||||
// 运行时版本:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
|
||||||
// 重新生成代码,这些更改将会丢失。
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Automation;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Controls.Primitives;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Ink;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Markup;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Animation;
|
|
||||||
using System.Windows.Media.Effects;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Media.Media3D;
|
|
||||||
using System.Windows.Media.TextFormatting;
|
|
||||||
using System.Windows.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
using System.Windows.Shell;
|
|
||||||
|
|
||||||
|
|
||||||
namespace SWS.WPF.Views {
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// CustomDialogWindow
|
|
||||||
/// </summary>
|
|
||||||
public partial class CustomDialogWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector {
|
|
||||||
|
|
||||||
private bool _contentLoaded;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// InitializeComponent
|
|
||||||
/// </summary>
|
|
||||||
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
|
||||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
|
|
||||||
public void InitializeComponent() {
|
|
||||||
if (_contentLoaded) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_contentLoaded = true;
|
|
||||||
System.Uri resourceLocater = new System.Uri("/SWS.WPF;component/views/customdialogwindow.xaml", System.UriKind.Relative);
|
|
||||||
|
|
||||||
#line 1 "..\..\..\Views\CustomDialogWindow.xaml"
|
|
||||||
System.Windows.Application.LoadComponent(this, resourceLocater);
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
|
||||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
|
|
||||||
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
|
|
||||||
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
|
|
||||||
this._contentLoaded = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
|||||||
#pragma checksum "..\..\..\Views\CustomDialogWindow.xaml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "956DCAA69401A5FDB20F966B90D412C75ECA9F3C976EAF72C6FE973675BDDD58"
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
// <auto-generated>
|
|
||||||
// 此代码由工具生成。
|
|
||||||
// 运行时版本:4.0.30319.42000
|
|
||||||
//
|
|
||||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
|
||||||
// 重新生成代码,这些更改将会丢失。
|
|
||||||
// </auto-generated>
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Automation;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Controls.Primitives;
|
|
||||||
using System.Windows.Data;
|
|
||||||
using System.Windows.Documents;
|
|
||||||
using System.Windows.Ink;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using System.Windows.Markup;
|
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Media.Animation;
|
|
||||||
using System.Windows.Media.Effects;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
using System.Windows.Media.Media3D;
|
|
||||||
using System.Windows.Media.TextFormatting;
|
|
||||||
using System.Windows.Navigation;
|
|
||||||
using System.Windows.Shapes;
|
|
||||||
using System.Windows.Shell;
|
|
||||||
|
|
||||||
|
|
||||||
namespace SWS.WPF.Views {
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// CustomDialogWindow
|
|
||||||
/// </summary>
|
|
||||||
public partial class CustomDialogWindow : System.Windows.Window, System.Windows.Markup.IComponentConnector {
|
|
||||||
|
|
||||||
private bool _contentLoaded;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// InitializeComponent
|
|
||||||
/// </summary>
|
|
||||||
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
|
||||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
|
|
||||||
public void InitializeComponent() {
|
|
||||||
if (_contentLoaded) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_contentLoaded = true;
|
|
||||||
System.Uri resourceLocater = new System.Uri("/SWS.WPF;component/views/customdialogwindow.xaml", System.UriKind.Relative);
|
|
||||||
|
|
||||||
#line 1 "..\..\..\Views\CustomDialogWindow.xaml"
|
|
||||||
System.Windows.Application.LoadComponent(this, resourceLocater);
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
}
|
|
||||||
|
|
||||||
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
|
||||||
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
|
|
||||||
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes")]
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")]
|
|
||||||
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
|
|
||||||
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) {
|
|
||||||
this._contentLoaded = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user