添加多个方法的注释以提高代码可读性
添加了以下方法的注释: - `CheckDPETerminals`:检查地排端子 - `CheckWireErpNr`:检查线材料号 - `CheckNumberTube`:检查号码管 - `CheckRequiredFields`:检查必填项 - `CheckCeCompliance`:检查是否全部使用CE认证物料 - `CheckInsulation`:检查变色套大小与是否使用变色管 - `CheckDuplicateModel`:检查重复 - `SetItemError`:将一项设置为异常 - `GetCanUsedTerminal`:获取可使用的端子 - `CheckImprint`:检查变色套是否使用正确的颜色
This commit is contained in:
parent
0ae84bd0ca
commit
34e2337864
|
|
@ -45,7 +45,10 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
CheckDPETerminals(item);
|
||||
CheckDuplicateModel(item);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查地排端子
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
public void CheckDPETerminals(StuffedDataModel item)
|
||||
{
|
||||
// 地排只检查4.0线径以下的
|
||||
|
|
@ -63,6 +66,10 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查线材料号
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
public void CheckWireErpNr(StuffedDataModel item)
|
||||
{
|
||||
var wireInfos = ExcelHelper.GetWireInfo(item.WireModel);
|
||||
|
|
@ -88,7 +95,10 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查号码管
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
private void CheckNumberTube(StuffedDataModel item)
|
||||
{
|
||||
if (string.IsNullOrEmpty(item.NumberTubeSpec))
|
||||
|
|
@ -96,7 +106,10 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
SetItemError(item, "未匹配到正确的号码管!\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查必填项
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
private void CheckRequiredFields(StuffedDataModel item)
|
||||
{
|
||||
if (string.IsNullOrEmpty(item.RearTerminalMaterialCode))
|
||||
|
|
@ -120,7 +133,10 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
SetItemError(item, "印记(线号)内容为空\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查是否全部使用CE认证物料
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
private void CheckCeCompliance(StuffedDataModel item)
|
||||
{
|
||||
if (item.WireModel.IndexOf("-CE", StringComparison.OrdinalIgnoreCase) < 0)
|
||||
|
|
@ -136,7 +152,10 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
SetItemError(item, "后端子未使用CE认证端子!\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查变色套(绝缘软套)大小与是否使用了变色管
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
public void CheckInsulation(StuffedDataModel item)
|
||||
{
|
||||
if (item.Insulation != null && item.Insulation.Specification != null)
|
||||
|
|
@ -217,7 +236,10 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
SetItemError(item, "该型号无可用端子!\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查重复
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
private void CheckDuplicateModel(StuffedDataModel item)
|
||||
{
|
||||
if (StuffedData?.Count(it => it != null && it.Model == item.Model) > 1)
|
||||
|
|
@ -248,14 +270,25 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将一项设置为异常
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <param name="errorMsg"></param>
|
||||
private void SetItemError(StuffedDataModel item, string errorMsg)
|
||||
{
|
||||
if (!errorMsg.EndsWith("\r\n"))
|
||||
errorMsg += "\r\n";
|
||||
|
||||
item.IsError = true;
|
||||
item.ErrorCount += 1;
|
||||
item.CheckedMsg += errorMsg;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取可使用的端子
|
||||
/// </summary>
|
||||
/// <param name="wireModel"></param>
|
||||
/// <returns></returns>
|
||||
private List<TerminalModel> GetCanUsedTerminal(string wireModel)
|
||||
{
|
||||
var result = ExcelHelper.GetWireTerminalMappingTable(wireModel);
|
||||
|
|
@ -350,7 +383,10 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
}
|
||||
return terminals;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查变色套是否使用正确的颜色
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
private void CheckImprint(StuffedDataModel item)
|
||||
{
|
||||
var imprintConditions = new List<(string Prefix, WireFlagType? FlagType, string Color)>
|
||||
|
|
|
|||
Loading…
Reference in New Issue