105040 Update 更新电机无前段线的功率范围

This commit is contained in:
lihanbo 2025-04-02 17:24:34 +08:00
parent e8361ef455
commit 509f4d3670
3 changed files with 60 additions and 94 deletions

View File

@ -35,5 +35,14 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Datas
/// 型号后缀
/// </summary>
public string Suffix { get; set; }
/// <summary>
/// 电机带前段线的功率范围,起始(>)
/// </summary>
public double MotorCablePowerRangeStart { get; set; }
/// <summary>
/// 电机带前段线的功率范围,结束(<=
/// </summary>
public double MotorCablePowerRangeEnd { get; set; }
}
}

View File

@ -49,7 +49,9 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Datas
SheetName = ANCHUAN,
Prefix = "JZSP-",
MotorPrefix = "SGMX",
Suffix = "-E"
Suffix = "-E",
MotorCablePowerRangeStart = 0,
MotorCablePowerRangeEnd = 750
}
},
{HUICHUAN,
@ -59,7 +61,9 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Datas
SheetName = HUICHUAN,
Prefix = "S6-L-",
MotorPrefix = "MS1H",
Suffix = ""
Suffix = "",
MotorCablePowerRangeStart = 0,
MotorCablePowerRangeEnd = 0
}
},
{SANLING_HK_KT,
@ -69,7 +73,9 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Datas
SheetName = SANLING_HK_KT,
Prefix = "MR-",
MotorPrefix = "HK-KT",
Suffix = ""
Suffix = "",
MotorCablePowerRangeStart = 0,
MotorCablePowerRangeEnd = 0
}
},
};

View File

@ -1,4 +1,5 @@
using EPLAN.Harness.Core.Controls;
using EPLAN.Harness.Core.LibEntities.Enums;
using HandyControl.Controls;
using Sinvo.EplanHpD.Plugin.Service;
using Sinvo.EplanHpD.Plugin.WPFUI.Datas;
@ -89,7 +90,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
};
line.DrawingNo = line.GetCableDrawNo();
line.SubLines = GetSubLines(line.DrawingNo);
var startIndex = 0;
var startIndex = 1;
if (CableConnectionType == ConnectionType.FullParagraph)
{
LectotypeList.Clear();
@ -104,7 +105,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
{
var motorPower = MotorExcelHelper.Instance.GetMotorPower(Motor.MotorModelStr);
// 功率750W以下的电机不需要前段线
if (motorPower <= 750)
if (motorPower > brandData.MotorCablePowerRangeStart && motorPower <= brandData.MotorCablePowerRangeEnd)
{
seqNo = 1;
startIndex = 1;
@ -127,26 +128,11 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
var secLine = new LectotypeLineModel
{
//SeqNo = seqNo,
//MechanicalNo = MechanicalNo,
//MechanicalName = MechanicalName,
AxisNo = AxisNo,
//MotorSerie = MotorSerie,
//MotorPower = Motor.MotorPower,
//DriverInterface = DriverInterface,
//DriverModel = DriverModel,
{
AxisNo = AxisNo,
CableConnectionClass = CableConnectionType == ConnectionType.FullParagraph ? "前段" : "直通",
CableType = CableTypeSecond,
//IsFlexibility = IsFlexibility,
//PowerLineLength = PowerLineLength,
//EncoderLineLength = EncoderLineLength,
//PowerBrakeLineLength = PowerBrakeLineLength,
//DrawingNo = LineModelStr,
CableModelNo = CableModelStr,
//LineCount = Math.Max(PowerLineCount, EncoderLineCount),
//CurrentLineNumber = 1,
//BomList = GenBomListByCurrent(DrawingNo)
CableType = CableTypeSecond,
CableModelNo = CableModelStr,
IsLectotype = true,
CurrentLine = 1,
Motor = Motor
@ -158,6 +144,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
}
else
{
startIndex = 2;
LectotypeList.Add(line);
}
@ -206,24 +193,11 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
}
var encoderLine = new LectotypeLineModel
{
//SeqNo = seqNo,
//MechanicalNo = MechanicalNo,
//MechanicalName = MechanicalName,
AxisNo = AxisNo,
//MotorSerie = MotorSerie,
//MotorPower = MotorPower,
//DriverInterface = DriverInterface,
//DriverModel = DriverModel,
//PowerBrakeLineLength = PowerBrakeLineLength,
//DrawingNo = DrawingNo,
//CableModelNo = CableModelNo,
CableConnectionClass = cableConnectionType,
CableType = CableTypePrimary,
LineCount = EncoderLineParagraph,
//PowerLineLength = PowerLineLength,
//CurrentLineNumber = i,
CurrentLine = i,
//CableFlag = GetCableModelFlag(MotorPower, PowerLineName, cableConnectionType, false)
Motor = Motor,
IsLectotype = true
};
@ -241,26 +215,11 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
if (_passthroughCableCount >= 2)
{
var secLine = new LectotypeLineModel
{
//SeqNo = seqNo,
//MechanicalNo = MechanicalNo,
//MechanicalName = MechanicalName,
AxisNo = AxisNo,
//MotorSerie = MotorSerie,
//MotorPower = Motor.MotorPower,
//DriverInterface = DriverInterface,
//DriverModel = DriverModel,
{
AxisNo = AxisNo,
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)
CableType = CableTypeSecond,
CableModelNo = CableModelStr,
IsLectotype = true,
CurrentLine = 1,
Motor = Motor
@ -272,26 +231,11 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
if (_passthroughCableCount >= 3)
{
var secLine = new LectotypeLineModel
{
//SeqNo = seqNo,
//MechanicalNo = MechanicalNo,
//MechanicalName = MechanicalName,
AxisNo = AxisNo,
//MotorSerie = MotorSerie,
//MotorPower = Motor.MotorPower,
//DriverInterface = DriverInterface,
//DriverModel = DriverModel,
{
AxisNo = AxisNo,
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)
CableType = CableTypeThree,
CableModelNo = CableModelStr,
IsLectotype = true,
CurrentLine = 1,
Motor = Motor
@ -314,7 +258,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
private List<LectotypeLineModel> GetSubLines(string drawingNo)
{
return MotorExcelHelper.Instance.GetBomList(drawingNo).Where(it =>
return [.. MotorExcelHelper.Instance.GetBomList(drawingNo).Where(it =>
{
// BOM表中只有 编码器线 和 动力线 不区分是不是带刹车
return it.Name == "编码器线" || it.Name == "动力线" || it.Name == "刹车线";
@ -323,7 +267,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
SeqNo = 0,
CableModel = it.Spec,
CableType = it.Name
}).ToList();
})];
}
private void ShowError(string msg)
{
@ -339,17 +283,9 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
{
get
{
var brandData = Brands.GetBrandData(Motor.Brand);
var isCombo = brandData.ComplexLine;
// 三菱电机选两种线之后再进行合并
var types = motorExcelHelper.GetCableTypes();
if(isCombo)
{
return [.. types.Where(it => it.ItemFlag == "是")];
}
else
{
return [.. types.Where(it => it.ItemFlag == "否")];
}
return [.. types.Where(it => it.ItemFlag == "否")];
}
set
{
@ -475,13 +411,13 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
}
private string _axison;
private string _axisNo;
public string AxisNo
{
get { return _axison; }
get { return _axisNo; }
set
{
_axison = value;
_axisNo = value;
OnPropertyChanged(nameof(AxisNo));
}
}
@ -600,7 +536,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
CableModelStr = viewModel.CableModelStr;
SelectedLines = [];
// 深拷贝 SelectedLines
SelectedLines.AddRange(viewModel.SelectedLines.Select(line => new LectotypeLineModel
SelectedLines.AddRange([.. viewModel.SelectedLines.Select(line => new LectotypeLineModel
{
SeqNo = line.SeqNo,
MechanicalNo = line.MechanicalNo,
@ -618,17 +554,32 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
Motor = line.Motor,
IsLectotype = line.IsLectotype,
IsComplete = line.IsComplete,
SubLines = line.SubLines.Select(subLine => new LectotypeLineModel
SubLines = [.. line.SubLines.Select(subLine => new LectotypeLineModel
{
SeqNo = subLine.SeqNo,
CableModel = subLine.CableModel,
CableType = subLine.CableType,
IsChecked = subLine.IsChecked,
LectotypeLineId = subLine.LectotypeLineId
}).ToList()
}).ToList());
})]
}).OrderBy(it => it.CurrentLine).ThenBy(it => it.CableType)]);
OnPropertyChanged(nameof(SelectedLines));
}
//public void OnChange()
//{
// if(Motor != null)
// {
// var motorData = Brands.GetBrandData(Motor.Brand);
// if(motorData != null)
// {
// if (motorData.ComplexLine)
// {
// IsEnableSecCableType = false;
// }
// }
// }
//}
#endregion
}