diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/ConnectorHeatShrinkMapping.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/ConnectorHeatShrinkMapping.cs
new file mode 100644
index 0000000..01d05c2
--- /dev/null
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/ConnectorHeatShrinkMapping.cs
@@ -0,0 +1,71 @@
+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 ConnectorHeatShrinkMapping
+ {
+ /*
+ 序号 料号 品名 规格(CE认证) 对应CAD图纸规格 针脚数量 热缩管规格 热缩管物料编码 热缩管长度(mm)
+ */
+
+ ///
+ /// 序号
+ ///
+ [ExcelColumn(Name = "序号")]
+ public int SequenceNumber { get; set; }
+
+ ///
+ /// 料号
+ ///
+ [ExcelColumn(Name = "料号")]
+ public string MaterialCode { get; set; }
+
+ ///
+ /// 品名
+ ///
+ [ExcelColumn(Name = "品名")]
+ public string ProductName { get; set; }
+
+ ///
+ /// 规格(CE认证)
+ ///
+ [ExcelColumn(Name = "规格(CE认证)")]
+ public string CESpecification { get; set; }
+
+ ///
+ /// 对应CAD图纸规格
+ ///
+ [ExcelColumn(Name = "对应CAD图纸规格")]
+ public string CADDrawingSpecification { get; set; }
+
+ ///
+ /// 针脚数量
+ ///
+ [ExcelColumn(Name = "针脚数量")]
+ public int PinCount { get; set; }
+
+ ///
+ /// 热缩管规格
+ ///
+ [ExcelColumn(Name = "热缩管规格")]
+ public string HeatShrinkTubeSpecification { get; set; }
+
+ ///
+ /// 热缩管物料编码
+ ///
+ [ExcelColumn(Name = "热缩管物料编码")]
+ public string HeatShrinkTubeMaterialCode { get; set; }
+
+ ///
+ /// 热缩管长度(mm)
+ ///
+ [ExcelColumn(Name = "热缩管长度(mm)")]
+ public double HeatShrinkTubeLength { get; set; }
+
+ }
+}
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireDataModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireDataModel.cs
index f381646..6e5218d 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireDataModel.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireDataModel.cs
@@ -1,4 +1,5 @@
-using System;
+using MiniExcelLibs.Attributes;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -8,6 +9,19 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
{
public class MultiCoreWireDataModel
{
+
+ 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 string WireKey { get; set; }
+ public string ApplicationScenario { get; set; }
+ public string WireDiameterSpecification { get; set; }
+ public string IsHighFlexibilityStr { get; set; }
+ public string WireCoreCount { get; set; }
+
///
/// 引脚编号
///
@@ -68,6 +82,69 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
///
public int RearConnectorQuantity { get; set; }
+ ///
+ /// 号码管型号
+ ///
+ public string NumberTubeModel { get; set; }
+
+ ///
+ /// 号码管物料编码
+ ///
+ public string NumberTubeMCode { get; set; }
+
+ ///
+ /// 号码管长度
+ ///
+ public int NumberTubeLength { get; set; }
+ public bool FrontConnectorIsPin { get; set; }
+ public bool RearConnectorIsPin { get; set; }
+ ///
+ /// 透明热缩管型号
+ ///
+ public string TransparentHeatShrinkTubeModel { get; set; }
+ ///
+ /// 透明热缩管标示
+ ///
+ public string TransparentHeatShrinkTubeDesc { get; set; }
+ ///
+ /// 透明热缩管物料编码
+ ///
+ public string TransparentHeatShrinkTubeMCode { get; set; }
+
+ ///
+ /// 黑色热缩管型号(插头)
+ ///
+ public string BlackHeatShrinkTubeModel { get; set; }
+ ///
+ /// 黑色热缩管物料编码(插头)
+ ///
+ public string BlackHeatShrinkTubeMCode { get; set; }
+
+ ///
+ /// 黑色热缩管型号(剥线后)
+ ///
+ public string BlackHeatShrinkTubeModelAfterStripping { get; set; }
+ ///
+ /// 黑色热缩管物料编码(剥线后)
+ ///
+ public string BlackHeatShrinkTubeMCodeAfterStripping { get; set; }
+
+
+ ///
+ /// 热缩管标识
+ ///
+ public string HeatShrinkTubeDesc { get; set; }
+
+ ///
+ /// 前段子剥线长度
+ ///
+ public int FrontStrippingLength { get; set; }
+ ///
+ /// 后段子剥线长度
+ ///
+ public int RearStrippingLength { get; set; }
+
+ public bool Layouted { get;set; }
private List _children = [];
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireLecModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireExcelModel.cs
similarity index 88%
rename from Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireLecModel.cs
rename to Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireExcelModel.cs
index 6ffbf1b..b8d5d7a 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireLecModel.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireExcelModel.cs
@@ -10,31 +10,13 @@ using System.Threading.Tasks;
namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
{
- public class MultiCoreWireLecModel : INotifyPropertyChanged
+ public class MultiCoreWireExcelModel : INotifyPropertyChanged
{
/*
* 应用场景 类型 线径规格(mm2) 是否高柔 线芯数 线材型号规格 插头型号 前端子型号 后端子型号
*/
- 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; }
- private int _seqNo;
- [ExcelColumn(Ignore = true)]
- public int SeqNo
- {
- get => _seqNo;
- set
- {
- _seqNo = value;
- OnPropertyChanged(nameof(SeqNo));
- }
- }
+
///
/// 应用场景
@@ -81,6 +63,14 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
}
}
+ /*号码管/热缩管型号 号码管物料编码*/
+
+ [ExcelColumn(Name = "号码管/热缩管型号")]
+ public string NumberTubeModel { get; set; }
+
+
+ [ExcelColumn(Name = "号码管物料编码")]
+ public string NumberTubeMCode { get; set; }
///
/// 是否高柔
///
@@ -175,9 +165,9 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
///
/// 叉耳端子剥线长度(mm)
///
- private double _forkTerminalStripLength;
+ private int _forkTerminalStripLength;
[ExcelColumn(Name = "叉耳端子剥线长度(mm)")]
- public double ForkTerminalStripLength
+ public int ForkTerminalStripLength
{
get => _forkTerminalStripLength;
set
@@ -223,9 +213,9 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
///
/// 扁形端子剥线长度(mm)
///
- private double _flatTerminalStripLength;
+ private int _flatTerminalStripLength;
[ExcelColumn(Name = "扁形端子剥线长度(mm)")]
- public double FlatTerminalStripLength
+ public int FlatTerminalStripLength
{
get => _flatTerminalStripLength;
set
@@ -271,9 +261,9 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
///
/// O型端子剥线长度(mm)
///
- private double _oTypeTerminalStripLength;
+ private int _oTypeTerminalStripLength;
[ExcelColumn(Name = "O型端子剥线长度(mm)")]
- public double OTypeTerminalStripLength
+ public int OTypeTerminalStripLength
{
get => _oTypeTerminalStripLength;
set
@@ -319,9 +309,9 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
///
/// 针型端子剥线长度(mm)
///
- private double _pinTerminalStripLength;
+ private int _pinTerminalStripLength;
[ExcelColumn(Name = "针型端子剥线长度(mm)")]
- public double PinTerminalStripLength
+ public int PinTerminalStripLength
{
get => _pinTerminalStripLength;
set
@@ -367,9 +357,9 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
///
/// Y形端子剥线长度(mm)
///
- private double _yTypeTerminalStripLength;
+ private int _yTypeTerminalStripLength;
[ExcelColumn(Name = "Y形端子剥线长度(mm)")]
- public double YTypeTerminalStripLength
+ public int YTypeTerminalStripLength
{
get => _yTypeTerminalStripLength;
set
@@ -507,39 +497,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
}
-
- private int _frontConnectorCount;
- ///
- ///
- [ExcelColumn(Ignore = true)]
- public int FrontConnectorQuantity
- {
- get => _frontConnectorCount;
- set
- {
- _frontConnectorCount = value;
- OnPropertyChanged(nameof(FrontConnectorQuantity));
- }
- }
- private int _rearConnectorQuantity;
- ///
- ///
- [ExcelColumn(Ignore = true)]
- public int RearConnectorQuantity
- {
- get => _rearConnectorQuantity;
- set
- {
- _rearConnectorQuantity = value;
- OnPropertyChanged(nameof(RearConnectorQuantity));
- }
- }
-
- ///
- /// 号码管型号
- ///
- public string NumberTubeModel { get; set; }
-
+
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged(string propertyName)
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireTerminalModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireTerminalModel.cs
index 0820bb7..ccd4f64 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireTerminalModel.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/MultiCoreWireTerminalModel.cs
@@ -16,7 +16,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models.MultiCoreWire
///
/// 端子剥线长度(mm)
- public double TerminalStripLength { get; set; }
+ public int TerminalStripLength { get; set; }
///
/// 端子物料编码
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/WireHeatShrinkMapping.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/WireHeatShrinkMapping.cs
new file mode 100644
index 0000000..7909c10
--- /dev/null
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MultiCoreWire/WireHeatShrinkMapping.cs
@@ -0,0 +1,46 @@
+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 WireHeatShrinkMapping
+ {
+ /*
+ 线材型号 透明热缩管型号 热缩管物料编码 热缩管型号 热缩管物料编码
+ */
+
+ ///
+ /// 线材型号
+ ///
+ [ExcelColumn(Name = "线材型号")]
+ public string WireModelSpecification { get; set; }
+
+ ///
+ /// 透明热缩管型号
+ ///
+ [ExcelColumn(Name = "透明热缩管型号")]
+ public string TransparentHeatShrinkTubeModel { get; set; }
+
+ ///
+ /// 透明热缩管物料编码
+ ///
+ [ExcelColumn(Name = "透明热缩管物料编码")]
+ public string TransparentHeatShrinkTubeMaterialCode { get; set; }
+
+ ///
+ /// 黑色热缩管型号
+ ///
+ [ExcelColumn(Name = "黑色热缩管型号")]
+ public string BlackHeatShrinkTubeModel { get; set; }
+
+ ///
+ /// 黑色热缩管物料编码
+ ///
+ [ExcelColumn(Name = "黑色热缩管物料编码")]
+ public string BlackHeatShrinkTubeMaterialCode { 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 bf5b959..1e10a78 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/Sinvo.EplanHpD.Plugin.WPFUI.csproj
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/Sinvo.EplanHpD.Plugin.WPFUI.csproj
@@ -254,7 +254,9 @@
+
+
@@ -292,7 +294,7 @@
-
+
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Utils/MultiCoreWireExcelHelper.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Utils/MultiCoreWireExcelHelper.cs
index 27997bd..9bcde6f 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/Utils/MultiCoreWireExcelHelper.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/Utils/MultiCoreWireExcelHelper.cs
@@ -1,5 +1,6 @@
using MiniExcelLibs;
using Sinvo.EplanHpD.Plugin.WPFUI.Models;
+using Sinvo.EplanHpD.Plugin.WPFUI.Models.MultiCoreWire;
using System;
using System.Collections.Generic;
using System.IO;
@@ -28,7 +29,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
}
}
- public IEnumerable GetMultiCoreWireLecDatas()
+ public IEnumerable GetMultiCoreWireLecDatas()
{
if (dataFileStream == null || !dataFileStream.CanRead)
{
@@ -36,10 +37,35 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
ReadDataToStream();
}
//var filePath = "D:\\旧电脑文件\\Desktop\\Data\\三菱伺服HK-KT线材选型BOM表_按程序格式整理后.xlsx";
- var data = MiniExcel.Query(dataFileStream,sheetName: "多芯线WPS数据配对");
+ var data = MiniExcel.Query(dataFileStream,sheetName: "多芯线WPS数据配对");
+ //MiniExcel.Query()
+ return data;
+ }
+ public ConnectorHeatShrinkMapping GetConnectorHeatShrinkMappingDatas(string connectorModel)
+ {
+ if (dataFileStream == null || !dataFileStream.CanRead)
+ {
+ // 未初始化或是无法读取时,重试一次
+ ReadDataToStream();
+ }
+ //var filePath = "D:\\旧电脑文件\\Desktop\\Data\\三菱伺服HK-KT线材选型BOM表_按程序格式整理后.xlsx";
+ var data = MiniExcel.Query(dataFileStream, sheetName: "插头对应热缩管")
+ .FirstOrDefault(it => it.ProductName == connectorModel);
+ //MiniExcel.Query()
+ return data;
+ }
+ public WireHeatShrinkMapping GetWireHeatShrinkMappingDatas(string wireModelSpecification)
+ {
+ if (dataFileStream == null || !dataFileStream.CanRead)
+ {
+ // 未初始化或是无法读取时,重试一次
+ ReadDataToStream();
+ }
+ //var filePath = "D:\\旧电脑文件\\Desktop\\Data\\三菱伺服HK-KT线材选型BOM表_按程序格式整理后.xlsx";
+ var data = MiniExcel.Query(dataFileStream, sheetName: "线材对应热缩管")
+ .FirstOrDefault(it => it.WireModelSpecification == wireModelSpecification);
//MiniExcel.Query()
return data;
}
-
}
}
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/MultiCoreWireWindow.xaml b/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/MultiCoreWireWindow.xaml
index 84a98c8..6ad6ab4 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/MultiCoreWireWindow.xaml
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/MultiCoreWire/MultiCoreWireWindow.xaml
@@ -159,7 +159,7 @@
+ Text="{Binding Wirekey}" />
@@ -234,14 +234,14 @@
-
+
@@ -324,10 +324,12 @@
-
-
-
-
+
+
+
+
+
+
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MultiCoreWireViewModel/MultiCoreWireLayoutHelperViewModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MultiCoreWireViewModel/MultiCoreWireLayoutHelperViewModel.cs
index 911143f..1bd6487 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MultiCoreWireViewModel/MultiCoreWireLayoutHelperViewModel.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MultiCoreWireViewModel/MultiCoreWireLayoutHelperViewModel.cs
@@ -29,7 +29,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
private FlexDesigner _currentFlexDesigner;
private List ApplicationScenarios = [];
public int ApplicationScenarioIndex = 0;
- private List _wireData = [];
+ private List _wireData = [];
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged(string propertyName)
{
@@ -43,7 +43,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
UpdatePropNotify();
wireDatas.ForEach(wire =>
{
- _wireData.Add(MapperUtil.MapFor(wire));
+ _wireData.Add(MapperUtil.MapFor(wire));
});
_wireData.Where(wire => wire.ApplicationScenario == ApplicationScenario).ForEach(LecWires.Add);
@@ -210,9 +210,9 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
OnPropertyChanged(nameof(ApplicationScenario));
}
}
- private ObservableCollection _lecWires = [];
+ private ObservableCollection _lecWires = [];
- public ObservableCollection LecWires
+ public ObservableCollection LecWires
{
get { return _lecWires; }
set
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MultiCoreWireViewModel/MultiCoreWireViewModel.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MultiCoreWireViewModel/MultiCoreWireViewModel.cs
index 0efd87a..db58045 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MultiCoreWireViewModel/MultiCoreWireViewModel.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MultiCoreWireViewModel/MultiCoreWireViewModel.cs
@@ -20,7 +20,6 @@ using System.ComponentModel;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
-using System.Windows.Forms;
namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
{
@@ -44,9 +43,9 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
}
}
- private ObservableCollection _lecWires = [];
+ private ObservableCollection _lecWires = [];
- public ObservableCollection LecWires
+ public ObservableCollection LecWires
{
get { return _lecWires; }
set
@@ -461,11 +460,22 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
#endregion
- private IEnumerable _datas;
+ private IEnumerable _datas;
+
public void LoadLecData()
{
- _datas = _dataHelper.GetMultiCoreWireLecDatas();
+ try
+ {
+ _datas = _dataHelper.GetMultiCoreWireLecDatas();
+
+
+ }
+ catch (Exception ex)
+ {
+ HandyControl.Controls.MessageBox.Show(ex.Message);
+ return;
+ }
SetDatas(_datas);
try
{
@@ -475,7 +485,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
{
wiresData.ForEach(wire =>
{
- LecWires.Add(new MultiCoreWireLecModel
+ LecWires.Add(new MultiCoreWireDataModel
{
Id = wire.Id,
SeqNo = wire.SeqNo,
@@ -528,7 +538,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
SetDatas(canUsedDatas, propName,true);
}
- private void SetDatas(IEnumerable datas, string propName = "",bool isLecChange = false)
+ private void SetDatas(IEnumerable datas, string propName = "",bool isLecChange = false)
{
if (datas != null)
{
@@ -649,6 +659,11 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
HandyControl.Controls.MessageBox.Show("有信息未选择!",caption: "提示",icon: MessageBoxImage.Warning);
return;
}
+ if(RearConnectorType == "插头" && FrontConnectorType == "插头")
+ {
+ HandyControl.Controls.MessageBox.Show("不能两头都是插头!", caption: "提示", icon: MessageBoxImage.Warning);
+ return;
+ }
if (LecWires.Any(it => it.ApplicationScenario == ApplicationScenario && it.WireModelSpecification == WireModelSpecification
&& it.FrontConnectorModel == FrontConnectorModel && it.RearConnectorModel == RearConnectorModel))
{
@@ -666,11 +681,12 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
- var wire = new MultiCoreWireLecModel
+ var wire = new MultiCoreWireDataModel
{
Id = Guid.NewGuid().ToString(),
SeqNo = LecWires.Count + 1,
ApplicationScenario = ApplicationScenario,
+ WireKey = Wirekey,
WireDiameterSpecification = WireDiameterSpecification,
IsHighFlexibilityStr = HighFlexibility,
WireCoreCount = WireCoreCount,
@@ -678,36 +694,103 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
FrontConnectorModel = FrontConnectorModel,
FrontConnectorQuantity = FrontConnectorCount,
FrontConnectorMCode = frontConnectorMCode,
-
+ FrontConnectorIsPin = FrontConnectorType == "端子",
RearConnectorModel = RearConnectorModel,
RearConnectorQuantity = RearConnectorCount,
RearConnectorMCode = rearConnectorMCode,
-
+ RearConnectorIsPin = RearConnectorType == "端子",
+
UserId = PluginServices.user.ID,
ProjectName = LectotypeManager.CURRENT_DOC_NAME,
UniqueKey = $"{LectotypeManager.CURRENT_DOC_NAME}_{PluginServices.user.ID}"
};
-
- _service.SaveData(new MultiCoreWireLecDBModel
+ Task.Factory.StartNew(() =>
{
- Id = wire.Id,
- UniqueKey = wire.UniqueKey,
- ProjectName = wire.ProjectName,
- UserId = wire.UserId,
- SeqNo = wire.SeqNo,
- ApplicationScenario = wire.ApplicationScenario,
- WireDiameterSpecification = wire.WireDiameterSpecification,
- IsHighFlexibilityStr = wire.IsHighFlexibilityStr,
- WireCoreCount = wire.WireCoreCount,
- WireModelSpecification = wire.WireModelSpecification,
+ try
+ {
- FrontConnectorModel = wire.FrontConnectorModel,
- FrontConnectorQuantity = wire.FrontConnectorQuantity,
- RearConnectorModel = wire.RearConnectorModel,
- RearConnectorQuantity = wire.RearConnectorQuantity
+ if (!wire.FrontConnectorIsPin)
+ {
+ // 获取插头信息
+ var connectorInfo = MultiCoreWireExcelHelper.Instance.GetConnectorHeatShrinkMappingDatas(wire.FrontConnectorModel);
+ if (connectorInfo != null)
+ {
+ wire.BlackHeatShrinkTubeMCode = connectorInfo.HeatShrinkTubeSpecification;
+ wire.BlackHeatShrinkTubeMCode = connectorInfo.HeatShrinkTubeMaterialCode;
+ //wire.bla
+ }
+ }
+ if (!wire.RearConnectorIsPin)
+ {
+ // 获取插头信息
+ // 获取插头信息
+ var connectorInfo = MultiCoreWireExcelHelper.Instance.GetConnectorHeatShrinkMappingDatas(wire.RearConnectorModel);
+ if (connectorInfo != null)
+ {
+ wire.BlackHeatShrinkTubeModel = connectorInfo.HeatShrinkTubeSpecification;
+ wire.BlackHeatShrinkTubeMCode = connectorInfo.HeatShrinkTubeMaterialCode;
+ //wire.bla
+ }
+ }
+ // 获取透明热缩管 、黑色热缩管
+ var heatShrinkTubeInfo = MultiCoreWireExcelHelper.Instance.GetWireHeatShrinkMappingDatas(wire.WireModelSpecification);
+ if(heatShrinkTubeInfo != null)
+ {
+ wire.TransparentHeatShrinkTubeModel = heatShrinkTubeInfo.TransparentHeatShrinkTubeModel;
+ wire.TransparentHeatShrinkTubeMCode = heatShrinkTubeInfo.TransparentHeatShrinkTubeMaterialCode;
+ wire.BlackHeatShrinkTubeModelAfterStripping = heatShrinkTubeInfo.BlackHeatShrinkTubeModel;
+ wire.BlackHeatShrinkTubeMCodeAfterStripping = heatShrinkTubeInfo.BlackHeatShrinkTubeMaterialCode;
+ }
+ var wireData = _datas.Where(it => it.WireModelSpecification == wire.WireModelSpecification).FirstOrDefault();
+ if (wireData != null)
+ {
+ wire.NumberTubeModel = wireData.NumberTubeModel;
+ wire.NumberTubeMCode = wireData.NumberTubeMCode;
+ if (wire.FrontConnectorIsPin)
+ {
+ wire.FrontStrippingLength = wireData.TerminalModels.FirstOrDefault(it => it.TerminalModel == wire.FrontConnectorModel)?.TerminalStripLength ?? 0;
+ }
+ if (wire.RearConnectorIsPin)
+ {
+ wire.RearStrippingLength = wireData.TerminalModels.FirstOrDefault(it => it.TerminalModel == wire.RearConnectorModel)?.TerminalStripLength ?? 0;
+ }
+ }
+
+ }
+ catch (Exception ex)
+ {
+ HandyControl.Controls.MessageBox.Show(ex.Message);
+ }
+ }).ContinueWith(x =>
+ {
+ //_service.SaveData(new MultiCoreWireLecDBModel
+ //{
+ // Id = wire.Id,
+ // UniqueKey = wire.UniqueKey,
+ // ProjectName = wire.ProjectName,
+ // UserId = wire.UserId,
+ // SeqNo = wire.SeqNo,
+ // ApplicationScenario = wire.ApplicationScenario,
+
+ // WireDiameterSpecification = wire.WireDiameterSpecification,
+ // IsHighFlexibilityStr = wire.IsHighFlexibilityStr,
+ // WireCoreCount = wire.WireCoreCount,
+ // WireModelSpecification = wire.WireModelSpecification,
+
+ // FrontConnectorModel = wire.FrontConnectorModel,
+ // FrontConnectorQuantity = wire.FrontConnectorQuantity,
+ // RearConnectorModel = wire.RearConnectorModel,
+ // RearConnectorQuantity = wire.RearConnectorQuantity
+
+ //});
+ Application.Current.Dispatcher.BeginInvoke(() =>
+ {
+ LecWires.Add(wire);
+ OnPropertyChanged(nameof(LecWires));
+ });
});
- LecWires.Add(wire);
+
}
catch (Exception ex)
{