Compare commits
6 Commits
26e0c305be
...
c6d5b7883a
Author | SHA1 | Date |
---|---|---|
|
c6d5b7883a | |
|
e40d2ce185 | |
|
27cd690bc6 | |
|
aafcacaeb5 | |
|
071f3bc503 | |
|
4df7a23796 |
|
@ -45,6 +45,7 @@ namespace Sinvo.EplanHpD.Plugin.Service
|
|||
DB.CodeFirst.InitTables(typeof(Model.CableLectotype));
|
||||
DB.CodeFirst.InitTables(typeof(Model.LectotypeLine));
|
||||
DB.CodeFirst.InitTables(typeof(Model.MultiCoreWireLecDBModel));
|
||||
DB.CodeFirst.InitTables(typeof(Model.MultiWireCoreDataModel));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,54 +9,139 @@ 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; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 应用场景
|
||||
/// </summary>
|
||||
public string WireKey { get; set; }
|
||||
public string ApplicationScenario { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 线径规格(mm2)
|
||||
/// </summary>
|
||||
public string WireDiameterSpecification { get; set; }
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否高柔
|
||||
/// </summary>
|
||||
public string IsHighFlexibilityStr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 线芯数
|
||||
/// </summary>
|
||||
public string WireCoreCount { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 线材型号规格
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public string WireModelSpecification { get; set; }
|
||||
/// <summary>
|
||||
/// 前连接
|
||||
/// </summary>
|
||||
/// 线材颜色名
|
||||
/// </summary>
|
||||
public string WireColorName { get; set; }
|
||||
/// <summary>
|
||||
/// 线材长度
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public string WireLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 前连接物型号
|
||||
/// </summary>
|
||||
public string FrontConnectorModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 后连接
|
||||
/// </summary>
|
||||
public string BackConnectorModel { get; set; }
|
||||
/// 前连接物料号
|
||||
/// </summary>
|
||||
public string FrontConnectorMCode { get; set; }
|
||||
/// <summary>
|
||||
/// 前连接物数量
|
||||
/// </summary>
|
||||
public int FrontConnectorQuantity { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否已布线
|
||||
/// </summary>
|
||||
public bool Layouted { get; set; } = false;
|
||||
/// 后连接物型号
|
||||
/// </summary>
|
||||
public string RearConnectorModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 后连接物料号
|
||||
/// </summary>
|
||||
public string RearConnectorMCode { get; set; }
|
||||
/// <summary>
|
||||
/// 后连接物数量
|
||||
/// </summary>
|
||||
public int RearConnectorQuantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 号码管型号
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public string NumberTubeModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 号码管物料编码
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public string NumberTubeMCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 号码管长度
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public int NumberTubeLength { get; set; }
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public bool FrontConnectorIsPin { get; set; }
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public bool RearConnectorIsPin { get; set; }
|
||||
/// <summary>
|
||||
/// 透明热缩管型号
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public string TransparentHeatShrinkTubeModel { get; set; }
|
||||
/// <summary>
|
||||
/// 透明热缩管标示
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public string TransparentHeatShrinkTubeDesc { get; set; }
|
||||
/// <summary>
|
||||
/// 透明热缩管物料编码
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public string TransparentHeatShrinkTubeMCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 黑色热缩管型号(插头)
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public string BlackHeatShrinkTubeModel { get; set; }
|
||||
/// <summary>
|
||||
/// 黑色热缩管物料编码(插头)
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public string BlackHeatShrinkTubeMCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 黑色热缩管型号(剥线后)
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public string BlackHeatShrinkTubeModelAfterStripping { get; set; }
|
||||
/// <summary>
|
||||
/// 黑色热缩管物料编码(剥线后)
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public string BlackHeatShrinkTubeMCodeAfterStripping { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 热缩管标识
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public string HeatShrinkTubeDesc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 前段子剥线长度
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public int FrontStrippingLength { get; set; }
|
||||
/// <summary>
|
||||
/// 后段子剥线长度
|
||||
/// </summary>
|
||||
[SugarColumn(IsNullable = true)]
|
||||
public int RearStrippingLength { get; set; }
|
||||
|
||||
public bool Layouted { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.Service.Model
|
||||
{
|
||||
[SugarTable("T_MCWIRE_LEC_CORE")]
|
||||
public class MultiWireCoreDataModel
|
||||
{
|
||||
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public string Id { get; set; }
|
||||
public string PId { get; set; }
|
||||
public int SeqNo { get; set; }
|
||||
public string CoreWireName { get; set; }
|
||||
/// <summary>
|
||||
/// 线芯引脚号
|
||||
/// </summary>
|
||||
public int PinIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 线芯号码管标示
|
||||
/// </summary>
|
||||
public string CoreNumberTube { get; set; }
|
||||
}
|
||||
}
|
|
@ -10,12 +10,8 @@ namespace Sinvo.EplanHpD.Plugin.Service
|
|||
{
|
||||
public class PluginServices
|
||||
{
|
||||
public static UserInfo user;
|
||||
#if DEBUG
|
||||
public static UserInfo user;
|
||||
public static bool IsLogin => user != null && !string.IsNullOrEmpty(user.GUID) && DynaServerClient.GetClient().IsLoginExpired();
|
||||
#else
|
||||
|
||||
public static bool IsLogin => true;
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,6 @@ using System.Runtime.InteropServices;
|
|||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.1.3")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.3")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.1.3")]
|
||||
[assembly: AssemblyVersion("1.0.1.4")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.4")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.1.4")]
|
|
@ -74,6 +74,7 @@
|
|||
<Compile Include="Model\MotorDataModel.cs" />
|
||||
<Compile Include="Model\MotorModel.cs" />
|
||||
<Compile Include="Model\MultiCoreWireLecDBModel.cs" />
|
||||
<Compile Include="Model\MultiWireCoreDataModel.cs" />
|
||||
<Compile Include="Model\UserInfo.cs" />
|
||||
<Compile Include="PluginServices.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
using Sinvo.EplanHpD.Plugin.WPFUI.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Animation;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.Controls
|
||||
{
|
||||
//继承ScrollViewer 通过截获MouseWheel事件控制滚动
|
||||
public class MyScrollViewer : ScrollViewer
|
||||
{
|
||||
//记录上一次的滚动位置
|
||||
private double LastLocation = 0;
|
||||
//重写鼠标滚动事件
|
||||
protected override void OnMouseWheel(MouseWheelEventArgs e)
|
||||
{
|
||||
double WheelChange = e.Delta;
|
||||
//可以更改一次滚动的距离倍数 (WheelChange可能为正负数!)
|
||||
double newOffset = LastLocation - (WheelChange * 2);
|
||||
//Animation并不会改变真正的VerticalOffset(只是它的依赖属性) 所以将VOffset设置到上一次的滚动位置 (相当于衔接上一个动画)
|
||||
ScrollToVerticalOffset(LastLocation);
|
||||
//碰到底部和顶部时的处理
|
||||
if (newOffset < 0)
|
||||
newOffset = 0;
|
||||
if (newOffset > ScrollableHeight)
|
||||
newOffset = ScrollableHeight;
|
||||
|
||||
AnimateScroll(newOffset);
|
||||
LastLocation = newOffset;
|
||||
//告诉ScrollViewer我们已经完成了滚动
|
||||
e.Handled = true;
|
||||
}
|
||||
private void AnimateScroll(double ToValue)
|
||||
{
|
||||
//为了避免重复,先结束掉上一个动画
|
||||
BeginAnimation(ScrollViewerBehavior.VerticalOffsetProperty, null);
|
||||
DoubleAnimation Animation = new DoubleAnimation();
|
||||
Animation.EasingFunction = new CubicEase() { EasingMode = EasingMode.EaseOut };
|
||||
Animation.From = VerticalOffset;
|
||||
Animation.To = ToValue;
|
||||
//动画速度
|
||||
Animation.Duration = TimeSpan.FromMilliseconds(800);
|
||||
//考虑到性能,可以降低动画帧数
|
||||
//Timeline.SetDesiredFrameRate(Animation, 40);
|
||||
BeginAnimation(ScrollViewerBehavior.VerticalOffsetProperty, Animation);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,54 +1,790 @@
|
|||
using System;
|
||||
using EPLAN.Harness.API.Occurrences.Nailboard;
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string _id;
|
||||
public string Id
|
||||
{
|
||||
get => _id;
|
||||
set
|
||||
{
|
||||
if (_id != value)
|
||||
{
|
||||
_id = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 引脚编号
|
||||
/// </summary>
|
||||
private int _pinIndex;
|
||||
public int PinIndex
|
||||
{
|
||||
get => _pinIndex;
|
||||
set
|
||||
{
|
||||
if (_pinIndex != value)
|
||||
{
|
||||
_pinIndex = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 线材型号规格
|
||||
/// </summary>
|
||||
public string WireModelSpecification { get; set; }
|
||||
private string _wireModelSpecification;
|
||||
public string WireModelSpecification
|
||||
{
|
||||
get => _wireModelSpecification;
|
||||
set
|
||||
{
|
||||
if (_wireModelSpecification != value)
|
||||
{
|
||||
_wireModelSpecification = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 线材颜色名
|
||||
/// </summary>
|
||||
public string WireColorName { get; set; }
|
||||
private string _wireColorName;
|
||||
public string WireColorName
|
||||
{
|
||||
get => _wireColorName;
|
||||
set
|
||||
{
|
||||
if (_wireColorName != value)
|
||||
{
|
||||
_wireColorName = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 线材颜色十六进制
|
||||
/// </summary>
|
||||
public string WireColorHex { get; set; }
|
||||
private string _wireColorHex;
|
||||
public string WireColorHex
|
||||
{
|
||||
get => _wireColorHex;
|
||||
set
|
||||
{
|
||||
if (_wireColorHex != value)
|
||||
{
|
||||
_wireColorHex = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 线材颜色十六进制 次颜色
|
||||
/// </summary>
|
||||
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; }
|
||||
/// <summary>
|
||||
/// 是否高柔
|
||||
/// </summary>
|
||||
public bool IsHighFlexibility { get; set; }
|
||||
|
||||
private bool _isHighFlexibility;
|
||||
public bool IsHighFlexibility
|
||||
{
|
||||
get => _isHighFlexibility;
|
||||
set
|
||||
{
|
||||
if (_isHighFlexibility != value)
|
||||
{
|
||||
_isHighFlexibility = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 前端子型号
|
||||
/// 前连接物型号
|
||||
/// </summary>
|
||||
public string FrontTerminalModel { get; set; }
|
||||
private string _frontConnectorModel;
|
||||
public string FrontConnectorModel
|
||||
{
|
||||
get => _frontConnectorModel;
|
||||
set
|
||||
{
|
||||
if (_frontConnectorModel != value)
|
||||
{
|
||||
_frontConnectorModel = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 后端子型号
|
||||
/// 前连接物料号
|
||||
/// </summary>
|
||||
public string BackTerminalModel { get; set; }
|
||||
private string _frontConnectorMCode;
|
||||
public string FrontConnectorMCode
|
||||
{
|
||||
get => _frontConnectorMCode;
|
||||
set
|
||||
{
|
||||
if (_frontConnectorMCode != value)
|
||||
{
|
||||
_frontConnectorMCode = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 前连接物数量
|
||||
/// </summary>
|
||||
private int _frontConnectorQuantity;
|
||||
public int FrontConnectorQuantity
|
||||
{
|
||||
get => _frontConnectorQuantity;
|
||||
set
|
||||
{
|
||||
if (_frontConnectorQuantity != value)
|
||||
{
|
||||
_frontConnectorQuantity = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 后连接物型号
|
||||
/// </summary>
|
||||
private string _rearConnectorModel;
|
||||
public string RearConnectorModel
|
||||
{
|
||||
get => _rearConnectorModel;
|
||||
set
|
||||
{
|
||||
if (_rearConnectorModel != value)
|
||||
{
|
||||
_rearConnectorModel = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 后连接物料号
|
||||
/// </summary>
|
||||
private string _rearConnectorMCode;
|
||||
public string RearConnectorMCode
|
||||
{
|
||||
get => _rearConnectorMCode;
|
||||
set
|
||||
{
|
||||
if (_rearConnectorMCode != value)
|
||||
{
|
||||
_rearConnectorMCode = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 后连接物数量
|
||||
/// </summary>
|
||||
private int _rearConnectorQuantity;
|
||||
public int RearConnectorQuantity
|
||||
{
|
||||
get => _rearConnectorQuantity;
|
||||
set
|
||||
{
|
||||
if (_rearConnectorQuantity != value)
|
||||
{
|
||||
_rearConnectorQuantity = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 号码管型号
|
||||
/// </summary>
|
||||
private string _numberTubeModel;
|
||||
public string NumberTubeModel
|
||||
{
|
||||
get => _numberTubeModel;
|
||||
set
|
||||
{
|
||||
if (_numberTubeModel != value)
|
||||
{
|
||||
_numberTubeModel = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 号码管物料编码
|
||||
/// </summary>
|
||||
private string _numberTubeMCode;
|
||||
public string NumberTubeMCode
|
||||
{
|
||||
get => _numberTubeMCode;
|
||||
set
|
||||
{
|
||||
if (_numberTubeMCode != value)
|
||||
{
|
||||
_numberTubeMCode = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 号码管长度
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 透明热缩管型号
|
||||
/// </summary>
|
||||
private string _transparentHeatShrinkTubeModel;
|
||||
public string TransparentHeatShrinkTubeModel
|
||||
{
|
||||
get => _transparentHeatShrinkTubeModel;
|
||||
set
|
||||
{
|
||||
if (_transparentHeatShrinkTubeModel != value)
|
||||
{
|
||||
_transparentHeatShrinkTubeModel = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 透明热缩管标示
|
||||
/// </summary>
|
||||
private string _transparentHeatShrinkTubeDesc;
|
||||
public string TransparentHeatShrinkTubeDesc
|
||||
{
|
||||
get => _transparentHeatShrinkTubeDesc;
|
||||
set
|
||||
{
|
||||
if (_transparentHeatShrinkTubeDesc != value)
|
||||
{
|
||||
_transparentHeatShrinkTubeDesc = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 透明热缩管物料编码
|
||||
/// </summary>
|
||||
private string _transparentHeatShrinkTubeMCode;
|
||||
public string TransparentHeatShrinkTubeMCode
|
||||
{
|
||||
get => _transparentHeatShrinkTubeMCode;
|
||||
set
|
||||
{
|
||||
if (_transparentHeatShrinkTubeMCode != value)
|
||||
{
|
||||
_transparentHeatShrinkTubeMCode = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 黑色热缩管型号(插头)
|
||||
/// </summary>
|
||||
private string _blackHeatShrinkTubeModel;
|
||||
public string BlackHeatShrinkTubeModel
|
||||
{
|
||||
get => _blackHeatShrinkTubeModel;
|
||||
set
|
||||
{
|
||||
if (_blackHeatShrinkTubeModel != value)
|
||||
{
|
||||
_blackHeatShrinkTubeModel = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 黑色热缩管物料编码(插头)
|
||||
/// </summary>
|
||||
private string _blackHeatShrinkTubeMCode;
|
||||
public string BlackHeatShrinkTubeMCode
|
||||
{
|
||||
get => _blackHeatShrinkTubeMCode;
|
||||
set
|
||||
{
|
||||
if (_blackHeatShrinkTubeMCode != value)
|
||||
{
|
||||
_blackHeatShrinkTubeMCode = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 黑色热缩管型号(剥线后)
|
||||
/// </summary>
|
||||
private string _blackHeatShrinkTubeModelAfterStripping;
|
||||
public string BlackHeatShrinkTubeModelAfterStripping
|
||||
{
|
||||
get => _blackHeatShrinkTubeModelAfterStripping;
|
||||
set
|
||||
{
|
||||
if (_blackHeatShrinkTubeModelAfterStripping != value)
|
||||
{
|
||||
_blackHeatShrinkTubeModelAfterStripping = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 黑色热缩管物料编码(剥线后)
|
||||
/// </summary>
|
||||
private string _blackHeatShrinkTubeMCodeAfterStripping;
|
||||
public string BlackHeatShrinkTubeMCodeAfterStripping
|
||||
{
|
||||
get => _blackHeatShrinkTubeMCodeAfterStripping;
|
||||
set
|
||||
{
|
||||
if (_blackHeatShrinkTubeMCodeAfterStripping != value)
|
||||
{
|
||||
_blackHeatShrinkTubeMCodeAfterStripping = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 热缩管标识
|
||||
/// </summary>
|
||||
private string _heatShrinkTubeDesc;
|
||||
public string HeatShrinkTubeDesc
|
||||
{
|
||||
get => _heatShrinkTubeDesc;
|
||||
set
|
||||
{
|
||||
if (_heatShrinkTubeDesc != value)
|
||||
{
|
||||
_heatShrinkTubeDesc = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 前段子剥线长度
|
||||
/// </summary>
|
||||
private int _frontStrippingLength;
|
||||
public int FrontStrippingLength
|
||||
{
|
||||
get => _frontStrippingLength;
|
||||
set
|
||||
{
|
||||
if (_frontStrippingLength != value)
|
||||
{
|
||||
_frontStrippingLength = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 后段子剥线长度
|
||||
/// </summary>
|
||||
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;
|
||||
/// <summary>
|
||||
/// 插头型号
|
||||
/// </summary>
|
||||
public string PlugModel
|
||||
{
|
||||
get => _plugModel;
|
||||
set
|
||||
{
|
||||
if (_plugModel != value)
|
||||
{
|
||||
_plugModel = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
private string _plugMCode;
|
||||
/// <summary>
|
||||
/// 插头料号
|
||||
/// </summary>
|
||||
public string PlugMCode
|
||||
{
|
||||
get => _plugMCode;
|
||||
set
|
||||
{
|
||||
if (_plugMCode != value)
|
||||
{
|
||||
_plugMCode = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
private int _plugQty;
|
||||
/// <summary>
|
||||
/// 插头数量
|
||||
/// </summary>
|
||||
public int PlugQty
|
||||
{
|
||||
get => _plugQty;
|
||||
set
|
||||
{
|
||||
if (_plugQty != value)
|
||||
{
|
||||
_plugQty = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private string _coreNumberTube;
|
||||
/// <summary>
|
||||
/// 线芯号码管标示
|
||||
/// </summary>
|
||||
public string CoreNumberTube
|
||||
{
|
||||
get { return _coreNumberTube; }
|
||||
set
|
||||
{
|
||||
_coreNumberTube = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
绝缘软套型号
|
||||
绝缘软套型号物料编码
|
||||
绝缘软套数量
|
||||
*/
|
||||
private string _insulationModel;
|
||||
/// <summary>
|
||||
/// E绝缘软套型号
|
||||
/// </summary>
|
||||
public string InsulationModel
|
||||
{
|
||||
get { return _insulationModel; }
|
||||
set
|
||||
{
|
||||
|
||||
_insulationModel = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// E绝缘软套型号物料编码
|
||||
/// </summary>
|
||||
private string _insulationMaterialNo;
|
||||
public string InsulationMaterialNo
|
||||
{
|
||||
get { return _insulationMaterialNo; }
|
||||
set
|
||||
{
|
||||
|
||||
_insulationMaterialNo = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绝缘软套型号数量
|
||||
/// </summary>
|
||||
public int InsulationQuantity { get; set; } = 1;
|
||||
|
||||
private List<MultiCoreWireDataModel> _children = [];
|
||||
public List<MultiCoreWireDataModel> Children
|
||||
{
|
||||
get { return _children; }
|
||||
set { _children = value; }
|
||||
get => _children;
|
||||
set
|
||||
{
|
||||
if (_children != value)
|
||||
{
|
||||
_children = value;
|
||||
OnPropertyChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public new event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using MiniExcelLibs.Attributes;
|
||||
using Microsoft.WindowsAPICodePack.ApplicationServices;
|
||||
using MiniExcelLibs.Attributes;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Models.MultiCoreWire;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -9,28 +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; }
|
||||
|
||||
|
||||
private int _seqNo;
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public int SeqNo
|
||||
{
|
||||
get => _seqNo;
|
||||
set
|
||||
{
|
||||
_seqNo = value;
|
||||
OnPropertyChanged(nameof(SeqNo));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 应用场景
|
||||
|
@ -77,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>
|
||||
|
@ -171,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
|
||||
|
@ -219,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
|
||||
|
@ -267,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
|
||||
|
@ -315,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
|
||||
|
@ -363,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
|
||||
|
@ -406,64 +400,105 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
|
|||
OnPropertyChanged(nameof(FrontConnectorModel));
|
||||
}
|
||||
}
|
||||
private string _frontConnectorMCode;
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public string FrontConnectorMCode
|
||||
{
|
||||
get => _frontConnectorMCode;
|
||||
set
|
||||
{
|
||||
_frontConnectorMCode = value;
|
||||
OnPropertyChanged(nameof(FrontConnectorMCode));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 后连接
|
||||
/// </summary>
|
||||
private string _backConnectorModel;
|
||||
private string _rearConnectorModel;
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public string BackConnectorModel
|
||||
public string RearConnectorModel
|
||||
{
|
||||
get => _backConnectorModel;
|
||||
get => _rearConnectorModel;
|
||||
set
|
||||
{
|
||||
_backConnectorModel = value;
|
||||
OnPropertyChanged(nameof(BackConnectorModel));
|
||||
_rearConnectorModel = value;
|
||||
OnPropertyChanged(nameof(RearConnectorModel));
|
||||
}
|
||||
}
|
||||
private string _rearConnectorMCode;
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public string RearConnectorMCode
|
||||
{
|
||||
get => _rearConnectorMCode;
|
||||
set
|
||||
{
|
||||
_rearConnectorMCode = value;
|
||||
OnPropertyChanged(nameof(RearConnectorMCode));
|
||||
}
|
||||
}
|
||||
private bool _layouted;
|
||||
/// <summary>
|
||||
/// 是否已布线
|
||||
/// </summary>
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public bool Layouted
|
||||
{
|
||||
get
|
||||
{
|
||||
return _layouted;
|
||||
}
|
||||
set
|
||||
{
|
||||
_layouted = value;
|
||||
OnPropertyChanged(nameof(Layouted));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public List<MultiCoreWireTerminalModel> TerminalModels
|
||||
{
|
||||
get
|
||||
{
|
||||
// 将所有类型的端子模型组合成一个列表
|
||||
return [
|
||||
List<MultiCoreWireTerminalModel> terminals = [
|
||||
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
|
||||
}
|
||||
{
|
||||
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
|
||||
}
|
||||
];
|
||||
return [.. terminals.Where(it => !string.IsNullOrEmpty(it.TerminalModel))];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
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; }
|
||||
}
|
||||
}
|
|
@ -46,6 +46,6 @@ using System.Windows;
|
|||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.1.3")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.3")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.1.3")]
|
||||
[assembly: AssemblyVersion("1.0.1.4")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.4")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.1.4")]
|
|
@ -96,5 +96,27 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Service
|
|||
throw;
|
||||
}
|
||||
}
|
||||
internal void UpdateWireIsLayout(string id)
|
||||
{
|
||||
if (string.IsNullOrEmpty(id))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var db = DBHelper.DB;
|
||||
try
|
||||
{
|
||||
db.BeginTran();
|
||||
db.Updateable<MultiCoreWireLecDBModel>()
|
||||
.Where(it => it.Id == id)
|
||||
.SetColumns(it => it.Layouted == true)
|
||||
.ExecuteCommand();
|
||||
db.CommitTran();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
db.RollbackTran();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -239,6 +239,7 @@
|
|||
<Compile Include="Common\CommonMessage.cs" />
|
||||
<Compile Include="Common\LectotypeMessage.cs" />
|
||||
<Compile Include="Common\OpenDrawMessage.cs" />
|
||||
<Compile Include="Controls\MyScrollViewer.cs" />
|
||||
<Compile Include="Converter\ConnectionTypeConverter.cs" />
|
||||
<Compile Include="Converter\FlagEnumConverter.cs" />
|
||||
<Compile Include="Converter\NameTypeConverter.cs" />
|
||||
|
@ -254,7 +255,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" />
|
||||
|
@ -283,14 +286,17 @@
|
|||
<Compile Include="Utils\LambdaComparer.cs" />
|
||||
<Compile Include="Utils\LectotypeLineModelExt.cs" />
|
||||
<Compile Include="Utils\LectotypeManager.cs" />
|
||||
<Compile Include="Utils\MapperUtil.cs" />
|
||||
<Compile Include="Utils\MotorExcelHelper.cs" />
|
||||
<Compile Include="Utils\MultiCoreWireExcelHelper.cs" />
|
||||
<Compile Include="Utils\ScrollSynchronizer.cs" />
|
||||
<Compile Include="Utils\ScrollViewerBehavior.cs" />
|
||||
<Compile Include="ViewModel\CableLectotype\CableLectotypeViewModel.cs" />
|
||||
<Compile Include="ViewModel\CableLectotype\LayoutHelperViewModel.cs" />
|
||||
<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" />
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
|
||||
{
|
||||
public class MapperUtil
|
||||
{
|
||||
public static T MapFor<T,S>(S sourceObj)
|
||||
{
|
||||
if (sourceObj == null)
|
||||
return default(T);
|
||||
var destObj = Activator.CreateInstance<T>();
|
||||
var sourceType = sourceObj.GetType();
|
||||
var destType = typeof(T);
|
||||
foreach (var prop in destType.GetProperties())
|
||||
{
|
||||
var sourceProp = sourceType.GetProperty(prop.Name);
|
||||
if (sourceProp != null && prop.CanWrite)
|
||||
{
|
||||
var value = sourceProp.GetValue(sourceObj);
|
||||
prop.SetValue(destObj, value);
|
||||
}
|
||||
}
|
||||
return destObj;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,202 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
|
||||
{
|
||||
public static class ScrollSynchronizer
|
||||
{
|
||||
// 附加属性定义
|
||||
public static readonly DependencyProperty SynchronizeWithParentProperty =
|
||||
DependencyProperty.RegisterAttached(
|
||||
"SynchronizeWithParent",
|
||||
typeof(bool),
|
||||
typeof(ScrollSynchronizer),
|
||||
new PropertyMetadata(false, OnSynchronizeWithParentChanged));
|
||||
// 为 ListBox 添加自动寻找内部 DataGrid 的附加属性
|
||||
public static readonly DependencyProperty AutoSynchronizeChildrenProperty =
|
||||
DependencyProperty.RegisterAttached(
|
||||
"AutoSynchronizeChildren",
|
||||
typeof(bool),
|
||||
typeof(ScrollSynchronizer),
|
||||
new PropertyMetadata(false, OnAutoSynchronizeChildrenChanged));
|
||||
|
||||
// Getter 和 Setter
|
||||
public static bool GetSynchronizeWithParent(DependencyObject obj)
|
||||
{
|
||||
return (bool)obj.GetValue(SynchronizeWithParentProperty);
|
||||
}
|
||||
|
||||
public static void SetSynchronizeWithParent(DependencyObject obj, bool value)
|
||||
{
|
||||
obj.SetValue(SynchronizeWithParentProperty, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当属性值改变时触发
|
||||
/// </summary>
|
||||
/// <param name="d"></param>
|
||||
/// <param name="e"></param>
|
||||
private static void OnSynchronizeWithParentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is UIElement element)
|
||||
{
|
||||
if ((bool)e.NewValue)
|
||||
{
|
||||
// 添加事件处理
|
||||
element.PreviewMouseWheel += Element_PreviewMouseWheel;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 移除事件处理
|
||||
element.PreviewMouseWheel -= Element_PreviewMouseWheel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理滚动事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private static void Element_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
|
||||
{
|
||||
if (sender is UIElement element)
|
||||
{
|
||||
// 向上查找父级 ListBox
|
||||
var listBox = FindParentListBox(element);
|
||||
if (listBox != null)
|
||||
{
|
||||
// 直接获取 ListBox 的 ScrollViewer
|
||||
ScrollViewer scrollViewer = GetScrollViewer(listBox);
|
||||
if (scrollViewer != null)
|
||||
{
|
||||
// 直接控制滚动位置
|
||||
if (e.Delta < 0)
|
||||
{
|
||||
scrollViewer.LineDown();
|
||||
}
|
||||
else
|
||||
{
|
||||
scrollViewer.LineUp();
|
||||
}
|
||||
|
||||
// 标记事件已处理
|
||||
e.Handled = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果找不到 ScrollViewer,回退到事件传递
|
||||
var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta);
|
||||
eventArg.RoutedEvent = UIElement.MouseWheelEvent;
|
||||
eventArg.Source = sender;
|
||||
listBox.RaiseEvent(eventArg);
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 添加获取 ScrollViewer 的辅助方法
|
||||
/// </summary>
|
||||
/// <param name="element"></param>
|
||||
/// <returns></returns>
|
||||
private static ScrollViewer GetScrollViewer(DependencyObject element)
|
||||
{
|
||||
if (element is ScrollViewer scrollViewer)
|
||||
return scrollViewer;
|
||||
|
||||
// 尝试从控件模板中查找 ScrollViewer
|
||||
ScrollViewer result = null;
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(element) && result == null; i++)
|
||||
{
|
||||
var child = VisualTreeHelper.GetChild(element, i);
|
||||
result = GetScrollViewer(child); // 递归查找
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找父级 ListBox
|
||||
/// </summary>
|
||||
/// <param name="child"></param>
|
||||
/// <returns></returns>
|
||||
private static ListBox FindParentListBox(DependencyObject child)
|
||||
{
|
||||
var parent = VisualTreeHelper.GetParent(child);
|
||||
while (parent != null && !(parent is ListBox))
|
||||
{
|
||||
parent = VisualTreeHelper.GetParent(parent);
|
||||
}
|
||||
return parent as ListBox;
|
||||
}
|
||||
|
||||
public static bool GetAutoSynchronizeChildren(DependencyObject obj)
|
||||
{
|
||||
return (bool)obj.GetValue(AutoSynchronizeChildrenProperty);
|
||||
}
|
||||
|
||||
public static void SetAutoSynchronizeChildren(DependencyObject obj, bool value)
|
||||
{
|
||||
obj.SetValue(AutoSynchronizeChildrenProperty, value);
|
||||
}
|
||||
|
||||
private static void OnAutoSynchronizeChildrenChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is ListBox listBox && (bool)e.NewValue)
|
||||
{
|
||||
// 监听 ListBox 的 Loaded 事件
|
||||
listBox.Loaded += ListBox_Loaded;
|
||||
// 监听 ItemContainerGenerator 状态变化,处理动态加载的项
|
||||
listBox.ItemContainerGenerator.StatusChanged += (s, args) =>
|
||||
{
|
||||
if (listBox.ItemContainerGenerator.Status == System.Windows.Controls.Primitives.GeneratorStatus.ContainersGenerated)
|
||||
{
|
||||
AttachToAllDataGrids(listBox);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private static void ListBox_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is ListBox listBox)
|
||||
{
|
||||
AttachToAllDataGrids(listBox);
|
||||
}
|
||||
}
|
||||
|
||||
private static void AttachToAllDataGrids(ListBox listBox)
|
||||
{
|
||||
var dataGrids = FindVisualChildren<DataGrid>(listBox);
|
||||
foreach (var dataGrid in dataGrids)
|
||||
{
|
||||
SetSynchronizeWithParent(dataGrid, true);
|
||||
}
|
||||
}
|
||||
|
||||
/// 查找所有指定类型的可视化子元素
|
||||
private static IEnumerable<T> FindVisualChildren<T>(DependencyObject obj) where T : DependencyObject
|
||||
{
|
||||
if (obj != null)
|
||||
{
|
||||
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(obj); i++)
|
||||
{
|
||||
DependencyObject child = VisualTreeHelper.GetChild(obj, i);
|
||||
if (child != null && child is T)
|
||||
{
|
||||
yield return (T)child;
|
||||
}
|
||||
|
||||
foreach (T childOfChild in FindVisualChildren<T>(child))
|
||||
{
|
||||
yield return childOfChild;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
|
||||
{
|
||||
public static class ScrollViewerBehavior
|
||||
{
|
||||
public static readonly DependencyProperty VerticalOffsetProperty = DependencyProperty.RegisterAttached("VerticalOffset", typeof(double), typeof(ScrollViewerBehavior), new UIPropertyMetadata(0.0, OnVerticalOffsetChanged));
|
||||
public static void SetVerticalOffset(FrameworkElement target, double value) => target.SetValue(VerticalOffsetProperty, value);
|
||||
public static double GetVerticalOffset(FrameworkElement target) => (double)target.GetValue(VerticalOffsetProperty);
|
||||
private static void OnVerticalOffsetChanged(DependencyObject target, DependencyPropertyChangedEventArgs e) => (target as ScrollViewer)?.ScrollToVerticalOffset((double)e.NewValue);
|
||||
}
|
||||
}
|
|
@ -12,14 +12,14 @@
|
|||
Width="450"
|
||||
Height="260"
|
||||
MinWidth="450"
|
||||
MinHeight="260"
|
||||
MinHeight="360"
|
||||
d:DataContext="{d:DesignInstance Type=multicorewireviewmodel:MultiCoreWireLayoutHelperViewModel}"
|
||||
ActiveGlowColor="{DynamicResource PrimaryColor}"
|
||||
Background="White"
|
||||
FontSize="14"
|
||||
Left="1460"
|
||||
Loaded="GlowWindow_Loaded"
|
||||
Top="770"
|
||||
Top="700"
|
||||
WindowStartupLocation="Manual"
|
||||
mc:Ignorable="d">
|
||||
<Window.Resources>
|
||||
|
@ -46,22 +46,85 @@
|
|||
FontSize="16"
|
||||
FontWeight="Bold"
|
||||
Foreground="#c92d28"
|
||||
Text="触摸屏" />
|
||||
Text="{Binding ApplicationScenario}" />
|
||||
</TextBlock>
|
||||
</hc:SimpleStackPanel>
|
||||
<DataGrid
|
||||
|
||||
<ListView
|
||||
Grid.Row="1"
|
||||
AutoGenerateColumns="False"
|
||||
ItemsSource="{Binding LecWires}">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Header="序号" />
|
||||
<DataGridTextColumn
|
||||
MinWidth="240"
|
||||
Binding="{Binding WireModelSpecification}"
|
||||
Header="线型号" />
|
||||
<DataGridCheckBoxColumn Binding="{Binding Layouted}" Header="是否已布线" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
ItemsSource="{Binding LecWires}"
|
||||
VirtualizingPanel.ScrollUnit="Pixel">
|
||||
<ListView.ItemContainerStyle>
|
||||
<Style BasedOn="{StaticResource ListViewItemBaseStyle.Small}" TargetType="ListViewItem">
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="BorderBrush" Value="Gray" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="Margin" Value="2" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Layouted}" Value="True">
|
||||
<Setter Property="Background" Value="#18a05d" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
|
||||
</Style>
|
||||
</ListView.ItemContainerStyle>
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Margin="5" HorizontalAlignment="Stretch">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox
|
||||
Grid.Row="0"
|
||||
Margin="0,2,0,5"
|
||||
HorizontalAlignment="Stretch"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
IsReadOnly="True"
|
||||
TextAlignment="Center">
|
||||
<TextBox.Text>
|
||||
<MultiBinding StringFormat="{}{0}-{1}">
|
||||
<Binding Path="ApplicationScenario" />
|
||||
<Binding Path="WireKey" />
|
||||
</MultiBinding>
|
||||
</TextBox.Text>
|
||||
</TextBox>
|
||||
<TextBox
|
||||
Grid.Row="1"
|
||||
Margin="0,2,0,5"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalContentAlignment="Center"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding WireModelSpecification}" />
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
Margin="0,2"
|
||||
HorizontalAlignment="Center"
|
||||
Text="{Binding FrontConnectorModel, StringFormat=前连接:{0}}"
|
||||
TextAlignment="Center" />
|
||||
<TextBlock
|
||||
Grid.Row="3"
|
||||
Margin="0,2"
|
||||
HorizontalAlignment="Center"
|
||||
Text="{Binding RearConnectorModel, StringFormat=后连接:{0}}"
|
||||
TextAlignment="Center" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
<!-- 添加一个空数据模板 -->
|
||||
<ListView.Template>
|
||||
<ControlTemplate>
|
||||
<hc:ScrollViewer>
|
||||
<ItemsPresenter />
|
||||
</hc:ScrollViewer>
|
||||
</ControlTemplate>
|
||||
</ListView.Template>
|
||||
</ListView>
|
||||
|
||||
<hc:SimpleStackPanel
|
||||
Grid.Row="4"
|
||||
Margin="10"
|
||||
|
@ -69,14 +132,14 @@
|
|||
<DockPanel HorizontalAlignment="Stretch">
|
||||
<Button
|
||||
Click="PrevBtn_Click"
|
||||
Content="上一根线"
|
||||
Content="上一个场景"
|
||||
DockPanel.Dock="Left"
|
||||
IsEnabled="{Binding HasPrev}"
|
||||
Style="{StaticResource ButtonDanger}" />
|
||||
<Button
|
||||
HorizontalAlignment="Right"
|
||||
Click="NextBtn_Click"
|
||||
Content="下一根线"
|
||||
Content="下一个场景"
|
||||
DockPanel.Dock="Right"
|
||||
IsEnabled="{Binding HasNext}"
|
||||
Style="{StaticResource ButtonPrimary}" />
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using HandyControl.Controls;
|
||||
using EPLAN.Harness.Core.Controls;
|
||||
using HandyControl.Controls;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
@ -32,17 +33,40 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View.MultiCoreWire.LayoutHelper
|
|||
|
||||
private void GlowWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
ViewModel.Init();
|
||||
}
|
||||
|
||||
private void NextBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
ViewModel.Next();
|
||||
}
|
||||
|
||||
private void PrevBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ViewModel.Prev();
|
||||
|
||||
}
|
||||
|
||||
private void TextBox_GotFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if(sender is System.Windows.Controls.TextBox box)
|
||||
{
|
||||
box.SelectAll();
|
||||
CopyToClipboard(box.Text);
|
||||
}
|
||||
}
|
||||
|
||||
private void CopyToClipboard(string content)
|
||||
{
|
||||
try
|
||||
{
|
||||
Clipboard.SetDataObject(content);
|
||||
Growl.SuccessGlobal($"{content} 复制成功!");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FlexMessageBox.Error(ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,9 +5,11 @@
|
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:local="clr-namespace:Sinvo.EplanHpD.Plugin.WPFUI.View"
|
||||
xmlns:localCtr="clr-namespace:Sinvo.EplanHpD.Plugin.WPFUI.Controls"
|
||||
xmlns:localconverter="clr-namespace:Sinvo.EplanHpD.Plugin.WPFUI.Converter"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:multicorewireviewmodel="clr-namespace:Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel"
|
||||
xmlns:utils="clr-namespace:Sinvo.EplanHpD.Plugin.WPFUI.Utils"
|
||||
Title="多芯线数据抓取"
|
||||
Width="1200"
|
||||
Height="600"
|
||||
|
@ -20,6 +22,7 @@
|
|||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Sinvo.EplanHpD.Plugin.WPFUI;component/Themes/Theme.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<Geometry x:Key="ThumbsUpGeometry">M68.191078 915.462005l161.384597 0L229.575676 431.30719 68.191078 431.30719 68.191078 915.462005zM955.808922 471.653083c0-44.582381-36.109406-80.69281-80.69281-80.69281L620.329241 390.960273 658.859789 206.578915c0.807389-4.034896 1.412163-8.271384 1.412163-12.709463 0-16.743336-6.859221-31.873941-17.752316-42.767036l-42.968627-42.565445L333.871043 374.216937c-14.524808 14.7264-23.602557 34.899858-23.602557 57.090253l0 403.462005c0 44.582381 36.109406 80.69281 80.69281 80.69281l363.116111 0c33.487695 0 62.133106-20.37505 74.236771-49.222051l121.643478-284.441261c3.63069-9.279341 5.850242-19.164478 5.850242-29.452799L955.807898 475.083206l-0.403183-0.403183L955.808922 471.653083z</Geometry>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
|
@ -38,15 +41,23 @@
|
|||
<Setter Property="Margin" Value="2" />
|
||||
</Style>
|
||||
</hc:SimpleStackPanel.Resources>
|
||||
<hc:TextBox hc:TitleElement.Title="机构编号" hc:TitleElement.TitlePlacement="Left" />
|
||||
<hc:TextBox hc:TitleElement.Title="机构名称" hc:TitleElement.TitlePlacement="Left" />
|
||||
<hc:TextBox
|
||||
hc:TitleElement.Title="机构编号"
|
||||
hc:TitleElement.TitlePlacement="Left"
|
||||
Text="{Binding MechanismNo}" />
|
||||
<hc:TextBox
|
||||
hc:TitleElement.Title="机构名称"
|
||||
hc:TitleElement.TitlePlacement="Left"
|
||||
Text="{Binding MechanismName}" />
|
||||
</hc:SimpleStackPanel>
|
||||
<Button
|
||||
Margin="10,0"
|
||||
Click="Layout_Click"
|
||||
Content="布线助手"
|
||||
Style="{StaticResource ButtonSuccess}" />
|
||||
<Button
|
||||
Margin="10,0"
|
||||
Click="ExportBtn_Click"
|
||||
Content="导出下单表"
|
||||
Style="{StaticResource ButtonSuccess}" />
|
||||
</hc:SimpleStackPanel>
|
||||
|
@ -54,7 +65,7 @@
|
|||
<TabItem Header="多芯线选型">
|
||||
<Grid Margin="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="210" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border
|
||||
|
@ -120,12 +131,8 @@
|
|||
MinWidth="100"
|
||||
Margin="10,0"
|
||||
IsEnabled="{Binding ApplicationScenarioSelected}"
|
||||
SelectedValue="{Binding HighFlexibility, Mode=TwoWay}"
|
||||
SelectedValuePath="Content">
|
||||
<ComboBoxItem Content="是" />
|
||||
<ComboBoxItem Content="否" />
|
||||
<ComboBoxItem Content="" />
|
||||
</hc:ComboBox>
|
||||
ItemsSource="{Binding HighFlexibilitys}"
|
||||
SelectedValue="{Binding HighFlexibility}" />
|
||||
</hc:SimpleStackPanel>
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel
|
||||
|
@ -147,6 +154,23 @@
|
|||
</hc:SimpleStackPanel>
|
||||
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel
|
||||
MinWidth="200"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<hc:SimpleStackPanel
|
||||
MinWidth="200"
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="线材标识:" />
|
||||
<hc:TextBox
|
||||
MinWidth="100"
|
||||
Margin="10,0"
|
||||
Text="{Binding Wirekey}" />
|
||||
</hc:SimpleStackPanel>
|
||||
|
||||
</hc:SimpleStackPanel>
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel
|
||||
Grid.Row="0"
|
||||
|
@ -187,6 +211,8 @@
|
|||
<ComboBoxItem Content="端子" />
|
||||
<ComboBoxItem Content="插头" />
|
||||
</hc:ComboBox>
|
||||
<TextBlock VerticalAlignment="Center" Text="连接物数量:" />
|
||||
<hc:NumericUpDown Value="{Binding FrontConnectorCount}" />
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
|
@ -216,11 +242,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 RearConnectorCount}" />
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
|
@ -231,8 +260,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>
|
||||
|
@ -252,6 +281,26 @@
|
|||
ItemsSource="{Binding WireModelSpecifications}"
|
||||
SelectedValue="{Binding WireModelSpecification}" />
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
MinWidth="70"
|
||||
VerticalAlignment="Center"
|
||||
Text="线材外皮颜色:" />
|
||||
<hc:ComboBox
|
||||
MinWidth="60"
|
||||
Margin="10,0"
|
||||
SelectedValue="{Binding WireColorName}"
|
||||
SelectedValuePath="Tag">
|
||||
<ComboBoxItem
|
||||
Content="黑色"
|
||||
Selector.IsSelected="True"
|
||||
Tag="BK" />
|
||||
<ComboBoxItem Content="橙色" Tag="OG" />
|
||||
</hc:ComboBox>
|
||||
</hc:SimpleStackPanel>
|
||||
</hc:SimpleStackPanel>
|
||||
<DockPanel
|
||||
Grid.Row="1"
|
||||
|
@ -291,13 +340,28 @@
|
|||
<DataGrid.Columns>
|
||||
<!--<DataGridTextColumn Binding="{Binding SeqNo}" Header="序号" />-->
|
||||
<DataGridTextColumn Binding="{Binding ApplicationScenario}" Header="应用场景" />
|
||||
<DataGridTextColumn Binding="{Binding WireKey}" Header="线材标识" />
|
||||
<DataGridTextColumn Binding="{Binding WireDiameterSpecification}" Header="线径规格(mm²)" />
|
||||
<DataGridTextColumn Binding="{Binding IsHighFlexibilityStr}" Header="是否高柔" />
|
||||
<DataGridTextColumn Binding="{Binding WireCoreCount}" Header="线芯数量" />
|
||||
<DataGridTextColumn Binding="{Binding WireModelSpecification}" Header="线材型号" />
|
||||
<DataGridTextColumn Binding="{Binding WireModelSpecification}" Header="号码管型号" />
|
||||
<!--<DataGridTextColumn Binding="{Binding WireModelSpecification}" Header="号码管物料编码" />-->
|
||||
<!--<DataGridTextColumn Binding="{Binding WireModelSpecification}" Header="号码管数量" />
|
||||
<DataGridTextColumn Binding="{Binding WireModelSpecification}" Header="号码管长度" />-->
|
||||
<DataGridTextColumn Binding="{Binding FrontConnectorModel}" Header="前连接物型号" />
|
||||
<DataGridTextColumn Binding="{Binding BackConnectorModel}" Header="后连接物型号" />
|
||||
<DataGridTemplateColumn>
|
||||
<DataGridTextColumn Binding="{Binding FrontConnectorMCode}" Header="前连接物料号" />
|
||||
<DataGridTextColumn Binding="{Binding FrontConnectorQuantity}" 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="后连接物数量" />
|
||||
<DataGridTemplateColumn Header="操作">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<hc:SimpleStackPanel>
|
||||
|
@ -315,113 +379,152 @@
|
|||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="数据抓取">
|
||||
<ListBox
|
||||
Padding="0"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
Focusable="True"
|
||||
ItemsSource="{Binding Wires}"
|
||||
ScrollViewer.CanContentScroll="False"
|
||||
VirtualizingPanel.ScrollUnit="Pixel">
|
||||
<ListBox.Resources>
|
||||
<Style BasedOn="{StaticResource ListBoxBaseStyle}" TargetType="{x:Type ListBox}">
|
||||
<Style.Setters>
|
||||
<Setter Property="Padding" Value="0" />
|
||||
</Style.Setters>
|
||||
</Style>
|
||||
</ListBox.Resources>
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style BasedOn="{StaticResource ListBoxItemBaseStyle}" TargetType="{x:Type ListBoxItem}">
|
||||
<Style.Setters>
|
||||
<Setter Property="Padding" Value="0" />
|
||||
</Style.Setters>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="#E0E0E0" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border>
|
||||
<Expander>
|
||||
<Expander.Resources>
|
||||
<Style BasedOn="{StaticResource ExpanderBaseStyle}" TargetType="Expander">
|
||||
<Setter Property="Background" Value="#CC002255" />
|
||||
</Style>
|
||||
</Expander.Resources>
|
||||
<Expander.Header>
|
||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
Foreground="White"
|
||||
Text="{Binding WireModelSpecification}" />
|
||||
</hc:SimpleStackPanel>
|
||||
</Expander.Header>
|
||||
<DataGrid AutoGenerateColumns="False" ItemsSource="{Binding Children}">
|
||||
<DataGrid.Resources>
|
||||
<localconverter:WireColorConverter x:Key="WireColorConverter" />
|
||||
<Style BasedOn="{StaticResource DataGridCellStyle}" TargetType="DataGridCell">
|
||||
<Setter Property="BorderBrush">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource WireColorConverter}">
|
||||
<Binding Path="WireColorHex" />
|
||||
<Binding Path="WireColorHexSec" />
|
||||
<Binding Path="IsMultiColor" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="BorderThickness" Value="0,0,0,2" />
|
||||
<Setter Property="hc:BorderElement.CornerRadius" Value="0" />
|
||||
<Setter Property="Margin" Value="0" />
|
||||
<localCtr:MyScrollViewer>
|
||||
<ListBox
|
||||
x:Name="DataList"
|
||||
Padding="0"
|
||||
HorizontalContentAlignment="Stretch"
|
||||
Focusable="True"
|
||||
ItemsSource="{Binding Wires}"
|
||||
PreviewMouseWheel="ListView_PreviewMouseWheel"
|
||||
VirtualizingPanel.ScrollUnit="Pixel"
|
||||
VirtualizingPanel.VirtualizationMode="Recycling">
|
||||
<ListBox.Resources>
|
||||
<Style BasedOn="{StaticResource ListBoxBaseStyle}" TargetType="{x:Type ListBox}">
|
||||
<Style.Setters>
|
||||
<Setter Property="Padding" Value="0" />
|
||||
</Style.Setters>
|
||||
</Style>
|
||||
</ListBox.Resources>
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style BasedOn="{StaticResource ListBoxItemBaseStyle}" TargetType="{x:Type ListBoxItem}">
|
||||
<Style.Setters>
|
||||
<Setter Property="Padding" Value="0" />
|
||||
</Style.Setters>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter Property="Background" Value="#E0E0E0" />
|
||||
</Trigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border>
|
||||
<Expander IsExpanded="False">
|
||||
<Expander.Resources>
|
||||
<Style BasedOn="{StaticResource ExpanderBaseStyle}" TargetType="Expander">
|
||||
<Setter Property="Background" Value="#CC002255" />
|
||||
<Setter Property="Foreground" Value="White" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsError}" Value="True">
|
||||
<Setter Property="Background" Value="#dc4d41" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding WireModelSpecification}" Header="线芯名称" />
|
||||
<DataGridTextColumn Binding="{Binding WireColorName}" Header="线芯颜色" />
|
||||
<DataGridTextColumn Binding="{Binding FrontTerminalModel}" Header="前连接" />
|
||||
<DataGridTextColumn Binding="{Binding BackTerminalModel}" Header="后连接" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
<!--<ItemsControl ItemsSource="{Binding Children}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Margin="5" IsItemsHost="True" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border
|
||||
</Expander.Resources>
|
||||
<Expander.Header>
|
||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
MinWidth="700"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="White"
|
||||
Text="{Binding WireModelSpecification}" />
|
||||
<TextBlock
|
||||
Margin="10,0"
|
||||
BorderBrush="{Binding WireColorHex}"
|
||||
BorderThickness="0,0,0,2">
|
||||
<hc:SimpleStackPanel>
|
||||
<TextBlock Margin="2">
|
||||
<Run Text="线芯名称:" />
|
||||
<Run Text="{Binding WireModelSpecification}" />
|
||||
</TextBlock>
|
||||
<TextBlock Margin="2">
|
||||
<Run Text="线芯颜色:" />
|
||||
<Run Text="{Binding WireColorName}" />
|
||||
</TextBlock>
|
||||
<TextBlock Margin="2">
|
||||
<Run Text="前端子:" />
|
||||
<Run Text="{Binding FrontTerminalModel}" />
|
||||
</TextBlock>
|
||||
<TextBlock Margin="2">
|
||||
<Run Text="后端子:" />
|
||||
<Run Text="{Binding BackTerminalModel}" />
|
||||
</TextBlock>
|
||||
</hc:SimpleStackPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>-->
|
||||
</Expander>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
VerticalAlignment="Center"
|
||||
Foreground="White"
|
||||
Text="{Binding CheckedMsg}" />
|
||||
</hc:SimpleStackPanel>
|
||||
</Expander.Header>
|
||||
<TabControl>
|
||||
<TabItem Header="线芯数据">
|
||||
<hc:SimpleStackPanel Orientation="Vertical">
|
||||
<Button
|
||||
Margin="5"
|
||||
Click="SaveWireCoreData_Click"
|
||||
Content="保存线芯信息"
|
||||
Style="{StaticResource ButtonSuccess}"
|
||||
Tag="{Binding}" />
|
||||
<DataGrid
|
||||
AutoGenerateColumns="False"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding Children}"
|
||||
PreviewMouseWheel="ListView_PreviewMouseWheel">
|
||||
<DataGrid.Resources>
|
||||
<localconverter:WireColorConverter x:Key="WireColorConverter" />
|
||||
</DataGrid.Resources>
|
||||
<DataGrid.Columns>
|
||||
<DataGridTextColumn Binding="{Binding WireModelSpecification}" Header="线芯名称" />
|
||||
<DataGridTemplateColumn Header="线芯颜色">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Border>
|
||||
<Border.Resources>
|
||||
<Style BasedOn="{StaticResource BorderClip}" TargetType="Border">
|
||||
<Setter Property="BorderBrush">
|
||||
<Setter.Value>
|
||||
<MultiBinding Converter="{StaticResource WireColorConverter}">
|
||||
<Binding Path="WireColorHex" />
|
||||
<Binding Path="WireColorHexSec" />
|
||||
<Binding Path="IsMultiColor" />
|
||||
</MultiBinding>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
<Setter Property="BorderThickness" Value="0,0,0,4" />
|
||||
<Setter Property="hc:BorderElement.CornerRadius" Value="0" />
|
||||
<Setter Property="Margin" Value="0" />
|
||||
</Style>
|
||||
</Border.Resources>
|
||||
<TextBlock Text="{Binding WireColorName}" />
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Binding="{Binding FrontConnectorModel}" Header="前连接" />
|
||||
<DataGridTextColumn Binding="{Binding FrontConnectorMCode}" Header="前连接料号" />
|
||||
<DataGridTextColumn Binding="{Binding RearConnectorModel}" Header="后连接" />
|
||||
<DataGridTextColumn Binding="{Binding RearConnectorMCode}" Header="后连接料号" />
|
||||
<DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn.Header>
|
||||
<TextBlock Text="线芯引脚号" />
|
||||
</DataGridTemplateColumn.Header>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<hc:SimpleStackPanel>
|
||||
<hc:TextBox Text="{Binding PinIndex, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</hc:SimpleStackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn.Header>
|
||||
<TextBlock Text="线芯号码管标示" />
|
||||
</DataGridTemplateColumn.Header>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<hc:SimpleStackPanel>
|
||||
<hc:TextBox Text="{Binding CoreNumberTube, UpdateSourceTrigger=PropertyChanged}" />
|
||||
</hc:SimpleStackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Binding="{Binding InsulationModel}" Header="绝缘软套型号" />
|
||||
<DataGridTextColumn Binding="{Binding InsulationMaterialNo}" Header="绝缘软套型号物料编码" />
|
||||
<DataGridTextColumn Binding="{Binding InsulationQuantity}" Header="绝缘软套数量" />
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</hc:SimpleStackPanel>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
</Expander>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</localCtr:MyScrollViewer>
|
||||
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</Grid>
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
using Sinvo.EplanHpD.Plugin.WPFUI.Models;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.View.MultiCoreWire.LayoutHelper;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel;
|
||||
using SqlSugar.Extensions;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
||||
{
|
||||
|
@ -51,5 +53,49 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Layout_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MultiCoreWireLayoutHelperWindow layoutWindow = new(viewModel.CurrUniqueKey)
|
||||
{
|
||||
Topmost = true
|
||||
};
|
||||
layoutWindow.Show();
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void ExportBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
viewModel.ExportLines();
|
||||
}
|
||||
|
||||
private void SaveWireCoreData_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if(sender is Button btn)
|
||||
{
|
||||
var tag = btn.Tag as MultiCoreWireDataModel;
|
||||
if (tag != null)
|
||||
{
|
||||
viewModel.SaveWireCoreData(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void ListView_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
|
||||
{
|
||||
if (!e.Handled)
|
||||
{
|
||||
// ListView拦截鼠标滚轮事件
|
||||
e.Handled = true;
|
||||
|
||||
// 激发一个鼠标滚轮事件,冒泡给外层ListView接收到
|
||||
var eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta);
|
||||
eventArg.RoutedEvent = UIElement.MouseWheelEvent;
|
||||
eventArg.Source = sender;
|
||||
var parent = ((Control)sender).Parent as UIElement;
|
||||
parent.RaiseEvent(eventArg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
using Sinvo.EplanHpD.Plugin.Service.Model;
|
||||
using EPLAN.Harness.API;
|
||||
using EPLAN.Harness.Common.Extensions;
|
||||
using EPLAN.Harness.Core.Controls;
|
||||
using EPLAN.Harness.Core;
|
||||
using EPLAN.Harness.ProjectCore;
|
||||
using Sinvo.EplanHpD.Plugin.Service.Model;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Models;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Service;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
@ -7,39 +14,245 @@ using System.ComponentModel;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using EPLAN.Harness.ProjectCore.Occurrences.Designer;
|
||||
using System.Diagnostics;
|
||||
using EPLAN.Harness.Primitives.Treeviews.NodeMaps;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Utils;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
||||
{
|
||||
public class MultiCoreWireLayoutHelperViewModel : INotifyPropertyChanged
|
||||
{
|
||||
|
||||
private readonly MultiCoreWireService _service = new();
|
||||
private string _uniqueKey;
|
||||
|
||||
|
||||
private FlexDesigner _currentFlexDesigner;
|
||||
private List<string> ApplicationScenarios = [];
|
||||
public int ApplicationScenarioIndex = 0;
|
||||
private List<MultiCoreWireDataModel> _wireData = [];
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
internal void LoadData()
|
||||
{
|
||||
var wireDatas = _service.GetByUniqueKey(_uniqueKey);
|
||||
var applicationScenarios = wireDatas.Select(it => it.ApplicationScenario).Distinct().ToList();
|
||||
ApplicationScenarios = applicationScenarios;
|
||||
UpdatePropNotify();
|
||||
wireDatas.ForEach(wire =>
|
||||
{
|
||||
_wireData.Add(MapperUtil.MapFor<MultiCoreWireDataModel, MultiCoreWireLecDBModel>(wire));
|
||||
});
|
||||
|
||||
_wireData.Where(wire => wire.ApplicationScenario == ApplicationScenario).ForEach(LecWires.Add);
|
||||
|
||||
UpdatePropNotify();
|
||||
|
||||
}
|
||||
public void Init()
|
||||
{
|
||||
GetCurrentDoc();
|
||||
|
||||
if(_currentFlexDesigner != null)
|
||||
{
|
||||
_currentFlexDesigner.SelectSet.SelectionChanged += SelectSet_SelectionChanged;
|
||||
}
|
||||
LecWires = [];
|
||||
LoadData();
|
||||
}
|
||||
private void SelectSet_SelectionChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (sender is OccSelectSet selectSet)
|
||||
{
|
||||
var item = selectSet.SelectedItem;
|
||||
if (item is OccSubPart part)
|
||||
{
|
||||
Debug.WriteLine($"Select part -> {part.Name} / {part.ID}");
|
||||
if (part.Parents != null)
|
||||
{
|
||||
var SelectMotorModel = part.Parents?.First()?.Name ?? "";
|
||||
Debug.WriteLine($"Select part parent -> {SelectMotorModel} / {part.Parents?.First()?.ID}");
|
||||
}
|
||||
}
|
||||
else if (item != null)
|
||||
{
|
||||
CheckSelLine(slient: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 检查选中的线
|
||||
/// </summary>
|
||||
/// <param name="slient"></param>
|
||||
/// <returns></returns>
|
||||
private bool CheckSelLine(bool slient = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
var parts = _currentFlexDesigner.SelectSet;
|
||||
foreach (var part in parts)
|
||||
{
|
||||
if (part != null)
|
||||
{
|
||||
// 如果选中的是导线,则直接使用,如果选中的是绝缘层,则使用绝缘层,其他情况使用父级
|
||||
var linePart = part is OccCableForked ?
|
||||
part as OccCableForked
|
||||
: part is OccCablesInsulatorGraph ?
|
||||
part
|
||||
: part.Parents?.FirstOrDefault() as OccCableForked;
|
||||
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
|
||||
&& name == $"{it.ApplicationScenario}-{it.WireKey}"
|
||||
&& !it.Layouted);
|
||||
if(wire != null)
|
||||
{
|
||||
wire.Layouted = true;
|
||||
_service.UpdateWireIsLayout(wire.Id);
|
||||
OnPropertyChanged(nameof(LecWires));
|
||||
OnPropertyChanged("Layouted");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#if DEBUG
|
||||
return true;
|
||||
#else
|
||||
if(!slient)
|
||||
FlexMessageBox.Warning($"当前选中的线不是推荐中的线型号");
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
if (!slient)
|
||||
FlexMessageBox.Warning("抓取线信息异常");
|
||||
return false;
|
||||
}
|
||||
if (!slient)
|
||||
FlexMessageBox.Warning("请选择正确的线");
|
||||
return false;
|
||||
}
|
||||
public void GetCurrentDoc()
|
||||
{
|
||||
try
|
||||
{
|
||||
HpdApi api = HpdApi.GetInstance();
|
||||
var currentDocId = api.CurrentProject.GetActiveDocument()?.ID;
|
||||
var designer = SelfControler<FlexBaseOrganizer>.FindInstance(currentDocId) as FlexDesigner;
|
||||
if (designer != null)
|
||||
{
|
||||
_currentFlexDesigner = designer;
|
||||
}
|
||||
else
|
||||
{
|
||||
FlexMessageBox.Warning("未找到当前打开的工作区,请先打开工作区");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FlexMessageBox.Error(ex.Message);
|
||||
}
|
||||
}
|
||||
internal void Next()
|
||||
{
|
||||
if (ApplicationScenarioIndex < ApplicationScenarios.Count - 1)
|
||||
{
|
||||
ApplicationScenarioIndex++;
|
||||
OnPropertyChanged(nameof(ApplicationScenario));
|
||||
LecWires.Clear();
|
||||
_wireData.Where(wire => wire.ApplicationScenario == ApplicationScenario).ForEach(LecWires.Add);
|
||||
}
|
||||
|
||||
UpdatePropNotify();
|
||||
}
|
||||
|
||||
internal void Prev()
|
||||
{
|
||||
if (ApplicationScenarioIndex > 0)
|
||||
{
|
||||
ApplicationScenarioIndex--;
|
||||
OnPropertyChanged(nameof(ApplicationScenario));
|
||||
LecWires.Clear();
|
||||
_wireData.Where(wire => wire.ApplicationScenario == ApplicationScenario).ForEach(LecWires.Add);
|
||||
}
|
||||
|
||||
UpdatePropNotify();
|
||||
}
|
||||
|
||||
public MultiCoreWireLayoutHelperViewModel(string uniqueKey)
|
||||
{
|
||||
_uniqueKey = uniqueKey;
|
||||
}
|
||||
|
||||
|
||||
private void UpdatePropNotify()
|
||||
{
|
||||
OnPropertyChanged(nameof(LecWires));
|
||||
OnPropertyChanged(nameof(ApplicationScenario));
|
||||
OnPropertyChanged(nameof(HasPrev));
|
||||
OnPropertyChanged(nameof(HasNext));
|
||||
}
|
||||
#region Props
|
||||
public string ApplicationScenario
|
||||
{
|
||||
get
|
||||
{
|
||||
return ApplicationScenarios[ApplicationScenarioIndex];
|
||||
}
|
||||
set
|
||||
{
|
||||
OnPropertyChanged(nameof(ApplicationScenario));
|
||||
}
|
||||
}
|
||||
private ObservableCollection<MultiCoreWireDataModel> _lecWires;
|
||||
|
||||
private ObservableCollection<MultiCoreWireLecModel> _lecWires = [];
|
||||
|
||||
public ObservableCollection<MultiCoreWireLecModel> LecWires
|
||||
public ObservableCollection<MultiCoreWireDataModel> LecWires
|
||||
{
|
||||
get { return _lecWires; }
|
||||
set
|
||||
{
|
||||
{
|
||||
_lecWires = value;
|
||||
OnPropertyChanged(nameof(LecWires));
|
||||
}
|
||||
}
|
||||
public bool HasPrev
|
||||
{
|
||||
get
|
||||
{
|
||||
return ApplicationScenarioIndex > 0;
|
||||
}
|
||||
set
|
||||
{
|
||||
OnPropertyChanged(nameof(HasPrev));
|
||||
}
|
||||
}
|
||||
public bool HasNext
|
||||
{
|
||||
get
|
||||
{
|
||||
return ApplicationScenarioIndex < ApplicationScenarios.Count - 1;
|
||||
}
|
||||
set
|
||||
{
|
||||
OnPropertyChanged(nameof(HasNext));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
|
|
@ -3,8 +3,11 @@ using EPLAN.Harness.Core.Appearance;
|
|||
using EPLAN.Harness.Core.Utils;
|
||||
using EPLAN.Harness.ProjectCore;
|
||||
using EPLAN.Harness.ProjectCore.Occurrences.Designer;
|
||||
using EPLAN.Harness.ProjectCore.Occurrences.Nailboard;
|
||||
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;
|
||||
|
@ -20,7 +23,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
|
||||
{
|
||||
|
@ -29,7 +31,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
public string _docId = docId;
|
||||
private readonly MultiCoreWireExcelHelper _dataHelper = MultiCoreWireExcelHelper.Instance;
|
||||
private readonly MultiCoreWireService _service = new();
|
||||
private string CurrUniqueKey = "";
|
||||
public string CurrUniqueKey = "";
|
||||
#region Props
|
||||
|
||||
private ObservableCollection<MultiCoreWireDataModel> _wires = [];
|
||||
|
@ -44,9 +46,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
|
||||
|
@ -57,6 +59,34 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
}
|
||||
|
||||
|
||||
private string _mechanismNo;
|
||||
/// <summary>
|
||||
/// 机构号
|
||||
/// </summary>
|
||||
public string MechanismNo
|
||||
{
|
||||
get => _mechanismNo;
|
||||
set
|
||||
{
|
||||
_mechanismNo = value;
|
||||
OnPropertyChanged(nameof(MechanismNo));
|
||||
}
|
||||
}
|
||||
private string _mechanismName;
|
||||
/// <summary>
|
||||
/// 机构名称
|
||||
/// </summary>
|
||||
public string MechanismName
|
||||
{
|
||||
get => _mechanismName;
|
||||
set
|
||||
{
|
||||
_mechanismName = value;
|
||||
OnPropertyChanged(nameof(MechanismName));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string _applicationScenario;
|
||||
/// <summary>
|
||||
/// 应用场景
|
||||
|
@ -76,6 +106,21 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
}
|
||||
}
|
||||
|
||||
private string _wireKey;
|
||||
/// <summary>
|
||||
/// 线材标识
|
||||
/// </summary>
|
||||
public string Wirekey
|
||||
{
|
||||
get => _wireKey;
|
||||
set
|
||||
{
|
||||
_wireKey = value;
|
||||
|
||||
OnPropertyChanged(nameof(Wirekey));
|
||||
|
||||
}
|
||||
}
|
||||
private bool _applicationScenarioSelected;
|
||||
|
||||
public bool ApplicationScenarioSelected
|
||||
|
@ -157,6 +202,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
_wireModelSpecification = value;
|
||||
OnPropertyChanged(nameof(WireModelSpecification));
|
||||
OnLecChanged(nameof(WireModelSpecification));
|
||||
OnWireChange();
|
||||
}
|
||||
}
|
||||
//private string _connectorModel;
|
||||
|
@ -267,9 +313,24 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
{
|
||||
_wireModelSpecifications = value;
|
||||
OnPropertyChanged(nameof(WireModelSpecifications));
|
||||
OnWireChange();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private List<string> _highFlexibilitys;
|
||||
/// <summary>
|
||||
/// 线径规格
|
||||
/// </summary>
|
||||
public List<string> HighFlexibilitys
|
||||
{
|
||||
get => _highFlexibilitys;
|
||||
set
|
||||
{
|
||||
_highFlexibilitys = value;
|
||||
OnPropertyChanged(nameof(HighFlexibilitys));
|
||||
}
|
||||
}
|
||||
//private List<string> _connectorModels;
|
||||
///// <summary>
|
||||
///// 连接器型号
|
||||
|
@ -298,17 +359,17 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
}
|
||||
|
||||
|
||||
private List<MultiCoreWireTerminalModel> _backConnectorModels;
|
||||
private List<MultiCoreWireTerminalModel> _rearConnectorModels;
|
||||
/// <summary>
|
||||
/// 后连接器型号
|
||||
/// </summary>
|
||||
public List<MultiCoreWireTerminalModel> BackConnectorModels
|
||||
public List<MultiCoreWireTerminalModel> RearConnectorModels
|
||||
{
|
||||
get => _backConnectorModels;
|
||||
get => _rearConnectorModels;
|
||||
set
|
||||
{
|
||||
_backConnectorModels = value;
|
||||
OnPropertyChanged(nameof(BackConnectorModels));
|
||||
_rearConnectorModels = value;
|
||||
OnPropertyChanged(nameof(RearConnectorModels));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -323,51 +384,51 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
{
|
||||
_frontConnectorType = value;
|
||||
OnPropertyChanged(nameof(FrontConnectorType));
|
||||
OnFrontTypeChange(FrontConnectorType);
|
||||
OnFrontConnectorTypeModels(FrontConnectorType);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void OnFrontTypeChange(string type)
|
||||
private void OnFrontConnectorTypeModels(string type)
|
||||
{
|
||||
if (type == "端子")
|
||||
{
|
||||
FrontConnectorModels = [.. _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.TerminalModels];
|
||||
FrontConnectorModels = [.. _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.TerminalModels ?? [] ];
|
||||
}
|
||||
else
|
||||
{
|
||||
FrontConnectorModels = [new MultiCoreWireTerminalModel {
|
||||
TerminalModel = _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.ConnectorModel
|
||||
TerminalModel = _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.ConnectorModel ?? null
|
||||
}];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private string _backConnectorType;
|
||||
private string _rearConnectorType;
|
||||
/// <summary>
|
||||
/// 后连接器类型
|
||||
/// </summary>
|
||||
public string BackConnectorType
|
||||
public string RearConnectorType
|
||||
{
|
||||
get => _backConnectorType;
|
||||
get => _rearConnectorType;
|
||||
set
|
||||
{
|
||||
_backConnectorType = value;
|
||||
OnPropertyChanged(nameof(BackConnectorType));
|
||||
OnBackTypeChange(BackConnectorType);
|
||||
_rearConnectorType = value;
|
||||
OnPropertyChanged(nameof(RearConnectorType));
|
||||
OnRearConnectorTypeChange(RearConnectorType);
|
||||
|
||||
}
|
||||
}
|
||||
private void OnBackTypeChange(string type)
|
||||
private void OnRearConnectorTypeChange(string type)
|
||||
{
|
||||
if (type == "端子")
|
||||
{
|
||||
BackConnectorModels = [.. _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.TerminalModels];
|
||||
RearConnectorModels = [.. _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.TerminalModels ?? []];
|
||||
}
|
||||
else
|
||||
{
|
||||
BackConnectorModels = [new MultiCoreWireTerminalModel {
|
||||
TerminalModel = _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.ConnectorModel
|
||||
RearConnectorModels = [new MultiCoreWireTerminalModel {
|
||||
TerminalModel = _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.ConnectorModel ?? null
|
||||
}];
|
||||
|
||||
}
|
||||
|
@ -389,51 +450,84 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
}
|
||||
|
||||
|
||||
private string _backConnectorModel;
|
||||
private string _rearConnectorModel;
|
||||
/// <summary>
|
||||
/// 后连接器型号
|
||||
/// </summary>
|
||||
public string BackConnectorModel
|
||||
public string RearConnectorModel
|
||||
{
|
||||
get => _backConnectorModel;
|
||||
get => _rearConnectorModel;
|
||||
set
|
||||
{
|
||||
_backConnectorModel = value;
|
||||
OnPropertyChanged(nameof(BackConnectorModel));
|
||||
_rearConnectorModel = value;
|
||||
OnPropertyChanged(nameof(RearConnectorModel));
|
||||
}
|
||||
}
|
||||
|
||||
private int _frontConnectorCount;
|
||||
/// <summary>
|
||||
///
|
||||
public int FrontConnectorCount
|
||||
{
|
||||
get => _frontConnectorCount;
|
||||
set
|
||||
{
|
||||
_frontConnectorCount = value;
|
||||
OnPropertyChanged(nameof(FrontConnectorCount));
|
||||
}
|
||||
}
|
||||
private int _rearConnectorCount;
|
||||
/// <summary>
|
||||
///
|
||||
public int RearConnectorCount
|
||||
{
|
||||
get => _rearConnectorCount;
|
||||
set
|
||||
{
|
||||
_rearConnectorCount = value;
|
||||
OnPropertyChanged(nameof(RearConnectorCount));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string _wireColorName;
|
||||
/// <summary>
|
||||
/// 线材外皮颜色
|
||||
/// </summary>
|
||||
public string WireColorName
|
||||
{
|
||||
get => _wireColorName;
|
||||
set
|
||||
{
|
||||
_wireColorName = value;
|
||||
OnPropertyChanged(nameof(WireColorName));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
private IEnumerable<MultiCoreWireExcelModel> _datas;
|
||||
|
||||
private IEnumerable<MultiCoreWireLecModel> _datas;
|
||||
public void LoadLecData()
|
||||
{
|
||||
_datas = _dataHelper.GetMultiCoreWireLecDatas();
|
||||
|
||||
try
|
||||
{
|
||||
_datas = _dataHelper.GetMultiCoreWireLecDatas();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Show(ex.Message);
|
||||
return;
|
||||
}
|
||||
SetDatas(_datas);
|
||||
try
|
||||
{
|
||||
|
||||
var wiresData = _service.GetByUniqueKey(CurrUniqueKey);
|
||||
if (wiresData != null)
|
||||
{
|
||||
wiresData.ForEach(wire =>
|
||||
{
|
||||
LecWires.Add(new MultiCoreWireLecModel
|
||||
{
|
||||
Id = wire.Id,
|
||||
SeqNo = wire.SeqNo,
|
||||
ApplicationScenario = wire.ApplicationScenario,
|
||||
WireDiameterSpecification = wire.WireDiameterSpecification,
|
||||
IsHighFlexibilityStr = wire.IsHighFlexibilityStr,
|
||||
WireCoreCount = wire.WireCoreCount,
|
||||
WireModelSpecification = wire.WireModelSpecification,
|
||||
FrontConnectorModel = wire.FrontConnectorModel,
|
||||
BackConnectorModel = wire.BackConnectorModel,
|
||||
UserId = wire.UserId,
|
||||
ProjectName = wire.ProjectName,
|
||||
UniqueKey = wire.UniqueKey
|
||||
});
|
||||
var wiredata = MapperUtil.MapFor<MultiCoreWireDataModel, MultiCoreWireLecDBModel>(wire);
|
||||
LecWires.Add(wiredata);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -458,9 +552,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
//var datas = _dataHelper.GetMultiCoreWireLecDatas();
|
||||
var canUsedDatas = _datas
|
||||
// 使用场景
|
||||
.WhereIF(!string.IsNullOrEmpty(ApplicationScenario), it => it.ApplicationScenario == ApplicationScenario)
|
||||
//线材类型
|
||||
//.WhereIF(!string.IsNullOrEmpty(WireType), it => it.WireType == LecData.WireType)
|
||||
.WhereIF(!string.IsNullOrEmpty(ApplicationScenario), it => it.ApplicationScenario == ApplicationScenario)
|
||||
// 线径规格
|
||||
.WhereIF(!string.IsNullOrEmpty(WireDiameterSpecification), it => it.WireDiameterSpecification == WireDiameterSpecification)
|
||||
// 是否高柔
|
||||
|
@ -470,41 +562,36 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
// 线芯数
|
||||
.WhereIF(!string.IsNullOrEmpty(WireCoreCount), it => it.WireCoreCount == WireCoreCount)
|
||||
;
|
||||
SetDatas(canUsedDatas, propName);
|
||||
SetDatas(canUsedDatas, propName,true);
|
||||
}
|
||||
|
||||
private void SetDatas(IEnumerable<MultiCoreWireLecModel> datas, string propName = "")
|
||||
private void SetDatas(IEnumerable<MultiCoreWireExcelModel> datas, string propName = "",bool isLecChange = false)
|
||||
{
|
||||
if (datas != null)
|
||||
{
|
||||
LecChanging = true;
|
||||
ApplicationScenarios = [.. datas.Where(it => !string.IsNullOrEmpty(it.ApplicationScenario)).Select(it => it.ApplicationScenario).Distinct(), ""];
|
||||
if (!isLecChange)
|
||||
{
|
||||
ApplicationScenarios = [.. datas.Where(it => !string.IsNullOrEmpty(it.ApplicationScenario)).Select(it => it.ApplicationScenario).Distinct(), ""];
|
||||
}
|
||||
//if (ApplicationScenarios.Where(it => !string.IsNullOrEmpty(it)).Count() == 1 && propName != nameof(ApplicationScenario))
|
||||
//{
|
||||
// ApplicationScenario = ApplicationScenarios.FirstOrDefault();
|
||||
//}
|
||||
//WireTypes = [.. datas.Where(it => !string.IsNullOrEmpty(it.WireType)).Select(it => it.WireType).Distinct(), ""];
|
||||
//if (WireTypes.Where(it => !string.IsNullOrEmpty(it)).Count() == 1 && propName != nameof(WireType))
|
||||
//{
|
||||
// WireType = WireTypes.FirstOrDefault();
|
||||
//}
|
||||
WireDiameterSpecifications = [.. datas.Where(it => !string.IsNullOrEmpty(it.WireDiameterSpecification)).Select(it => it.WireDiameterSpecification).Distinct(), ""];
|
||||
//if (WireDiameterSpecifications.Where(it => !string.IsNullOrEmpty(it)).Count() == 1 && propName != nameof(WireDiameterSpecification))
|
||||
//{
|
||||
// WireDiameterSpecification = WireDiameterSpecifications.FirstOrDefault();
|
||||
//}
|
||||
|
||||
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();
|
||||
//}
|
||||
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))
|
||||
{
|
||||
WireModelSpecification = WireModelSpecifications.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(), ""];
|
||||
LecChanging = false;
|
||||
}
|
||||
}
|
||||
|
@ -519,36 +606,46 @@ 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}");
|
||||
var lecData = LecWires?.FirstOrDefault(i => $"{i.ApplicationScenario}-{i.WireKey}" == it.Name && i.WireModelSpecification == it.LibraryName);
|
||||
if (lecData == null)
|
||||
{
|
||||
wireData.IsError = true;
|
||||
wireData.CheckedMsg = "无法匹配选型数据!";
|
||||
wireData.IsChecked = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
wireData.IsChecked = true;
|
||||
wireData.Id = lecData.Id;
|
||||
}
|
||||
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)),
|
||||
WireColorHex = $"#{wire.Color.Major.ToHex()}",
|
||||
WireColorHexSec = $"#{wire.Color.Minor.ToHex()}",
|
||||
IsMultiColor = wire.Color.Major.IsValid() && wire.Color.Minor.IsValid(),
|
||||
FrontTerminalModel = wire.GetEndingPins()?.FirstOrDefault()?.Parents?.FirstOrDefault()?.LibraryName,
|
||||
BackTerminalModel = wire.GetEndingPins()?.LastOrDefault()?.Parents?.FirstOrDefault()?.LibraryName
|
||||
});
|
||||
FrontConnectorModel = wire.GetEndingPins()?.FirstOrDefault()?.Parents?.FirstOrDefault()?.LibraryName,
|
||||
RearConnectorModel = wire.GetEndingPins()?.LastOrDefault()?.Parents?.FirstOrDefault()?.LibraryName
|
||||
};
|
||||
|
||||
wireData.Children.Add(wireItem);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -558,6 +655,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)
|
||||
{
|
||||
|
@ -574,9 +683,12 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
WireCoreCount = "";
|
||||
WireModelSpecification = "";
|
||||
FrontConnectorType = "";
|
||||
BackConnectorType = "";
|
||||
|
||||
RearConnectorType = "";
|
||||
FrontConnectorModel = "";
|
||||
RearConnectorModel = "";
|
||||
LecChanging = false;
|
||||
Wirekey = "";
|
||||
WireColorName = "";
|
||||
OnLecChanged("");
|
||||
}
|
||||
|
||||
|
@ -588,52 +700,126 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
|| WireCoreCount == null
|
||||
|| WireModelSpecification == null
|
||||
|| FrontConnectorModel == null
|
||||
|| BackConnectorModel == null)
|
||||
|| RearConnectorModel == null)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Show("有信息未选择!",caption: "提示",icon: MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
//if(LecWires.Any(it=> it.ApplicationScenario == ApplicationScenario && it.WireModelSpecification == WireModelSpecification))
|
||||
//{
|
||||
// MessageBox.Show("已选择相同的线!");
|
||||
// return;
|
||||
//}
|
||||
|
||||
if(RearConnectorType == "插头" && FrontConnectorType == "插头")
|
||||
{
|
||||
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))
|
||||
{
|
||||
var result = HandyControl.Controls.MessageBox.Show("存在信息相同的线,是否继续添加?", "提示", button: MessageBoxButton.YesNo);
|
||||
if(!(result == MessageBoxResult.Yes))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
var wire = new MultiCoreWireLecModel
|
||||
var frontConnectorMCode = GetConnectorMCode(FrontConnectorModel, FrontConnectorType);
|
||||
var rearConnectorMCode = GetConnectorMCode(RearConnectorModel, RearConnectorType);
|
||||
var wire = new MultiCoreWireDataModel
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
SeqNo = LecWires.Count + 1,
|
||||
ApplicationScenario = ApplicationScenario,
|
||||
WireKey = Wirekey,
|
||||
WireDiameterSpecification = WireDiameterSpecification,
|
||||
IsHighFlexibilityStr = HighFlexibility,
|
||||
WireCoreCount = WireCoreCount,
|
||||
WireModelSpecification = WireModelSpecification,
|
||||
FrontConnectorModel = FrontConnectorModel,
|
||||
BackConnectorModel = BackConnectorModel,
|
||||
FrontConnectorQuantity = FrontConnectorCount,
|
||||
FrontConnectorMCode = frontConnectorMCode,
|
||||
FrontConnectorIsPin = FrontConnectorType == "端子",
|
||||
RearConnectorModel = RearConnectorModel,
|
||||
RearConnectorQuantity = RearConnectorCount,
|
||||
RearConnectorMCode = rearConnectorMCode,
|
||||
RearConnectorIsPin = RearConnectorType == "端子",
|
||||
|
||||
WireColorName = WireColorName,
|
||||
|
||||
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,
|
||||
FrontConnectorModel = wire.FrontConnectorModel,
|
||||
BackConnectorModel = wire.BackConnectorModel
|
||||
try
|
||||
{
|
||||
|
||||
if (!wire.FrontConnectorIsPin)
|
||||
{
|
||||
// 获取插头信息
|
||||
var connectorInfo = MultiCoreWireExcelHelper.Instance.GetConnectorHeatShrinkMappingDatas(wire.FrontConnectorModel);
|
||||
if (connectorInfo != null)
|
||||
{
|
||||
wire.BlackHeatShrinkTubeMCode = connectorInfo.HeatShrinkTubeSpecification;
|
||||
wire.BlackHeatShrinkTubeMCode = connectorInfo.HeatShrinkTubeMaterialCode;
|
||||
}
|
||||
}
|
||||
|
||||
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 =>
|
||||
{
|
||||
var wireData = MapperUtil.MapFor<MultiCoreWireLecDBModel, MultiCoreWireDataModel>(wire);
|
||||
Application.Current.Dispatcher.BeginInvoke(() =>
|
||||
{
|
||||
_service.SaveData(wireData);
|
||||
LecWires.Add(wire);
|
||||
ClearLecData();
|
||||
OnPropertyChanged(nameof(LecWires));
|
||||
});
|
||||
});
|
||||
LecWires.Add(wire);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -645,6 +831,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);
|
||||
}
|
||||
|
@ -672,21 +863,77 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
HandyControl.Controls.MessageBox.Error($"删除数据失败!{ex}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//ReOrderLecWires();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//private void ReOrderLecWires()
|
||||
//{
|
||||
// int seq = 1;
|
||||
// LecWires.OrderBy(it => it.SeqNo).ForEach(it =>
|
||||
// {
|
||||
// it.SeqNo = seq;
|
||||
// seq++;
|
||||
// });
|
||||
// OnPropertyChanged(nameof(LecWires));
|
||||
//}
|
||||
private string GetConnectorMCode(string connectorModel,string connectorType)
|
||||
{
|
||||
if(_datas != null)
|
||||
{
|
||||
if (connectorType == "端子")
|
||||
{
|
||||
|
||||
var terminals = _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.TerminalModels;
|
||||
return terminals.FirstOrDefault(it => it.TerminalModel == connectorModel)?.TerminalMaterialCode ?? "";
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO 插头型号信息获取
|
||||
return "";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
private void OnWireChange()
|
||||
{
|
||||
OnFrontConnectorTypeModels(FrontConnectorType);
|
||||
OnRearConnectorTypeChange(RearConnectorType);
|
||||
}
|
||||
|
||||
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<dynamic> {
|
||||
new { MechanismNo, MechanismName, WireModelStr= '1' },
|
||||
new { MechanismNo, MechanismName, WireModelStr= '2' },
|
||||
new { MechanismNo, MechanismName, WireModelStr= '3' }
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void SaveWireCoreData(MultiCoreWireDataModel tag)
|
||||
{
|
||||
//var coreWireData = MapperUtil.MapFor<MultiWireCoreDataModel, MultiCoreWireDataModel>(tag);
|
||||
var coreWireDatas = new List<MultiWireCoreDataModel>();
|
||||
if(tag.Children != null && tag.Children.Any())
|
||||
{
|
||||
var seq = 0;
|
||||
tag.Children.ForEach(it =>
|
||||
{
|
||||
seq++;
|
||||
coreWireDatas.Add(new MultiWireCoreDataModel
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
PId = tag.Id,
|
||||
CoreWireName = it.WireModelSpecification,
|
||||
PinIndex = it.PinIndex,
|
||||
CoreNumberTube = it.CoreNumberTube,
|
||||
SeqNo = seq
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,27 +59,39 @@ namespace Sinvo.EplanHpD.Plugin
|
|||
|
||||
public void Execute(HpdApi api)
|
||||
{
|
||||
new DBHelper().CodeFirst();
|
||||
var doc = api.CurrentProject.GetActiveDocument();
|
||||
if (window == null)
|
||||
bool isLogin = PluginServices.IsLogin;
|
||||
if (!isLogin)
|
||||
{
|
||||
window = new LectotypeWindow(doc.ID);
|
||||
// 获取版本号并显示到窗口标题
|
||||
window.Title += $" V{Version} - {doc.Name}";
|
||||
ElementHost.EnableModelessKeyboardInterop(window);
|
||||
var mainApp = BaseApp.ActiveApplication;
|
||||
var helper = new System.Windows.Interop.WindowInteropHelper(window);
|
||||
helper.Owner = mainApp.Handle;
|
||||
window.Closed += delegate
|
||||
var LoginWindow = new LoginWindow();
|
||||
if (LoginWindow.ShowDialog() == true)
|
||||
{
|
||||
window = null;
|
||||
};
|
||||
window.Show();
|
||||
isLogin = PluginServices.IsLogin;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (isLogin)
|
||||
{
|
||||
window.WindowState = System.Windows.WindowState.Normal;
|
||||
window.Activate();
|
||||
new DBHelper().CodeFirst();
|
||||
var doc = api.CurrentProject.GetActiveDocument();
|
||||
if (window == null)
|
||||
{
|
||||
window = new LectotypeWindow(doc.ID);
|
||||
// 获取版本号并显示到窗口标题
|
||||
window.Title += $" V{Version} - {doc.Name}";
|
||||
ElementHost.EnableModelessKeyboardInterop(window);
|
||||
var mainApp = BaseApp.ActiveApplication;
|
||||
var helper = new System.Windows.Interop.WindowInteropHelper(window);
|
||||
helper.Owner = mainApp.Handle;
|
||||
window.Closed += delegate
|
||||
{
|
||||
window = null;
|
||||
};
|
||||
window.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
window.WindowState = System.Windows.WindowState.Normal;
|
||||
window.Activate();
|
||||
}
|
||||
}
|
||||
}
|
||||
public void Initialize()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using EPLAN.Harness.API;
|
||||
using EPLAN.Harness.API.Plugins.Core;
|
||||
using EPLAN.Harness.AppCore;
|
||||
using HandyControl.Controls;
|
||||
using Sinvo.EplanHpD.Plugin.DynaClient;
|
||||
using Sinvo.EplanHpD.Plugin.Service;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI;
|
||||
|
@ -16,7 +17,7 @@ using System.Windows.Forms.Integration;
|
|||
|
||||
namespace Sinvo.EplanHpD.Plugin
|
||||
{
|
||||
#if DEBUG
|
||||
#if Release_WireAndCable || DEBUG
|
||||
public class MultiCoreWirePluginEntry : EPLAN.Harness.API.Plugins.IHpDPlugin
|
||||
#else
|
||||
public class MultiCoreWirePluginEntry
|
||||
|
@ -59,7 +60,6 @@ namespace Sinvo.EplanHpD.Plugin
|
|||
|
||||
public void Execute(HpdApi api)
|
||||
{
|
||||
#if DEBUG
|
||||
bool isLogin = PluginServices.IsLogin;
|
||||
if (!isLogin)
|
||||
{
|
||||
|
@ -71,32 +71,36 @@ namespace Sinvo.EplanHpD.Plugin
|
|||
}
|
||||
if (isLogin)
|
||||
{
|
||||
#endif
|
||||
new DBHelper().CodeFirst();
|
||||
var doc = api.CurrentProject.GetActiveDocument();
|
||||
if (window == null)
|
||||
try
|
||||
{
|
||||
window = new MultiCoreWireWindow(doc.ID);
|
||||
// 获取版本号并显示到窗口标题
|
||||
window.Title += $" V{Version} - {doc.Name}";
|
||||
ElementHost.EnableModelessKeyboardInterop(window);
|
||||
var mainApp = BaseApp.ActiveApplication;
|
||||
var helper = new System.Windows.Interop.WindowInteropHelper(window);
|
||||
helper.Owner = mainApp.Handle;
|
||||
window.Closed += delegate
|
||||
new DBHelper().CodeFirst();
|
||||
var doc = api.CurrentProject.GetActiveDocument();
|
||||
if (window == null)
|
||||
{
|
||||
window = null;
|
||||
};
|
||||
window.Show();
|
||||
window = new MultiCoreWireWindow(doc.ID);
|
||||
// 获取版本号并显示到窗口标题
|
||||
window.Title += $" V{Version} - {doc.Name}";
|
||||
ElementHost.EnableModelessKeyboardInterop(window);
|
||||
var mainApp = BaseApp.ActiveApplication;
|
||||
var helper = new System.Windows.Interop.WindowInteropHelper(window);
|
||||
helper.Owner = mainApp.Handle;
|
||||
window.Closed += delegate
|
||||
{
|
||||
window = null;
|
||||
};
|
||||
window.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
window.WindowState = System.Windows.WindowState.Normal;
|
||||
window.Activate();
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception ex)
|
||||
{
|
||||
window.WindowState = System.Windows.WindowState.Normal;
|
||||
window.Activate();
|
||||
MessageBox.Show(ex.ToString());
|
||||
}
|
||||
#if DEBUG
|
||||
}
|
||||
#endif
|
||||
}
|
||||
public void Initialize()
|
||||
{
|
||||
|
|
|
@ -61,83 +61,95 @@ namespace Sinvo.EplanHpD.Plugin
|
|||
private MainWindow window;
|
||||
public void Execute(HpdApi api)
|
||||
{
|
||||
bool isUpdated = false;
|
||||
try
|
||||
bool isLogin = PluginServices.IsLogin;
|
||||
if (!isLogin)
|
||||
{
|
||||
var doc = api.CurrentProject.GetActiveDocument();
|
||||
//doc.ID
|
||||
//if(doc is FlexReport)
|
||||
if (doc is EPLAN.Harness.API.Projects.Documents.Report report)
|
||||
var LoginWindow = new LoginWindow();
|
||||
if (LoginWindow.ShowDialog() == true)
|
||||
{
|
||||
var reportId = report.ID;
|
||||
var allReports = FlexProject.CurrentProject.GetReports();
|
||||
if (allReports.Any(item => item.ID == reportId))
|
||||
isLogin = PluginServices.IsLogin;
|
||||
}
|
||||
}
|
||||
if (isLogin)
|
||||
{
|
||||
bool isUpdated = false;
|
||||
try
|
||||
{
|
||||
var doc = api.CurrentProject.GetActiveDocument();
|
||||
//doc.ID
|
||||
//if(doc is FlexReport)
|
||||
if (doc is EPLAN.Harness.API.Projects.Documents.Report report)
|
||||
{
|
||||
var flexReport = allReports.Where(item => item.ID == reportId).First();
|
||||
if (flexReport != null)
|
||||
var reportId = report.ID;
|
||||
var allReports = FlexProject.CurrentProject.GetReports();
|
||||
if (allReports.Any(item => item.ID == reportId))
|
||||
{
|
||||
var isNeedUpdate = FlexReport.IsUpToDate(flexReport);
|
||||
if (!isNeedUpdate)
|
||||
var flexReport = allReports.Where(item => item.ID == reportId).First();
|
||||
if (flexReport != null)
|
||||
{
|
||||
if (FlexMessageBox.Warning(FlexMessageBox.Buttons.OK_CANCEL,
|
||||
"Report",
|
||||
"报表数据不是最新的,是否更新?", false) == DialogResult.OK)
|
||||
var isNeedUpdate = FlexReport.IsUpToDate(flexReport);
|
||||
if (!isNeedUpdate)
|
||||
{
|
||||
flexReport.UpdateReport();
|
||||
isUpdated = true;
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
if (window == null)
|
||||
{
|
||||
|
||||
window = new MainWindow(flexReport);
|
||||
ElementHost.EnableModelessKeyboardInterop(window);
|
||||
window.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isUpdated)
|
||||
if (FlexMessageBox.Warning(FlexMessageBox.Buttons.OK_CANCEL,
|
||||
"Report",
|
||||
"报表数据不是最新的,是否更新?", false) == DialogResult.OK)
|
||||
{
|
||||
window.Close();
|
||||
flexReport.UpdateReport();
|
||||
isUpdated = true;
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
if (window == null)
|
||||
{
|
||||
|
||||
window = new MainWindow(flexReport);
|
||||
ElementHost.EnableModelessKeyboardInterop(window);
|
||||
window.Show();
|
||||
}
|
||||
window.ShowActivated = true;
|
||||
if (window.WindowState == System.Windows.WindowState.Minimized)
|
||||
else
|
||||
{
|
||||
window.WindowState = System.Windows.WindowState.Normal;
|
||||
if (isUpdated)
|
||||
{
|
||||
window.Close();
|
||||
window = new MainWindow(flexReport);
|
||||
ElementHost.EnableModelessKeyboardInterop(window);
|
||||
window.Show();
|
||||
}
|
||||
window.ShowActivated = true;
|
||||
if (window.WindowState == System.Windows.WindowState.Minimized)
|
||||
{
|
||||
window.WindowState = System.Windows.WindowState.Normal;
|
||||
}
|
||||
window.Show();
|
||||
window.Activate();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
window = new MainWindow(flexReport);
|
||||
// 解决WPF窗体在WinForm中无法输入的问题
|
||||
ElementHost.EnableModelessKeyboardInterop(window);
|
||||
window.Show();
|
||||
window.Activate();
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
window = new MainWindow(flexReport);
|
||||
// 解决WPF窗体在WinForm中无法输入的问题
|
||||
ElementHost.EnableModelessKeyboardInterop(window);
|
||||
window.Show();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FlexMessageBox.Error("未找到项目中匹配的报表,请检查是否生成成功或是未保存到项目中!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FlexMessageBox.Error("未找到项目中匹配的报表,请检查是否生成成功或是未保存到项目中!");
|
||||
FlexMessageBox.Error("请打开一个报表后再使用!");
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception ex)
|
||||
{
|
||||
FlexMessageBox.Error("请打开一个报表后再使用!");
|
||||
FlexMessageBox.Error(ex.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FlexMessageBox.Error(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
|
|
|
@ -28,6 +28,6 @@ using System.Runtime.InteropServices;
|
|||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.1.3")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.3")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.1.3")]
|
||||
[assembly: AssemblyVersion("1.0.1.4")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.4")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.1.4")]
|
Loading…
Reference in New Issue