diff --git a/Sinvo.EplanHpD.Plugin.Service/Model/CableLectotype.cs b/Sinvo.EplanHpD.Plugin.Service/Model/CableLectotype.cs
index e014352..9f90e6e 100644
--- a/Sinvo.EplanHpD.Plugin.Service/Model/CableLectotype.cs
+++ b/Sinvo.EplanHpD.Plugin.Service/Model/CableLectotype.cs
@@ -30,6 +30,8 @@ namespace Sinvo.EplanHpD.Plugin.Service.Model
[SugarColumn(IsNullable = true)]
public string CableTypeSecond { get; set; }
+ [SugarColumn(IsNullable = true)]
+ public string CableTypeThree { get; set; }
[SugarColumn(IsNullable = true)]
public int EncoderLineParagraph { get; set; }
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Models/MotorPassthroughCable.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MotorPassthroughCable.cs
new file mode 100644
index 0000000..cd86e4e
--- /dev/null
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/Models/MotorPassthroughCable.cs
@@ -0,0 +1,49 @@
+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
+{
+ ///
+ /// 电机直通线数量
+ ///
+ public class MotorPassthroughCable
+ {
+ /*
+ 电机型号 动力线或动力刹车直通线数量 编码器直通线数量 直通刹车线数量 直通线总数量
+ */
+
+ ///
+ /// 电机型号
+ ///
+ [ExcelColumn(Name = "电机型号")]
+ public string MotorModel { get; set; }
+
+ ///
+ /// 动力线或动力刹车直通线数量
+ ///
+ [ExcelColumn(Name = "动力线或动力刹车直通线数量")]
+ public int PowerOrBrakeCableCount { get; set; }
+
+ ///
+ /// 编码器直通线数量
+ ///
+ [ExcelColumn(Name = "编码器直通线数量")]
+ public int EncoderCableCount { get; set; }
+
+ ///
+ /// 直通刹车线数量
+ ///
+ [ExcelColumn(Name = "直通刹车线数量")]
+ public int BrakeCableCount { get; set; }
+
+ ///
+ /// 直通线总数量
+ ///
+ [ExcelColumn(Name = "直通线总数量")]
+ public int TotalCableCount { get; set; }
+ }
+}
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Service/MotorLectotypeService.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Service/MotorLectotypeService.cs
index aa53f2e..00d9665 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/Service/MotorLectotypeService.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/Service/MotorLectotypeService.cs
@@ -105,6 +105,7 @@ namespace Sinvo.EplanHpD.Plugin.Service
AxisNo = cableLectotype.AxisNo,
CableTypePrimary = cableLectotype.CableTypePrimary,
CableTypeSecond = cableLectotype.CableTypeSecond,
+ CableTypeThree = cableLectotype.CableTypeThree,
EncoderLineParagraph = cableLectotype.EncoderLineParagraph,
PowerLineParagraph = cableLectotype.PowerLineParagraph,
CableModelStr = cableLectotype.CableModelStr,
@@ -201,6 +202,7 @@ namespace Sinvo.EplanHpD.Plugin.Service
AxisNo = data.AxisNo,
CableTypePrimary = data.CableTypePrimary,
CableTypeSecond = data.CableTypeSecond,
+ CableTypeThree = data.CableTypeThree,
EncoderLineParagraph = data.EncoderLineParagraph,
PowerLineParagraph = data.PowerLineParagraph,
CableModelStr = data.CableModelStr,
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Sinvo.EplanHpD.Plugin.WPFUI.csproj b/Sinvo.EplanHpD.Plugin.WPFUI/Sinvo.EplanHpD.Plugin.WPFUI.csproj
index cd9d9bd..04ce29c 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/Sinvo.EplanHpD.Plugin.WPFUI.csproj
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/Sinvo.EplanHpD.Plugin.WPFUI.csproj
@@ -261,6 +261,7 @@
+
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/Utils/MotorExcelHelper.cs b/Sinvo.EplanHpD.Plugin.WPFUI/Utils/MotorExcelHelper.cs
index ac893ba..1af2351 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/Utils/MotorExcelHelper.cs
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/Utils/MotorExcelHelper.cs
@@ -14,7 +14,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
private Stream dataFileStream;
#if DEBUG
- public const string DATA_FILE_PATH = @"D:\旧电脑文件\Desktop\EPlan\线材选型";
+ public const string DATA_FILE_PATH = @"D:\Desktop\EPlan\线材选型";
#else
public const string DATA_FILE_PATH = @"\\192.168.1.160\plm系统文档\线材选型\插件";//@"D:\旧电脑文件\Desktop\EPlan\线材选型";//
@@ -118,7 +118,20 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
obj => obj.ToString().GetHashCode()
)).OrderBy(it => it.ItemValue).ToList();
}
-
+ ///
+ /// 获取直通线数量
+ ///
+ ///
+ ///
+ public List GetPassthroughCableCount(string motorModel)
+ {
+ if (dataFileStream == null || !dataFileStream.CanRead)
+ {
+ // 未初始化或是无法读取时,重试一次
+ ReadDataToStream();
+ }
+ return MiniExcel.Query(dataFileStream, sheetName: "直通线数量").Where(it => it.MotorModel == motorModel).ToList();
+ }
public List GetBomList(string drawNo)
{
//var filePath = "D:\\Desktop\\Data\\BOM表.xlsx";
diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml b/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml
index 0ca9e56..0f8db55 100644
--- a/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml
+++ b/Sinvo.EplanHpD.Plugin.WPFUI/View/CableLectotypeUserControl.xaml
@@ -170,7 +170,7 @@
IsReadOnly="False"
Text="{Binding EncoderLineParagraph, Mode=TwoWay}" />
-
+
-
+
= 2)
{
- SeqNo = seqNo,
- //MechanicalNo = MechanicalNo,
- //MechanicalName = MechanicalName,
- AxisNo = AxisNo,
- //MotorSerie = MotorSerie,
- //MotorPower = Motor.MotorPower,
- //DriverInterface = DriverInterface,
- //DriverModel = DriverModel,
- CableConnectionClass = "直通",
- CableType = CableTypeSecond,
- //IsFlexibility = IsFlexibility,
- //PowerLineLength = PowerLineLength,
- //EncoderLineLength = EncoderLineLength,
- //PowerBrakeLineLength = PowerBrakeLineLength,
- //DrawingNo = LineModelStr,
- CableModelNo = CableModelStr,
- //LineCount = Math.Max(PowerLineCount, EncoderLineCount),
- //CurrentLineNumber = 1,
- //BomList = GenBomListByCurrent(DrawingNo)
- IsLectotype = true,
- CurrentLine = 1,
- Motor = Motor
- };
- secLine.DrawingNo = secLine.GetCableDrawNo();
- secLine.SubLines = GetSubLines(secLine.DrawingNo);
- LectotypeList.Add(secLine);
+ var secLine = new LectotypeLineModel
+ {
+ SeqNo = seqNo,
+ //MechanicalNo = MechanicalNo,
+ //MechanicalName = MechanicalName,
+ AxisNo = AxisNo,
+ //MotorSerie = MotorSerie,
+ //MotorPower = Motor.MotorPower,
+ //DriverInterface = DriverInterface,
+ //DriverModel = DriverModel,
+ CableConnectionClass = "直通",
+ CableType = CableTypeSecond,
+ //IsFlexibility = IsFlexibility,
+ //PowerLineLength = PowerLineLength,
+ //EncoderLineLength = EncoderLineLength,
+ //PowerBrakeLineLength = PowerBrakeLineLength,
+ //DrawingNo = LineModelStr,
+ CableModelNo = CableModelStr,
+ //LineCount = Math.Max(PowerLineCount, EncoderLineCount),
+ //CurrentLineNumber = 1,
+ //BomList = GenBomListByCurrent(DrawingNo)
+ IsLectotype = true,
+ CurrentLine = 1,
+ Motor = Motor
+ };
+ secLine.DrawingNo = secLine.GetCableDrawNo();
+ secLine.SubLines = GetSubLines(secLine.DrawingNo);
+ LectotypeList.Add(secLine);
+ }
+ if (_passthroughCableCount >= 3)
+ {
+ var secLine = new LectotypeLineModel
+ {
+ SeqNo = seqNo,
+ //MechanicalNo = MechanicalNo,
+ //MechanicalName = MechanicalName,
+ AxisNo = AxisNo,
+ //MotorSerie = MotorSerie,
+ //MotorPower = Motor.MotorPower,
+ //DriverInterface = DriverInterface,
+ //DriverModel = DriverModel,
+ CableConnectionClass = "直通",
+ CableType = CableTypeThree,
+ //IsFlexibility = IsFlexibility,
+ //PowerLineLength = PowerLineLength,
+ //EncoderLineLength = EncoderLineLength,
+ //PowerBrakeLineLength = PowerBrakeLineLength,
+ //DrawingNo = LineModelStr,
+ CableModelNo = CableModelStr,
+ //LineCount = Math.Max(PowerLineCount, EncoderLineCount),
+ //CurrentLineNumber = 1,
+ //BomList = GenBomListByCurrent(DrawingNo)
+ IsLectotype = true,
+ CurrentLine = 1,
+ Motor = Motor
+ };
+ secLine.DrawingNo = secLine.GetCableDrawNo();
+ secLine.SubLines = GetSubLines(secLine.DrawingNo);
+ LectotypeList.Add(secLine);
+ }
}
}
@@ -344,6 +378,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
{
_motor = value;
OnPropertyChanged(nameof(Motor));
+ UpdatePassthroughCableCount();
}
}
@@ -360,13 +395,50 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
IsEnableParagraph = !(_cableConnectionType == ConnectionType.Passthrough);
PowerLineParagraph = 0;
EncoderLineParagraph = 0;
- if (!IsEnableParagraph && Motor.Brand != Brands.ANCHUAN)
+ if (!IsEnableParagraph)
{
- IsEnableSecCableType = false;
+ UpdatePassthroughCableCount();
}
- else
+ else
+ {
+ IsEnableThreeCableType = false;
+ }
+ }
+ }
+
+ public int _passthroughCableCount = 0;
+
+ private bool _isEnableThreeCableType = false;
+
+ public bool IsEnableThreeCableType
+ {
+ get { return _isEnableThreeCableType; }
+ set
+ {
+ _isEnableThreeCableType = value;
+ OnPropertyChanged(nameof(IsEnableThreeCableType));
+ }
+ }
+ public void UpdatePassthroughCableCount()
+ {
+ if (_motor != null)
+ {
+ var passthroughCables = MotorExcelHelper.Instance.GetPassthroughCableCount(_motor.MotorModelStr).FirstOrDefault();
+ _passthroughCableCount = passthroughCables.TotalCableCount;
+ if (_passthroughCableCount == 2)
{
IsEnableSecCableType = true;
+ IsEnableThreeCableType = false;
+ }
+ if (_passthroughCableCount == 3)
+ {
+ IsEnableSecCableType = true;
+ IsEnableThreeCableType = true;
+ }
+ if (_passthroughCableCount == 1)
+ {
+ IsEnableSecCableType = false;
+ IsEnableThreeCableType = false;
}
}
}
@@ -464,20 +536,6 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
OnPropertyChanged(nameof(IsEnableSecCableType));
}
}
- ///
- /// 是否显示第三种线材类型
- ///
- private bool _isShowThreeCableType = false;
- public bool IsShowThreeCableType
- {
- get => _isShowThreeCableType;
- set
- {
- _isShowThreeCableType = value;
- OnPropertyChanged(nameof(IsShowThreeCableType));
- }
- }
-
public bool SaveToDb()
{
//var service = new MotorLectotypeService();
@@ -504,6 +562,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
AxisNo = viewModel.AxisNo;
CableTypePrimary = viewModel.CableTypePrimary;
CableTypeSecond = viewModel.CableTypeSecond;
+ CableTypeThree = viewModel.CableTypeThree;
EncoderLineParagraph = viewModel.EncoderLineParagraph;
PowerLineParagraph = viewModel.PowerLineParagraph;
CableModelStr = viewModel.CableModelStr;