diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireDataModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireDataModel.cs
index 5e8c035..283db85 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireDataModel.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireDataModel.cs
@@ -34,10 +34,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
/// 是否高柔
///
public bool IsHighFlexibility { get; set; }
- ///
- /// 插头型号
- ///
- public string ConnectorModel { get; set; }
+
///
/// 前端子型号
///
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireLecModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireLecModel.cs
index e447d7d..1502878 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireLecModel.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireLecModel.cs
@@ -1,4 +1,5 @@
using MiniExcelLibs.Attributes;
+using Sinvo.EplanHpD.Plugin.WPFUI.Models.MultiCoreWire;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -7,66 +8,460 @@ using System.Text;
using System.Threading.Tasks;
namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
-{
- public class MultiCoreWireLecModel
+{
+ public class MultiCoreWireLecModel : INotifyPropertyChanged
{
/*
* 应用场景 类型 线径规格(mm2) 是否高柔 线芯数 线材型号规格 插头型号 前端子型号 后端子型号
*/
+ private int _seqNo;
+ public int SeqNo
+ {
+ get => _seqNo;
+ set
+ {
+ _seqNo = value;
+ OnPropertyChanged(nameof(SeqNo));
+ }
+ }
+
///
/// 应用场景
///
+ private string _applicationScenario;
[ExcelColumn(Name = "应用场合")]
- public string ApplicationScenario { get; set; }
+ public string ApplicationScenario
+ {
+ get => _applicationScenario;
+ set
+ {
+ _applicationScenario = value;
+ OnPropertyChanged(nameof(ApplicationScenario));
+ }
+ }
+
///
/// 线材类型
///
- [ExcelColumn(Ignore = true)]
- public string WireType { get; set; }
+ private string _wireType;
+ [ExcelColumn(Ignore = true)]
+ public string WireType
+ {
+ get => _wireType;
+ set
+ {
+ _wireType = value;
+ OnPropertyChanged(nameof(WireType));
+ }
+ }
+
///
/// 线径规格(mm2)
///
+ private string _wireDiameterSpecification;
[ExcelColumn(IndexName = "F")]
- public string WireDiameterSpecification { get; set; }
- ///
- /// 是否高柔
- ///
- [ExcelColumn(Ignore = true)]
- public bool IsHighFlexibility { get; set; }
+ public string WireDiameterSpecification
+ {
+ get => _wireDiameterSpecification;
+ set
+ {
+ _wireDiameterSpecification = value;
+ OnPropertyChanged(nameof(WireDiameterSpecification));
+ }
+ }
///
/// 是否高柔
///
+ private bool _isHighFlexibility;
+ [ExcelColumn(Ignore = true)]
+ public bool IsHighFlexibility
+ {
+ get => _isHighFlexibility;
+ set
+ {
+ _isHighFlexibility = value;
+ OnPropertyChanged(nameof(IsHighFlexibility));
+ }
+ }
+
+ ///
+ /// 是否高柔
+ ///
+ private string _isHighFlexibilityStr;
[ExcelColumn(Name = "是否高柔")]
- public string IsHighFlexibilityStr { get; set; }
+ public string IsHighFlexibilityStr
+ {
+ get => _isHighFlexibilityStr;
+ set
+ {
+ _isHighFlexibilityStr = value;
+ OnPropertyChanged(nameof(IsHighFlexibilityStr));
+ }
+ }
+
///
/// 线芯数
///
+ private string _wireCoreCount;
[ExcelColumn(Name = "线芯数")]
- public string WireCoreCount { get; set; }
+ public string WireCoreCount
+ {
+ get => _wireCoreCount;
+ set
+ {
+ _wireCoreCount = value;
+ OnPropertyChanged(nameof(WireCoreCount));
+ }
+ }
+
///
/// 线材型号规格
///
+ private string _wireModelSpecification;
[ExcelColumn(Name = "线材型号规格")]
- public string WireModelSpecification { get; set; }
+ public string WireModelSpecification
+ {
+ get => _wireModelSpecification;
+ set
+ {
+ _wireModelSpecification = value;
+ OnPropertyChanged(nameof(WireModelSpecification));
+ }
+ }
+
///
/// 插头型号
///
+ private string _connectorModel;
[ExcelColumn(Name = "插头型号")]
- public string ConnectorModel { get; set; }
- ///
- /// 前端子型号
- ///
- [ExcelColumn(Ignore = true)]
- public string FrontTerminalModel { get; set; }
- ///
- /// 后端子型号
- ///
- [ExcelColumn(Ignore = true)]
- public string BackTerminalModel { get; set; }
+ public string ConnectorModel
+ {
+ get => _connectorModel;
+ set
+ {
+ _connectorModel = value;
+ OnPropertyChanged(nameof(ConnectorModel));
+ }
+ }
-
+ ///
+ /// 叉耳端子
+ ///
+ private string _forkTerminal;
+ [ExcelColumn(Name = "叉耳端子")]
+ public string ForkTerminal
+ {
+ get => _forkTerminal;
+ set
+ {
+ _forkTerminal = value;
+ OnPropertyChanged(nameof(ForkTerminal));
+ OnPropertyChanged(nameof(TerminalModels));
+ }
+ }
+ ///
+ /// 叉耳端子剥线长度(mm)
+ ///
+ private double _forkTerminalStripLength;
+ [ExcelColumn(Name = "叉耳端子剥线长度(mm)")]
+ public double ForkTerminalStripLength
+ {
+ get => _forkTerminalStripLength;
+ set
+ {
+ _forkTerminalStripLength = value;
+ OnPropertyChanged(nameof(ForkTerminalStripLength));
+ OnPropertyChanged(nameof(TerminalModels));
+ }
+ }
+
+ ///
+ /// 叉耳端子物料编码
+ ///
+ private string _forkTerminalMaterialCode;
+ [ExcelColumn(Name = "叉耳端子物料编码")]
+ public string ForkTerminalMaterialCode
+ {
+ get => _forkTerminalMaterialCode;
+ set
+ {
+ _forkTerminalMaterialCode = value;
+ OnPropertyChanged(nameof(ForkTerminalMaterialCode));
+ OnPropertyChanged(nameof(TerminalModels));
+ }
+ }
+
+ ///
+ /// 扁形端子
+ ///
+ private string _flatTerminal;
+ [ExcelColumn(Name = "扁形端子")]
+ public string FlatTerminal
+ {
+ get => _flatTerminal;
+ set
+ {
+ _flatTerminal = value;
+ OnPropertyChanged(nameof(FlatTerminal));
+ OnPropertyChanged(nameof(TerminalModels));
+ }
+ }
+
+ ///
+ /// 扁形端子剥线长度(mm)
+ ///
+ private double _flatTerminalStripLength;
+ [ExcelColumn(Name = "扁形端子剥线长度(mm)")]
+ public double FlatTerminalStripLength
+ {
+ get => _flatTerminalStripLength;
+ set
+ {
+ _flatTerminalStripLength = value;
+ OnPropertyChanged(nameof(FlatTerminalStripLength));
+ OnPropertyChanged(nameof(TerminalModels));
+ }
+ }
+
+ ///
+ /// 扁形端子物料编码
+ ///
+ private string _flatTerminalMaterialCode;
+ [ExcelColumn(Name = "扁形端子物料编码")]
+ public string FlatTerminalMaterialCode
+ {
+ get => _flatTerminalMaterialCode;
+ set
+ {
+ _flatTerminalMaterialCode = value;
+ OnPropertyChanged(nameof(FlatTerminalMaterialCode));
+ OnPropertyChanged(nameof(TerminalModels));
+ }
+ }
+
+ ///
+ /// O型端子
+ ///
+ private string _oTypeTerminal;
+ [ExcelColumn(Name = "O型端子")]
+ public string OTypeTerminal
+ {
+ get => _oTypeTerminal;
+ set
+ {
+ _oTypeTerminal = value;
+ OnPropertyChanged(nameof(OTypeTerminal));
+ OnPropertyChanged(nameof(TerminalModels));
+ }
+ }
+
+ ///
+ /// O型端子剥线长度(mm)
+ ///
+ private double _oTypeTerminalStripLength;
+ [ExcelColumn(Name = "O型端子剥线长度(mm)")]
+ public double OTypeTerminalStripLength
+ {
+ get => _oTypeTerminalStripLength;
+ set
+ {
+ _oTypeTerminalStripLength = value;
+ OnPropertyChanged(nameof(OTypeTerminalStripLength));
+ OnPropertyChanged(nameof(TerminalModels));
+ }
+ }
+
+ ///
+ /// O型端子物料编码
+ ///
+ private string _oTypeTerminalMaterialCode;
+ [ExcelColumn(Name = "O型端子物料编码")]
+ public string OTypeTerminalMaterialCode
+ {
+ get => _oTypeTerminalMaterialCode;
+ set
+ {
+ _oTypeTerminalMaterialCode = value;
+ OnPropertyChanged(nameof(OTypeTerminalMaterialCode));
+ OnPropertyChanged(nameof(TerminalModels));
+ }
+ }
+
+ ///
+ /// 针型端子
+ ///
+ private string _pinTerminal;
+ [ExcelColumn(Name = "针型端子")]
+ public string PinTerminal
+ {
+ get => _pinTerminal;
+ set
+ {
+ _pinTerminal = value;
+ OnPropertyChanged(nameof(PinTerminal));
+ OnPropertyChanged(nameof(TerminalModels));
+ }
+ }
+
+ ///
+ /// 针型端子剥线长度(mm)
+ ///
+ private double _pinTerminalStripLength;
+ [ExcelColumn(Name = "针型端子剥线长度(mm)")]
+ public double PinTerminalStripLength
+ {
+ get => _pinTerminalStripLength;
+ set
+ {
+ _pinTerminalStripLength = value;
+ OnPropertyChanged(nameof(PinTerminalStripLength));
+ OnPropertyChanged(nameof(TerminalModels));
+ }
+ }
+
+ ///
+ /// 针型端子物料编码
+ ///
+ private string _pinTerminalMaterialCode;
+ [ExcelColumn(Name = "针型端子物料编码")]
+ public string PinTerminalMaterialCode
+ {
+ get => _pinTerminalMaterialCode;
+ set
+ {
+ _pinTerminalMaterialCode = value;
+ OnPropertyChanged(nameof(PinTerminalMaterialCode));
+ OnPropertyChanged(nameof(TerminalModels));
+ }
+ }
+
+ ///
+ /// Y形端子
+ ///
+ private string _yTypeTerminal;
+ [ExcelColumn(Name = "Y形端子")]
+ public string YTypeTerminal
+ {
+ get => _yTypeTerminal;
+ set
+ {
+ _yTypeTerminal = value;
+ OnPropertyChanged(nameof(YTypeTerminal));
+ OnPropertyChanged(nameof(TerminalModels));
+ }
+ }
+
+ ///
+ /// Y形端子剥线长度(mm)
+ ///
+ private double _yTypeTerminalStripLength;
+ [ExcelColumn(Name = "Y形端子剥线长度(mm)")]
+ public double YTypeTerminalStripLength
+ {
+ get => _yTypeTerminalStripLength;
+ set
+ {
+ _yTypeTerminalStripLength = value;
+ OnPropertyChanged(nameof(YTypeTerminalStripLength));
+ OnPropertyChanged(nameof(TerminalModels));
+ }
+ }
+
+ ///
+ /// Y形端子物料编码
+ ///
+ private string _yTypeTerminalMaterialCode;
+ [ExcelColumn(Name = "Y形端子物料编码")]
+ public string YTypeTerminalMaterialCode
+ {
+ get => _yTypeTerminalMaterialCode;
+ set
+ {
+ _yTypeTerminalMaterialCode = value;
+ OnPropertyChanged(nameof(YTypeTerminalMaterialCode));
+ OnPropertyChanged(nameof(TerminalModels));
+ }
+ }
+
+ ///
+ /// 前连接
+ ///
+ private string _frontConnectorModel;
+ [ExcelColumn(Ignore = true)]
+ public string FrontConnectorModel
+ {
+ get => _frontConnectorModel;
+ set
+ {
+ _frontConnectorModel = value;
+ OnPropertyChanged(nameof(FrontConnectorModel));
+ }
+ }
+
+ ///
+ /// 后连接
+ ///
+ private string _backConnectorModel;
+ [ExcelColumn(Ignore = true)]
+ public string BackConnectorModel
+ {
+ get => _backConnectorModel;
+ set
+ {
+ _backConnectorModel = value;
+ OnPropertyChanged(nameof(BackConnectorModel));
+ }
+ }
+
+
+ [ExcelColumn(Ignore = true)]
+ public List TerminalModels
+ {
+ get
+ {
+ // 将所有类型的端子模型组合成一个列表
+ return [
+ new MultiCoreWireTerminalModel
+ {
+ TerminalModel = ForkTerminal,
+ TerminalStripLength = ForkTerminalStripLength,
+ TerminalMaterialCode = ForkTerminalMaterialCode
+ },
+ new MultiCoreWireTerminalModel
+ {
+ TerminalModel = FlatTerminal,
+ TerminalStripLength = FlatTerminalStripLength,
+ TerminalMaterialCode = FlatTerminalMaterialCode
+ },
+ new MultiCoreWireTerminalModel
+ {
+ TerminalModel = OTypeTerminal,
+ TerminalStripLength = OTypeTerminalStripLength,
+ TerminalMaterialCode = OTypeTerminalMaterialCode
+ },
+ new MultiCoreWireTerminalModel
+ {
+ TerminalModel = PinTerminal,
+ TerminalStripLength = PinTerminalStripLength,
+ TerminalMaterialCode = PinTerminalMaterialCode
+ },
+ new MultiCoreWireTerminalModel
+ {
+ TerminalModel = YTypeTerminal,
+ TerminalStripLength = YTypeTerminalStripLength,
+ TerminalMaterialCode = YTypeTerminalMaterialCode
+ }
+ ];
+ }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+ public void OnPropertyChanged(string propertyName)
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
}
}
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireTerminalModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireTerminalModel.cs
new file mode 100644
index 0000000..0820bb7
--- /dev/null
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireTerminalModel.cs
@@ -0,0 +1,27 @@
+using MiniExcelLibs.Attributes;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Sinvo.EplanHpD.Plugin.WPFUI.Models.MultiCoreWire
+{
+ public class MultiCoreWireTerminalModel
+ {
+ ///
+ /// 端子型号
+ ///
+ public string TerminalModel { get; set; }
+
+ ///
+ /// 端子剥线长度(mm)
+ public double TerminalStripLength { get; set; }
+
+ ///
+ /// 端子物料编码
+ ///
+ public string TerminalMaterialCode { get; set; }
+
+ }
+}
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Sinvo.EplanHpD.Plugin.WPFUI.csproj b/Sinvo.EplanHpD.Plugin.WPFUI/Sinvo.EplanHpD.Plugin.WPFUI.csproj
index bae9ae8..41342f4 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/Sinvo.EplanHpD.Plugin.WPFUI.csproj
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/Sinvo.EplanHpD.Plugin.WPFUI.csproj
@@ -253,6 +253,7 @@
+
@@ -308,6 +309,9 @@
LoginWindow.xaml
+
+ MultiCoreWireLayoutHelperWindow.xaml
+
MultiCoreWireWindow.xaml
@@ -348,6 +352,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Utils/MultiCoreWireExcelHelper.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Utils/MultiCoreWireExcelHelper.cs
index b6f04dd..27997bd 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/Utils/MultiCoreWireExcelHelper.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/Utils/MultiCoreWireExcelHelper.cs
@@ -39,6 +39,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
var data = MiniExcel.Query(dataFileStream,sheetName: "多芯线WPS数据配对");
//MiniExcel.Query()
return data;
- }
+ }
+
}
}
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/LayoutHelper/MultiCoreWireLayoutHelperWindow.xaml b/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/LayoutHelper/MultiCoreWireLayoutHelperWindow.xaml
new file mode 100644
index 0000000..2b8e323
--- /dev/null
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/LayoutHelper/MultiCoreWireLayoutHelperWindow.xaml
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/LayoutHelper/MultiCoreWireLayoutHelperWindow.xaml.cs b/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/LayoutHelper/MultiCoreWireLayoutHelperWindow.xaml.cs
new file mode 100644
index 0000000..9028239
--- /dev/null
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/LayoutHelper/MultiCoreWireLayoutHelperWindow.xaml.cs
@@ -0,0 +1,33 @@
+using HandyControl.Controls;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace Sinvo.EplanHpD.Plugin.WPFUI.View.MultiCoreWire.LayoutHelper
+{
+ ///
+ /// MultiCoreWireLayoutHerlpWindow.xaml 的交互逻辑
+ ///
+ public partial class MultiCoreWireLayoutHelperWindow : GlowWindow
+ {
+ public MultiCoreWireLayoutHelperWindow()
+ {
+ InitializeComponent();
+ }
+
+ private void GlowWindow_Loaded(object sender, RoutedEventArgs e)
+ {
+
+ }
+ }
+}
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/MultiCoreWireWindow.xaml b/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/MultiCoreWireWindow.xaml
index 9aa4ad0..e466999 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/MultiCoreWireWindow.xaml
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/MultiCoreWireWindow.xaml
@@ -8,8 +8,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:multicorewireviewmodel="clr-namespace:Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel"
Title="多芯线数据抓取"
- Width="850"
- Height="450"
+ Width="1200"
+ Height="600"
d:DataContext="{d:DesignInstance Type=multicorewireviewmodel:MultiCoreWireViewModel}"
FontSize="14"
Loaded="Window_Loaded"
@@ -21,335 +21,382 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ Content="布线助手"
+ Style="{StaticResource ButtonSuccess}" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/MultiCoreWireWindow.xaml.cs b/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/MultiCoreWireWindow.xaml.cs
index 3d3222d..953b938 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/MultiCoreWireWindow.xaml.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/MultiCoreWireWindow.xaml.cs
@@ -1,5 +1,7 @@
-using Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel;
+using Sinvo.EplanHpD.Plugin.WPFUI.Models;
+using Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel;
using System.Windows;
+using System.Windows.Controls;
namespace Sinvo.EplanHpD.Plugin.WPFUI.View
{
@@ -35,5 +37,17 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
{
viewModel.ClearLecLines();
}
+
+ private void DeleteItemBtn_Click(object sender, RoutedEventArgs e)
+ {
+ if(sender is Button btn)
+ {
+ int? seqNo = (int)btn.Tag;
+ if(seqNo != null)
+ {
+ viewModel.DeleteLecWireItem(seqNo);
+ }
+ }
+ }
}
}
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MultiCoreWireViewModel/MultiCoreWireViewModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MultiCoreWireViewModel/MultiCoreWireViewModel.cs
index 9e900b4..1469f74 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MultiCoreWireViewModel/MultiCoreWireViewModel.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MultiCoreWireViewModel/MultiCoreWireViewModel.cs
@@ -5,6 +5,7 @@ using EPLAN.Harness.ProjectCore;
using EPLAN.Harness.ProjectCore.Occurrences.Designer;
using MiniExcelLibs.Attributes;
using Sinvo.EplanHpD.Plugin.WPFUI.Models;
+using Sinvo.EplanHpD.Plugin.WPFUI.Models.MultiCoreWire;
using Sinvo.EplanHpD.Plugin.WPFUI.Utils;
using SqlSugar;
using System;
@@ -48,6 +49,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
}
}
+
private string _applicationScenario;
///
/// 应用场景
@@ -58,11 +60,27 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
set
{
_applicationScenario = value;
+
+ ApplicationScenarioSelected = !string.IsNullOrEmpty(value);
+
OnPropertyChanged(nameof(ApplicationScenario));
+
OnLecChanged(nameof(ApplicationScenario));
}
}
+ private bool _applicationScenarioSelected;
+
+ public bool ApplicationScenarioSelected
+ {
+ get => _applicationScenarioSelected;
+ set
+ {
+ _applicationScenarioSelected = value;
+ OnPropertyChanged(nameof(ApplicationScenarioSelected));
+ }
+ }
+
private string _wireType;
///
/// 线材类型
@@ -134,46 +152,46 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
OnLecChanged(nameof(WireModelSpecification));
}
}
- private string _connectorModel;
- ///
- /// 插头型号
- ///
- public string ConnectorModel
- {
- get => _connectorModel;
- set
- {
- _connectorModel = value;
- OnPropertyChanged(nameof(ConnectorModel));
- }
- }
- private string _frontTerminalModel;
- ///
- /// 前端子型号
- ///
- public string FrontTerminalModel
- {
- get => _frontTerminalModel;
- set
- {
- _frontTerminalModel = value;
- OnPropertyChanged(nameof(FrontTerminalModel));
- }
- }
+ //private string _connectorModel;
+ /////
+ ///// 插头型号
+ /////
+ //public string ConnectorModel
+ //{
+ // get => _connectorModel;
+ // set
+ // {
+ // _connectorModel = value;
+ // OnPropertyChanged(nameof(ConnectorModel));
+ // }
+ //}
+ //private string _frontTerminalModel;
+ /////
+ ///// 前端子型号
+ /////
+ //public string FrontTerminalModel
+ //{
+ // get => _frontTerminalModel;
+ // set
+ // {
+ // _frontTerminalModel = value;
+ // OnPropertyChanged(nameof(FrontTerminalModel));
+ // }
+ //}
- private string _backTerminalModel;
- ///
- /// 后端子型号
- ///
- public string BackTerminalModel
- {
- get => _backTerminalModel;
- set
- {
- _backTerminalModel = value;
- OnPropertyChanged(nameof(BackTerminalModel));
- }
- }
+ //private string _backTerminalModel;
+ /////
+ ///// 后端子型号
+ /////
+ //public string BackTerminalModel
+ //{
+ // get => _backTerminalModel;
+ // set
+ // {
+ // _backTerminalModel = value;
+ // OnPropertyChanged(nameof(BackTerminalModel));
+ // }
+ //}
private List _applicationScenarios;
@@ -245,48 +263,138 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
}
}
- private List _connectorModels;
+ //private List _connectorModels;
+ /////
+ ///// 连接器型号
+ /////
+ //public List ConnectorModels
+ //{
+ // get => _connectorModels;
+ // set
+ // {
+ // _connectorModels = value;
+ // OnPropertyChanged(nameof(ConnectorModels));
+ // }
+ //}
+ private List _frontConnectorModels;
///
- /// 连接器型号
+ /// 前连接器型号
///
- public List ConnectorModels
+ public List FrontConnectorModels
{
- get => _connectorModels;
+ get => _frontConnectorModels;
set
{
- _connectorModels = value;
- OnPropertyChanged(nameof(ConnectorModels));
- }
- }
- private List _frontTerminalModels;
- ///
- /// 前端子型号
- ///
- public List FrontTerminalModels
- {
- get => _frontTerminalModels;
- set
- {
- _frontTerminalModels = value;
- OnPropertyChanged(nameof(FrontTerminalModels));
- }
- }
- private List _backTerminalModels;
- ///
- /// 后端子型号
- ///
- public List BackTerminalModels
- {
- get => _backTerminalModels;
- set
- {
- _backTerminalModels = value;
- OnPropertyChanged(nameof(BackTerminalModels));
+ _frontConnectorModels = value;
+ OnPropertyChanged(nameof(FrontConnectorModels));
}
}
+ private List _backConnectorModels;
+ ///
+ /// 后连接器型号
+ ///
+ public List BackConnectorModels
+ {
+ get => _backConnectorModels;
+ set
+ {
+ _backConnectorModels = value;
+ OnPropertyChanged(nameof(BackConnectorModels));
+ }
+ }
+ private string _frontConnectorType;
+ ///
+ /// 前连接器类型
+ ///
+ public string FrontConnectorType
+ {
+ get => _frontConnectorType;
+ set
+ {
+ _frontConnectorType = value;
+ OnPropertyChanged(nameof(FrontConnectorType));
+ OnFrontTypeChange(FrontConnectorType);
+ }
+
+ }
+
+ private void OnFrontTypeChange(string type)
+ {
+ if (type == "端子")
+ {
+ FrontConnectorModels = [.. _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.TerminalModels];
+ }
+ else
+ {
+ FrontConnectorModels = [new MultiCoreWireTerminalModel {
+ TerminalModel = _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.ConnectorModel
+ }];
+
+ }
+ }
+
+ private string _backConnectorType;
+ ///
+ /// 后连接器类型
+ ///
+ public string BackConnectorType
+ {
+ get => _backConnectorType;
+ set
+ {
+ _backConnectorType = value;
+ OnPropertyChanged(nameof(BackConnectorType));
+ OnBackTypeChange(BackConnectorType);
+
+ }
+ }
+ private void OnBackTypeChange(string type)
+ {
+ if (type == "端子")
+ {
+ BackConnectorModels = [.. _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.TerminalModels];
+ }
+ else
+ {
+ BackConnectorModels = [new MultiCoreWireTerminalModel {
+ TerminalModel = _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.ConnectorModel
+ }];
+
+ }
+ }
+
+ //}
+ private string _frontConnectorModel;
+ ///
+ /// 前连接器型号
+ ///
+ public string FrontConnectorModel
+ {
+ get => _frontConnectorModel;
+ set
+ {
+ _frontConnectorModel = value;
+ OnPropertyChanged(nameof(FrontConnectorModel));
+ }
+ }
+
+
+ private string _backConnectorModel;
+ ///
+ /// 后连接器型号
+ ///
+ public string BackConnectorModel
+ {
+ get => _backConnectorModel;
+ set
+ {
+ _backConnectorModel = value;
+ OnPropertyChanged(nameof(BackConnectorModel));
+ }
+ }
#endregion
@@ -315,10 +423,6 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
.WhereIF(!string.IsNullOrEmpty(WireModelSpecification), it => it.WireModelSpecification == WireModelSpecification)
// 线芯数
.WhereIF(!string.IsNullOrEmpty(WireCoreCount), it => it.WireCoreCount == WireCoreCount)
- // 连接器
- .WhereIF(!string.IsNullOrEmpty(ConnectorModel), it => it.ConnectorModel == ConnectorModel)
- .WhereIF(!string.IsNullOrEmpty(FrontTerminalModel), it => it.FrontTerminalModel == FrontTerminalModel)
- .WhereIF(!string.IsNullOrEmpty(BackTerminalModel), it => it.BackTerminalModel == BackTerminalModel)
;
SetDatas(canUsedDatas, propName);
}
@@ -353,9 +457,8 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
{
WireModelSpecification = WireModelSpecifications.FirstOrDefault();
}
- ConnectorModels = [.. datas.Where(it => !string.IsNullOrEmpty(it.ConnectorModel)).Select(it => it.ConnectorModel).Distinct(), ""];
- FrontTerminalModels = [.. datas.Where(it => !string.IsNullOrEmpty(it.FrontTerminalModel)).Select(it => it.FrontTerminalModel).Distinct(), ""];
- BackTerminalModels = [.. datas.Where(it => !string.IsNullOrEmpty(it.BackTerminalModel)).Select(it => it.BackTerminalModel).Distinct(), ""];
+ //FrontConnectorModels = [.. datas.Where(it => !string.IsNullOrEmpty(it.FrontTerminalModel)).Select(it => it.FrontTerminalModel).Distinct(), ""];
+ //BackConnectorModels = [.. datas.Where(it => !string.IsNullOrEmpty(it.BackTerminalModel)).Select(it => it.BackTerminalModel).Distinct(), ""];
LecChanging = false;
}
}
@@ -424,9 +527,8 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
HighFlexibility = "";
WireCoreCount = "";
WireModelSpecification = "";
- ConnectorModel = "";
- FrontTerminalModel = "";
- BackTerminalModel = "";
+ FrontConnectorType = "";
+ BackConnectorType = "";
LecChanging = false;
OnLecChanged("");
@@ -434,8 +536,19 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
public void SaveLecToLine()
{
- LecWires.Add(new MultiCoreWireLecModel
+ if(ApplicationScenario == null
+ || WireType == null
+ || WireDiameterSpecification == null
+ || HighFlexibility == null
+ || WireCoreCount == null
+ || WireModelSpecification == null)
{
+ MessageBox.Show("有信息未选择!");
+ return;
+ }
+ var wire = new MultiCoreWireLecModel
+ {
+ SeqNo = LecWires.Count + 1,
ApplicationScenario = ApplicationScenario,
WireType = WireType,
WireDiameterSpecification = WireDiameterSpecification,
@@ -443,15 +556,42 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
IsHighFlexibilityStr = HighFlexibility,
WireCoreCount = WireCoreCount,
WireModelSpecification = WireModelSpecification,
- ConnectorModel = ConnectorModel,
- FrontTerminalModel = FrontTerminalModel,
- BackTerminalModel = BackTerminalModel
- });
+ FrontConnectorModel = FrontConnectorModel,
+ BackConnectorModel = BackConnectorModel,
+ };
+ LecWires.Add(wire);
+
+
}
public void ClearLecLines()
{
LecWires.Clear();
}
+
+ internal void DeleteLecWireItem(int? seqNo)
+ {
+ if(seqNo != null)
+ {
+ var removeItem = LecWires.FirstOrDefault(it => it.SeqNo == seqNo!);
+ if(removeItem != null)
+ {
+ LecWires.Remove(removeItem);
+ }
+
+ ReOrderLecWires();
+ }
+ }
+
+ private void ReOrderLecWires()
+ {
+ int seq = 1;
+ LecWires.OrderBy(it => it.SeqNo).ForEach(it =>
+ {
+ it.SeqNo = seq;
+ seq++;
+ });
+ OnPropertyChanged(nameof(LecWires));
+ }
}
}