From 4212086da157966dedf558268939206b55d9e274 Mon Sep 17 00:00:00 2001 From: lihanbo Date: Tue, 22 Apr 2025 14:33:49 +0800 Subject: [PATCH] =?UTF-8?q?105040=20Update=20=E5=AE=8C=E5=96=84=E5=A4=9A?= =?UTF-8?q?=E8=8A=AF=E7=BA=BF=E7=BA=BF=E6=9D=90=E9=80=89=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MultiCoreWire/MultiCoreWireDataModel.cs | 5 +- .../MultiCoreWire/MultiCoreWireLecModel.cs | 447 ++++++++++- .../MultiCoreWireTerminalModel.cs | 27 + .../Sinvo.EplanHpD.Plugin.WPFUI.csproj | 8 + .../Utils/MultiCoreWireExcelHelper.cs | 3 +- .../MultiCoreWireLayoutHelperWindow.xaml | 79 ++ .../MultiCoreWireLayoutHelperWindow.xaml.cs | 33 + .../MultiCoreWire/MultiCoreWireWindow.xaml | 705 ++++++++++-------- .../MultiCoreWire/MultiCoreWireWindow.xaml.cs | 16 +- .../MultiCoreWireViewModel.cs | 312 +++++--- 10 files changed, 1188 insertions(+), 447 deletions(-) create mode 100644 Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireTerminalModel.cs create mode 100644 Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/LayoutHelper/MultiCoreWireLayoutHelperWindow.xaml create mode 100644 Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/LayoutHelper/MultiCoreWireLayoutHelperWindow.xaml.cs 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +