105040 Update 更新安川电机逻辑,750W以下功率不生成前段线

更新程序集版本,添加新方法和类

更新了 `AssemblyInfo.cs` 文件中的程序集版本号至 `1.0.0.26`。
在 `MotorLectotypeService.cs` 文件中添加了 `SetLineDone` 方法。
在 `Sinvo.EplanHpD.Plugin.WPFUI.csproj` 文件中添加了 `MotorPowerModel.cs` 文件的编译包含项。
在 `MotorExcelHelper.cs` 文件中添加了 `GetMotorPower` 方法,用于获取电机功率。
在 `CableLectotypeViewModel.cs` 文件中进行了多处修改,包括修正逻辑、初始化 `LectotypeList`、根据电机功率决定前段线、排序并重新设置序号。
在 `Sinvo.EplanHpD.Plugin.csproj` 文件中更新了多个配置的输出路径。
添加了 `MotorPowerModel.cs` 文件,定义了 `MotorPowerModel` 类,用于表示电机功率。
This commit is contained in:
lihanbo 2025-02-14 15:40:43 +08:00
parent 4b088964e2
commit 9e3e71a4ca
9 changed files with 138 additions and 64 deletions

View File

@ -29,6 +29,6 @@ using System.Runtime.InteropServices;
// 生成号
// 修订号
//
[assembly: AssemblyVersion("1.0.0.24")]
[assembly: AssemblyFileVersion("1.0.0.24")]
[assembly: AssemblyInformationalVersion("1.0.0.24")]
[assembly: AssemblyVersion("1.0.0.25")]
[assembly: AssemblyFileVersion("1.0.0.25")]
[assembly: AssemblyInformationalVersion("1.0.0.25")]

View File

@ -0,0 +1,30 @@
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
{
/// <summary>
/// 电机功率
/// </summary>
public class MotorPowerModel
{
/*
*/
/// <summary>
/// 电机型号
/// </summary>
[ExcelColumn(Name = "电机型号")]
public string MotorModel { get; set; }
/// <summary>
/// 电机型号
/// </summary>
[ExcelColumn(Name = "功率")]
public int MotorPower { get; set; }
}
}

View File

@ -46,6 +46,6 @@ using System.Windows;
// 生成号
// 修订号
//
[assembly: AssemblyVersion("1.0.0.24")]
[assembly: AssemblyFileVersion("1.0.0.24")]
[assembly: AssemblyInformationalVersion("1.0.0.24")]
[assembly: AssemblyVersion("1.0.0.25")]
[assembly: AssemblyFileVersion("1.0.0.26")]
[assembly: AssemblyInformationalVersion("1.0.0.26")]

View File

@ -297,6 +297,8 @@ namespace Sinvo.EplanHpD.Plugin.Service
}
}
public int SetLineDone(string motorUniqueFlag,string lineId)
{
var db = DBHelper.DB;

View File

@ -262,6 +262,7 @@
<Compile Include="Models\LineBomModel.cs" />
<Compile Include="Models\MotorModel.cs" />
<Compile Include="Models\MotorPassthroughCable.cs" />
<Compile Include="Models\MotorPowerModel.cs" />
<Compile Include="Models\ReportModel.cs" />
<Compile Include="Models\ScanCableModel.cs" />
<Compile Include="Models\StuffedDataModel.cs" />

View File

@ -132,6 +132,24 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Utils
}
return MiniExcel.Query<MotorPassthroughCable>(dataFileStream, sheetName: "直通线数量").Where(it => it.MotorModel == motorModel).ToList();
}
/// <summary>
/// 获取电机功率
/// </summary>
/// <param name="motorModel">电机型号</param>
/// <returns></returns>
public int GetMotorPower(string motorModel)
{
if (dataFileStream == null || !dataFileStream.CanRead)
{
// 未初始化或是无法读取时,重试一次
ReadDataToStream();
}
return MiniExcel.Query<MotorPowerModel>(dataFileStream, sheetName: "电机功率")
.Where(it => it.MotorModel == motorModel)
.FirstOrDefault()
?.MotorPower ?? 0;
}
public List<LineBomModel> GetBomList(string drawNo)
{
//var filePath = "D:\\Desktop\\Data\\BOM表.xlsx";

View File

@ -59,16 +59,17 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
ShowWarning("请选择线材类型!");
return;
}
if (CableTypePrimary.Equals(CableTypeSecond) || CableTypePrimary.Equals(CableTypeThree) || CableTypeThree.Equals(CableTypeSecond))
if (CableTypePrimary.Equals(CableTypeSecond) || CableTypePrimary.Equals(CableTypeThree) || CableTypeSecond.Equals(CableTypeThree))
{
ShowWarning("不能选择同样的线段类型!");
return;
}
int seqNo = 1;
var LectotypeList = new List<LectotypeLineModel>();
var line = new LectotypeLineModel
{
SeqNo = seqNo,
//SeqNo = seqNo,
//MechanicalNo = MechanicalNo,
//MechanicalName = MechanicalName,
AxisNo = AxisNo,
@ -93,7 +94,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
};
line.DrawingNo = line.GetCableDrawNo();
line.SubLines = GetSubLines(line.DrawingNo);
var startIndex = 0;
if (CableConnectionType == ConnectionType.FullParagraph)
{
LectotypeList.Clear();
@ -102,57 +103,73 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
// WPFUISession.Instance.snackbarService.Show("相同轴号已经添加过数据,禁止重复添加!", "请检查是否添加错误", appearance: ControlAppearance.Danger, timeout: TimeSpan.FromSeconds(3));
// return;
//}
// 第一条线为所选线
LectotypeList.Add(line);
// 安川第一条线不合并,所以需要再次添加另一个类型的线
if (Motor.Brand == Brands.ANCHUAN)
{
//var index = CableTypeIndexs[CableTypePrimary];
//var secLineCableType = "";
//var flag = index.Keys.First() + index.Values.First();
//if (CableTypePrimary.Contains("刹车") && flag != 1)
//{
// // 动力线 or 动力刹车线
// flag = 0;
//}
////else
//secLineCableType = CableTypeIndexs.Keys.ToList()[flag];
var secLine = new LectotypeLineModel
var motorPower = MotorExcelHelper.Instance.GetMotorPower(Motor.MotorModelStr);
// 功率750W以下的电机不需要前段线
if (motorPower <= 750)
{
SeqNo = seqNo,
//MechanicalNo = MechanicalNo,
//MechanicalName = MechanicalName,
AxisNo = AxisNo,
//MotorSerie = MotorSerie,
//MotorPower = Motor.MotorPower,
//DriverInterface = DriverInterface,
//DriverModel = DriverModel,
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)
IsLectotype = true,
CurrentLine = 1,
Motor = Motor
};
secLine.DrawingNo = secLine.GetCableDrawNo();
secLine.SubLines = GetSubLines(secLine.DrawingNo);
LectotypeList.Add(secLine);
seqNo = 1;
startIndex = 1;
}
else
{
startIndex = 2;
// 第一条线为所选线
LectotypeList.Add(line);
//var index = CableTypeIndexs[CableTypePrimary];
//var secLineCableType = "";
//var flag = index.Keys.First() + index.Values.First();
//if (CableTypePrimary.Contains("刹车") && flag != 1)
//{
// // 动力线 or 动力刹车线
// flag = 0;
//}
////else
//secLineCableType = CableTypeIndexs.Keys.ToList()[flag];
var secLine = new LectotypeLineModel
{
//SeqNo = seqNo,
//MechanicalNo = MechanicalNo,
//MechanicalName = MechanicalName,
AxisNo = AxisNo,
//MotorSerie = MotorSerie,
//MotorPower = Motor.MotorPower,
//DriverInterface = DriverInterface,
//DriverModel = DriverModel,
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)
IsLectotype = true,
CurrentLine = 1,
Motor = Motor
};
secLine.DrawingNo = secLine.GetCableDrawNo();
secLine.SubLines = GetSubLines(secLine.DrawingNo);
LectotypeList.Add(secLine);
}
}
for (global::System.Int32 i = 2; i <= PowerLineParagraph; i++)
else
{
seqNo++;
LectotypeList.Add(line);
}
for (global::System.Int32 i = startIndex; i <= PowerLineParagraph; i++)
{
//seqNo++;
var cableConnectionType = "中段";
if (i >= PowerLineParagraph)
{
@ -160,7 +177,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
}
var powerLine = new LectotypeLineModel
{
SeqNo = seqNo,
//SeqNo = seqNo,
//MechanicalNo = MechanicalNo,
//MechanicalName = MechanicalName,
AxisNo = AxisNo,
@ -185,9 +202,9 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
powerLine.SubLines = GetSubLines(powerLine.DrawingNo);
LectotypeList.Add(powerLine);
}
for (global::System.Int32 i = 2; i <= EncoderLineParagraph; i++)
for (global::System.Int32 i = startIndex; i <= EncoderLineParagraph; i++)
{
seqNo++;
//seqNo++;
var cableConnectionType = "中段";
if (i >= EncoderLineParagraph)
{
@ -195,7 +212,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
}
var encoderLine = new LectotypeLineModel
{
SeqNo = seqNo,
//SeqNo = seqNo,
//MechanicalNo = MechanicalNo,
//MechanicalName = MechanicalName,
AxisNo = AxisNo,
@ -231,7 +248,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
{
var secLine = new LectotypeLineModel
{
SeqNo = seqNo,
//SeqNo = seqNo,
//MechanicalNo = MechanicalNo,
//MechanicalName = MechanicalName,
AxisNo = AxisNo,
@ -262,7 +279,7 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
{
var secLine = new LectotypeLineModel
{
SeqNo = seqNo,
//SeqNo = seqNo,
//MechanicalNo = MechanicalNo,
//MechanicalName = MechanicalName,
AxisNo = AxisNo,
@ -292,7 +309,13 @@ public class CableLectotypeViewModel : INotifyPropertyChanged
}
}
SelectedLines = LectotypeList;
var sortedLines = LectotypeList.OrderBy(it => it.CableType).ThenBy(it => it.CurrentLine).ToList();
sortedLines.ForEach(it =>
{
it.SeqNo = seqNo;
seqNo++;
});
SelectedLines = sortedLines;
}
private List<LectotypeLineModel> GetSubLines(string drawingNo)

View File

@ -28,6 +28,6 @@ using System.Runtime.InteropServices;
// 生成号
// 修订号
//
[assembly: AssemblyVersion("1.0.0.24")]
[assembly: AssemblyVersion("1.0.0.26")]
[assembly: AssemblyFileVersion("1.0.0.24")]
[assembly: AssemblyInformationalVersion("1.0.0.24-rls")]

View File

@ -33,7 +33,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<OutputPath>..\..\..\PLMCADI\Release_WireAndCable\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
@ -104,7 +104,7 @@
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release_WireCheck|x64'">
<OutputPath>bin\x64\Release_WireAndCable\</OutputPath>
<OutputPath>..\..\..\PLMCADI\Release_WireAndCable\</OutputPath>
<DefineConstants>TRACE;Release_WireAndCable</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
@ -131,7 +131,7 @@
<ErrorReport>prompt</ErrorReport>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release_CableLayout|x64'">
<OutputPath>bin\x64\Release_CableLayout\</OutputPath>
<OutputPath>..\..\..\PLMCADI\EPLANProDAddin\</OutputPath>
<DefineConstants>TRACE;Release_CableLayout</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>