改进电缆数据处理和检查逻辑,更新版本号
在 `CheckTest.cs` 文件中,添加了多个测试方法,包括 `DPETerminalCheckTest`、`DPETerminalCrossSectionCheckTest` 和 `TerminalCheckTest`,用于检查不同端子的测试逻辑。 在 `AssemblyInfo.cs` 文件中,更新了程序集版本号和文件版本号。 在 `StuffTest.cs` 文件中,注释掉了一些断言语句,并添加了一个新的测试方法 `StuffedNameTubeTest`,用于测试号码管处理逻辑。 在 `LectotypeWindow.xaml` 文件中,添加了 `util` 命名空间引用,并定义了多个 `ControlTemplate` 模板和一个 `LectotypeLengthDataTemplateSelector` 模板选择器,用于根据线材类型选择不同的显示模板。同时,将 `DataGrid` 控件替换为 `ListView` 控件,并添加了上下文菜单和样式触发器。 在 `LectotypeWindow.xaml.cs` 文件中,添加了 `ToSourceMenuItem_Click` 方法,用于处理上下文菜单项的点击事件。 在 `MainWindow.xaml.cs` 文件中,重构了 `AddToDesignerSelectSet` 方法,添加了异常处理逻辑。 在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中,添加了 `LectotypeLengthDataTemplateSelector.cs` 文件的编译项。 在 `ExcelHelper.cs` 文件中,修改了 `GetWireTerminalMappingTable` 方法的过滤逻辑。 新增了 `LectotypeLengthDataTemplateSelector.cs` 文件,定义了 `LectotypeLengthDataTemplateSelector` 类,用于根据线材类型选择不同的数据模板。 在 `LectotypeViewModel.cs` 文件中: * 添加了对 `EPLAN.Harness.ProjectCore.Occurrences` 命名空间的引用。 * 添加了 `StuffedWires` 属性及其对应的私有字段 `_stuffedWires`。 * 在 `LoadData` 方法中,添加了对 `StuffData` 方法的调用,并将结果赋值给 `Wires`。 * 添加了 `StuffData` 方法,用于整理和合并电缆数据。 * 在 `ToSource` 方法中,添加了根据电缆名称获取设计器并设置可见性的逻辑。 * 修改了 `CableType` 的默认值从 "位置类型" 改为 "未知类型"。 在 `MainViewModel.Check.cs` 文件中: * 添加了 `CheckDPETerminals` 方法,用于检查地排端子。 * 修改了 `CheckTerminals` 方法,移除了对 `D-PE` 前缀的特殊处理逻辑。 * 修改了 `GetD_PECanUsedTerminal` 方法,注释掉了获取不包含前缀的端子的逻辑。 在 `DesignPluginEntry.cs` 文件中: * 注释掉了 `DesignPluginEntry` 类实现的 `IHpDPlugin` 接口。 在 `AssemblyInfo.cs` 文件中: * 更新了程序集版本号,从 `1.0.0.6` 更新到 `1.0.0.14`。
This commit is contained in:
parent
ed520cd26b
commit
143b0c3660
|
@ -239,6 +239,116 @@ w_00196 BK 黑色RV1.5-CE/定制 42012300001005 C45-1.5-CE/定制 4202010000
|
|||
}
|
||||
|
||||
|
||||
[TestMethod("D-PE端子检查测试")]
|
||||
public void DPETerminalCheckTest()
|
||||
{
|
||||
|
||||
var vm = new MainViewModel();
|
||||
var result = new StuffedDataModel
|
||||
{
|
||||
WireName = "w_00196",
|
||||
WireColor = "BK",
|
||||
WireModel = "黄绿色RV2.5-CE/定制",
|
||||
WireCode = "42012300001005",
|
||||
FrontTerminalModel = "SNB2-4-CE/定制",
|
||||
FrontTerminalMaterialCode = "42020100000427",
|
||||
FrontStripLength = "8 mm",
|
||||
RearTerminalModel = "RNB2-4-CE/定制",
|
||||
RearTerminalMaterialCode = "42020100000803",
|
||||
RearStripLength = "7.2 mm",
|
||||
CrossSection = "1.5",
|
||||
WireLength = "367",
|
||||
WireNumber = "L1SSR527",
|
||||
Imprint = "D-PESSR527",
|
||||
Model = "RV-BK-1x1.5-367-16×N2-D-PESSR527",
|
||||
Quantity = 1,
|
||||
NumberTubeContent = "白色号码管φ3/定制",
|
||||
NumberTubeMaterialNo = "42020100000003",
|
||||
DiscolorationDesc = "V-1.5-CE(褐色)/定制",
|
||||
Insulation = new InsulationModel()
|
||||
{
|
||||
Specification = "V-1.5-CE(褐色)/定制",
|
||||
MaterialCode = "42013500000414"
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
vm.CheckDPETerminals(result);
|
||||
Assert.IsTrue(result.IsError);
|
||||
}
|
||||
[TestMethod("D-PE端子线径检查测试")]
|
||||
public void DPETerminalCrossSectionCheckTest()
|
||||
{
|
||||
|
||||
var vm = new MainViewModel();
|
||||
var result = new StuffedDataModel
|
||||
{
|
||||
WireName = "w_00196",
|
||||
WireColor = "BK",
|
||||
WireModel = "黄绿色RV16.0-CE/定制",
|
||||
WireCode = "42020100000550",
|
||||
FrontTerminalModel = "C45-16-CE/定制",
|
||||
FrontTerminalMaterialCode = "42020100000607",
|
||||
FrontStripLength = "8 mm",
|
||||
RearTerminalModel = "SC16-10-CE/定制",
|
||||
RearTerminalMaterialCode = "42020100000828",
|
||||
RearStripLength = "7.2 mm",
|
||||
CrossSection = "16",
|
||||
WireLength = "367",
|
||||
WireNumber = "L1SSR527",
|
||||
Imprint = "D-PESSR527",
|
||||
Model = "RV-BK-1x1.5-367-16×N2-D-PESSR527",
|
||||
Quantity = 1,
|
||||
NumberTubeContent = "白色号码管φ3/定制",
|
||||
NumberTubeMaterialNo = "42020100000003",
|
||||
DiscolorationDesc = "V-1.5-CE(褐色)/定制",
|
||||
Insulation = new InsulationModel()
|
||||
{
|
||||
Specification = "V-1.5-CE(褐色)/定制",
|
||||
MaterialCode = "42013500000414"
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
vm.CheckDPETerminals(result);
|
||||
Assert.IsFalse(result.IsError);
|
||||
}
|
||||
[TestMethod("端子检查测试")]
|
||||
public void TerminalCheckTest()
|
||||
{
|
||||
|
||||
var vm = new MainViewModel();
|
||||
var result = new StuffedDataModel
|
||||
{
|
||||
WireName = "w_00196",
|
||||
WireColor = "BK",
|
||||
WireModel = "黄绿色RV2.5-CE/定制",
|
||||
WireCode = "42012300001005",
|
||||
FrontTerminalModel = "SNB2-4-CE/定制",
|
||||
FrontTerminalMaterialCode = "42020100000427",
|
||||
FrontStripLength = "8 mm",
|
||||
RearTerminalModel = "RNB2-4-CE/定制",
|
||||
RearTerminalMaterialCode = "42020100000803",
|
||||
RearStripLength = "7.2 mm",
|
||||
CrossSection = "1.5",
|
||||
WireLength = "367",
|
||||
WireNumber = "L1SSR527",
|
||||
Imprint = "L1SSR527",
|
||||
Model = "RV-BK-1x1.5-367-16×N2-D-PESSR527",
|
||||
Quantity = 1,
|
||||
NumberTubeContent = "白色号码管φ3/定制",
|
||||
NumberTubeMaterialNo = "42020100000003",
|
||||
DiscolorationDesc = "V-1.5-CE(褐色)/定制",
|
||||
Insulation = new InsulationModel()
|
||||
{
|
||||
Specification = "V-1.5-CE(褐色)/定制",
|
||||
MaterialCode = "42013500000414"
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
vm.CheckDPETerminals(result);
|
||||
Assert.IsFalse(result.IsError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,5 +16,5 @@ using System.Runtime.InteropServices;
|
|||
[assembly: Guid("aec39474-528b-4da8-b650-99189acb7a2c")]
|
||||
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.6")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.6")]
|
||||
[assembly: AssemblyVersion("1.0.0.13")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.8")]
|
||||
|
|
|
@ -91,13 +91,50 @@ Project = "放卷2",
|
|||
ConnectorTo = "RNB8-8/定制",
|
||||
ConnectorToERPNr = "42020100000148",
|
||||
StripLengthTo = "8 mm"
|
||||
}
|
||||
},
|
||||
|
||||
}).Result;
|
||||
Assert.IsTrue(result.Count == 3);
|
||||
//Assert.IsTrue(result.Count == 4);
|
||||
Assert.IsTrue(result.Where(it => it.Imprint == "EC5L1").First().WireColor == "LBU");
|
||||
Assert.IsTrue(result.Where(it => it.Imprint == "EC5L2").First().WireColor == "BUWH");
|
||||
Assert.IsTrue(result.Where(it => it.Imprint == "EC5L3").First().WireColor == "BK");
|
||||
//Assert.IsTrue(result.Where(it => it.Imprint == "D-PE").First().WireColor == "GNYE");
|
||||
//Assert.IsTrue(result.Where(it => it.Imprint == "D-PE").First().NumberTubeSpec == "黄绿色热缩管φ12/定制");
|
||||
|
||||
}
|
||||
[TestMethod("号码管处理测试")]
|
||||
public void StuffedNameTubeTest()
|
||||
{
|
||||
|
||||
var vm = new MainViewModel();
|
||||
var result = vm.StuffData(new List<ReportModel>
|
||||
{
|
||||
/*
|
||||
序号 项目 归属机构 电缆名称 规格型号 品牌 电线标码 长度(mm) 外径 截面积 物料编号 电线颜色 电线条颜色 导线名称 绞线 前端子型号 前端子物料编码 前端剥线长度 后端子型号 后端子物料编码 后端剥线长度
|
||||
1 放卷2 隔膜放卷_&G000111006-033_DQ 黑色RV10.0/定制 EC5L1 593.9 mm 6.7 mm 10 mm2 42020100000222 浅蓝色 电线 C45-10/定制 42020100000386 8 mm RNB8-8/定制 42020100000148 8 mm
|
||||
2 放卷2 隔膜放卷_&G000111006-033_DQ 黑色RV10.0/定制 EC5L2 581.8 mm 6.7 mm 10 mm2 42020100000222 蓝色 白色 电线 RNB8-8/定制 42020100000148 8 mm C45-10/定制 42020100000386 8 mm
|
||||
3 放卷2 隔膜放卷_&G000111006-033_DQ 黑色RV10.0/定制 EC5L3 584.1 mm 6.7 mm 10 mm2 42020100000222 黑色 电线 C45-10/定制 42020100000386 8 mm RNB8-8/定制 42020100000148 8 mm
|
||||
|
||||
*/
|
||||
new ReportModel
|
||||
{
|
||||
Imprint="D-PE",
|
||||
PartNumber = "黑色RV10.0/定制",
|
||||
CoreDiameter = "16 mm2",
|
||||
Length = "5841.1 mm",
|
||||
DisplayColor = "黄色",
|
||||
DisplayStripeColor = "绿色"
|
||||
}
|
||||
|
||||
}).Result;
|
||||
//Assert.IsTrue(result.Count == 4);
|
||||
//Assert.IsTrue(result.Where(it => it.Imprint == "EC5L1").First().WireColor == "LBU");
|
||||
//Assert.IsTrue(result.Where(it => it.Imprint == "EC5L2").First().WireColor == "BUWH");
|
||||
//Assert.IsTrue(result.Where(it => it.Imprint == "EC5L3").First().WireColor == "BK");
|
||||
Assert.IsTrue(result.Where(it => it.Imprint == "D-PE").First().WireColor == "GNYE");
|
||||
Assert.IsTrue(result.Where(it => it.Imprint == "D-PE").First().NumberTubeSpec == "白色号码管φ8/定制");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:local="clr-namespace:Sinvo.EplanHpD.Plugin.WPFUI"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:util="clr-namespace:Sinvo.EplanHpD.Plugin.WPFUI.Utils"
|
||||
xmlns:viewmodel="clr-namespace:Sinvo.EplanHpD.Plugin.WPFUI.ViewModel"
|
||||
Title="LectotypeWindow"
|
||||
Width="800"
|
||||
|
@ -24,6 +25,65 @@
|
|||
<PropertyGroupDescription PropertyName="AxisNo" />
|
||||
</CollectionViewSource.GroupDescriptions>
|
||||
</CollectionViewSource>
|
||||
<ControlTemplate x:Key="DefaultTemplate">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock>
|
||||
<Run Text="0" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</ControlTemplate>
|
||||
<ControlTemplate x:Key="PowerLineTemplate">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock>
|
||||
<Run Text="{Binding PowerLineLength}" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</ControlTemplate>
|
||||
<ControlTemplate x:Key="EncoderLineTemplate">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock>
|
||||
<Run Text="{Binding EncoderLineLength}" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</ControlTemplate>
|
||||
<ControlTemplate x:Key="ComplexLineTemplate">
|
||||
<StackPanel Orientation="Vertical">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock>
|
||||
<Run Text="动:" />
|
||||
<Run Text="{Binding PowerLineLength}" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock>
|
||||
<Run Text="编:" />
|
||||
<Run Text="{Binding EncoderLineLength}" />
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</ControlTemplate>
|
||||
<util:LectotypeLengthDataTemplateSelector x:Key="LectotypeLengthDataTemplateSelector">
|
||||
<util:LectotypeLengthDataTemplateSelector.DefaultTemplate>
|
||||
<DataTemplate>
|
||||
<ContentControl Template="{StaticResource DefaultTemplate}" />
|
||||
</DataTemplate>
|
||||
</util:LectotypeLengthDataTemplateSelector.DefaultTemplate>
|
||||
<util:LectotypeLengthDataTemplateSelector.PowerLineTemplate>
|
||||
<DataTemplate>
|
||||
<ContentControl Template="{StaticResource PowerLineTemplate}" />
|
||||
</DataTemplate>
|
||||
</util:LectotypeLengthDataTemplateSelector.PowerLineTemplate>
|
||||
<util:LectotypeLengthDataTemplateSelector.EncoderLineTemplate>
|
||||
<DataTemplate>
|
||||
<ContentControl Template="{StaticResource EncoderLineTemplate}" />
|
||||
</DataTemplate>
|
||||
</util:LectotypeLengthDataTemplateSelector.EncoderLineTemplate>
|
||||
<util:LectotypeLengthDataTemplateSelector.ComplexLineTemplate>
|
||||
<DataTemplate>
|
||||
<ContentControl Template="{StaticResource ComplexLineTemplate}" />
|
||||
</DataTemplate>
|
||||
</util:LectotypeLengthDataTemplateSelector.ComplexLineTemplate>
|
||||
</util:LectotypeLengthDataTemplateSelector>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
|
@ -38,23 +98,35 @@
|
|||
Content="Reload" />
|
||||
<hc:TabControl Grid.Row="1">
|
||||
<hc:TabItem Header="整理后的数据">
|
||||
|
||||
<DataGrid
|
||||
<ListView
|
||||
x:Name="LettotypeListView"
|
||||
hc:DataGridAttach.ShowRowNumber="True"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserAddRows="False"
|
||||
CanUserDeleteRows="False"
|
||||
ClipboardCopyMode="IncludeHeader"
|
||||
EnableColumnVirtualization="False"
|
||||
EnableRowVirtualization="True"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding Source={StaticResource LettotypeData}}"
|
||||
ScrollViewer.CanContentScroll="True"
|
||||
SelectionUnit="FullRow"
|
||||
SelectionMode="Single"
|
||||
VirtualizingPanel.IsContainerVirtualizable="True"
|
||||
VirtualizingPanel.IsVirtualizing="True"
|
||||
VirtualizingPanel.VirtualizationMode="Recycling">
|
||||
<DataGrid.GroupStyle>
|
||||
<ListView.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Click="ToSourceMenuItem_Click" Header="在3D中查看(转至源)" />
|
||||
</ContextMenu>
|
||||
</ListView.ContextMenu>
|
||||
<ListView.ItemContainerStyle>
|
||||
<Style BasedOn="{StaticResource ListViewItemBaseStyle}" TargetType="ListViewItem">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsError}" Value="True">
|
||||
<Setter Property="Background" Value="#dc4d41" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</DataTrigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Setter Property="Background" Value="#326cf3" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>
|
||||
<ListView.GroupStyle>
|
||||
<!-- Style for groups at top level. -->
|
||||
<GroupStyle>
|
||||
<GroupStyle.ContainerStyle>
|
||||
|
@ -64,11 +136,21 @@
|
|||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type GroupItem}">
|
||||
<Expander
|
||||
Background="#FF112255"
|
||||
BorderBrush="#FF002255"
|
||||
Background="#CC112255"
|
||||
BorderBrush="#CC002255"
|
||||
BorderThickness="1,1,1,5"
|
||||
Foreground="#FFEEEEEE"
|
||||
IsExpanded="True">
|
||||
<Expander.Resources>
|
||||
<Style BasedOn="{StaticResource {x:Type Expander}}" TargetType="Expander">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Path=Name}" Value="{x:Null}">
|
||||
<Setter Property="Background" Value="#dc4d41" />
|
||||
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Expander.Resources>
|
||||
<Expander.Header>
|
||||
<DockPanel>
|
||||
<TextBlock
|
||||
|
@ -87,25 +169,30 @@
|
|||
</Style>
|
||||
</GroupStyle.ContainerStyle>
|
||||
</GroupStyle>
|
||||
</DataGrid.GroupStyle>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding Name}" Header="名称" />
|
||||
<DataGridTextColumn Binding="{Binding CableName}" Header="线材名称" />
|
||||
<DataGridTextColumn Binding="{Binding AxisNo}" Header="轴号" />
|
||||
<DataGridTextColumn Binding="{Binding DrawingNo}" Header="图号" />
|
||||
<DataGridTextColumn Binding="{Binding CurrentLine}" Header="当前段号" />
|
||||
<DataGridTextColumn Binding="{Binding LineCount}" Header="总段数" />
|
||||
<DataGridTextColumn Binding="{Binding Length}" Header="长度" />
|
||||
<DataGridCheckBoxColumn Binding="{Binding IsFlexibility}" Header="是否高柔" />
|
||||
<!--<DataGridTextColumn Binding="{Binding PowerLineLength}" Header="动力线长度" />
|
||||
<DataGridTextColumn Binding="{Binding EncoderLineLength}" Header="编码器线长度" />-->
|
||||
<!--<DataGridTextColumn Binding="{Binding CableFlag}" Header="线材标识" />-->
|
||||
<DataGridTextColumn Binding="{Binding CableType}" Header="线材类型" />
|
||||
<DataGridTextColumn Binding="{Binding CableConnectionClass}" Header="线材连接方式" />
|
||||
<!--<DataGridCheckBoxColumn Binding="{Binding IsEncoderLine}" Header="是否编码器线" />
|
||||
<DataGridCheckBoxColumn Binding="{Binding IsPowerLine}" Header="是否动力线" />-->
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</ListView.GroupStyle>
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn DisplayMemberBinding="{Binding Name}" Header="名称" />
|
||||
<GridViewColumn DisplayMemberBinding="{Binding CableName}" Header="线材名称" />
|
||||
<GridViewColumn DisplayMemberBinding="{Binding AxisNo}" Header="轴号" />
|
||||
<GridViewColumn DisplayMemberBinding="{Binding DrawingNo}" Header="图号" />
|
||||
<GridViewColumn DisplayMemberBinding="{Binding CurrentLine}" Header="当前段号" />
|
||||
<GridViewColumn DisplayMemberBinding="{Binding LineCount}" Header="总段数" />
|
||||
<GridViewColumn CellTemplateSelector="{StaticResource LectotypeLengthDataTemplateSelector}" Header="长度" />
|
||||
<GridViewColumn Header="是否高柔">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox IsChecked="{Binding IsFlexibility}" IsEnabled="False" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn DisplayMemberBinding="{Binding CableType}" Header="线材类型" />
|
||||
<GridViewColumn DisplayMemberBinding="{Binding CableConnectionClass}" Header="线材连接方式" />
|
||||
<GridViewColumn DisplayMemberBinding="{Binding CheckedMsg}" Header="异常信息" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
|
||||
</hc:TabItem>
|
||||
</hc:TabControl>
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using Sinvo.EplanHpD.Plugin.WPFUI.ViewModel;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Models;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.ViewModel;
|
||||
using System.Windows;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.WPFUI
|
||||
|
@ -25,5 +26,16 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI
|
|||
{
|
||||
ViewModel.LoadData();
|
||||
}
|
||||
|
||||
|
||||
private void ToSourceMenuItem_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var selectItem = LettotypeListView.SelectedItem;
|
||||
if (selectItem is LectotypeModel model)
|
||||
{
|
||||
|
||||
ViewModel.ToSource(model.CableName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -411,26 +411,34 @@ public partial class MainWindow : Window
|
|||
|
||||
private void AddToDesignerSelectSet(FlexDesigner designerDoc, List<BaseOccurrence> occurrences)
|
||||
{
|
||||
List<BaseOccurrence> list = new List<BaseOccurrence>();
|
||||
foreach (BaseOccurrence baseOccurrence in occurrences)
|
||||
try
|
||||
{
|
||||
bool? flag;
|
||||
if (baseOccurrence == null)
|
||||
List<BaseOccurrence> list = new List<BaseOccurrence>();
|
||||
foreach (BaseOccurrence baseOccurrence in occurrences)
|
||||
{
|
||||
flag = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
FlexBaseOrganizer parentOrganizer = baseOccurrence.GetParentOrganizer();
|
||||
flag = ((parentOrganizer != null) ? new bool?(parentOrganizer.IsOccRegistered(baseOccurrence)) : null);
|
||||
}
|
||||
if (flag ?? false)
|
||||
{
|
||||
baseOccurrence.SetVisibility(true, null);
|
||||
list.Add(baseOccurrence);
|
||||
bool? flag;
|
||||
if (baseOccurrence == null)
|
||||
{
|
||||
flag = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
FlexBaseOrganizer parentOrganizer = baseOccurrence.GetParentOrganizer();
|
||||
flag = ((parentOrganizer != null) ? new bool?(parentOrganizer.IsOccRegistered(baseOccurrence)) : null);
|
||||
}
|
||||
if (flag ?? false)
|
||||
{
|
||||
baseOccurrence.SetVisibility(true, null);
|
||||
list.Add(baseOccurrence);
|
||||
}
|
||||
}
|
||||
designerDoc.SelectSet.Add(list);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FlexMessageBox.Error(ex.Message);
|
||||
}
|
||||
designerDoc.SelectSet.Add(list);
|
||||
|
||||
//designerDoc.
|
||||
}
|
||||
|
|
|
@ -46,6 +46,6 @@ using System.Windows;
|
|||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.6")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.6")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.0.6")]
|
||||
[assembly: AssemblyVersion("1.0.0.14")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.14")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.0.14")]
|
|
@ -135,6 +135,7 @@
|
|||
<Compile Include="Utils\DataGridType.cs" />
|
||||
<Compile Include="Utils\ExcelHelper.cs" />
|
||||
<Compile Include="Utils\FlagEnumConverter.cs" />
|
||||
<Compile Include="Utils\LectotypeLengthDataTemplateSelector.cs" />
|
||||
<Compile Include="Utils\WireFlagType.cs" />
|
||||
<Compile Include="ViewModel\LectotypeViewModel.cs" />
|
||||
<Compile Include="ViewModel\MainViewModel.Check.cs" />
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
|
|||
public static IEnumerable<ExcelModel> GetWireTerminalMappingTable(string wireModel, string prefix = "")
|
||||
{
|
||||
CheckAndGetCache();
|
||||
return _terminalMappingCache.Where(item => item.WireModelSpecification == wireModel && (item.Prefix == prefix || item.Prefix == null));
|
||||
return _terminalMappingCache.Where(item => item.WireModelSpecification == wireModel && (item.Prefix == prefix || prefix == ""));
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取线材信息
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
|
||||
{
|
||||
internal class LectotypeLengthDataTemplateSelector : DataTemplateSelector
|
||||
{
|
||||
|
||||
public DataTemplate DefaultTemplate { get; set; }
|
||||
public DataTemplate PowerLineTemplate { get; set; }
|
||||
public DataTemplate EncoderLineTemplate { get; set; }
|
||||
/// <summary>
|
||||
/// 复合线模板
|
||||
/// </summary>
|
||||
public DataTemplate ComplexLineTemplate { get; set; }
|
||||
public LectotypeLengthDataTemplateSelector()
|
||||
{
|
||||
}
|
||||
public override DataTemplate SelectTemplate(object item, DependencyObject container)
|
||||
{
|
||||
Type t = item.GetType();
|
||||
string cableType = null;
|
||||
PropertyInfo[] properties = t.GetProperties();
|
||||
foreach (PropertyInfo pi in properties)
|
||||
{
|
||||
if (pi.Name == "CableType")
|
||||
{
|
||||
cableType = pi.GetValue(item, null).ToString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (cableType)
|
||||
{
|
||||
case "动力线":
|
||||
return PowerLineTemplate;
|
||||
case "编码器线":
|
||||
return EncoderLineTemplate;
|
||||
case "动力线+编码器线":
|
||||
return ComplexLineTemplate;
|
||||
default:
|
||||
return DefaultTemplate;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,9 @@
|
|||
using EPLAN.Harness.Common.Extensions;
|
||||
using EPLAN.Harness.ProjectCore;
|
||||
using EPLAN.Harness.ProjectCore.Occurrences;
|
||||
using EPLAN.Harness.ProjectCore.Occurrences.Designer;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
|
@ -22,7 +24,16 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private List<LectotypeModel> _stuffedWires;
|
||||
public List<LectotypeModel> StuffedWires
|
||||
{
|
||||
get => _stuffedWires;
|
||||
set
|
||||
{
|
||||
_stuffedWires = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
public void LoadData()
|
||||
{
|
||||
if (string.IsNullOrEmpty(docId))
|
||||
|
@ -41,6 +52,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
it.GetType() == typeof(OccCableForked)
|
||||
//|| it.GetType() == typeof(OccWire)
|
||||
)
|
||||
//.Where(it => !string.IsNullOrEmpty(GetAxisNo((it.Children.First() as OccCablesInsulatorGraph).Imprint)) )
|
||||
//.Where(it =>it.PartStatus == EPLAN.Harness.Core.LibEntities.Enums.PartStatus.Released)
|
||||
.Select(it =>
|
||||
{
|
||||
|
@ -52,6 +64,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
var encoderLength = 0d;
|
||||
var powerLength = 0d;
|
||||
if(double.TryParse(insulatorGraph.CableLength_VH?.StrVal ?? "0",out double length)){
|
||||
length = Math.Round(length,0);
|
||||
if(isEncoderLine){
|
||||
encoderLength = length;
|
||||
}else{
|
||||
|
@ -69,11 +82,21 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
IsPowerLine = isPowerLine,
|
||||
PowerLineLength = powerLength,
|
||||
EncoderLineLength = encoderLength,
|
||||
CableType = isEncoderLine ? "编码器线" : isPowerLine ? "动力线" : "位置类型",
|
||||
CableType = isEncoderLine ? "编码器线" : isPowerLine ? "动力线" : "未知类型",
|
||||
};
|
||||
})
|
||||
.Where(it => it != null)
|
||||
//.Where(it => !string.IsNullOrEmpty(it.AxisNo))
|
||||
.OrderBy(it => it?.CableName ?? "")];
|
||||
|
||||
Wires = StuffData(cables);
|
||||
}
|
||||
|
||||
|
||||
public List<LectotypeModel> StuffData(List<LectotypeModel> cables)
|
||||
{
|
||||
List<LectotypeModel> datas = [];
|
||||
//1 整理数据
|
||||
cables.ForEach(it =>
|
||||
{
|
||||
var lineCount = 0;
|
||||
|
@ -97,8 +120,57 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
{
|
||||
it.CableConnectionClass = "尾段";
|
||||
}
|
||||
if (string.IsNullOrEmpty(axisNo))
|
||||
{
|
||||
it.IsError = true;
|
||||
it.IsChecked = true;
|
||||
it.ErrorCount += 1;
|
||||
it.CheckedMsg += "轴号不能为空!\r\n";
|
||||
}
|
||||
// 先把非第一行的数据添加到数据集合中
|
||||
if (it.CurrentLine != 1)
|
||||
{
|
||||
datas.Add(it);
|
||||
}
|
||||
});
|
||||
Wires = cables;
|
||||
//2 合并同轴号的第一条数据
|
||||
cables.Where(it => it.CurrentLine == 1).ForEach(it =>
|
||||
{
|
||||
var existLine = datas.FirstOrDefault(data => data.AxisNo == it.AxisNo && data.CurrentLine == 1);
|
||||
if (existLine != null)
|
||||
{
|
||||
if (existLine.CableType == it.CableType) return;
|
||||
else
|
||||
{
|
||||
if (existLine.IsPowerLine)
|
||||
{
|
||||
existLine.EncoderLineLength = it.EncoderLineLength;
|
||||
|
||||
}
|
||||
else if (existLine.IsEncoderLine)
|
||||
{
|
||||
existLine.PowerLineLength = it.PowerLineLength;
|
||||
}
|
||||
}
|
||||
existLine.CableType = "动力线+编码器线";
|
||||
if (datas.Any(i => i.AxisNo == it.AxisNo && i.CurrentLine != 1))
|
||||
{
|
||||
|
||||
existLine.CableConnectionClass = "前段";
|
||||
}
|
||||
else
|
||||
{
|
||||
existLine.CableConnectionClass = "直通";
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
datas.Add(it);
|
||||
}
|
||||
});
|
||||
|
||||
return datas.OrderBy(it => it.CurrentLine).ToList();
|
||||
}
|
||||
/// <summary>
|
||||
/// L -> 动力线 N -> 编码器线
|
||||
|
@ -177,5 +249,21 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
|
||||
public void ToSource(string cableName)
|
||||
{
|
||||
var doc = FlexProject.CurrentProject.GetDesigners().FirstOrDefault(designer => designer.ID == docId);
|
||||
var cable = doc.GetOccurrenceByName(cableName, typeof(OccCableForked));
|
||||
if (cable != null)
|
||||
{
|
||||
doc.SelectSet.Clear();
|
||||
var oriOcc = SelfControler<BaseOccurrence>.FindInstance(cable.ID);
|
||||
oriOcc.SetVisibility(true, null);
|
||||
|
||||
doc.SelectSet.Add(oriOcc.Children.First());
|
||||
doc.FitToSelectSet();
|
||||
doc.SelectSet.OnSelectionChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,9 +42,27 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
|
||||
CheckInsulation(item);
|
||||
CheckTerminals(item);
|
||||
CheckDPETerminals(item);
|
||||
CheckDuplicateModel(item);
|
||||
}
|
||||
|
||||
public void CheckDPETerminals(StuffedDataModel item)
|
||||
{
|
||||
// 地排只检查4.0线径以下的
|
||||
if (double.TryParse(item.CrossSection, out double crossSection))
|
||||
if (item.Imprint.StartsWith("D-PE") && crossSection <= 4.0)
|
||||
{
|
||||
var D_PECanUsedTerminals = GetD_PECanUsedTerminal(item.WireModel);
|
||||
if (D_PECanUsedTerminals.All(terminal =>
|
||||
terminal.TerminalSpec != item.FrontTerminalModel
|
||||
&& terminal.TerminalSpec != item.RearTerminalModel)
|
||||
)
|
||||
{
|
||||
SetItemError(item, "D-PE线未匹配到正确的端子!\r\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void CheckWireErpNr(StuffedDataModel item)
|
||||
{
|
||||
var wireInfos = ExcelHelper.GetWireInfo(item.WireModel);
|
||||
|
@ -163,18 +181,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
/// <param name="item"></param>
|
||||
public void CheckTerminals(StuffedDataModel item)
|
||||
{
|
||||
var canUsedTerminals = new List<TerminalModel>();
|
||||
//if(item.)
|
||||
if (item.Imprint.StartsWith("D-PE"))
|
||||
{
|
||||
canUsedTerminals = GetD_PECanUsedTerminal(item.WireModel);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
canUsedTerminals = GetCanUsedTerminal(item.WireModel);
|
||||
|
||||
}
|
||||
var canUsedTerminals = GetCanUsedTerminal(item.WireModel);
|
||||
if (canUsedTerminals != null && canUsedTerminals.Any())
|
||||
{
|
||||
var terminals = canUsedTerminals.Where(it => !string.IsNullOrEmpty(it.TerminalSpec) && !string.IsNullOrEmpty(it.TerminalMaterialCode));
|
||||
|
@ -195,7 +202,6 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
if (terminals.All(it => it.TerminalMaterialCode != item.RearTerminalMaterialCode))
|
||||
{
|
||||
SetItemError(item, "后端子料号不正确,不在可选列表中!\r\n");
|
||||
|
||||
}
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(item.FrontTerminalModel) || !string.IsNullOrEmpty(item.RearTerminalModel))
|
||||
|
@ -293,11 +299,11 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
// 获取D-PE前缀的可用端子
|
||||
var resultWithPrefix = ExcelHelper.GetWireTerminalMappingTable(wireModel, "D-PE");
|
||||
// 获取不包含前缀的端子
|
||||
var resultWithoutPrefix = ExcelHelper.GetWireTerminalMappingTable(wireModel);
|
||||
//var resultWithoutPrefix = ExcelHelper.GetWireTerminalMappingTable(wireModel);
|
||||
var terminals = new List<TerminalModel>();
|
||||
// 转换
|
||||
var withPrefixExcelModels = resultWithPrefix as List<ExcelModel> ?? resultWithPrefix.ToList();
|
||||
var withoutPrefixExcelModels = resultWithoutPrefix as List<ExcelModel> ?? resultWithoutPrefix.ToList();
|
||||
List<ExcelModel> withoutPrefixExcelModels = [];//resultWithoutPrefix as List<ExcelModel> ?? resultWithoutPrefix.ToList();
|
||||
// 合并
|
||||
var excelModels = withPrefixExcelModels.Concat(withoutPrefixExcelModels);
|
||||
if (!excelModels.Any()) return terminals;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using EPLAN.Harness.API;
|
||||
using EPLAN.Harness.API.Plugins;
|
||||
using EPLAN.Harness.API.Plugins.Core;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI;
|
||||
using System;
|
||||
|
@ -9,7 +8,7 @@ using System.Reflection;
|
|||
|
||||
namespace Sinvo.EplanHpD.Plugin
|
||||
{
|
||||
public class DesignPluginEntry : IHpDPlugin
|
||||
public class DesignPluginEntry //: IHpDPlugin
|
||||
{
|
||||
public string Name => "兴禾ProD插件-3D";
|
||||
|
||||
|
|
|
@ -28,6 +28,6 @@ using System.Runtime.InteropServices;
|
|||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.0.6")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.6")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.0.6")]
|
||||
[assembly: AssemblyVersion("1.0.0.14")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.14")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.0.14")]
|
Loading…
Reference in New Issue