105040
增强多芯线数据模型的灵活性和可扩展性 在 `MultiCoreWireDataModel.cs` 中添加多个新属性以扩展数据模型。删除 `MultiCoreWireLecModel` 类并用 `MultiCoreWireExcelModel` 替换,更新相关引用。修改 `MultiCoreWireTerminalModel.cs` 中 `TerminalStripLength` 属性的类型。更新项目文件以包含新的映射类 `ConnectorHeatShrinkMapping.cs` 和 `WireHeatShrinkMapping.cs`。调整数据绑定和视图模型以适应新的数据结构,确保数据处理逻辑的一致性。
This commit is contained in:
parent
aafcacaeb5
commit
27cd690bc6
|
@ -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)
|
||||
*/
|
||||
|
||||
/// <summary>
|
||||
/// 序号
|
||||
/// </summary>
|
||||
[ExcelColumn(Name = "序号")]
|
||||
public int SequenceNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 料号
|
||||
/// </summary>
|
||||
[ExcelColumn(Name = "料号")]
|
||||
public string MaterialCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 品名
|
||||
/// </summary>
|
||||
[ExcelColumn(Name = "品名")]
|
||||
public string ProductName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 规格(CE认证)
|
||||
/// </summary>
|
||||
[ExcelColumn(Name = "规格(CE认证)")]
|
||||
public string CESpecification { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 对应CAD图纸规格
|
||||
/// </summary>
|
||||
[ExcelColumn(Name = "对应CAD图纸规格")]
|
||||
public string CADDrawingSpecification { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 针脚数量
|
||||
/// </summary>
|
||||
[ExcelColumn(Name = "针脚数量")]
|
||||
public int PinCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 热缩管规格
|
||||
/// </summary>
|
||||
[ExcelColumn(Name = "热缩管规格")]
|
||||
public string HeatShrinkTubeSpecification { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 热缩管物料编码
|
||||
/// </summary>
|
||||
[ExcelColumn(Name = "热缩管物料编码")]
|
||||
public string HeatShrinkTubeMaterialCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 热缩管长度(mm)
|
||||
/// </summary>
|
||||
[ExcelColumn(Name = "热缩管长度(mm)")]
|
||||
public double HeatShrinkTubeLength { get; set; }
|
||||
|
||||
}
|
||||
}
|
|
@ -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; }
|
||||
|
||||
/// <summary>
|
||||
/// 引脚编号
|
||||
/// </summary>
|
||||
|
@ -68,6 +82,69 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
|
|||
/// </summary>
|
||||
public int RearConnectorQuantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 号码管型号
|
||||
/// </summary>
|
||||
public string NumberTubeModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 号码管物料编码
|
||||
/// </summary>
|
||||
public string NumberTubeMCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 号码管长度
|
||||
/// </summary>
|
||||
public int NumberTubeLength { get; set; }
|
||||
public bool FrontConnectorIsPin { get; set; }
|
||||
public bool RearConnectorIsPin { get; set; }
|
||||
/// <summary>
|
||||
/// 透明热缩管型号
|
||||
/// </summary>
|
||||
public string TransparentHeatShrinkTubeModel { get; set; }
|
||||
/// <summary>
|
||||
/// 透明热缩管标示
|
||||
/// </summary>
|
||||
public string TransparentHeatShrinkTubeDesc { get; set; }
|
||||
/// <summary>
|
||||
/// 透明热缩管物料编码
|
||||
/// </summary>
|
||||
public string TransparentHeatShrinkTubeMCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 黑色热缩管型号(插头)
|
||||
/// </summary>
|
||||
public string BlackHeatShrinkTubeModel { get; set; }
|
||||
/// <summary>
|
||||
/// 黑色热缩管物料编码(插头)
|
||||
/// </summary>
|
||||
public string BlackHeatShrinkTubeMCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 黑色热缩管型号(剥线后)
|
||||
/// </summary>
|
||||
public string BlackHeatShrinkTubeModelAfterStripping { get; set; }
|
||||
/// <summary>
|
||||
/// 黑色热缩管物料编码(剥线后)
|
||||
/// </summary>
|
||||
public string BlackHeatShrinkTubeMCodeAfterStripping { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 热缩管标识
|
||||
/// </summary>
|
||||
public string HeatShrinkTubeDesc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 前段子剥线长度
|
||||
/// </summary>
|
||||
public int FrontStrippingLength { get; set; }
|
||||
/// <summary>
|
||||
/// 后段子剥线长度
|
||||
/// </summary>
|
||||
public int RearStrippingLength { get; set; }
|
||||
|
||||
public bool Layouted { get;set; }
|
||||
|
||||
|
||||
private List<MultiCoreWireDataModel> _children = [];
|
||||
|
|
|
@ -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; }
|
||||
/// <summary>
|
||||
/// 线材名称
|
||||
/// </summary>
|
||||
public string WireKey { get; set; }
|
||||
|
||||
private int _seqNo;
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public int SeqNo
|
||||
{
|
||||
get => _seqNo;
|
||||
set
|
||||
{
|
||||
_seqNo = value;
|
||||
OnPropertyChanged(nameof(SeqNo));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 应用场景
|
||||
|
@ -81,6 +63,14 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
|
|||
}
|
||||
}
|
||||
|
||||
/*号码管/热缩管型号 号码管物料编码*/
|
||||
|
||||
[ExcelColumn(Name = "号码管/热缩管型号")]
|
||||
public string NumberTubeModel { get; set; }
|
||||
|
||||
|
||||
[ExcelColumn(Name = "号码管物料编码")]
|
||||
public string NumberTubeMCode { get; set; }
|
||||
/// <summary>
|
||||
/// 是否高柔
|
||||
/// </summary>
|
||||
|
@ -175,9 +165,9 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
|
|||
/// <summary>
|
||||
/// 叉耳端子剥线长度(mm)
|
||||
/// </summary>
|
||||
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
|
|||
/// <summary>
|
||||
/// 扁形端子剥线长度(mm)
|
||||
/// </summary>
|
||||
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
|
|||
/// <summary>
|
||||
/// O型端子剥线长度(mm)
|
||||
/// </summary>
|
||||
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
|
|||
/// <summary>
|
||||
/// 针型端子剥线长度(mm)
|
||||
/// </summary>
|
||||
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
|
|||
/// <summary>
|
||||
/// Y形端子剥线长度(mm)
|
||||
/// </summary>
|
||||
private double _yTypeTerminalStripLength;
|
||||
private int _yTypeTerminalStripLength;
|
||||
[ExcelColumn(Name = "Y形端子剥线长度(mm)")]
|
||||
public double YTypeTerminalStripLength
|
||||
public int YTypeTerminalStripLength
|
||||
{
|
||||
get => _yTypeTerminalStripLength;
|
||||
set
|
||||
|
@ -508,38 +498,6 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
|
|||
|
||||
|
||||
|
||||
private int _frontConnectorCount;
|
||||
/// <summary>
|
||||
///
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public int FrontConnectorQuantity
|
||||
{
|
||||
get => _frontConnectorCount;
|
||||
set
|
||||
{
|
||||
_frontConnectorCount = value;
|
||||
OnPropertyChanged(nameof(FrontConnectorQuantity));
|
||||
}
|
||||
}
|
||||
private int _rearConnectorQuantity;
|
||||
/// <summary>
|
||||
///
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public int RearConnectorQuantity
|
||||
{
|
||||
get => _rearConnectorQuantity;
|
||||
set
|
||||
{
|
||||
_rearConnectorQuantity = value;
|
||||
OnPropertyChanged(nameof(RearConnectorQuantity));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 号码管型号
|
||||
/// </summary>
|
||||
public string NumberTubeModel { get; set; }
|
||||
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string propertyName)
|
|
@ -16,7 +16,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models.MultiCoreWire
|
|||
|
||||
/// <summary>
|
||||
/// 端子剥线长度(mm)
|
||||
public double TerminalStripLength { get; set; }
|
||||
public int TerminalStripLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 端子物料编码
|
||||
|
|
|
@ -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
|
||||
{
|
||||
/*
|
||||
线材型号 透明热缩管型号 热缩管物料编码 热缩管型号 热缩管物料编码
|
||||
*/
|
||||
|
||||
/// <summary>
|
||||
/// 线材型号
|
||||
/// </summary>
|
||||
[ExcelColumn(Name = "线材型号")]
|
||||
public string WireModelSpecification { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 透明热缩管型号
|
||||
/// </summary>
|
||||
[ExcelColumn(Name = "透明热缩管型号")]
|
||||
public string TransparentHeatShrinkTubeModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 透明热缩管物料编码
|
||||
/// </summary>
|
||||
[ExcelColumn(Name = "透明热缩管物料编码")]
|
||||
public string TransparentHeatShrinkTubeMaterialCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 黑色热缩管型号
|
||||
/// </summary>
|
||||
[ExcelColumn(Name = "黑色热缩管型号")]
|
||||
public string BlackHeatShrinkTubeModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 黑色热缩管物料编码
|
||||
/// </summary>
|
||||
[ExcelColumn(Name = "黑色热缩管物料编码")]
|
||||
public string BlackHeatShrinkTubeMaterialCode { get; set; }
|
||||
}
|
||||
}
|
|
@ -254,7 +254,9 @@
|
|||
<Compile Include="Extension\CheckedModelExt.cs" />
|
||||
<Compile Include="Extension\MotorModelUniqueFlagExt.cs" />
|
||||
<Compile Include="Extension\PropertyListExt.cs" />
|
||||
<Compile Include="Models\MultiCoreWire\ConnectorHeatShrinkMapping.cs" />
|
||||
<Compile Include="Models\MultiCoreWire\MultiCoreWireTerminalModel.cs" />
|
||||
<Compile Include="Models\MultiCoreWire\WireHeatShrinkMapping.cs" />
|
||||
<Compile Include="Models\WireCheck\CheckedModel.cs" />
|
||||
<Compile Include="Models\ConfigItemModel.cs" />
|
||||
<Compile Include="Models\WireCheck\ExcelModel.cs" />
|
||||
|
@ -292,7 +294,7 @@
|
|||
<Compile Include="ViewModel\CableLectotype\LectotypeViewModel.cs" />
|
||||
<Compile Include="ViewModel\LoginViewModel.cs" />
|
||||
<Compile Include="Models\MultiCoreWire\MultiCoreWireDataModel.cs" />
|
||||
<Compile Include="Models\MultiCoreWire\MultiCoreWireLecModel.cs" />
|
||||
<Compile Include="Models\MultiCoreWire\MultiCoreWireExcelModel.cs" />
|
||||
<Compile Include="ViewModel\MultiCoreWireViewModel\MultiCoreWireLayoutHelperViewModel.cs" />
|
||||
<Compile Include="ViewModel\MultiCoreWireViewModel\MultiCoreWireViewModel.cs" />
|
||||
<Compile Include="ViewModel\WireCheck\MainViewModel.Check.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<MultiCoreWireLecModel> GetMultiCoreWireLecDatas()
|
||||
public IEnumerable<MultiCoreWireExcelModel> 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<MultiCoreWireLecModel>(dataFileStream,sheetName: "多芯线WPS数据配对");
|
||||
var data = MiniExcel.Query<MultiCoreWireExcelModel>(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<ConnectorHeatShrinkMapping>(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<WireHeatShrinkMapping>(dataFileStream, sheetName: "线材对应热缩管")
|
||||
.FirstOrDefault(it => it.WireModelSpecification == wireModelSpecification);
|
||||
//MiniExcel.Query()
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@
|
|||
<hc:TextBox
|
||||
MinWidth="100"
|
||||
Margin="10,0"
|
||||
IsEnabled="{Binding Wirekey}" />
|
||||
Text="{Binding Wirekey}" />
|
||||
</hc:SimpleStackPanel>
|
||||
|
||||
</hc:SimpleStackPanel>
|
||||
|
@ -234,14 +234,14 @@
|
|||
<hc:ComboBox
|
||||
MinWidth="100"
|
||||
Margin="10,0"
|
||||
SelectedValue="{Binding BackConnectorType}"
|
||||
SelectedValue="{Binding RearConnectorType}"
|
||||
SelectedValuePath="Content">
|
||||
<ComboBoxItem Content="端子" />
|
||||
<ComboBoxItem Content="插头" />
|
||||
</hc:ComboBox>
|
||||
|
||||
<TextBlock VerticalAlignment="Center" Text="连接物数量:" />
|
||||
<hc:NumericUpDown Value="{Binding BackConnectorCount}" />
|
||||
<hc:NumericUpDown Value="{Binding RearConnectorCount}" />
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
|
@ -252,8 +252,8 @@
|
|||
MinWidth="100"
|
||||
Margin="10,0"
|
||||
DisplayMemberPath="TerminalModel"
|
||||
ItemsSource="{Binding BackConnectorModels}"
|
||||
SelectedValue="{Binding BackConnectorModel}"
|
||||
ItemsSource="{Binding RearConnectorModels}"
|
||||
SelectedValue="{Binding RearConnectorModel}"
|
||||
SelectedValuePath="TerminalModel" />
|
||||
</hc:SimpleStackPanel>
|
||||
</hc:SimpleStackPanel>
|
||||
|
@ -324,10 +324,12 @@
|
|||
<DataGridTextColumn Binding="{Binding FrontConnectorModel}" Header="前连接物型号" />
|
||||
<DataGridTextColumn Binding="{Binding FrontConnectorMCode}" Header="前连接物料号" />
|
||||
<DataGridTextColumn Binding="{Binding FrontConnectorQuantity}" Header="前连接物数量" />
|
||||
<DataGridTextColumn Binding="{Binding FrontConnectorCount}" Header="热缩管型号(插头)" />
|
||||
<DataGridTextColumn Binding="{Binding FrontConnectorCount}" Header="热缩管物料编码(插头)" />
|
||||
<DataGridTextColumn Binding="{Binding FrontConnectorCount}" Header="热缩管数量(插头)" />
|
||||
<DataGridTextColumn Binding="{Binding FrontConnectorCount}" Header="热缩管总长度(插头)" />
|
||||
<DataGridTextColumn Binding="{Binding BlackHeatShrinkTubeModel}" Header="热缩管型号(插头)" />
|
||||
<DataGridTextColumn Binding="{Binding BlackHeatShrinkTubeMCode}" Header="热缩管物料编码(插头)" />
|
||||
<DataGridTextColumn Binding="{Binding TransparentHeatShrinkTubeModel}" Header="透明热缩管" />
|
||||
<DataGridTextColumn Binding="{Binding TransparentHeatShrinkTubeMCode}" Header="透明热缩管物料编码" />
|
||||
<DataGridTextColumn Binding="{Binding BlackHeatShrinkTubeModelAfterStripping}" Header="热缩管型号(剥线后)" />
|
||||
<DataGridTextColumn Binding="{Binding BlackHeatShrinkTubeMCodeAfterStripping}" Header="热缩管物料编码(剥线后)" />
|
||||
<DataGridTextColumn Binding="{Binding RearConnectorModel}" Header="后连接物型号" />
|
||||
<DataGridTextColumn Binding="{Binding RearConnectorMCode}" Header="后连接物料号" />
|
||||
<DataGridTextColumn Binding="{Binding RearConnectorQuantity}" Header="后连接物数量" />
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
private FlexDesigner _currentFlexDesigner;
|
||||
private List<string> ApplicationScenarios = [];
|
||||
public int ApplicationScenarioIndex = 0;
|
||||
private List<MultiCoreWireLecModel> _wireData = [];
|
||||
private List<MultiCoreWireDataModel> _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<MultiCoreWireLecModel, MultiCoreWireLecDBModel>(wire));
|
||||
_wireData.Add(MapperUtil.MapFor<MultiCoreWireDataModel, MultiCoreWireLecDBModel>(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<MultiCoreWireLecModel> _lecWires = [];
|
||||
private ObservableCollection<MultiCoreWireDataModel> _lecWires = [];
|
||||
|
||||
public ObservableCollection<MultiCoreWireLecModel> LecWires
|
||||
public ObservableCollection<MultiCoreWireDataModel> LecWires
|
||||
{
|
||||
get { return _lecWires; }
|
||||
set
|
||||
|
|
|
@ -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<MultiCoreWireLecModel> _lecWires = [];
|
||||
private ObservableCollection<MultiCoreWireDataModel> _lecWires = [];
|
||||
|
||||
public ObservableCollection<MultiCoreWireLecModel> LecWires
|
||||
public ObservableCollection<MultiCoreWireDataModel> LecWires
|
||||
{
|
||||
get { return _lecWires; }
|
||||
set
|
||||
|
@ -461,11 +460,22 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
#endregion
|
||||
|
||||
|
||||
private IEnumerable<MultiCoreWireLecModel> _datas;
|
||||
private IEnumerable<MultiCoreWireExcelModel> _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<MultiCoreWireLecModel> datas, string propName = "",bool isLecChange = false)
|
||||
private void SetDatas(IEnumerable<MultiCoreWireExcelModel> 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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue