diff --git a/Sinvo.EplanHpD.Plugin.Service/Model/MultiCoreWireLecDBModel.cs b/Sinvo.EplanHpD.Plugin.Service/Model/MultiCoreWireLecDBModel.cs
index 7ea4fea..b8af537 100644
--- a/Sinvo.EplanHpD.Plugin.Service/Model/MultiCoreWireLecDBModel.cs
+++ b/Sinvo.EplanHpD.Plugin.Service/Model/MultiCoreWireLecDBModel.cs
@@ -9,45 +9,42 @@ namespace Sinvo.EplanHpD.Plugin.Service.Model
/*
* 应用场景 类型 线径规格(mm2) 是否高柔 线芯数 线材型号规格 插头型号 前端子型号 后端子型号
*/
+
+ public int SeqNo { get; set; }
+
public string Id { get; set; }
public string UniqueKey { get; set; }
public string ProjectName { get; set; }
public string UserId { get; set; }
-
- public int SeqNo { get; set; }
-
-
- ///
- /// 应用场景
- ///
+ public string WireKey { get; set; }
public string ApplicationScenario { get; set; }
-
-
- ///
- /// 线径规格(mm2)
- ///
public string WireDiameterSpecification { get; set; }
-
-
-
- ///
- /// 是否高柔
- ///
public string IsHighFlexibilityStr { get; set; }
-
- ///
- /// 线芯数
- ///
public string WireCoreCount { get; set; }
-
+
///
/// 线材型号规格
- ///
+ ///
public string WireModelSpecification { get; set; }
+ ///
+ /// 线材颜色名
+ ///
+ public string WireColorName { get; set; }
+ ///
+ /// 线材长度
+ ///
+ [SugarColumn(IsNullable = true)]
+ public string WireLength { get; set; }
+
///
/// 前连接物型号
///
public string FrontConnectorModel { get; set; }
+
+ ///
+ /// 前连接物料号
+ ///
+ public string FrontConnectorMCode { get; set; }
///
/// 前连接物数量
///
@@ -58,16 +55,93 @@ namespace Sinvo.EplanHpD.Plugin.Service.Model
/// 后连接物型号
///
public string RearConnectorModel { get; set; }
+
+ ///
+ /// 后连接物料号
+ ///
+ public string RearConnectorMCode { get; set; }
///
/// 后连接物数量
///
public int RearConnectorQuantity { get; set; }
+ ///
+ /// 号码管型号
+ ///
+ [SugarColumn(IsNullable = true)]
+ public string NumberTubeModel { get; set; }
+
+ ///
+ /// 号码管物料编码
+ ///
+ [SugarColumn(IsNullable = true)]
+ public string NumberTubeMCode { get; set; }
+
+ ///
+ /// 号码管长度
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int NumberTubeLength { get; set; }
+ [SugarColumn(IsNullable = true)]
+ public bool FrontConnectorIsPin { get; set; }
+ [SugarColumn(IsNullable = true)]
+ public bool RearConnectorIsPin { get; set; }
+ ///
+ /// 透明热缩管型号
+ ///
+ [SugarColumn(IsNullable = true)]
+ public string TransparentHeatShrinkTubeModel { get; set; }
+ ///
+ /// 透明热缩管标示
+ ///
+ [SugarColumn(IsNullable = true)]
+ public string TransparentHeatShrinkTubeDesc { get; set; }
+ ///
+ /// 透明热缩管物料编码
+ ///
+ [SugarColumn(IsNullable = true)]
+ public string TransparentHeatShrinkTubeMCode { get; set; }
+
+ ///
+ /// 黑色热缩管型号(插头)
+ ///
+ [SugarColumn(IsNullable = true)]
+ public string BlackHeatShrinkTubeModel { get; set; }
+ ///
+ /// 黑色热缩管物料编码(插头)
+ ///
+ [SugarColumn(IsNullable = true)]
+ public string BlackHeatShrinkTubeMCode { get; set; }
+
+ ///
+ /// 黑色热缩管型号(剥线后)
+ ///
+ [SugarColumn(IsNullable = true)]
+ public string BlackHeatShrinkTubeModelAfterStripping { get; set; }
+ ///
+ /// 黑色热缩管物料编码(剥线后)
+ ///
+ [SugarColumn(IsNullable = true)]
+ public string BlackHeatShrinkTubeMCodeAfterStripping { get; set; }
///
- /// 是否已布线
- ///
- public bool Layouted { get; set; } = false;
+ /// 热缩管标识
+ ///
+ [SugarColumn(IsNullable = true)]
+ public string HeatShrinkTubeDesc { get; set; }
+
+ ///
+ /// 前段子剥线长度
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int FrontStrippingLength { get; set; }
+ ///
+ /// 后段子剥线长度
+ ///
+ [SugarColumn(IsNullable = true)]
+ public int RearStrippingLength { get; set; }
+
+ public bool Layouted { get; set; }
}
}
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Extension/ApplicationExt.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Extension/ApplicationExt.cs
index 3fd1fa1..8c01c44 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/Extension/ApplicationExt.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/Extension/ApplicationExt.cs
@@ -1,4 +1,5 @@
-using System;
+
+using System;
using System.Windows;
namespace Sinvo.EplanHpD.Plugin.WPFUI.Extension
@@ -36,9 +37,16 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Extension
Resources = new ResourceDictionary
{
Source = new Uri("pack://application:,,,/Sinvo.EplanHpD.Plugin.WPFUI;component/Themes/Theme.xaml")
- }
+ },
};
+ Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException;
}
}
+
+ private static void Current_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
+ {
+ HandyControl.Controls.MessageBox.Show($"{sender.GetType()}: {e.Exception.Message}");
+ e.Handled = true;
+ }
}
}
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireDataModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireDataModel.cs
index 6e5218d..dd5b2ef 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireDataModel.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireDataModel.cs
@@ -1,157 +1,732 @@
using MiniExcelLibs.Attributes;
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Linq;
+using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
{
- public class MultiCoreWireDataModel
+ public class MultiCoreWireDataModel : CheckedModel,INotifyPropertyChanged
{
+ private int _seqNo;
+ public int SeqNo
+ {
+ get => _seqNo;
+ set
+ {
+ if (_seqNo != value)
+ {
+ _seqNo = value;
+ OnPropertyChanged();
+ }
+ }
+ }
- public int SeqNo { get; set; }
+ private string _id;
+ public string Id
+ {
+ get => _id;
+ set
+ {
+ if (_id != value)
+ {
+ _id = value;
+ OnPropertyChanged();
+ }
+ }
+ }
- public string Id { get; set; }
- public string UniqueKey { get; set; }
- public string ProjectName { get; set; }
- public string UserId { get; set; }
- public string WireKey { get; set; }
- public string ApplicationScenario { get; set; }
- public string WireDiameterSpecification { get; set; }
- public string IsHighFlexibilityStr { get; set; }
- public string WireCoreCount { get; set; }
+ private string _uniqueKey;
+ public string UniqueKey
+ {
+ get => _uniqueKey;
+ set
+ {
+ if (_uniqueKey != value)
+ {
+ _uniqueKey = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ private string _projectName;
+ public string ProjectName
+ {
+ get => _projectName;
+ set
+ {
+ if (_projectName != value)
+ {
+ _projectName = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ private string _userId;
+ public string UserId
+ {
+ get => _userId;
+ set
+ {
+ if (_userId != value)
+ {
+ _userId = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ private string _wireKey;
+ public string WireKey
+ {
+ get => _wireKey;
+ set
+ {
+ if (_wireKey != value)
+ {
+ _wireKey = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ private string _applicationScenario;
+ public string ApplicationScenario
+ {
+ get => _applicationScenario;
+ set
+ {
+ if (_applicationScenario != value)
+ {
+ _applicationScenario = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ private string _wireDiameterSpecification;
+ public string WireDiameterSpecification
+ {
+ get => _wireDiameterSpecification;
+ set
+ {
+ if (_wireDiameterSpecification != value)
+ {
+ _wireDiameterSpecification = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ private string _isHighFlexibilityStr;
+ public string IsHighFlexibilityStr
+ {
+ get => _isHighFlexibilityStr;
+ set
+ {
+ if (_isHighFlexibilityStr != value)
+ {
+ _isHighFlexibilityStr = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ private string _wireCoreCount;
+ public string WireCoreCount
+ {
+ get => _wireCoreCount;
+ set
+ {
+ if (_wireCoreCount != value)
+ {
+ _wireCoreCount = value;
+ OnPropertyChanged();
+ }
+ }
+ }
///
/// 引脚编号
///
- public string PinIndex { get; set; }
+ private string _pinIndex;
+ public string PinIndex
+ {
+ get => _pinIndex;
+ set
+ {
+ if (_pinIndex != value)
+ {
+ _pinIndex = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
///
/// 线材型号规格
///
- public string WireModelSpecification { get; set; }
+ private string _wireModelSpecification;
+ public string WireModelSpecification
+ {
+ get => _wireModelSpecification;
+ set
+ {
+ if (_wireModelSpecification != value)
+ {
+ _wireModelSpecification = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
///
/// 线材颜色名
///
- public string WireColorName { get; set; }
+ private string _wireColorName;
+ public string WireColorName
+ {
+ get => _wireColorName;
+ set
+ {
+ if (_wireColorName != value)
+ {
+ _wireColorName = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
///
/// 线材颜色十六进制
///
- public string WireColorHex { get; set; }
+ private string _wireColorHex;
+ public string WireColorHex
+ {
+ get => _wireColorHex;
+ set
+ {
+ if (_wireColorHex != value)
+ {
+ _wireColorHex = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
///
/// 线材颜色十六进制 次颜色
///
- public string WireColorHexSec { get; set; }
+ private string _wireColorHexSec;
+ public string WireColorHexSec
+ {
+ get => _wireColorHexSec;
+ set
+ {
+ if (_wireColorHexSec != value)
+ {
+ _wireColorHexSec = value;
+ OnPropertyChanged();
+ }
+ }
+ }
- public bool IsMultiColor { get; set; }
+ private bool _isMultiColor;
+ public bool IsMultiColor
+ {
+ get => _isMultiColor;
+ set
+ {
+ if (_isMultiColor != value)
+ {
+ _isMultiColor = value;
+ OnPropertyChanged();
+ }
+ }
+ }
- public string WireType { get; set; }
+ private string _wireType;
+ public string WireType
+ {
+ get => _wireType;
+ set
+ {
+ if (_wireType != value)
+ {
+ _wireType = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ private string _wireLength;
+ public string WireLength
+ {
+ get => _wireLength;
+ set
+ {
+ if (_wireLength != value)
+ {
+ _wireLength = value;
+ OnPropertyChanged();
+ }
+ }
+ }
- public string WireLength { get; set; }
///
/// 是否高柔
///
- public bool IsHighFlexibility { get; set; }
-
+ private bool _isHighFlexibility;
+ public bool IsHighFlexibility
+ {
+ get => _isHighFlexibility;
+ set
+ {
+ if (_isHighFlexibility != value)
+ {
+ _isHighFlexibility = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
///
/// 前连接物型号
///
- public string FrontConnectorModel { get; set; }
+ private string _frontConnectorModel;
+ public string FrontConnectorModel
+ {
+ get => _frontConnectorModel;
+ set
+ {
+ if (_frontConnectorModel != value)
+ {
+ _frontConnectorModel = value;
+ OnPropertyChanged();
+ }
+ }
+ }
///
/// 前连接物料号
///
- public string FrontConnectorMCode { get; set; }
+ private string _frontConnectorMCode;
+ public string FrontConnectorMCode
+ {
+ get => _frontConnectorMCode;
+ set
+ {
+ if (_frontConnectorMCode != value)
+ {
+ _frontConnectorMCode = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
///
/// 前连接物数量
///
- public int FrontConnectorQuantity { get; set; }
-
+ private int _frontConnectorQuantity;
+ public int FrontConnectorQuantity
+ {
+ get => _frontConnectorQuantity;
+ set
+ {
+ if (_frontConnectorQuantity != value)
+ {
+ _frontConnectorQuantity = value;
+ OnPropertyChanged();
+ }
+ }
+ }
///
/// 后连接物型号
///
- public string RearConnectorModel { get; set; }
+ private string _rearConnectorModel;
+ public string RearConnectorModel
+ {
+ get => _rearConnectorModel;
+ set
+ {
+ if (_rearConnectorModel != value)
+ {
+ _rearConnectorModel = value;
+ OnPropertyChanged();
+ }
+ }
+ }
///
/// 后连接物料号
///
- public string RearConnectorMCode { get; set; }
+ private string _rearConnectorMCode;
+ public string RearConnectorMCode
+ {
+ get => _rearConnectorMCode;
+ set
+ {
+ if (_rearConnectorMCode != value)
+ {
+ _rearConnectorMCode = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
///
/// 后连接物数量
///
- public int RearConnectorQuantity { get; set; }
+ private int _rearConnectorQuantity;
+ public int RearConnectorQuantity
+ {
+ get => _rearConnectorQuantity;
+ set
+ {
+ if (_rearConnectorQuantity != value)
+ {
+ _rearConnectorQuantity = value;
+ OnPropertyChanged();
+ }
+ }
+ }
///
/// 号码管型号
///
- public string NumberTubeModel { get; set; }
+ private string _numberTubeModel;
+ public string NumberTubeModel
+ {
+ get => _numberTubeModel;
+ set
+ {
+ if (_numberTubeModel != value)
+ {
+ _numberTubeModel = value;
+ OnPropertyChanged();
+ }
+ }
+ }
///
/// 号码管物料编码
///
- public string NumberTubeMCode { get; set; }
+ private string _numberTubeMCode;
+ public string NumberTubeMCode
+ {
+ get => _numberTubeMCode;
+ set
+ {
+ if (_numberTubeMCode != value)
+ {
+ _numberTubeMCode = value;
+ OnPropertyChanged();
+ }
+ }
+ }
///
/// 号码管长度
///
- public int NumberTubeLength { get; set; }
- public bool FrontConnectorIsPin { get; set; }
- public bool RearConnectorIsPin { get; set; }
+ private int _numberTubeLength;
+ public int NumberTubeLength
+ {
+ get => _numberTubeLength;
+ set
+ {
+ if (_numberTubeLength != value)
+ {
+ _numberTubeLength = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ private bool _frontConnectorIsPin;
+ public bool FrontConnectorIsPin
+ {
+ get => _frontConnectorIsPin;
+ set
+ {
+ if (_frontConnectorIsPin != value)
+ {
+ _frontConnectorIsPin = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ private bool _rearConnectorIsPin;
+ public bool RearConnectorIsPin
+ {
+ get => _rearConnectorIsPin;
+ set
+ {
+ if (_rearConnectorIsPin != value)
+ {
+ _rearConnectorIsPin = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
///
/// 透明热缩管型号
///
- public string TransparentHeatShrinkTubeModel { get; set; }
+ private string _transparentHeatShrinkTubeModel;
+ public string TransparentHeatShrinkTubeModel
+ {
+ get => _transparentHeatShrinkTubeModel;
+ set
+ {
+ if (_transparentHeatShrinkTubeModel != value)
+ {
+ _transparentHeatShrinkTubeModel = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
///
/// 透明热缩管标示
///
- public string TransparentHeatShrinkTubeDesc { get; set; }
+ private string _transparentHeatShrinkTubeDesc;
+ public string TransparentHeatShrinkTubeDesc
+ {
+ get => _transparentHeatShrinkTubeDesc;
+ set
+ {
+ if (_transparentHeatShrinkTubeDesc != value)
+ {
+ _transparentHeatShrinkTubeDesc = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
///
/// 透明热缩管物料编码
///
- public string TransparentHeatShrinkTubeMCode { get; set; }
+ private string _transparentHeatShrinkTubeMCode;
+ public string TransparentHeatShrinkTubeMCode
+ {
+ get => _transparentHeatShrinkTubeMCode;
+ set
+ {
+ if (_transparentHeatShrinkTubeMCode != value)
+ {
+ _transparentHeatShrinkTubeMCode = value;
+ OnPropertyChanged();
+ }
+ }
+ }
///
/// 黑色热缩管型号(插头)
///
- public string BlackHeatShrinkTubeModel { get; set; }
+ private string _blackHeatShrinkTubeModel;
+ public string BlackHeatShrinkTubeModel
+ {
+ get => _blackHeatShrinkTubeModel;
+ set
+ {
+ if (_blackHeatShrinkTubeModel != value)
+ {
+ _blackHeatShrinkTubeModel = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
///
/// 黑色热缩管物料编码(插头)
///
- public string BlackHeatShrinkTubeMCode { get; set; }
+ private string _blackHeatShrinkTubeMCode;
+ public string BlackHeatShrinkTubeMCode
+ {
+ get => _blackHeatShrinkTubeMCode;
+ set
+ {
+ if (_blackHeatShrinkTubeMCode != value)
+ {
+ _blackHeatShrinkTubeMCode = value;
+ OnPropertyChanged();
+ }
+ }
+ }
///
/// 黑色热缩管型号(剥线后)
///
- public string BlackHeatShrinkTubeModelAfterStripping { get; set; }
+ private string _blackHeatShrinkTubeModelAfterStripping;
+ public string BlackHeatShrinkTubeModelAfterStripping
+ {
+ get => _blackHeatShrinkTubeModelAfterStripping;
+ set
+ {
+ if (_blackHeatShrinkTubeModelAfterStripping != value)
+ {
+ _blackHeatShrinkTubeModelAfterStripping = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
///
/// 黑色热缩管物料编码(剥线后)
///
- public string BlackHeatShrinkTubeMCodeAfterStripping { get; set; }
+ private string _blackHeatShrinkTubeMCodeAfterStripping;
+ public string BlackHeatShrinkTubeMCodeAfterStripping
+ {
+ get => _blackHeatShrinkTubeMCodeAfterStripping;
+ set
+ {
+ if (_blackHeatShrinkTubeMCodeAfterStripping != value)
+ {
+ _blackHeatShrinkTubeMCodeAfterStripping = value;
+ OnPropertyChanged();
+ }
+ }
+ }
-
///
/// 热缩管标识
///
- public string HeatShrinkTubeDesc { get; set; }
+ private string _heatShrinkTubeDesc;
+ public string HeatShrinkTubeDesc
+ {
+ get => _heatShrinkTubeDesc;
+ set
+ {
+ if (_heatShrinkTubeDesc != value)
+ {
+ _heatShrinkTubeDesc = value;
+ OnPropertyChanged();
+ }
+ }
+ }
///
/// 前段子剥线长度
///
- public int FrontStrippingLength { get; set; }
+ private int _frontStrippingLength;
+ public int FrontStrippingLength
+ {
+ get => _frontStrippingLength;
+ set
+ {
+ if (_frontStrippingLength != value)
+ {
+ _frontStrippingLength = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
///
/// 后段子剥线长度
///
- public int RearStrippingLength { get; set; }
-
- public bool Layouted { get;set; }
+ private int _rearStrippingLength;
+ public int RearStrippingLength
+ {
+ get => _rearStrippingLength;
+ set
+ {
+ if (_rearStrippingLength != value)
+ {
+ _rearStrippingLength = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+ private bool _layouted;
+ public bool Layouted
+ {
+ get => _layouted;
+ set
+ {
+ if (_layouted != value)
+ {
+ _layouted = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+ private string _plugModel;
+ ///
+ /// 插头型号
+ ///
+ public string PlugModel
+ {
+ get => _plugModel;
+ set
+ {
+ if (_plugModel != value)
+ {
+ _plugModel = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+ private string _plugMCode;
+ ///
+ /// 插头料号
+ ///
+ public string PlugMCode
+ {
+ get => _plugMCode;
+ set
+ {
+ if (_plugMCode != value)
+ {
+ _plugMCode = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+ private int _plugQty;
+ ///
+ /// 插头数量
+ ///
+ public int PlugQty
+ {
+ get => _plugQty;
+ set
+ {
+ if (_plugQty != value)
+ {
+ _plugQty = value;
+ OnPropertyChanged();
+ }
+ }
+ }
private List _children = [];
public List Children
{
- get { return _children; }
- set { _children = value; }
+ get => _children;
+ set
+ {
+ if (_children != value)
+ {
+ _children = value;
+ OnPropertyChanged();
+ }
+ }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/LayoutHelper/MultiCoreWireLayoutHelperWindow.xaml b/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/LayoutHelper/MultiCoreWireLayoutHelperWindow.xaml
index edc6546..a16aabc 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/LayoutHelper/MultiCoreWireLayoutHelperWindow.xaml
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/LayoutHelper/MultiCoreWireLayoutHelperWindow.xaml
@@ -52,40 +52,79 @@
+ VirtualizingPanel.ScrollUnit="Pixel">
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
@@ -273,6 +280,26 @@
ItemsSource="{Binding WireModelSpecifications}"
SelectedValue="{Binding WireModelSpecification}" />
+
+
+
+
+
+
+
-
+
+
-
@@ -422,7 +461,7 @@
-
+
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/MultiCoreWireWindow.xaml.cs b/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/MultiCoreWireWindow.xaml.cs
index 4b65973..d70c078 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/MultiCoreWireWindow.xaml.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/MultiCoreWireWindow.xaml.cs
@@ -63,6 +63,10 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
layoutWindow.Show();
this.Close();
}
-
+
+ private void ExportBtn_Click(object sender, RoutedEventArgs e)
+ {
+ viewModel.ExportLines();
+ }
}
}
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MultiCoreWireViewModel/MultiCoreWireLayoutHelperViewModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MultiCoreWireViewModel/MultiCoreWireLayoutHelperViewModel.cs
index 1bd6487..7d00546 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MultiCoreWireViewModel/MultiCoreWireLayoutHelperViewModel.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MultiCoreWireViewModel/MultiCoreWireLayoutHelperViewModel.cs
@@ -59,6 +59,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
{
_currentFlexDesigner.SelectSet.SelectionChanged += SelectSet_SelectionChanged;
}
+ LecWires = [];
LoadData();
}
private void SelectSet_SelectionChanged(object sender, EventArgs e)
@@ -104,19 +105,26 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
if (linePart != null)
{
var libName = linePart?.LibraryName;
+ var name = linePart.Name;
// 绝缘层选择上一层的导线来获取信息
if (part is OccCablesInsulatorGraph)
{
libName = (part.Parents?.First() as OccCableForked).LibraryName;
+ name = (part.Parents?.First() as OccCableForked).Name;
//partLineModel = (part.Parents?.First() as OccCableForked).LibraryName.Split('&')[1];
}
if(LecWires.Any(it =>it.WireModelSpecification == libName))
{
- var wire = LecWires.FirstOrDefault(it => it.WireModelSpecification == libName && !it.Layouted);
+ var wire = LecWires.FirstOrDefault(it =>
+ it.WireModelSpecification == libName
+ && name == $"{it.ApplicationScenario}-{it.WireKey}"
+ && !it.Layouted);
if(wire != null)
{
wire.Layouted = true;
_service.UpdateWireIsLayout(wire.Id);
+ OnPropertyChanged(nameof(LecWires));
+ OnPropertyChanged("Layouted");
}
}
}
@@ -194,6 +202,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
private void UpdatePropNotify()
{
+ OnPropertyChanged(nameof(LecWires));
OnPropertyChanged(nameof(ApplicationScenario));
OnPropertyChanged(nameof(HasPrev));
OnPropertyChanged(nameof(HasNext));
@@ -210,7 +219,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
OnPropertyChanged(nameof(ApplicationScenario));
}
}
- private ObservableCollection _lecWires = [];
+ private ObservableCollection _lecWires;
public ObservableCollection LecWires
{
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MultiCoreWireViewModel/MultiCoreWireViewModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MultiCoreWireViewModel/MultiCoreWireViewModel.cs
index db58045..991fdc9 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MultiCoreWireViewModel/MultiCoreWireViewModel.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MultiCoreWireViewModel/MultiCoreWireViewModel.cs
@@ -4,7 +4,9 @@ using EPLAN.Harness.Core.Utils;
using EPLAN.Harness.ProjectCore;
using EPLAN.Harness.ProjectCore.Occurrences.Designer;
using HandyControl.Controls;
+using MiniExcelLibs;
using MiniExcelLibs.Attributes;
+using MiniExcelLibs.OpenXml;
using Sinvo.EplanHpD.Plugin.Service;
using Sinvo.EplanHpD.Plugin.Service.Model;
using Sinvo.EplanHpD.Plugin.WPFUI.Models;
@@ -56,6 +58,34 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
}
+ private string _mechanismNo;
+ ///
+ /// 机构号
+ ///
+ public string MechanismNo
+ {
+ get => _mechanismNo;
+ set
+ {
+ _mechanismNo = value;
+ OnPropertyChanged(nameof(MechanismNo));
+ }
+ }
+ private string _mechanismName;
+ ///
+ /// 机构名称
+ ///
+ public string MechanismName
+ {
+ get => _mechanismName;
+ set
+ {
+ _mechanismName = value;
+ OnPropertyChanged(nameof(MechanismName));
+ }
+ }
+
+
private string _applicationScenario;
///
/// 应用场景
@@ -457,6 +487,21 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
OnPropertyChanged(nameof(RearConnectorCount));
}
}
+
+
+ private string _wireColorName;
+ ///
+ /// 线材外皮颜色
+ ///
+ public string WireColorName
+ {
+ get => _wireColorName;
+ set
+ {
+ _wireColorName = value;
+ OnPropertyChanged(nameof(WireColorName));
+ }
+ }
#endregion
@@ -485,22 +530,8 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
{
wiresData.ForEach(wire =>
{
- LecWires.Add(new MultiCoreWireDataModel
- {
- Id = wire.Id,
- SeqNo = wire.SeqNo,
- ApplicationScenario = wire.ApplicationScenario,
- WireKey = Wirekey,
- WireDiameterSpecification = wire.WireDiameterSpecification,
- IsHighFlexibilityStr = wire.IsHighFlexibilityStr,
- WireCoreCount = wire.WireCoreCount,
- WireModelSpecification = wire.WireModelSpecification,
- FrontConnectorModel = wire.FrontConnectorModel,
- RearConnectorModel = wire.RearConnectorModel,
- UserId = wire.UserId,
- ProjectName = wire.ProjectName,
- UniqueKey = wire.UniqueKey
- });
+ var wiredata = MapperUtil.MapFor(wire);
+ LecWires.Add(wiredata);
});
}
}
@@ -560,12 +591,6 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
HighFlexibilitys = [.. datas.Where(it => !string.IsNullOrEmpty(it.IsHighFlexibilityStr)).Select(it => it.IsHighFlexibilityStr).Distinct(), ""];
WireCores = [.. datas.Where(it => !string.IsNullOrEmpty(it.WireCoreCount)).Select(it => it.WireCoreCount).Distinct(), ""];
- //if (WireCores.Where(it => !string.IsNullOrEmpty(it)).Count() == 1 && propName != nameof(WireCoreCount))
- //{
- // WireCoreCount = WireCores.FirstOrDefault();
- //}
- //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(), ""];
WireModelSpecifications = [.. datas.Where(it => !string.IsNullOrEmpty(it.WireModelSpecification)).Select(it => it.WireModelSpecification).Distinct(), ""];
if (WireModelSpecifications.Where(it => !string.IsNullOrEmpty(it)).Count() == 1 && propName != nameof(WireModelSpecification))
{
@@ -585,27 +610,29 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
var des = FlexProject.CurrentProject.GetDesigners().FirstOrDefault(it => it.ID == _docId) ?? throw new Exception("设计器不存在");
var cables = des.GetOrganizerOccurrences(_docId, typeof(OccCableForked));
Wires?.Clear();
- cables.Where(it => it.Name?.StartsWith("信号线") ?? false).ForEach(it =>
+ cables.Where(it => StartWithApplicationScenario(it.Name)).ForEach(it =>
{
var wireData = new MultiCoreWireDataModel
{
WireModelSpecification = $"{it.Name} / {it.LibraryName}"
- };
- //Debug.WriteLine($"{it.Name} - {it.LibraryName}");
+ };
+ if(LecWires != null && !LecWires.Any(i => $"{i.ApplicationScenario}-{i.WireKey}" == it.Name && i.WireModelSpecification == it.LibraryName))
+ {
+ wireData.IsError = true;
+ wireData.CheckedMsg = "无法匹配选型数据!";
+ wireData.IsChecked = true;
+ }
if (it.Children?.Any() ?? false)
{
it.Children.ForEach(c =>
- {
- //Debug.WriteLine($"\t{c.Name} - {c.LibraryName}");
+ {
if (c.Children?.Any() ?? false)
{
c.Children.Where(ccc => ccc is OccWire).ForEach(cc =>
{
if (cc is OccWire wire)
{
- //var color = materials.Where(col => col == wire.Color)
- //Debug.WriteLine($"\t\t{wire.Name} - {wire.LibraryName} - {FlexColors.GetName(wire.Color.Major)}");
- wireData.Children.Add(new MultiCoreWireDataModel
+ var wireItem = new MultiCoreWireDataModel
{
WireModelSpecification = wire.Name,
WireColorName = FlexColors.GetName(wire.Color.Major) + (FlexColors.GetName(wire.Color.Minor) == "未设置" ? "" : " " + FlexColors.GetName(wire.Color.Minor)),
@@ -614,7 +641,9 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
IsMultiColor = wire.Color.Major.IsValid() && wire.Color.Minor.IsValid(),
FrontConnectorModel = wire.GetEndingPins()?.FirstOrDefault()?.Parents?.FirstOrDefault()?.LibraryName,
RearConnectorModel = wire.GetEndingPins()?.LastOrDefault()?.Parents?.FirstOrDefault()?.LibraryName
- });
+ };
+
+ wireData.Children.Add(wireItem);
}
});
}
@@ -624,6 +653,18 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
});
return Task.CompletedTask;
}
+
+ public bool StartWithApplicationScenario(string wireName)
+ {
+ if(ApplicationScenarios != null && ApplicationScenarios.Any())
+ {
+ return ApplicationScenarios.Where(it => !string.IsNullOrEmpty(it)).Any(wireName.StartsWith);
+ }
+ else
+ {
+ return false;
+ }
+ }
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged(string propertyName)
{
@@ -641,8 +682,11 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
WireModelSpecification = "";
FrontConnectorType = "";
RearConnectorType = "";
-
+ FrontConnectorModel = "";
+ RearConnectorModel = "";
LecChanging = false;
+ Wirekey = "";
+ WireColorName = "";
OnLecChanged("");
}
@@ -664,6 +708,11 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
HandyControl.Controls.MessageBox.Show("不能两头都是插头!", caption: "提示", icon: MessageBoxImage.Warning);
return;
}
+ if(RearConnectorCount == 0 || FrontConnectorCount == 0)
+ {
+ HandyControl.Controls.MessageBox.Show("连接物数量不能为0!", caption: "提示", icon: MessageBoxImage.Warning);
+ return;
+ }
if (LecWires.Any(it => it.ApplicationScenario == ApplicationScenario && it.WireModelSpecification == WireModelSpecification
&& it.FrontConnectorModel == FrontConnectorModel && it.RearConnectorModel == RearConnectorModel))
{
@@ -700,6 +749,8 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
RearConnectorMCode = rearConnectorMCode,
RearConnectorIsPin = RearConnectorType == "端子",
+ WireColorName = WireColorName,
+
UserId = PluginServices.user.ID,
ProjectName = LectotypeManager.CURRENT_DOC_NAME,
UniqueKey = $"{LectotypeManager.CURRENT_DOC_NAME}_{PluginServices.user.ID}"
@@ -722,8 +773,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
}
if (!wire.RearConnectorIsPin)
- {
- // 获取插头信息
+ {
// 获取插头信息
var connectorInfo = MultiCoreWireExcelHelper.Instance.GetConnectorHeatShrinkMappingDatas(wire.RearConnectorModel);
if (connectorInfo != null)
@@ -764,6 +814,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
}
}).ContinueWith(x =>
{
+ // TODO Save line data
//_service.SaveData(new MultiCoreWireLecDBModel
//{
// Id = wire.Id,
@@ -784,9 +835,12 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
// RearConnectorQuantity = wire.RearConnectorQuantity
//});
+ var wireData = MapperUtil.MapFor(wire);
Application.Current.Dispatcher.BeginInvoke(() =>
{
+ _service.SaveData(wireData);
LecWires.Add(wire);
+ ClearLecData();
OnPropertyChanged(nameof(LecWires));
});
});
@@ -802,6 +856,11 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
{
try
{
+ var result = HandyControl.Controls.MessageBox.Show($"是否清除数据?", "提示", button: MessageBoxButton.YesNo);
+ if (result != MessageBoxResult.Yes)
+ {
+ return;
+ }
LecWires.Clear();
_service.ClearSelf(CurrUniqueKey);
}
@@ -829,9 +888,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
HandyControl.Controls.MessageBox.Error($"删除数据失败!{ex}");
}
- }
-
- //ReOrderLecWires();
+ }
}
}
@@ -862,15 +919,26 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
OnFrontConnectorTypeModels(FrontConnectorType);
OnRearConnectorTypeChange(RearConnectorType);
}
- //private void ReOrderLecWires()
- //{
- // int seq = 1;
- // LecWires.OrderBy(it => it.SeqNo).ForEach(it =>
- // {
- // it.SeqNo = seq;
- // seq++;
- // });
- // OnPropertyChanged(nameof(LecWires));
- //}
+
+ public void ExportLines()
+ {
+ if(string.IsNullOrEmpty(MechanismNo) || string.IsNullOrEmpty(MechanismName))
+ {
+ HandyControl.Controls.MessageBox.Show("机构号或机构名称不能为空!", caption: "提示", icon: MessageBoxImage.Warning);
+ return;
+ }
+ MiniExcel.SaveAsByTemplate("D:\\Desktop\\123.xlsx", "D:\\Desktop\\EPLAN\\多芯线\\副本多芯线下单模板_测试.xlsx", new
+ {
+ data = new List {
+ new { MechanismNo, MechanismName, WireModelStr= '1' },
+ new { MechanismNo, MechanismName, WireModelStr= '2' },
+ new { MechanismNo, MechanismName, WireModelStr= '3' }
+ }
+ },new OpenXmlConfiguration
+ {
+ FillMergedCells = true
+ });
+
+ }
}
}