105040 M 合并1.0.1.3版本
This commit is contained in:
commit
26e0c305be
|
|
@ -44,6 +44,7 @@ namespace Sinvo.EplanHpD.Plugin.Service
|
|||
DB.CodeFirst.InitTables(typeof(Model.Motor));
|
||||
DB.CodeFirst.InitTables(typeof(Model.CableLectotype));
|
||||
DB.CodeFirst.InitTables(typeof(Model.LectotypeLine));
|
||||
DB.CodeFirst.InitTables(typeof(Model.MultiCoreWireLecDBModel));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
using SqlSugar;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.Service.Model
|
||||
{
|
||||
[SugarTable("T_MCWIRE_LEC")]
|
||||
public class MultiCoreWireLecDBModel
|
||||
{
|
||||
/*
|
||||
* 应用场景 类型 线径规格(mm2) 是否高柔 线芯数 线材型号规格 插头型号 前端子型号 后端子型号
|
||||
*/
|
||||
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 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>
|
||||
public string WireModelSpecification { get; set; }
|
||||
/// <summary>
|
||||
/// 前连接
|
||||
/// </summary>
|
||||
public string FrontConnectorModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 后连接
|
||||
/// </summary>
|
||||
public string BackConnectorModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否已布线
|
||||
/// </summary>
|
||||
public bool Layouted { get; set; } = false;
|
||||
}
|
||||
}
|
||||
|
|
@ -29,6 +29,6 @@ using System.Runtime.InteropServices;
|
|||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.1.2")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.2")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.1.2")]
|
||||
[assembly: AssemblyVersion("1.0.1.3")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.3")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.1.3")]
|
||||
|
|
@ -73,6 +73,7 @@
|
|||
<Compile Include="Model\LectotypeLine.cs" />
|
||||
<Compile Include="Model\MotorDataModel.cs" />
|
||||
<Compile Include="Model\MotorModel.cs" />
|
||||
<Compile Include="Model\MultiCoreWireLecDBModel.cs" />
|
||||
<Compile Include="Model\UserInfo.cs" />
|
||||
<Compile Include="PluginServices.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.Converter
|
||||
{
|
||||
public class WireColorConverter : IMultiValueConverter
|
||||
{
|
||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (values.Length < 2 || values[0] == null || values[1] == null)
|
||||
return Brushes.Transparent;
|
||||
|
||||
string primaryColor = values[0].ToString();
|
||||
string secondaryColor = values[1].ToString();
|
||||
bool isMultiColor = false;
|
||||
|
||||
if (values.Length > 2 && values[2] is bool v)
|
||||
isMultiColor = v;
|
||||
|
||||
if (!isMultiColor || string.IsNullOrEmpty(secondaryColor))
|
||||
return new SolidColorBrush((Color)ColorConverter.ConvertFromString(primaryColor));
|
||||
|
||||
// 创建线性渐变刷
|
||||
LinearGradientBrush gradientBrush = new LinearGradientBrush();
|
||||
gradientBrush.StartPoint = new System.Windows.Point(0, 0);
|
||||
gradientBrush.EndPoint = new System.Windows.Point(1, 0);
|
||||
|
||||
gradientBrush.GradientStops.Add(
|
||||
new GradientStop((Color)ColorConverter.ConvertFromString(primaryColor), 0.0));
|
||||
gradientBrush.GradientStops.Add(
|
||||
new GradientStop((Color)ColorConverter.ConvertFromString(secondaryColor), 1.0));
|
||||
|
||||
return gradientBrush;
|
||||
}
|
||||
|
||||
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Datas
|
|||
5. 数据表中Sheet名称: 安川
|
||||
*/
|
||||
{ANCHUAN,
|
||||
new BrandData{
|
||||
new BrandData {
|
||||
Name = ANCHUAN,
|
||||
ComplexLine = false,
|
||||
SheetName = ANCHUAN,
|
||||
|
|
@ -61,7 +61,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Datas
|
|||
5. 数据表中Sheet名称: 汇川
|
||||
*/
|
||||
{HUICHUAN,
|
||||
new BrandData{
|
||||
new BrandData {
|
||||
Name = HUICHUAN,
|
||||
ComplexLine = false,
|
||||
SheetName = HUICHUAN,
|
||||
|
|
@ -81,7 +81,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Datas
|
|||
5. 数据表中Sheet名称: HK_KT
|
||||
*/
|
||||
{SANLING_HK_KT,
|
||||
new BrandData{
|
||||
new BrandData {
|
||||
Name = SANLING_HK_KT,
|
||||
ComplexLine = true,
|
||||
SheetName = SANLING_HK_KT,
|
||||
|
|
|
|||
|
|
@ -1,13 +1,15 @@
|
|||
using EPLAN.Harness.AppCore.AttributeEvents;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Datas;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
|
||||
{
|
||||
public class LectotypeLineModel : CheckedModel
|
||||
public class
|
||||
LectotypeLineModel : CheckedModel
|
||||
{
|
||||
|
||||
public string CableLectotypeId { get; set; }
|
||||
|
|
@ -288,7 +290,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
|
|||
}
|
||||
}
|
||||
|
||||
private string _cableModelNo;
|
||||
//private string _cableModelNo;
|
||||
public string CableModelNo
|
||||
{
|
||||
get
|
||||
|
|
@ -416,5 +418,92 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
|
|||
CableType = it.Name
|
||||
}).ToList();
|
||||
}
|
||||
public bool SubLineNeedInsulation
|
||||
{
|
||||
get
|
||||
{
|
||||
return SubLines != null && SubLines.Any(it => it.NeedInsulation);
|
||||
}
|
||||
}
|
||||
//private bool _needInsulation;
|
||||
public bool NeedInsulation
|
||||
{
|
||||
get
|
||||
{
|
||||
return (CableType == "动力线" || CableType == "动力刹车线") && (CableModel?.Contains("黄绿色") ?? false);
|
||||
}
|
||||
}
|
||||
|
||||
private string _insulationMCode;
|
||||
/// <summary>
|
||||
/// 绝缘软套物料编码
|
||||
/// </summary>
|
||||
public string InsulationMCode
|
||||
{
|
||||
get
|
||||
{
|
||||
return _insulationMCode;
|
||||
}
|
||||
set
|
||||
{
|
||||
_insulationMCode = value;
|
||||
OnPropertyChanged(nameof(InsulationMCode));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 绝缘软套物料编码
|
||||
/// </summary>
|
||||
public int? InsulationCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return NeedInsulation ? 1 : null;
|
||||
}
|
||||
set
|
||||
{
|
||||
OnPropertyChanged(nameof(InsulationCount));
|
||||
}
|
||||
}
|
||||
public string InsulationModel
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetInsulation();
|
||||
}
|
||||
set {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string GetInsulation()
|
||||
{
|
||||
if (string.IsNullOrEmpty(CableModel) || !NeedInsulation)
|
||||
return "";
|
||||
// 线径
|
||||
var matchGroups = Consts.InsulationRegex.Match(CableModel).Groups;
|
||||
var wireDiameter = matchGroups[1]?.Value;
|
||||
var ceFlag = matchGroups[2]?.Value ?? "";
|
||||
if (string.IsNullOrEmpty(ceFlag) && CableModel.Contains("-CE"))
|
||||
{
|
||||
ceFlag = "-CE";
|
||||
}
|
||||
if (double.Parse(wireDiameter) <= 1.5)
|
||||
{
|
||||
wireDiameter = "1.5";
|
||||
}
|
||||
var insulationModel = $"V-{wireDiameter}{ceFlag}(绿色)/定制";
|
||||
var insData = ExcelHelper.GetInsulationSoftSleeveTable(insulationModel).FirstOrDefault();
|
||||
if (insData != null)
|
||||
{
|
||||
InsulationMCode = insData.MaterialCode;
|
||||
OnPropertyChanged(nameof(NeedInsulation));
|
||||
return insData.Specification;
|
||||
}
|
||||
else
|
||||
{
|
||||
return " - ";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,10 +34,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
|
|||
/// 是否高柔
|
||||
/// </summary>
|
||||
public bool IsHighFlexibility { get; set; }
|
||||
/// <summary>
|
||||
/// 插头型号
|
||||
/// </summary>
|
||||
public string ConnectorModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 前端子型号
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using MiniExcelLibs.Attributes;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Models.MultiCoreWire;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
|
@ -7,66 +8,466 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
|
||||
{
|
||||
public class MultiCoreWireLecModel
|
||||
{
|
||||
public class MultiCoreWireLecModel : 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>
|
||||
/// 应用场景
|
||||
/// </summary>
|
||||
private string _applicationScenario;
|
||||
[ExcelColumn(Name = "应用场合")]
|
||||
public string ApplicationScenario { get; set; }
|
||||
public string ApplicationScenario
|
||||
{
|
||||
get => _applicationScenario;
|
||||
set
|
||||
{
|
||||
_applicationScenario = value;
|
||||
OnPropertyChanged(nameof(ApplicationScenario));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 线材类型
|
||||
/// </summary>
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public string WireType { get; set; }
|
||||
//private string _wireType;
|
||||
//[ExcelColumn(Ignore = true)]
|
||||
//public string WireType
|
||||
//{
|
||||
// get => _wireType;
|
||||
// set
|
||||
// {
|
||||
// _wireType = value;
|
||||
// OnPropertyChanged(nameof(WireType));
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 线径规格(mm2)
|
||||
/// </summary>
|
||||
private string _wireDiameterSpecification;
|
||||
[ExcelColumn(IndexName = "F")]
|
||||
public string WireDiameterSpecification { get; set; }
|
||||
/// <summary>
|
||||
/// 是否高柔
|
||||
/// </summary>
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public bool IsHighFlexibility { get; set; }
|
||||
public string WireDiameterSpecification
|
||||
{
|
||||
get => _wireDiameterSpecification;
|
||||
set
|
||||
{
|
||||
_wireDiameterSpecification = value;
|
||||
OnPropertyChanged(nameof(WireDiameterSpecification));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否高柔
|
||||
/// </summary>
|
||||
private bool _isHighFlexibility;
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public bool IsHighFlexibility
|
||||
{
|
||||
get => _isHighFlexibility;
|
||||
set
|
||||
{
|
||||
_isHighFlexibility = value;
|
||||
OnPropertyChanged(nameof(IsHighFlexibility));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 是否高柔
|
||||
/// </summary>
|
||||
private string _isHighFlexibilityStr;
|
||||
[ExcelColumn(Name = "是否高柔")]
|
||||
public string IsHighFlexibilityStr { get; set; }
|
||||
public string IsHighFlexibilityStr
|
||||
{
|
||||
get => _isHighFlexibilityStr;
|
||||
set
|
||||
{
|
||||
_isHighFlexibilityStr = value;
|
||||
OnPropertyChanged(nameof(IsHighFlexibilityStr));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 线芯数
|
||||
/// </summary>
|
||||
private string _wireCoreCount;
|
||||
[ExcelColumn(Name = "线芯数")]
|
||||
public string WireCoreCount { get; set; }
|
||||
public string WireCoreCount
|
||||
{
|
||||
get => _wireCoreCount;
|
||||
set
|
||||
{
|
||||
_wireCoreCount = value;
|
||||
OnPropertyChanged(nameof(WireCoreCount));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 线材型号规格
|
||||
/// </summary>
|
||||
private string _wireModelSpecification;
|
||||
[ExcelColumn(Name = "线材型号规格")]
|
||||
public string WireModelSpecification { get; set; }
|
||||
public string WireModelSpecification
|
||||
{
|
||||
get => _wireModelSpecification;
|
||||
set
|
||||
{
|
||||
_wireModelSpecification = value;
|
||||
OnPropertyChanged(nameof(WireModelSpecification));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 插头型号
|
||||
/// </summary>
|
||||
private string _connectorModel;
|
||||
[ExcelColumn(Name = "插头型号")]
|
||||
public string ConnectorModel { get; set; }
|
||||
/// <summary>
|
||||
/// 前端子型号
|
||||
/// </summary>
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public string FrontTerminalModel { get; set; }
|
||||
/// <summary>
|
||||
/// 后端子型号
|
||||
/// </summary>
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public string BackTerminalModel { get; set; }
|
||||
public string ConnectorModel
|
||||
{
|
||||
get => _connectorModel;
|
||||
set
|
||||
{
|
||||
_connectorModel = value;
|
||||
OnPropertyChanged(nameof(ConnectorModel));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 叉耳端子
|
||||
/// </summary>
|
||||
private string _forkTerminal;
|
||||
[ExcelColumn(Name = "叉耳端子")]
|
||||
public string ForkTerminal
|
||||
{
|
||||
get => _forkTerminal;
|
||||
set
|
||||
{
|
||||
_forkTerminal = value;
|
||||
OnPropertyChanged(nameof(ForkTerminal));
|
||||
OnPropertyChanged(nameof(TerminalModels));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 叉耳端子剥线长度(mm)
|
||||
/// </summary>
|
||||
private double _forkTerminalStripLength;
|
||||
[ExcelColumn(Name = "叉耳端子剥线长度(mm)")]
|
||||
public double ForkTerminalStripLength
|
||||
{
|
||||
get => _forkTerminalStripLength;
|
||||
set
|
||||
{
|
||||
_forkTerminalStripLength = value;
|
||||
OnPropertyChanged(nameof(ForkTerminalStripLength));
|
||||
OnPropertyChanged(nameof(TerminalModels));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 叉耳端子物料编码
|
||||
/// </summary>
|
||||
private string _forkTerminalMaterialCode;
|
||||
[ExcelColumn(Name = "叉耳端子物料编码")]
|
||||
public string ForkTerminalMaterialCode
|
||||
{
|
||||
get => _forkTerminalMaterialCode;
|
||||
set
|
||||
{
|
||||
_forkTerminalMaterialCode = value;
|
||||
OnPropertyChanged(nameof(ForkTerminalMaterialCode));
|
||||
OnPropertyChanged(nameof(TerminalModels));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扁形端子
|
||||
/// </summary>
|
||||
private string _flatTerminal;
|
||||
[ExcelColumn(Name = "扁形端子")]
|
||||
public string FlatTerminal
|
||||
{
|
||||
get => _flatTerminal;
|
||||
set
|
||||
{
|
||||
_flatTerminal = value;
|
||||
OnPropertyChanged(nameof(FlatTerminal));
|
||||
OnPropertyChanged(nameof(TerminalModels));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扁形端子剥线长度(mm)
|
||||
/// </summary>
|
||||
private double _flatTerminalStripLength;
|
||||
[ExcelColumn(Name = "扁形端子剥线长度(mm)")]
|
||||
public double FlatTerminalStripLength
|
||||
{
|
||||
get => _flatTerminalStripLength;
|
||||
set
|
||||
{
|
||||
_flatTerminalStripLength = value;
|
||||
OnPropertyChanged(nameof(FlatTerminalStripLength));
|
||||
OnPropertyChanged(nameof(TerminalModels));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 扁形端子物料编码
|
||||
/// </summary>
|
||||
private string _flatTerminalMaterialCode;
|
||||
[ExcelColumn(Name = "扁形端子物料编码")]
|
||||
public string FlatTerminalMaterialCode
|
||||
{
|
||||
get => _flatTerminalMaterialCode;
|
||||
set
|
||||
{
|
||||
_flatTerminalMaterialCode = value;
|
||||
OnPropertyChanged(nameof(FlatTerminalMaterialCode));
|
||||
OnPropertyChanged(nameof(TerminalModels));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// O型端子
|
||||
/// </summary>
|
||||
private string _oTypeTerminal;
|
||||
[ExcelColumn(Name = "O型端子")]
|
||||
public string OTypeTerminal
|
||||
{
|
||||
get => _oTypeTerminal;
|
||||
set
|
||||
{
|
||||
_oTypeTerminal = value;
|
||||
OnPropertyChanged(nameof(OTypeTerminal));
|
||||
OnPropertyChanged(nameof(TerminalModels));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// O型端子剥线长度(mm)
|
||||
/// </summary>
|
||||
private double _oTypeTerminalStripLength;
|
||||
[ExcelColumn(Name = "O型端子剥线长度(mm)")]
|
||||
public double OTypeTerminalStripLength
|
||||
{
|
||||
get => _oTypeTerminalStripLength;
|
||||
set
|
||||
{
|
||||
_oTypeTerminalStripLength = value;
|
||||
OnPropertyChanged(nameof(OTypeTerminalStripLength));
|
||||
OnPropertyChanged(nameof(TerminalModels));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// O型端子物料编码
|
||||
/// </summary>
|
||||
private string _oTypeTerminalMaterialCode;
|
||||
[ExcelColumn(Name = "O型端子物料编码")]
|
||||
public string OTypeTerminalMaterialCode
|
||||
{
|
||||
get => _oTypeTerminalMaterialCode;
|
||||
set
|
||||
{
|
||||
_oTypeTerminalMaterialCode = value;
|
||||
OnPropertyChanged(nameof(OTypeTerminalMaterialCode));
|
||||
OnPropertyChanged(nameof(TerminalModels));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 针型端子
|
||||
/// </summary>
|
||||
private string _pinTerminal;
|
||||
[ExcelColumn(Name = "针型端子")]
|
||||
public string PinTerminal
|
||||
{
|
||||
get => _pinTerminal;
|
||||
set
|
||||
{
|
||||
_pinTerminal = value;
|
||||
OnPropertyChanged(nameof(PinTerminal));
|
||||
OnPropertyChanged(nameof(TerminalModels));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 针型端子剥线长度(mm)
|
||||
/// </summary>
|
||||
private double _pinTerminalStripLength;
|
||||
[ExcelColumn(Name = "针型端子剥线长度(mm)")]
|
||||
public double PinTerminalStripLength
|
||||
{
|
||||
get => _pinTerminalStripLength;
|
||||
set
|
||||
{
|
||||
_pinTerminalStripLength = value;
|
||||
OnPropertyChanged(nameof(PinTerminalStripLength));
|
||||
OnPropertyChanged(nameof(TerminalModels));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 针型端子物料编码
|
||||
/// </summary>
|
||||
private string _pinTerminalMaterialCode;
|
||||
[ExcelColumn(Name = "针型端子物料编码")]
|
||||
public string PinTerminalMaterialCode
|
||||
{
|
||||
get => _pinTerminalMaterialCode;
|
||||
set
|
||||
{
|
||||
_pinTerminalMaterialCode = value;
|
||||
OnPropertyChanged(nameof(PinTerminalMaterialCode));
|
||||
OnPropertyChanged(nameof(TerminalModels));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Y形端子
|
||||
/// </summary>
|
||||
private string _yTypeTerminal;
|
||||
[ExcelColumn(Name = "Y形端子")]
|
||||
public string YTypeTerminal
|
||||
{
|
||||
get => _yTypeTerminal;
|
||||
set
|
||||
{
|
||||
_yTypeTerminal = value;
|
||||
OnPropertyChanged(nameof(YTypeTerminal));
|
||||
OnPropertyChanged(nameof(TerminalModels));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Y形端子剥线长度(mm)
|
||||
/// </summary>
|
||||
private double _yTypeTerminalStripLength;
|
||||
[ExcelColumn(Name = "Y形端子剥线长度(mm)")]
|
||||
public double YTypeTerminalStripLength
|
||||
{
|
||||
get => _yTypeTerminalStripLength;
|
||||
set
|
||||
{
|
||||
_yTypeTerminalStripLength = value;
|
||||
OnPropertyChanged(nameof(YTypeTerminalStripLength));
|
||||
OnPropertyChanged(nameof(TerminalModels));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Y形端子物料编码
|
||||
/// </summary>
|
||||
private string _yTypeTerminalMaterialCode;
|
||||
[ExcelColumn(Name = "Y形端子物料编码")]
|
||||
public string YTypeTerminalMaterialCode
|
||||
{
|
||||
get => _yTypeTerminalMaterialCode;
|
||||
set
|
||||
{
|
||||
_yTypeTerminalMaterialCode = value;
|
||||
OnPropertyChanged(nameof(YTypeTerminalMaterialCode));
|
||||
OnPropertyChanged(nameof(TerminalModels));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 前连接
|
||||
/// </summary>
|
||||
private string _frontConnectorModel;
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public string FrontConnectorModel
|
||||
{
|
||||
get => _frontConnectorModel;
|
||||
set
|
||||
{
|
||||
_frontConnectorModel = value;
|
||||
OnPropertyChanged(nameof(FrontConnectorModel));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 后连接
|
||||
/// </summary>
|
||||
private string _backConnectorModel;
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public string BackConnectorModel
|
||||
{
|
||||
get => _backConnectorModel;
|
||||
set
|
||||
{
|
||||
_backConnectorModel = value;
|
||||
OnPropertyChanged(nameof(BackConnectorModel));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[ExcelColumn(Ignore = true)]
|
||||
public List<MultiCoreWireTerminalModel> TerminalModels
|
||||
{
|
||||
get
|
||||
{
|
||||
// 将所有类型的端子模型组合成一个列表
|
||||
return [
|
||||
new MultiCoreWireTerminalModel
|
||||
{
|
||||
TerminalModel = ForkTerminal,
|
||||
TerminalStripLength = ForkTerminalStripLength,
|
||||
TerminalMaterialCode = ForkTerminalMaterialCode
|
||||
},
|
||||
new MultiCoreWireTerminalModel
|
||||
{
|
||||
TerminalModel = FlatTerminal,
|
||||
TerminalStripLength = FlatTerminalStripLength,
|
||||
TerminalMaterialCode = FlatTerminalMaterialCode
|
||||
},
|
||||
new MultiCoreWireTerminalModel
|
||||
{
|
||||
TerminalModel = OTypeTerminal,
|
||||
TerminalStripLength = OTypeTerminalStripLength,
|
||||
TerminalMaterialCode = OTypeTerminalMaterialCode
|
||||
},
|
||||
new MultiCoreWireTerminalModel
|
||||
{
|
||||
TerminalModel = PinTerminal,
|
||||
TerminalStripLength = PinTerminalStripLength,
|
||||
TerminalMaterialCode = PinTerminalMaterialCode
|
||||
},
|
||||
new MultiCoreWireTerminalModel
|
||||
{
|
||||
TerminalModel = YTypeTerminal,
|
||||
TerminalStripLength = YTypeTerminalStripLength,
|
||||
TerminalMaterialCode = YTypeTerminalMaterialCode
|
||||
}
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
using MiniExcelLibs.Attributes;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.Models.MultiCoreWire
|
||||
{
|
||||
public class MultiCoreWireTerminalModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 端子型号
|
||||
/// </summary>
|
||||
public string TerminalModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 端子剥线长度(mm)
|
||||
public double TerminalStripLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 端子物料编码
|
||||
/// </summary>
|
||||
public string TerminalMaterialCode { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -46,6 +46,6 @@ using System.Windows;
|
|||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.1.2")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.2")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.1.2")]
|
||||
[assembly: AssemblyVersion("1.0.1.3")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.3")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.1.3")]
|
||||
|
|
@ -88,9 +88,10 @@ namespace Sinvo.EplanHpD.Plugin.Service
|
|||
|
||||
// 查询关联的 LectotypeLine 数据
|
||||
var selectedLines = DBHelper.DB.Queryable<LectotypeLine>()
|
||||
.Where(ll => ll.CableLectotypeId == cableLectotype.CableLectotypeId)
|
||||
//.OrderBy(ll => ll.SeqNo)
|
||||
.Where(line => line.CableLectotypeId == cableLectotype.CableLectotypeId)
|
||||
.ToList();
|
||||
//.OrderBy(ll => ll.SeqNo)
|
||||
|
||||
|
||||
// 构建 CableLectotypeViewModel
|
||||
var viewModel = new CableLectotypeViewModel
|
||||
|
|
|
|||
|
|
@ -0,0 +1,100 @@
|
|||
using Newtonsoft.Json.Bson;
|
||||
using Sinvo.EplanHpD.Plugin.Service;
|
||||
using Sinvo.EplanHpD.Plugin.Service.Model;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Models.MultiCoreWire;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.Service
|
||||
{
|
||||
public class MultiCoreWireService
|
||||
{
|
||||
public IEnumerable<MultiCoreWireLecDBModel> GetByUniqueKey(string uniqueKey)
|
||||
{
|
||||
|
||||
if (string.IsNullOrEmpty(uniqueKey))
|
||||
{
|
||||
return [];
|
||||
}
|
||||
var db = DBHelper.DB;
|
||||
try
|
||||
{
|
||||
var result = db.Queryable<MultiCoreWireLecDBModel>()
|
||||
.Where(it => it.UniqueKey == uniqueKey)
|
||||
.ToList();
|
||||
return result;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
// 保存
|
||||
public void SaveData(MultiCoreWireLecDBModel line)
|
||||
{
|
||||
if (string.IsNullOrEmpty(line.UniqueKey)
|
||||
|| string.IsNullOrEmpty(line.UserId)
|
||||
|| string.IsNullOrEmpty(line.ProjectName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var db = DBHelper.DB;
|
||||
try
|
||||
{
|
||||
db.BeginTran();
|
||||
db.Insertable(line).ExecuteCommand();
|
||||
db.CommitTran();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
db.RollbackTran();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
internal void ClearSelf(string uniqueKey)
|
||||
{
|
||||
if (string.IsNullOrEmpty(uniqueKey))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var db = DBHelper.DB;
|
||||
try
|
||||
{
|
||||
db.BeginTran();
|
||||
db.Deleteable<MultiCoreWireLecDBModel>().Where(it => it.UniqueKey == uniqueKey).ExecuteCommand();
|
||||
db.CommitTran();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
db.RollbackTran();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
internal void DeleteById(string id)
|
||||
{
|
||||
if (string.IsNullOrEmpty(id))
|
||||
{
|
||||
return;
|
||||
}
|
||||
var db = DBHelper.DB;
|
||||
try
|
||||
{
|
||||
db.BeginTran();
|
||||
db.Deleteable<MultiCoreWireLecDBModel>().Where(it => it.Id == id).ExecuteCommand();
|
||||
db.CommitTran();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
db.RollbackTran();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -242,6 +242,7 @@
|
|||
<Compile Include="Converter\ConnectionTypeConverter.cs" />
|
||||
<Compile Include="Converter\FlagEnumConverter.cs" />
|
||||
<Compile Include="Converter\NameTypeConverter.cs" />
|
||||
<Compile Include="Converter\WireColorConverter.cs" />
|
||||
<Compile Include="Datas\BrandData.cs" />
|
||||
<Compile Include="Datas\Brands.cs" />
|
||||
<Compile Include="Enum\ConnectionType.cs" />
|
||||
|
|
@ -253,6 +254,7 @@
|
|||
<Compile Include="Extension\CheckedModelExt.cs" />
|
||||
<Compile Include="Extension\MotorModelUniqueFlagExt.cs" />
|
||||
<Compile Include="Extension\PropertyListExt.cs" />
|
||||
<Compile Include="Models\MultiCoreWire\MultiCoreWireTerminalModel.cs" />
|
||||
<Compile Include="Models\WireCheck\CheckedModel.cs" />
|
||||
<Compile Include="Models\ConfigItemModel.cs" />
|
||||
<Compile Include="Models\WireCheck\ExcelModel.cs" />
|
||||
|
|
@ -272,6 +274,7 @@
|
|||
<Compile Include="Models\UserLoginModel.cs" />
|
||||
<Compile Include="Selector\LectotypeLengthDataTemplateSelector.cs" />
|
||||
<Compile Include="Service\MotorLectotypeService.cs" />
|
||||
<Compile Include="Service\MultiCoreWireService.cs" />
|
||||
<Compile Include="TestWindow.xaml.cs">
|
||||
<DependentUpon>TestWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
|
@ -288,6 +291,7 @@
|
|||
<Compile Include="ViewModel\LoginViewModel.cs" />
|
||||
<Compile Include="Models\MultiCoreWire\MultiCoreWireDataModel.cs" />
|
||||
<Compile Include="Models\MultiCoreWire\MultiCoreWireLecModel.cs" />
|
||||
<Compile Include="ViewModel\MultiCoreWireViewModel\MultiCoreWireLayoutHelperViewModel.cs" />
|
||||
<Compile Include="ViewModel\MultiCoreWireViewModel\MultiCoreWireViewModel.cs" />
|
||||
<Compile Include="ViewModel\WireCheck\MainViewModel.Check.cs" />
|
||||
<Compile Include="ViewModel\WireCheck\MainViewModel.cs" />
|
||||
|
|
@ -308,6 +312,9 @@
|
|||
<Compile Include="View\LoginWindow.xaml.cs">
|
||||
<DependentUpon>LoginWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\MultiCoreWire\LayoutHelper\MultiCoreWireLayoutHelperWindow.xaml.cs">
|
||||
<DependentUpon>MultiCoreWireLayoutHelperWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="View\MultiCoreWire\MultiCoreWireWindow.xaml.cs">
|
||||
<DependentUpon>MultiCoreWireWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
|
@ -348,6 +355,10 @@
|
|||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="View\MultiCoreWire\LayoutHelper\MultiCoreWireLayoutHelperWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="View\MultiCoreWire\MultiCoreWireWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
|
|
|||
|
|
@ -40,6 +40,10 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
|
|||
/// </summary>
|
||||
public static readonly Regex dRegex = new("V-[\\d]+\\.?[\\d]*", RegexOptions.Compiled);
|
||||
/// <summary>
|
||||
/// 线径大小匹配(伺服电机线材选型)
|
||||
/// </summary>
|
||||
public static readonly Regex InsulationRegex = new("(?:[T]{0,}RVV\\d×)(\\d\\.{0,}\\d+)(?:-2000W)?(-CE)?", RegexOptions.Compiled);
|
||||
/// <summary>
|
||||
/// 括号内容匹配
|
||||
/// </summary>
|
||||
public static readonly Regex regexParenthesesContent = new(@"(?<=\()[^)]*(?=\))", RegexOptions.Compiled);
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
|
|||
{
|
||||
public class ExcelHelper
|
||||
{
|
||||
private static IEnumerable<InsulationModel> _insulations;
|
||||
|
||||
private static IEnumerable<ExcelModel> _terminalMappingCache = [];
|
||||
/// <summary>
|
||||
/// 线材端子对照表
|
||||
|
|
@ -54,8 +56,16 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
|
|||
/// </summary>
|
||||
public static IEnumerable<InsulationModel> GetInsulationSoftSleeveTable(string wireModel)
|
||||
{
|
||||
if(_insulations != null)
|
||||
{
|
||||
return _insulations.Where(item => item.Specification == wireModel);
|
||||
}
|
||||
var path = Path.Combine(Consts.DATA_FILE_PATH, Consts.DATA_FILE_PATH_INSULATION);
|
||||
var results = MiniExcel.Query<InsulationModel>(path);
|
||||
if(_insulations == null)
|
||||
{
|
||||
_insulations = results;
|
||||
}
|
||||
//.Where(item => item.Specification == wireModel)
|
||||
//.ToList();
|
||||
return results.Where(item => item.Specification == wireModel);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Sinvo.EplanHpD.Plugin.Service;
|
||||
using EPLAN.Harness.ProjectCore;
|
||||
using Sinvo.EplanHpD.Plugin.Service;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Extension;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Models;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.ViewModel;
|
||||
|
|
@ -27,7 +28,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
|
|||
/// </summary>
|
||||
/// <param name="motor"></param>
|
||||
/// <returns></returns>
|
||||
public static async Task<CableLectotypeViewModel> CreateOrGetAsync(MotorModel motor)
|
||||
public static CableLectotypeViewModel CreateOrGetAsync(MotorModel motor)
|
||||
{
|
||||
if (motor == null || string.IsNullOrEmpty(motor.AxisNo))
|
||||
{
|
||||
|
|
@ -67,5 +68,17 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
|
|||
}
|
||||
|
||||
}
|
||||
public static string GetDocName(FlexDesigner designer)
|
||||
{
|
||||
var docName = designer.Name;
|
||||
if (docName.Contains("+"))
|
||||
{
|
||||
return docName.Split('+').FirstOrDefault();
|
||||
}
|
||||
else
|
||||
{
|
||||
return docName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -138,6 +138,9 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
|
|||
line.CableType,
|
||||
line.AxisNo,
|
||||
line.DrawingNo,
|
||||
line.InsulationMCode,
|
||||
line.InsulationModel,
|
||||
line.InsulationCount,
|
||||
EncoderLineLength = line.EncoderLineLength == 0 ? "" : line.EncoderLineLength.ToString(),
|
||||
PowerLineLength = line.PowerLineLength == 0 ? "" : line.PowerLineLength.ToString(),
|
||||
OrderDate = DateTime.Now.ToString("yyyy/M/d"),
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
|
|||
var data = MiniExcel.Query<MultiCoreWireLecModel>(dataFileStream,sheetName: "多芯线WPS数据配对");
|
||||
//MiniExcel.Query()
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
Grid.ColumnSpan="2"
|
||||
Panel.ZIndex="99"
|
||||
ContentTemplate="{StaticResource LoadingMask}"
|
||||
Visibility="Collapsed" />
|
||||
Visibility="Hidden" />
|
||||
<hc:Card
|
||||
x:Name="InfoCard"
|
||||
Grid.Row="0"
|
||||
|
|
@ -401,6 +401,30 @@
|
|||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="150">
|
||||
<GridViewColumnHeader Content="绝缘软套料号" Visibility="{Binding SubLineNeedInsulation, Converter={StaticResource Boolean2VisibilityConverter}}" />
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<hc:TextBox
|
||||
MinWidth="100"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding InsulationMCode}"
|
||||
Visibility="{Binding NeedInsulation, Converter={StaticResource Boolean2VisibilityConverter}}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="420">
|
||||
<GridViewColumnHeader Content="绝缘软套型号" Visibility="{Binding SubLineNeedInsulation, Converter={StaticResource Boolean2VisibilityConverter}}" />
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<hc:TextBox
|
||||
MinWidth="400"
|
||||
IsReadOnly="True"
|
||||
Text="{Binding InsulationModel}"
|
||||
Visibility="{Binding NeedInsulation, Converter={StaticResource Boolean2VisibilityConverter}}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<!--<GridViewColumn Header="是否布线完成">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ using Sinvo.EplanHpD.Plugin.WPFUI.ViewModel;
|
|||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
|
|
@ -58,7 +59,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
|||
try
|
||||
{
|
||||
LoadingContentMask.Visibility = Visibility.Visible;
|
||||
var oldViewModel = LectotypeViewModelFactory.CreateOrGetAsync(_motor).Result;
|
||||
var oldViewModel = LectotypeViewModelFactory.CreateOrGetAsync(_motor);
|
||||
if (oldViewModel != null)
|
||||
{
|
||||
ViewModel.Apply(oldViewModel);
|
||||
|
|
@ -77,18 +78,30 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
|||
}
|
||||
private void CableratorBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ViewModel.Cablerator();
|
||||
//var motor = Motor as MotorModel;
|
||||
if(Motor is CableLectotypeViewModel motor)
|
||||
LoadingContentMask.Visibility = Visibility.Visible;
|
||||
Dispatcher.Invoke(() => { });
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
// 发送消息,用户生成了数据
|
||||
WeakReferenceMessenger.Default.Send<LectotypeMessage,string>(new LectotypeMessage
|
||||
(new System.Collections.Generic.Dictionary<string, string>
|
||||
ViewModel.Cablerator();
|
||||
|
||||
}).ContinueWith(x =>
|
||||
{
|
||||
Dispatcher.BeginInvoke(() =>
|
||||
{
|
||||
if (Motor is CableLectotypeViewModel motor)
|
||||
{
|
||||
// 发送消息,用户生成了数据
|
||||
WeakReferenceMessenger.Default.Send<LectotypeMessage, string>(new LectotypeMessage
|
||||
(new System.Collections.Generic.Dictionary<string, string>
|
||||
{
|
||||
{motor.Motor.MotorModelStr,motor.Motor.AxisNo}
|
||||
}), "Lectotype"
|
||||
);
|
||||
}
|
||||
}), "Lectotype"
|
||||
);
|
||||
}
|
||||
LoadingContentMask.Visibility = Visibility.Collapsed;
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void ListView_PreviewMouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
|
||||
|
|
@ -115,32 +128,43 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
|||
private void SaveBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
LoadingContentMask.Visibility = Visibility.Visible;
|
||||
try
|
||||
bool saved = false;
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
if (ViewModel.SaveToDb())
|
||||
try
|
||||
{
|
||||
if (Motor is CableLectotypeViewModel motor)
|
||||
{
|
||||
WeakReferenceMessenger.Default.Send(new LectotypeMessage
|
||||
(new System.Collections.Generic.Dictionary<string, string>
|
||||
{
|
||||
{motor.Motor.MotorModelStr,motor.Motor.AxisNo}
|
||||
}), "LectotypeSaved"
|
||||
);
|
||||
}
|
||||
Growl.Success("保存成功", "CableLectotypeMessage");
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Error("保存失败", "CableLectotypeMessage");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.ToString());
|
||||
}
|
||||
LoadingContentMask.Visibility = Visibility.Collapsed;
|
||||
|
||||
saved = ViewModel.SaveToDb();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.ToString());
|
||||
}
|
||||
}).ContinueWith(x =>
|
||||
{
|
||||
Dispatcher.BeginInvoke(() =>
|
||||
{
|
||||
if (saved)
|
||||
{
|
||||
if (Motor is CableLectotypeViewModel motor)
|
||||
{
|
||||
WeakReferenceMessenger.Default.Send(new LectotypeMessage
|
||||
(new System.Collections.Generic.Dictionary<string, string>
|
||||
{
|
||||
{motor.Motor.MotorModelStr,motor.Motor.AxisNo}
|
||||
}), "LectotypeSaved"
|
||||
);
|
||||
}
|
||||
Growl.Success("保存成功", "CableLectotypeMessage");
|
||||
}
|
||||
else
|
||||
{
|
||||
Growl.Error("保存失败", "CableLectotypeMessage");
|
||||
}
|
||||
LoadingContentMask.Visibility = Visibility.Collapsed;
|
||||
});
|
||||
});
|
||||
}
|
||||
private void CloseBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -496,6 +496,8 @@
|
|||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Binding="{Binding CableType}" Header="线材类型" />
|
||||
<DataGridTextColumn Binding="{Binding CableConnectionClass}" Header="线材连接方式" />
|
||||
<DataGridTextColumn Binding="{Binding InsulationModel}" Header="绝缘软套型号" />
|
||||
<DataGridTextColumn Binding="{Binding InsulationMCode}" Header="绝缘软套料号" />
|
||||
<DataGridTextColumn Binding="{Binding CheckedMsg}" Header="异常信息" />
|
||||
<DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI
|
|||
{
|
||||
//DrawPDFHelper.CacheAllPdfToMemory();
|
||||
MotorExcelHelper.Instance.ReadDataToStream();
|
||||
ExcelHelper.GetInsulationSoftSleeveTable("");
|
||||
LoadData();
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using EPLAN.Harness.Core.Settings;
|
||||
using Newtonsoft.Json;
|
||||
using Sinvo.EplanHpD.Plugin.Service;
|
||||
using Sinvo.EplanHpD.Plugin.Service.Model;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Models;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.ViewModel;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -67,7 +68,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
|||
{
|
||||
viewModel.User = user;
|
||||
viewModel.IsRemember = true;
|
||||
_ = this.Dispatcher.BeginInvoke(() =>
|
||||
await this.Dispatcher.BeginInvoke(() =>
|
||||
{
|
||||
this.PasswordTxt.Password = user.UserPassword;
|
||||
LoadGroupAndRole();
|
||||
|
|
@ -110,7 +111,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
|||
var result = viewModel.Login();
|
||||
if(result != null && !string.IsNullOrEmpty(result.GUID))
|
||||
{
|
||||
PluginServices.user = new Service.Model.UserInfo
|
||||
PluginServices.user = new UserInfo
|
||||
{
|
||||
Group = viewModel.User.UserGroup,
|
||||
Role = viewModel.User.UserRole,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,87 @@
|
|||
|
||||
<hc:GlowWindow
|
||||
x:Class="Sinvo.EplanHpD.Plugin.WPFUI.View.MultiCoreWire.LayoutHelper.MultiCoreWireLayoutHelperWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
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.MultiCoreWire.LayoutHelper"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:multicorewireviewmodel="clr-namespace:Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel"
|
||||
Title="布线助手"
|
||||
Width="450"
|
||||
Height="260"
|
||||
MinWidth="450"
|
||||
MinHeight="260"
|
||||
d:DataContext="{d:DesignInstance Type=multicorewireviewmodel:MultiCoreWireLayoutHelperViewModel}"
|
||||
ActiveGlowColor="{DynamicResource PrimaryColor}"
|
||||
Background="White"
|
||||
FontSize="14"
|
||||
Left="1460"
|
||||
Loaded="GlowWindow_Loaded"
|
||||
Top="770"
|
||||
WindowStartupLocation="Manual"
|
||||
mc:Ignorable="d">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Sinvo.EplanHpD.Plugin.WPFUI;component/Themes/Theme.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<Border Background="{DynamicResource MainContentForegroundDrawingBrush}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="50" />
|
||||
</Grid.RowDefinitions>
|
||||
<hc:SimpleStackPanel
|
||||
Grid.Row="0"
|
||||
Margin="10"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock FontSize="14">
|
||||
<Run Text="应用场景:" />
|
||||
<Run
|
||||
FontSize="16"
|
||||
FontWeight="Bold"
|
||||
Foreground="#c92d28"
|
||||
Text="触摸屏" />
|
||||
</TextBlock>
|
||||
</hc:SimpleStackPanel>
|
||||
<DataGrid
|
||||
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>
|
||||
<hc:SimpleStackPanel
|
||||
Grid.Row="4"
|
||||
Margin="10"
|
||||
VerticalAlignment="Center">
|
||||
<DockPanel HorizontalAlignment="Stretch">
|
||||
<Button
|
||||
Click="PrevBtn_Click"
|
||||
Content="上一根线"
|
||||
DockPanel.Dock="Left"
|
||||
IsEnabled="{Binding HasPrev}"
|
||||
Style="{StaticResource ButtonDanger}" />
|
||||
<Button
|
||||
HorizontalAlignment="Right"
|
||||
Click="NextBtn_Click"
|
||||
Content="下一根线"
|
||||
DockPanel.Dock="Right"
|
||||
IsEnabled="{Binding HasNext}"
|
||||
Style="{StaticResource ButtonPrimary}" />
|
||||
</DockPanel>
|
||||
</hc:SimpleStackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</hc:GlowWindow>
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
using HandyControl.Controls;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.View.MultiCoreWire.LayoutHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// MultiCoreWireLayoutHerlpWindow.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class MultiCoreWireLayoutHelperWindow : GlowWindow
|
||||
{
|
||||
private readonly string _uniqueKey = "";
|
||||
public MultiCoreWireLayoutHelperViewModel ViewModel;
|
||||
public MultiCoreWireLayoutHelperWindow(string uniqueKey)
|
||||
{
|
||||
InitializeComponent();
|
||||
_uniqueKey = uniqueKey;
|
||||
this.DataContext = ViewModel = new MultiCoreWireLayoutHelperViewModel(uniqueKey);
|
||||
}
|
||||
|
||||
private void GlowWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void NextBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void PrevBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,11 +5,12 @@
|
|||
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: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"
|
||||
Title="多芯线数据抓取"
|
||||
Width="850"
|
||||
Height="450"
|
||||
Width="1200"
|
||||
Height="600"
|
||||
d:DataContext="{d:DesignInstance Type=multicorewireviewmodel:MultiCoreWireViewModel}"
|
||||
FontSize="14"
|
||||
Loaded="Window_Loaded"
|
||||
|
|
@ -21,223 +22,407 @@
|
|||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<TabControl>
|
||||
<TabItem Header="多芯线选型">
|
||||
<StackPanel Margin="0" Orientation="Vertical">
|
||||
<Border
|
||||
Grid.Row="0"
|
||||
Margin="0"
|
||||
VerticalAlignment="Top"
|
||||
Style="{StaticResource BorderRegion}">
|
||||
<hc:SimpleStackPanel Orientation="Vertical">
|
||||
<hc:SimpleStackPanel.Resources>
|
||||
<Style BasedOn="{StaticResource TextBlockBaseStyle}" TargetType="TextBlock">
|
||||
<Setter Property="MinWidth" Value="80" />
|
||||
</Style>
|
||||
</hc:SimpleStackPanel.Resources>
|
||||
<hc:SimpleStackPanel HorizontalAlignment="Left" Orientation="Horizontal">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="80" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||
<hc:SimpleStackPanel
|
||||
MinWidth="200"
|
||||
Margin="10"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Vertical">
|
||||
<hc:SimpleStackPanel.Resources>
|
||||
<Style BasedOn="{StaticResource TextBoxExtend}" TargetType="hc:TextBox">
|
||||
<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:SimpleStackPanel>
|
||||
<Button
|
||||
Margin="10,0"
|
||||
Content="布线助手"
|
||||
Style="{StaticResource ButtonSuccess}" />
|
||||
<Button
|
||||
Margin="10,0"
|
||||
Content="导出下单表"
|
||||
Style="{StaticResource ButtonSuccess}" />
|
||||
</hc:SimpleStackPanel>
|
||||
<TabControl Grid.Row="1">
|
||||
<TabItem Header="多芯线选型">
|
||||
<Grid Margin="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="210" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border
|
||||
Grid.Row="0"
|
||||
Margin="10"
|
||||
VerticalAlignment="Top"
|
||||
Style="{StaticResource BorderRegion}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="30" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<hc:SimpleStackPanel
|
||||
MinWidth="200"
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="应用场景:" />
|
||||
<hc:ComboBox
|
||||
MinWidth="100"
|
||||
Margin="10,0"
|
||||
ItemsSource="{Binding ApplicationScenarios}"
|
||||
SelectedValue="{Binding ApplicationScenario}" />
|
||||
Grid.Column="0"
|
||||
VerticalAlignment="Top"
|
||||
Orientation="Vertical">
|
||||
<hc:SimpleStackPanel.Resources>
|
||||
<Style BasedOn="{StaticResource TextBlockBaseStyle}" TargetType="TextBlock">
|
||||
<Setter Property="MinWidth" Value="80" />
|
||||
</Style>
|
||||
</hc:SimpleStackPanel.Resources>
|
||||
<hc:SimpleStackPanel HorizontalAlignment="Left" Orientation="Horizontal">
|
||||
<hc:SimpleStackPanel
|
||||
MinWidth="200"
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="应用场景:" />
|
||||
<hc:ComboBox
|
||||
MinWidth="100"
|
||||
Margin="10,0"
|
||||
ItemsSource="{Binding ApplicationScenarios}"
|
||||
SelectedValue="{Binding ApplicationScenario}" />
|
||||
</hc:SimpleStackPanel>
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel HorizontalAlignment="Left" Orientation="Horizontal">
|
||||
<hc:SimpleStackPanel
|
||||
MinWidth="200"
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="线径规格:" />
|
||||
<hc:ComboBox
|
||||
MinWidth="100"
|
||||
Margin="10,0"
|
||||
IsEnabled="{Binding ApplicationScenarioSelected}"
|
||||
ItemsSource="{Binding WireDiameterSpecifications}"
|
||||
SelectedValue="{Binding WireDiameterSpecification}" />
|
||||
</hc:SimpleStackPanel>
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel HorizontalAlignment="Left" Orientation="Horizontal">
|
||||
<hc:SimpleStackPanel
|
||||
MinWidth="200"
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="是否高柔:" />
|
||||
<hc:ComboBox
|
||||
MinWidth="100"
|
||||
Margin="10,0"
|
||||
IsEnabled="{Binding ApplicationScenarioSelected}"
|
||||
SelectedValue="{Binding HighFlexibility, Mode=TwoWay}"
|
||||
SelectedValuePath="Content">
|
||||
<ComboBoxItem Content="是" />
|
||||
<ComboBoxItem Content="否" />
|
||||
<ComboBoxItem Content="" />
|
||||
</hc:ComboBox>
|
||||
</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:ComboBox
|
||||
MinWidth="100"
|
||||
Margin="10,0"
|
||||
IsEnabled="{Binding ApplicationScenarioSelected}"
|
||||
ItemsSource="{Binding WireCores}"
|
||||
SelectedValue="{Binding WireCoreCount}" />
|
||||
</hc:SimpleStackPanel>
|
||||
|
||||
</hc:SimpleStackPanel>
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="类型:" />
|
||||
<hc:ComboBox
|
||||
MinWidth="100"
|
||||
Margin="10,0"
|
||||
SelectedValue="{Binding WireType, Mode=TwoWay}"
|
||||
SelectedValuePath="Content">
|
||||
<ComboBoxItem Content="插头+端子" />
|
||||
<ComboBoxItem Content="端子+端子" />
|
||||
</hc:ComboBox>
|
||||
VerticalAlignment="Top"
|
||||
IsEnabled="{Binding ApplicationScenarioSelected}"
|
||||
Orientation="Vertical">
|
||||
<Grid VerticalAlignment="Top">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<GroupBox Grid.Row="0" Grid.Column="0">
|
||||
<GroupBox.Header>
|
||||
<TextBlock Text="前" />
|
||||
</GroupBox.Header>
|
||||
<hc:SimpleStackPanel
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Margin="2"
|
||||
VerticalAlignment="Top"
|
||||
Orientation="Vertical">
|
||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
MinWidth="70"
|
||||
VerticalAlignment="Center"
|
||||
Text="连接物:" />
|
||||
<hc:ComboBox
|
||||
MinWidth="100"
|
||||
Margin="10,0"
|
||||
SelectedValue="{Binding FrontConnectorType}"
|
||||
SelectedValuePath="Content">
|
||||
<ComboBoxItem Content="端子" />
|
||||
<ComboBoxItem Content="插头" />
|
||||
</hc:ComboBox>
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
MinWidth="70"
|
||||
VerticalAlignment="Center"
|
||||
Text="型号:" />
|
||||
<hc:ComboBox
|
||||
MinWidth="100"
|
||||
Margin="10,0"
|
||||
DisplayMemberPath="TerminalModel"
|
||||
ItemsSource="{Binding FrontConnectorModels}"
|
||||
SelectedValue="{Binding FrontConnectorModel}"
|
||||
SelectedValuePath="TerminalModel" />
|
||||
</hc:SimpleStackPanel>
|
||||
</hc:SimpleStackPanel>
|
||||
</GroupBox>
|
||||
<GroupBox Grid.Row="0" Grid.Column="1">
|
||||
<GroupBox.Header>
|
||||
<TextBlock Text="后" />
|
||||
</GroupBox.Header>
|
||||
<hc:SimpleStackPanel Margin="2" Orientation="Vertical">
|
||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
MinWidth="70"
|
||||
VerticalAlignment="Center"
|
||||
Text="连接物:" />
|
||||
<hc:ComboBox
|
||||
MinWidth="100"
|
||||
Margin="10,0"
|
||||
SelectedValue="{Binding BackConnectorType}"
|
||||
SelectedValuePath="Content">
|
||||
<ComboBoxItem Content="端子" />
|
||||
<ComboBoxItem Content="插头" />
|
||||
</hc:ComboBox>
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||
<TextBlock
|
||||
MinWidth="70"
|
||||
VerticalAlignment="Center"
|
||||
Text="型号:" />
|
||||
<hc:ComboBox
|
||||
MinWidth="100"
|
||||
Margin="10,0"
|
||||
DisplayMemberPath="TerminalModel"
|
||||
ItemsSource="{Binding BackConnectorModels}"
|
||||
SelectedValue="{Binding BackConnectorModel}"
|
||||
SelectedValuePath="TerminalModel" />
|
||||
</hc:SimpleStackPanel>
|
||||
</hc:SimpleStackPanel>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
<hc:SimpleStackPanel
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock
|
||||
MinWidth="70"
|
||||
VerticalAlignment="Center"
|
||||
Text="线材型号:" />
|
||||
<hc:ComboBox
|
||||
MinWidth="300"
|
||||
Margin="10,0"
|
||||
ItemsSource="{Binding WireModelSpecifications}"
|
||||
SelectedValue="{Binding WireModelSpecification}" />
|
||||
</hc:SimpleStackPanel>
|
||||
</hc:SimpleStackPanel>
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel HorizontalAlignment="Left" Orientation="Horizontal">
|
||||
<hc:SimpleStackPanel
|
||||
MinWidth="200"
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="线径规格:" />
|
||||
<hc:ComboBox
|
||||
MinWidth="60"
|
||||
Margin="10,0"
|
||||
ItemsSource="{Binding WireDiameterSpecifications}"
|
||||
SelectedValue="{Binding WireDiameterSpecification}" />
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="是否高柔:" />
|
||||
<hc:ComboBox
|
||||
MinWidth="50"
|
||||
Margin="10,0"
|
||||
SelectedValue="{Binding HighFlexibility, Mode=TwoWay}"
|
||||
SelectedValuePath="Content">
|
||||
<ComboBoxItem Content="是" />
|
||||
<ComboBoxItem Content="否" />
|
||||
<ComboBoxItem Content="" />
|
||||
</hc:ComboBox>
|
||||
</hc:SimpleStackPanel>
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="线芯数量:" />
|
||||
<hc:ComboBox
|
||||
MinWidth="30"
|
||||
Margin="10,0"
|
||||
ItemsSource="{Binding WireCores}"
|
||||
SelectedValue="{Binding WireCoreCount}" />
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<TextBlock VerticalAlignment="Center" Text="线材型号:" />
|
||||
<hc:ComboBox
|
||||
MinWidth="100"
|
||||
Margin="10,0"
|
||||
AutoComplete="True"
|
||||
IsEditable="True"
|
||||
ItemsSource="{Binding WireModelSpecifications}"
|
||||
SelectedValue="{Binding WireModelSpecification}" />
|
||||
</hc:SimpleStackPanel>
|
||||
<DockPanel>
|
||||
<hc:SimpleStackPanel
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Left"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
Click="SaveLecToLine_Click"
|
||||
Content="保存选择的线"
|
||||
Style="{StaticResource ButtonSuccess}" />
|
||||
<Button
|
||||
Margin="10,0"
|
||||
Click="ClearLecData_Click"
|
||||
Content="清除选择"
|
||||
Style="{StaticResource ButtonWarning}" />
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel DockPanel.Dock="Right">
|
||||
<Button
|
||||
Margin="10,0"
|
||||
HorizontalAlignment="Right"
|
||||
Click="ClearLecLine_Click"
|
||||
Content="清空选中的线"
|
||||
Style="{StaticResource ButtonDanger}" />
|
||||
</hc:SimpleStackPanel>
|
||||
</DockPanel>
|
||||
</hc:SimpleStackPanel>
|
||||
</Border>
|
||||
<ListBox ItemsSource="{Binding LecWires}">
|
||||
<DockPanel
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2">
|
||||
<hc:SimpleStackPanel
|
||||
Margin="2"
|
||||
VerticalAlignment="Center"
|
||||
DockPanel.Dock="Left"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
Click="SaveLecToLine_Click"
|
||||
Content="保存选择的线"
|
||||
Style="{StaticResource ButtonSuccess}" />
|
||||
<Button
|
||||
Margin="10,0"
|
||||
Click="ClearLecData_Click"
|
||||
Content="清除选择"
|
||||
Style="{StaticResource ButtonWarning}" />
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel DockPanel.Dock="Right">
|
||||
<Button
|
||||
Margin="10,0"
|
||||
HorizontalAlignment="Right"
|
||||
Click="ClearLecLine_Click"
|
||||
Content="清空选中的线"
|
||||
Style="{StaticResource ButtonDanger}" />
|
||||
</hc:SimpleStackPanel>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
<DataGrid
|
||||
Grid.Row="1"
|
||||
AutoGenerateColumns="False"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding LecWires}">
|
||||
<DataGrid.Columns>
|
||||
<!--<DataGridTextColumn Binding="{Binding SeqNo}" Header="序号" />-->
|
||||
<DataGridTextColumn Binding="{Binding ApplicationScenario}" 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 FrontConnectorModel}" Header="前连接物型号" />
|
||||
<DataGridTextColumn Binding="{Binding BackConnectorModel}" Header="后连接物型号" />
|
||||
<DataGridTemplateColumn>
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<hc:SimpleStackPanel>
|
||||
<Button
|
||||
Click="DeleteItemBtn_Click"
|
||||
Content="删除"
|
||||
Style="{StaticResource ButtonDanger}"
|
||||
Tag="{Binding Id}" />
|
||||
</hc:SimpleStackPanel>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</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>
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding WireModelSpecification}" />
|
||||
</StackPanel>
|
||||
<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" />
|
||||
</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
|
||||
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>
|
||||
</StackPanel>
|
||||
</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>
|
||||
<ItemsControl ItemsSource="{Binding Children}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<WrapPanel Margin="5" IsItemsHost="True" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border
|
||||
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>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
using Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Models;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel;
|
||||
using SqlSugar.Extensions;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
||||
{
|
||||
|
|
@ -17,6 +20,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
|||
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
viewModel.Init();
|
||||
viewModel.LoadWiresData();
|
||||
}
|
||||
|
||||
|
|
@ -35,5 +39,17 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
|||
{
|
||||
viewModel.ClearLecLines();
|
||||
}
|
||||
|
||||
private void DeleteItemBtn_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if(sender is Button btn)
|
||||
{
|
||||
string id = (string)btn.Tag;
|
||||
if(id != null)
|
||||
{
|
||||
viewModel.DeleteLecWireItem(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
|||
/// <param name="e"></param>
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_scannerViewModel.S_part)) ;
|
||||
if (string.IsNullOrEmpty(_scannerViewModel.S_part)) { }
|
||||
else
|
||||
{
|
||||
_scannerViewModel.ToSourceById(_scannerViewModel._ScanCableModels.FirstOrDefault().S_PartID);
|
||||
|
|
@ -79,7 +79,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
|||
/// <param name="e"></param>
|
||||
private void Button_Click_1(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_scannerViewModel.S_pin)) ;
|
||||
if (string.IsNullOrEmpty(_scannerViewModel.S_pin)) { }
|
||||
else
|
||||
{
|
||||
_scannerViewModel.ToSourceById(_scannerViewModel._ScanCableModels.FirstOrDefault().S_pinID);
|
||||
|
|
@ -88,7 +88,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
|||
|
||||
private void Button_Click_2(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_scannerViewModel.E_part)) ;
|
||||
if (string.IsNullOrEmpty(_scannerViewModel.E_part)) { }
|
||||
else
|
||||
{
|
||||
_scannerViewModel.ToSourceById(_scannerViewModel._ScanCableModels.FirstOrDefault().E_PartID);
|
||||
|
|
@ -97,7 +97,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
|
|||
|
||||
private void Button_Click_3(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_scannerViewModel.E_pin)) ;
|
||||
if (string.IsNullOrEmpty(_scannerViewModel.E_pin)) { }
|
||||
else
|
||||
{
|
||||
_scannerViewModel.ToSourceById(_scannerViewModel._ScanCableModels.FirstOrDefault().E_pinID);
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ public partial class MainWindow : System.Windows.Window
|
|||
Task.WaitAll(dataColumns, data);
|
||||
var stuffedData = ViewModel.StuffData(data.Result);
|
||||
|
||||
_ = stuffedData.ContinueWith(x =>
|
||||
await stuffedData.ContinueWith(x =>
|
||||
{
|
||||
_ = this.Dispatcher.BeginInvoke(delegate ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ using System.Collections.Generic;
|
|||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel;
|
||||
|
||||
|
|
@ -29,14 +30,13 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
|
|||
/// </summary>
|
||||
public void Cablerator()
|
||||
{
|
||||
|
||||
SelectedLines?.Clear();
|
||||
if (string.IsNullOrEmpty(Motor.MotorPower))
|
||||
{
|
||||
ShowWarning("电机功率不能为空!");
|
||||
return;
|
||||
}
|
||||
if(IsEnableParagraph)
|
||||
if (IsEnableParagraph)
|
||||
{
|
||||
if (EncoderLineParagraph == 0 || PowerLineParagraph == 0)
|
||||
{
|
||||
|
|
@ -67,7 +67,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
|
|||
{
|
||||
AxisNo = AxisNo,
|
||||
CableConnectionClass = CableConnectionType == ConnectionType.FullParagraph ? "前段" : "直通",
|
||||
CableType = brandData.ComplexLine ? $"{CableTypePrimary}+{CableTypeSecond}" : CableTypePrimary,
|
||||
CableType = brandData.ComplexLine ? $"{CableTypePrimary}+{CableTypeSecond}" : CableTypePrimary,
|
||||
CableModelNo = CableModelStr,
|
||||
IsLectotype = true,
|
||||
CurrentLine = 1,
|
||||
|
|
@ -75,7 +75,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
|
|||
};
|
||||
line.DrawingNo = line.GetCableDrawNo();
|
||||
line.SubLines = GetSubLines(line.DrawingNo);
|
||||
var startIndex = 1;
|
||||
var startIndex = 1;
|
||||
if (CableConnectionType == ConnectionType.FullParagraph)
|
||||
{
|
||||
LectotypeList.Clear();
|
||||
|
|
@ -95,11 +95,11 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
|
|||
// 第一条线为所选线
|
||||
LectotypeList.Add(line);
|
||||
var secLine = new LectotypeLineModel
|
||||
{
|
||||
AxisNo = AxisNo,
|
||||
{
|
||||
AxisNo = AxisNo,
|
||||
CableConnectionClass = CableConnectionType == ConnectionType.FullParagraph ? "前段" : "直通",
|
||||
CableType = CableTypeSecond,
|
||||
CableModelNo = CableModelStr,
|
||||
CableType = CableTypeSecond,
|
||||
CableModelNo = CableModelStr,
|
||||
IsLectotype = true,
|
||||
CurrentLine = 1,
|
||||
Motor = Motor
|
||||
|
|
@ -169,11 +169,11 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
|
|||
if (_passthroughCableCount >= 2 && !string.IsNullOrEmpty(CableTypeSecond))
|
||||
{
|
||||
var secLine = new LectotypeLineModel
|
||||
{
|
||||
AxisNo = AxisNo,
|
||||
{
|
||||
AxisNo = AxisNo,
|
||||
CableConnectionClass = "直通",
|
||||
CableType = CableTypeSecond,
|
||||
CableModelNo = CableModelStr,
|
||||
CableType = CableTypeSecond,
|
||||
CableModelNo = CableModelStr,
|
||||
IsLectotype = true,
|
||||
CurrentLine = 1,
|
||||
Motor = Motor
|
||||
|
|
@ -185,11 +185,11 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
|
|||
if (_passthroughCableCount >= 3 && !string.IsNullOrEmpty(CableTypeThree))
|
||||
{
|
||||
var secLine = new LectotypeLineModel
|
||||
{
|
||||
AxisNo = AxisNo,
|
||||
{
|
||||
AxisNo = AxisNo,
|
||||
CableConnectionClass = "直通",
|
||||
CableType = CableTypeThree,
|
||||
CableModelNo = CableModelStr,
|
||||
CableType = CableTypeThree,
|
||||
CableModelNo = CableModelStr,
|
||||
IsLectotype = true,
|
||||
CurrentLine = 1,
|
||||
Motor = Motor
|
||||
|
|
@ -199,7 +199,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
|
|||
LectotypeList.Add(secLine);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
var sortedLines = LectotypeList.OrderBy(it => it.CableType).ThenBy(it => it.CurrentLine).ToList();
|
||||
sortedLines.ForEach(it =>
|
||||
|
|
@ -462,6 +462,18 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
|
|||
OnPropertyChanged(nameof(IsEnableSecCableType));
|
||||
}
|
||||
}
|
||||
|
||||
private bool _loading;
|
||||
public bool Loading
|
||||
{
|
||||
get => _loading;
|
||||
set
|
||||
{
|
||||
_loading = value;
|
||||
OnPropertyChanged(nameof(Loading));
|
||||
}
|
||||
}
|
||||
|
||||
public bool SaveToDb()
|
||||
{
|
||||
//var service = new MotorLectotypeService();
|
||||
|
|
|
|||
|
|
@ -169,9 +169,9 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
|
|||
// 当前的工作区
|
||||
var designer = FlexProject.CurrentProject.GetDesigners().FirstOrDefault(designer => designer.ID == docId);
|
||||
// 获取项目名
|
||||
DocName = GetDocName(designer);
|
||||
DocName = LectotypeManager.GetDocName(designer);
|
||||
LectotypeManager.CURRENT_DOC_NAME = DocName;
|
||||
LectotypeManager.CURRENT_DOC_CREATE_TIME = new DateTimeOffset(designer.CreatedDateDateTime).ToUnixTimeMilliseconds().ToString();
|
||||
//LectotypeManager.CURRENT_DOC_CREATE_TIME = new DateTimeOffset(designer.CreatedDateDateTime).ToUnixTimeMilliseconds().ToString();
|
||||
|
||||
// 获取所有存在的
|
||||
var wires = designer.GetOrganizerOccurrences(designer.ID);
|
||||
|
|
@ -212,6 +212,7 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
|
|||
return new LectotypeLineModel
|
||||
{
|
||||
Name= GetLectotypeName(occCable.LibraryName),
|
||||
CableModel = GetLectotypeName(occCable.LibraryName),
|
||||
LibraryName = occCable.LibraryName,
|
||||
CableName = occCable.Name,
|
||||
AxisNo = GetAxisNo(insulatorGraph.Imprint),
|
||||
|
|
@ -262,18 +263,18 @@ public class LectotypeViewModel(string docId) : INotifyPropertyChanged
|
|||
}
|
||||
}
|
||||
|
||||
public string GetDocName(FlexDesigner designer)
|
||||
{
|
||||
var docName = designer.Name;
|
||||
if (docName.Contains("+"))
|
||||
{
|
||||
return docName.Split('+').FirstOrDefault();
|
||||
}
|
||||
else
|
||||
{
|
||||
return docName;
|
||||
}
|
||||
}
|
||||
//public string GetDocName(FlexDesigner designer)
|
||||
//{
|
||||
// var docName = designer.Name;
|
||||
// if (docName.Contains("+"))
|
||||
// {
|
||||
// return docName.Split('+').FirstOrDefault();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return docName;
|
||||
// }
|
||||
//}
|
||||
public List<LectotypeLineModel> StuffData(List<LectotypeLineModel> cables)
|
||||
{
|
||||
List<LectotypeLineModel> datas = [];
|
||||
|
|
|
|||
|
|
@ -0,0 +1,46 @@
|
|||
using Sinvo.EplanHpD.Plugin.Service.Model;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
||||
{
|
||||
public class MultiCoreWireLayoutHelperViewModel : INotifyPropertyChanged
|
||||
{
|
||||
|
||||
private string _uniqueKey;
|
||||
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||
}
|
||||
public MultiCoreWireLayoutHelperViewModel(string uniqueKey)
|
||||
{
|
||||
_uniqueKey = uniqueKey;
|
||||
}
|
||||
|
||||
|
||||
#region Props
|
||||
|
||||
private ObservableCollection<MultiCoreWireLecModel> _lecWires = [];
|
||||
|
||||
public ObservableCollection<MultiCoreWireLecModel> LecWires
|
||||
{
|
||||
get { return _lecWires; }
|
||||
set
|
||||
{
|
||||
_lecWires = value;
|
||||
OnPropertyChanged(nameof(LecWires));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -3,8 +3,13 @@ using EPLAN.Harness.Core.Appearance;
|
|||
using EPLAN.Harness.Core.Utils;
|
||||
using EPLAN.Harness.ProjectCore;
|
||||
using EPLAN.Harness.ProjectCore.Occurrences.Designer;
|
||||
using HandyControl.Controls;
|
||||
using MiniExcelLibs.Attributes;
|
||||
using Sinvo.EplanHpD.Plugin.Service;
|
||||
using Sinvo.EplanHpD.Plugin.Service.Model;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Models;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Models.MultiCoreWire;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Service;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Utils;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
|
@ -14,6 +19,7 @@ using System.Collections.ObjectModel;
|
|||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
||||
|
|
@ -22,6 +28,8 @@ 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 = "";
|
||||
#region Props
|
||||
|
||||
private ObservableCollection<MultiCoreWireDataModel> _wires = [];
|
||||
|
|
@ -48,6 +56,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private string _applicationScenario;
|
||||
/// <summary>
|
||||
/// 应用场景
|
||||
|
|
@ -58,11 +67,27 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
set
|
||||
{
|
||||
_applicationScenario = value;
|
||||
|
||||
ApplicationScenarioSelected = !string.IsNullOrEmpty(value);
|
||||
|
||||
OnPropertyChanged(nameof(ApplicationScenario));
|
||||
|
||||
OnLecChanged(nameof(ApplicationScenario));
|
||||
}
|
||||
}
|
||||
|
||||
private bool _applicationScenarioSelected;
|
||||
|
||||
public bool ApplicationScenarioSelected
|
||||
{
|
||||
get => _applicationScenarioSelected;
|
||||
set
|
||||
{
|
||||
_applicationScenarioSelected = value;
|
||||
OnPropertyChanged(nameof(ApplicationScenarioSelected));
|
||||
}
|
||||
}
|
||||
|
||||
private string _wireType;
|
||||
/// <summary>
|
||||
/// 线材类型
|
||||
|
|
@ -134,46 +159,46 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
OnLecChanged(nameof(WireModelSpecification));
|
||||
}
|
||||
}
|
||||
private string _connectorModel;
|
||||
/// <summary>
|
||||
/// 插头型号
|
||||
/// </summary>
|
||||
public string ConnectorModel
|
||||
{
|
||||
get => _connectorModel;
|
||||
set
|
||||
{
|
||||
_connectorModel = value;
|
||||
OnPropertyChanged(nameof(ConnectorModel));
|
||||
}
|
||||
}
|
||||
private string _frontTerminalModel;
|
||||
/// <summary>
|
||||
/// 前端子型号
|
||||
/// </summary>
|
||||
public string FrontTerminalModel
|
||||
{
|
||||
get => _frontTerminalModel;
|
||||
set
|
||||
{
|
||||
_frontTerminalModel = value;
|
||||
OnPropertyChanged(nameof(FrontTerminalModel));
|
||||
}
|
||||
}
|
||||
//private string _connectorModel;
|
||||
///// <summary>
|
||||
///// 插头型号
|
||||
///// </summary>
|
||||
//public string ConnectorModel
|
||||
//{
|
||||
// get => _connectorModel;
|
||||
// set
|
||||
// {
|
||||
// _connectorModel = value;
|
||||
// OnPropertyChanged(nameof(ConnectorModel));
|
||||
// }
|
||||
//}
|
||||
//private string _frontTerminalModel;
|
||||
///// <summary>
|
||||
///// 前端子型号
|
||||
///// </summary>
|
||||
//public string FrontTerminalModel
|
||||
//{
|
||||
// get => _frontTerminalModel;
|
||||
// set
|
||||
// {
|
||||
// _frontTerminalModel = value;
|
||||
// OnPropertyChanged(nameof(FrontTerminalModel));
|
||||
// }
|
||||
//}
|
||||
|
||||
private string _backTerminalModel;
|
||||
/// <summary>
|
||||
/// 后端子型号
|
||||
/// </summary>
|
||||
public string BackTerminalModel
|
||||
{
|
||||
get => _backTerminalModel;
|
||||
set
|
||||
{
|
||||
_backTerminalModel = value;
|
||||
OnPropertyChanged(nameof(BackTerminalModel));
|
||||
}
|
||||
}
|
||||
//private string _backTerminalModel;
|
||||
///// <summary>
|
||||
///// 后端子型号
|
||||
///// </summary>
|
||||
//public string BackTerminalModel
|
||||
//{
|
||||
// get => _backTerminalModel;
|
||||
// set
|
||||
// {
|
||||
// _backTerminalModel = value;
|
||||
// OnPropertyChanged(nameof(BackTerminalModel));
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
private List<string> _applicationScenarios;
|
||||
|
|
@ -189,19 +214,19 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
OnPropertyChanged(nameof(ApplicationScenarios));
|
||||
}
|
||||
}
|
||||
private List<string> _wireTypes;
|
||||
/// <summary>
|
||||
/// 线材类型
|
||||
/// </summary>
|
||||
public List<string> WireTypes
|
||||
{
|
||||
get => _wireTypes;
|
||||
set
|
||||
{
|
||||
_wireTypes = value;
|
||||
OnPropertyChanged(nameof(WireTypes));
|
||||
}
|
||||
}
|
||||
//private List<string> _wireTypes;
|
||||
///// <summary>
|
||||
///// 线材类型
|
||||
///// </summary>
|
||||
//public List<string> WireTypes
|
||||
//{
|
||||
// get => _wireTypes;
|
||||
// set
|
||||
// {
|
||||
// _wireTypes = value;
|
||||
// OnPropertyChanged(nameof(WireTypes));
|
||||
// }
|
||||
//}
|
||||
private List<string> _wireDiameterSpecifications;
|
||||
/// <summary>
|
||||
/// 线径规格
|
||||
|
|
@ -245,48 +270,138 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
}
|
||||
}
|
||||
|
||||
private List<string> _connectorModels;
|
||||
//private List<string> _connectorModels;
|
||||
///// <summary>
|
||||
///// 连接器型号
|
||||
///// </summary>
|
||||
//public List<string> ConnectorModels
|
||||
//{
|
||||
// get => _connectorModels;
|
||||
// set
|
||||
// {
|
||||
// _connectorModels = value;
|
||||
// OnPropertyChanged(nameof(ConnectorModels));
|
||||
// }
|
||||
//}
|
||||
private List<MultiCoreWireTerminalModel> _frontConnectorModels;
|
||||
/// <summary>
|
||||
/// 连接器型号
|
||||
/// 前连接器型号
|
||||
/// </summary>
|
||||
public List<string> ConnectorModels
|
||||
public List<MultiCoreWireTerminalModel> FrontConnectorModels
|
||||
{
|
||||
get => _connectorModels;
|
||||
get => _frontConnectorModels;
|
||||
set
|
||||
{
|
||||
_connectorModels = value;
|
||||
OnPropertyChanged(nameof(ConnectorModels));
|
||||
}
|
||||
}
|
||||
private List<string> _frontTerminalModels;
|
||||
/// <summary>
|
||||
/// 前端子型号
|
||||
/// </summary>
|
||||
public List<string> FrontTerminalModels
|
||||
{
|
||||
get => _frontTerminalModels;
|
||||
set
|
||||
{
|
||||
_frontTerminalModels = value;
|
||||
OnPropertyChanged(nameof(FrontTerminalModels));
|
||||
}
|
||||
}
|
||||
private List<string> _backTerminalModels;
|
||||
/// <summary>
|
||||
/// 后端子型号
|
||||
/// </summary>
|
||||
public List<string> BackTerminalModels
|
||||
{
|
||||
get => _backTerminalModels;
|
||||
set
|
||||
{
|
||||
_backTerminalModels = value;
|
||||
OnPropertyChanged(nameof(BackTerminalModels));
|
||||
_frontConnectorModels = value;
|
||||
OnPropertyChanged(nameof(FrontConnectorModels));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private List<MultiCoreWireTerminalModel> _backConnectorModels;
|
||||
/// <summary>
|
||||
/// 后连接器型号
|
||||
/// </summary>
|
||||
public List<MultiCoreWireTerminalModel> BackConnectorModels
|
||||
{
|
||||
get => _backConnectorModels;
|
||||
set
|
||||
{
|
||||
_backConnectorModels = value;
|
||||
OnPropertyChanged(nameof(BackConnectorModels));
|
||||
}
|
||||
}
|
||||
|
||||
private string _frontConnectorType;
|
||||
/// <summary>
|
||||
/// 前连接器类型
|
||||
/// </summary>
|
||||
public string FrontConnectorType
|
||||
{
|
||||
get => _frontConnectorType;
|
||||
set
|
||||
{
|
||||
_frontConnectorType = value;
|
||||
OnPropertyChanged(nameof(FrontConnectorType));
|
||||
OnFrontTypeChange(FrontConnectorType);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void OnFrontTypeChange(string type)
|
||||
{
|
||||
if (type == "端子")
|
||||
{
|
||||
FrontConnectorModels = [.. _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.TerminalModels];
|
||||
}
|
||||
else
|
||||
{
|
||||
FrontConnectorModels = [new MultiCoreWireTerminalModel {
|
||||
TerminalModel = _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.ConnectorModel
|
||||
}];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private string _backConnectorType;
|
||||
/// <summary>
|
||||
/// 后连接器类型
|
||||
/// </summary>
|
||||
public string BackConnectorType
|
||||
{
|
||||
get => _backConnectorType;
|
||||
set
|
||||
{
|
||||
_backConnectorType = value;
|
||||
OnPropertyChanged(nameof(BackConnectorType));
|
||||
OnBackTypeChange(BackConnectorType);
|
||||
|
||||
}
|
||||
}
|
||||
private void OnBackTypeChange(string type)
|
||||
{
|
||||
if (type == "端子")
|
||||
{
|
||||
BackConnectorModels = [.. _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.TerminalModels];
|
||||
}
|
||||
else
|
||||
{
|
||||
BackConnectorModels = [new MultiCoreWireTerminalModel {
|
||||
TerminalModel = _datas.Where(it => it.WireModelSpecification == WireModelSpecification).FirstOrDefault()?.ConnectorModel
|
||||
}];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//}
|
||||
private string _frontConnectorModel;
|
||||
/// <summary>
|
||||
/// 前连接器型号
|
||||
/// </summary>
|
||||
public string FrontConnectorModel
|
||||
{
|
||||
get => _frontConnectorModel;
|
||||
set
|
||||
{
|
||||
_frontConnectorModel = value;
|
||||
OnPropertyChanged(nameof(FrontConnectorModel));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private string _backConnectorModel;
|
||||
/// <summary>
|
||||
/// 后连接器型号
|
||||
/// </summary>
|
||||
public string BackConnectorModel
|
||||
{
|
||||
get => _backConnectorModel;
|
||||
set
|
||||
{
|
||||
_backConnectorModel = value;
|
||||
OnPropertyChanged(nameof(BackConnectorModel));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
|
@ -296,6 +411,45 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
_datas = _dataHelper.GetMultiCoreWireLecDatas();
|
||||
|
||||
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
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Error("加载历史数据失败");
|
||||
}
|
||||
}
|
||||
|
||||
public void Init()
|
||||
{
|
||||
|
||||
var des = FlexProject.CurrentProject.GetDesigners().FirstOrDefault(it => it.ID == _docId) ?? throw new Exception("设计器不存在");
|
||||
LectotypeManager.CURRENT_DOC_NAME = LectotypeManager.GetDocName(des);
|
||||
|
||||
CurrUniqueKey = $"{LectotypeManager.CURRENT_DOC_NAME}_{PluginServices.user.ID}";
|
||||
}
|
||||
private bool LecChanging = false;
|
||||
public void OnLecChanged(string propName)
|
||||
|
|
@ -310,20 +464,16 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
// 线径规格
|
||||
.WhereIF(!string.IsNullOrEmpty(WireDiameterSpecification), it => it.WireDiameterSpecification == WireDiameterSpecification)
|
||||
// 是否高柔
|
||||
.WhereIF(!string.IsNullOrEmpty(HighFlexibility),it => it.IsHighFlexibilityStr == HighFlexibility)
|
||||
.WhereIF(!string.IsNullOrEmpty(HighFlexibility), it => it.IsHighFlexibilityStr == HighFlexibility)
|
||||
// 型号
|
||||
.WhereIF(!string.IsNullOrEmpty(WireModelSpecification), it => it.WireModelSpecification == WireModelSpecification)
|
||||
// 线芯数
|
||||
.WhereIF(!string.IsNullOrEmpty(WireCoreCount), it => it.WireCoreCount == WireCoreCount)
|
||||
// 连接器
|
||||
.WhereIF(!string.IsNullOrEmpty(ConnectorModel), it => it.ConnectorModel == ConnectorModel)
|
||||
.WhereIF(!string.IsNullOrEmpty(FrontTerminalModel), it => it.FrontTerminalModel == FrontTerminalModel)
|
||||
.WhereIF(!string.IsNullOrEmpty(BackTerminalModel), it => it.BackTerminalModel == BackTerminalModel)
|
||||
;
|
||||
SetDatas(canUsedDatas, propName);
|
||||
}
|
||||
|
||||
private void SetDatas(IEnumerable<MultiCoreWireLecModel> datas,string propName = "")
|
||||
private void SetDatas(IEnumerable<MultiCoreWireLecModel> datas, string propName = "")
|
||||
{
|
||||
if (datas != null)
|
||||
{
|
||||
|
|
@ -333,7 +483,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
//{
|
||||
// ApplicationScenario = ApplicationScenarios.FirstOrDefault();
|
||||
//}
|
||||
WireTypes = [.. datas.Where(it => !string.IsNullOrEmpty(it.WireType)).Select(it => it.WireType).Distinct(), ""];
|
||||
//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();
|
||||
|
|
@ -353,9 +503,8 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
{
|
||||
WireModelSpecification = WireModelSpecifications.FirstOrDefault();
|
||||
}
|
||||
ConnectorModels = [.. datas.Where(it => !string.IsNullOrEmpty(it.ConnectorModel)).Select(it => it.ConnectorModel).Distinct(), ""];
|
||||
FrontTerminalModels = [.. datas.Where(it => !string.IsNullOrEmpty(it.FrontTerminalModel)).Select(it => it.FrontTerminalModel).Distinct(), ""];
|
||||
BackTerminalModels = [.. datas.Where(it => !string.IsNullOrEmpty(it.BackTerminalModel)).Select(it => it.BackTerminalModel).Distinct(), ""];
|
||||
//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;
|
||||
}
|
||||
}
|
||||
|
|
@ -374,7 +523,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
{
|
||||
var wireData = new MultiCoreWireDataModel
|
||||
{
|
||||
WireModelSpecification = it.LibraryName
|
||||
WireModelSpecification = $"{it.Name} / {it.LibraryName}"
|
||||
};
|
||||
//Debug.WriteLine($"{it.Name} - {it.LibraryName}");
|
||||
if (it.Children?.Any() ?? false)
|
||||
|
|
@ -386,7 +535,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
{
|
||||
c.Children.Where(ccc => ccc is OccWire).ForEach(cc =>
|
||||
{
|
||||
if(cc is OccWire wire)
|
||||
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)}");
|
||||
|
|
@ -408,7 +557,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
Wires?.Add(wireData);
|
||||
});
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
public void OnPropertyChanged(string propertyName)
|
||||
{
|
||||
|
|
@ -424,9 +573,8 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
HighFlexibility = "";
|
||||
WireCoreCount = "";
|
||||
WireModelSpecification = "";
|
||||
ConnectorModel = "";
|
||||
FrontTerminalModel = "";
|
||||
BackTerminalModel = "";
|
||||
FrontConnectorType = "";
|
||||
BackConnectorType = "";
|
||||
|
||||
LecChanging = false;
|
||||
OnLecChanged("");
|
||||
|
|
@ -434,23 +582,111 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel.MultiCoreWireViewModel
|
|||
|
||||
public void SaveLecToLine()
|
||||
{
|
||||
LecWires.Add(new MultiCoreWireLecModel
|
||||
if (ApplicationScenario == null
|
||||
|| WireDiameterSpecification == null
|
||||
|| HighFlexibility == null
|
||||
|| WireCoreCount == null
|
||||
|| WireModelSpecification == null
|
||||
|| FrontConnectorModel == null
|
||||
|| BackConnectorModel == null)
|
||||
{
|
||||
ApplicationScenario = ApplicationScenario,
|
||||
WireType = WireType,
|
||||
WireDiameterSpecification = WireDiameterSpecification,
|
||||
IsHighFlexibility = HighFlexibility == "是",
|
||||
WireCoreCount = WireCoreCount,
|
||||
WireModelSpecification = WireModelSpecification,
|
||||
ConnectorModel = ConnectorModel,
|
||||
FrontTerminalModel = FrontTerminalModel,
|
||||
BackTerminalModel = BackTerminalModel
|
||||
});
|
||||
}
|
||||
HandyControl.Controls.MessageBox.Show("有信息未选择!",caption: "提示",icon: MessageBoxImage.Warning);
|
||||
return;
|
||||
}
|
||||
//if(LecWires.Any(it=> it.ApplicationScenario == ApplicationScenario && it.WireModelSpecification == WireModelSpecification))
|
||||
//{
|
||||
// MessageBox.Show("已选择相同的线!");
|
||||
// return;
|
||||
//}
|
||||
|
||||
try
|
||||
{
|
||||
var wire = new MultiCoreWireLecModel
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
SeqNo = LecWires.Count + 1,
|
||||
ApplicationScenario = ApplicationScenario,
|
||||
WireDiameterSpecification = WireDiameterSpecification,
|
||||
IsHighFlexibilityStr = HighFlexibility,
|
||||
WireCoreCount = WireCoreCount,
|
||||
WireModelSpecification = WireModelSpecification,
|
||||
FrontConnectorModel = FrontConnectorModel,
|
||||
BackConnectorModel = BackConnectorModel,
|
||||
UserId = PluginServices.user.ID,
|
||||
ProjectName = LectotypeManager.CURRENT_DOC_NAME,
|
||||
UniqueKey = $"{LectotypeManager.CURRENT_DOC_NAME}_{PluginServices.user.ID}"
|
||||
};
|
||||
|
||||
_service.SaveData(new MultiCoreWireLecDBModel
|
||||
{
|
||||
Id = wire.Id,
|
||||
UniqueKey = wire.UniqueKey,
|
||||
ProjectName = wire.ProjectName,
|
||||
UserId = wire.UserId,
|
||||
SeqNo = wire.SeqNo,
|
||||
ApplicationScenario = wire.ApplicationScenario,
|
||||
WireDiameterSpecification = wire.WireDiameterSpecification,
|
||||
IsHighFlexibilityStr = wire.IsHighFlexibilityStr,
|
||||
WireCoreCount = wire.WireCoreCount,
|
||||
WireModelSpecification = wire.WireModelSpecification,
|
||||
FrontConnectorModel = wire.FrontConnectorModel,
|
||||
BackConnectorModel = wire.BackConnectorModel
|
||||
|
||||
});
|
||||
LecWires.Add(wire);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Error($"保存数据失败!{ex}");
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearLecLines()
|
||||
{
|
||||
LecWires.Clear();
|
||||
try
|
||||
{
|
||||
LecWires.Clear();
|
||||
_service.ClearSelf(CurrUniqueKey);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandyControl.Controls.MessageBox.Error($"清除数据失败!{ex}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
internal void DeleteLecWireItem(string id)
|
||||
{
|
||||
if(id != null)
|
||||
{
|
||||
var removeItem = LecWires.FirstOrDefault(it => it.Id == id!);
|
||||
if(removeItem != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
LecWires.Remove(removeItem);
|
||||
_service.DeleteById(id);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
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));
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,39 +59,27 @@ namespace Sinvo.EplanHpD.Plugin
|
|||
|
||||
public void Execute(HpdApi api)
|
||||
{
|
||||
bool isLogin = PluginServices.IsLogin;
|
||||
if (!isLogin)
|
||||
{
|
||||
var LoginWindow = new LoginWindow();
|
||||
if(LoginWindow.ShowDialog() == true)
|
||||
{
|
||||
isLogin = PluginServices.IsLogin;
|
||||
}
|
||||
}
|
||||
if (isLogin)
|
||||
new DBHelper().CodeFirst();
|
||||
var doc = api.CurrentProject.GetActiveDocument();
|
||||
if (window == null)
|
||||
{
|
||||
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 = 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();
|
||||
}
|
||||
window = null;
|
||||
};
|
||||
window.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
window.WindowState = System.Windows.WindowState.Normal;
|
||||
window.Activate();
|
||||
}
|
||||
}
|
||||
public void Initialize()
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ using System.Windows.Forms.Integration;
|
|||
|
||||
namespace Sinvo.EplanHpD.Plugin
|
||||
{
|
||||
#if Release_WireAndCable || DEBUG
|
||||
#if DEBUG
|
||||
public class MultiCoreWirePluginEntry : EPLAN.Harness.API.Plugins.IHpDPlugin
|
||||
#else
|
||||
public class MultiCoreWirePluginEntry
|
||||
|
|
@ -59,6 +59,7 @@ namespace Sinvo.EplanHpD.Plugin
|
|||
|
||||
public void Execute(HpdApi api)
|
||||
{
|
||||
#if DEBUG
|
||||
bool isLogin = PluginServices.IsLogin;
|
||||
if (!isLogin)
|
||||
{
|
||||
|
|
@ -70,6 +71,7 @@ namespace Sinvo.EplanHpD.Plugin
|
|||
}
|
||||
if (isLogin)
|
||||
{
|
||||
#endif
|
||||
new DBHelper().CodeFirst();
|
||||
var doc = api.CurrentProject.GetActiveDocument();
|
||||
if (window == null)
|
||||
|
|
@ -92,7 +94,9 @@ namespace Sinvo.EplanHpD.Plugin
|
|||
window.WindowState = System.Windows.WindowState.Normal;
|
||||
window.Activate();
|
||||
}
|
||||
#if DEBUG
|
||||
}
|
||||
#endif
|
||||
}
|
||||
public void Initialize()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -61,96 +61,83 @@ namespace Sinvo.EplanHpD.Plugin
|
|||
private MainWindow window;
|
||||
public void Execute(HpdApi api)
|
||||
{
|
||||
bool isLogin = PluginServices.IsLogin;
|
||||
if (!isLogin)
|
||||
bool isUpdated = false;
|
||||
try
|
||||
{
|
||||
var LoginWindow = new LoginWindow();
|
||||
if (LoginWindow.ShowDialog() == true)
|
||||
var doc = api.CurrentProject.GetActiveDocument();
|
||||
//doc.ID
|
||||
//if(doc is FlexReport)
|
||||
if (doc is EPLAN.Harness.API.Projects.Documents.Report report)
|
||||
{
|
||||
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 reportId = report.ID;
|
||||
var allReports = FlexProject.CurrentProject.GetReports();
|
||||
if (allReports.Any(item => item.ID == reportId))
|
||||
{
|
||||
var reportId = report.ID;
|
||||
var allReports = FlexProject.CurrentProject.GetReports();
|
||||
if (allReports.Any(item => item.ID == reportId))
|
||||
var flexReport = allReports.Where(item => item.ID == reportId).First();
|
||||
if (flexReport != null)
|
||||
{
|
||||
var flexReport = allReports.Where(item => item.ID == reportId).First();
|
||||
if (flexReport != null)
|
||||
var isNeedUpdate = FlexReport.IsUpToDate(flexReport);
|
||||
if (!isNeedUpdate)
|
||||
{
|
||||
var isNeedUpdate = FlexReport.IsUpToDate(flexReport);
|
||||
if (!isNeedUpdate)
|
||||
if (FlexMessageBox.Warning(FlexMessageBox.Buttons.OK_CANCEL,
|
||||
"Report",
|
||||
"报表数据不是最新的,是否更新?", false) == DialogResult.OK)
|
||||
{
|
||||
if (FlexMessageBox.Warning(FlexMessageBox.Buttons.OK_CANCEL,
|
||||
"Report",
|
||||
"报表数据不是最新的,是否更新?", false) == DialogResult.OK)
|
||||
{
|
||||
flexReport.UpdateReport();
|
||||
isUpdated = true;
|
||||
}
|
||||
flexReport.UpdateReport();
|
||||
isUpdated = true;
|
||||
}
|
||||
try
|
||||
}
|
||||
try
|
||||
{
|
||||
|
||||
if (window == null)
|
||||
{
|
||||
|
||||
if (window == null)
|
||||
window = new MainWindow(flexReport);
|
||||
ElementHost.EnableModelessKeyboardInterop(window);
|
||||
window.Show();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isUpdated)
|
||||
{
|
||||
|
||||
window.Close();
|
||||
window = new MainWindow(flexReport);
|
||||
ElementHost.EnableModelessKeyboardInterop(window);
|
||||
window.Show();
|
||||
}
|
||||
else
|
||||
window.ShowActivated = true;
|
||||
if (window.WindowState == System.Windows.WindowState.Minimized)
|
||||
{
|
||||
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();
|
||||
window.WindowState = System.Windows.WindowState.Normal;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
window = new MainWindow(flexReport);
|
||||
// 解决WPF窗体在WinForm中无法输入的问题
|
||||
ElementHost.EnableModelessKeyboardInterop(window);
|
||||
window.Show();
|
||||
window.Activate();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FlexMessageBox.Error("未找到项目中匹配的报表,请检查是否生成成功或是未保存到项目中!");
|
||||
catch (Exception)
|
||||
{
|
||||
window = new MainWindow(flexReport);
|
||||
// 解决WPF窗体在WinForm中无法输入的问题
|
||||
ElementHost.EnableModelessKeyboardInterop(window);
|
||||
window.Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FlexMessageBox.Error("请打开一个报表后再使用!");
|
||||
FlexMessageBox.Error("未找到项目中匹配的报表,请检查是否生成成功或是未保存到项目中!");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
else
|
||||
{
|
||||
FlexMessageBox.Error(ex.ToString());
|
||||
FlexMessageBox.Error("请打开一个报表后再使用!");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
FlexMessageBox.Error(ex.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public void Initialize()
|
||||
|
|
|
|||
|
|
@ -28,6 +28,6 @@ using System.Runtime.InteropServices;
|
|||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
[assembly: AssemblyVersion("1.0.1.2")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.2")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.1.2")]
|
||||
[assembly: AssemblyVersion("1.0.1.3")]
|
||||
[assembly: AssemblyFileVersion("1.0.1.3")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.1.3")]
|
||||
Loading…
Reference in New Issue