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> /// </summary>
public string Suffix { get; set; } 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, SheetName = ANCHUAN,
Prefix = "JZSP-", Prefix = "JZSP-",
MotorPrefix = "SGMX", MotorPrefix = "SGMX",
Suffix = "-E" Suffix = "-E",
MotorCablePowerRangeStart = 0,
MotorCablePowerRangeEnd = 750
} }
}, },
{HUICHUAN, {HUICHUAN,
@ -59,7 +61,9 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Datas
SheetName = HUICHUAN, SheetName = HUICHUAN,
Prefix = "S6-L-", Prefix = "S6-L-",
MotorPrefix = "MS1H", MotorPrefix = "MS1H",
Suffix = "" Suffix = "",
MotorCablePowerRangeStart = 0,
MotorCablePowerRangeEnd = 0
} }
}, },
{SANLING_HK_KT, {SANLING_HK_KT,
@ -69,7 +73,9 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Datas
SheetName = SANLING_HK_KT, SheetName = SANLING_HK_KT,
Prefix = "MR-", Prefix = "MR-",
MotorPrefix = "HK-KT", MotorPrefix = "HK-KT",
Suffix = "" Suffix = "",
MotorCablePowerRangeStart = 0,
MotorCablePowerRangeEnd = 0
} }
}, },
}; };

View File

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