105040 Update 拆分线材型号生成逻辑
This commit is contained in:
parent
cde4bc41de
commit
5d198a137a
|
@ -0,0 +1,121 @@
|
|||
using EPLAN.Harness.Core.LibEntities.Enums;
|
||||
using Sinvo.EplanHpD.Plugin.Service.Model;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Datas;
|
||||
using Sinvo.EplanHpD.Plugin.WPFUI.Models;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
|
||||
namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
|
||||
{
|
||||
public static class LectotypeLineModelExt
|
||||
{
|
||||
public static string GenCableModelNo(this LectotypeLineModel model)
|
||||
{
|
||||
Stopwatch stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
model.DrawingNo = "";
|
||||
if (model.Motor == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
var brandData = Brands.GetBrandData(model.Motor.Brand);
|
||||
var ModelNo = new StringBuilder();
|
||||
if (brandData != null)
|
||||
{
|
||||
//ModelNo += brandData.Prefix;
|
||||
ModelNo.Append(brandData.Prefix);
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
var cableFlag = model.GetCableModelFlag(model.Motor?.MotorPower, model.CableType, model.CableConnectionClass, model.IsFlexibility);
|
||||
if (string.IsNullOrWhiteSpace(cableFlag))
|
||||
{
|
||||
|
||||
return "";
|
||||
}
|
||||
else
|
||||
{
|
||||
//ModelNo += cableFlag + "-";
|
||||
ModelNo.Append(cableFlag);
|
||||
ModelNo.Append("-");
|
||||
|
||||
}
|
||||
//编码器线+动力线 编码器线+动力刹车线
|
||||
if (model.CableType is "编码器线+动力线" or "编码器线+动力刹车线") // 组合线
|
||||
ModelNo.Append("A1-");
|
||||
|
||||
//ModelNo += "A1-";
|
||||
|
||||
if (model.IsFlexibility)
|
||||
{
|
||||
//ModelNo += "H-";
|
||||
ModelNo.Append("H-");
|
||||
}
|
||||
else
|
||||
{
|
||||
//ModelNo += "L-";
|
||||
ModelNo.Append("L-");
|
||||
|
||||
}
|
||||
if (model.IsComplexLine)
|
||||
{
|
||||
//ModelNo += $"{model.EncoderLineLength}-{model.PowerLineLength}";
|
||||
ModelNo.Append(model.EncoderLineLength);
|
||||
ModelNo.Append("-");
|
||||
ModelNo.Append(model.PowerLineLength);
|
||||
}
|
||||
else if (model.IsEncoderLine)
|
||||
{
|
||||
//ModelNo += $"{model.EncoderLineLength}";
|
||||
ModelNo.Append(model.EncoderLineLength);
|
||||
}
|
||||
else if (model.IsPowerLine)
|
||||
{
|
||||
//ModelNo += $"{model.PowerLineLength}";
|
||||
ModelNo.Append(model.PowerLineLength);
|
||||
}
|
||||
else
|
||||
{
|
||||
//ModelNo += $"{model.PowerLineLength}";
|
||||
ModelNo.Append(model.PowerLineLength);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(model.AxisNo))
|
||||
{
|
||||
ModelNo.Append(brandData.Suffix);
|
||||
//if (model.Motor.Brand == Brands.SANLING_HK_KT)
|
||||
{
|
||||
//ModelNo += "(";
|
||||
ModelNo.Append("(");
|
||||
}
|
||||
//if (model.Motor.Brand == Brands.ANCHUAN)
|
||||
//{
|
||||
// //ModelNo += "-E(";
|
||||
// ModelNo.Append("-E(");
|
||||
//}
|
||||
//ModelNo += $"{model.AxisNo}";
|
||||
ModelNo.Append(model.AxisNo);
|
||||
if (model.CableConnectionClass != "直通")
|
||||
{
|
||||
//if (!(CableType is "编码器线+动力线" or "编码器线+动力刹车线"))
|
||||
//ModelNo += $"-{model.CurrentLine}/{model.LineCount}";
|
||||
ModelNo.Append("-");
|
||||
ModelNo.Append(model.CurrentLine);
|
||||
ModelNo.Append("/");
|
||||
ModelNo.Append(model.LineCount);
|
||||
}
|
||||
//ModelNo += ")/定制";
|
||||
ModelNo.Append(")/定制");
|
||||
}
|
||||
//if (isUpdateDrawNo)
|
||||
{
|
||||
model.DrawingNo = model.GetCableDrawNo();
|
||||
}
|
||||
stopwatch.Stop();
|
||||
Debug.Print($"CableModelNo {ModelNo} : {stopwatch.ElapsedMilliseconds}ms");
|
||||
|
||||
return ModelNo.ToString();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue