105040 增加地线前缀处理
This commit is contained in:
parent
ce014b95e0
commit
5574ddbd0e
|
@ -17,6 +17,14 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.Models
|
|||
[ExcelColumn(Name = "规格型号")]
|
||||
public string SpecificationModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 规格型号
|
||||
/// </summary>
|
||||
[ExcelColumn(Name = "印记前缀")]
|
||||
public string Prefix { get; set; }
|
||||
|
||||
///
|
||||
|
||||
/// <summary>
|
||||
/// 线材型号规格
|
||||
/// </summary>
|
||||
|
|
|
@ -8,9 +8,9 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
{
|
||||
public partial class MainViewModel
|
||||
{
|
||||
public void CheckAll()
|
||||
public void CheckAll(IEnumerable<StuffedDataModel> datas)
|
||||
{
|
||||
StuffedData.AsParallel().WithDegreeOfParallelism(4).ForAll(item =>
|
||||
datas.AsParallel().WithDegreeOfParallelism(4).ForAll(item =>
|
||||
{
|
||||
if (item == null) return;
|
||||
item.IsError = false;
|
||||
|
@ -125,10 +125,24 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查引用的端子
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
private void CheckTerminals(StuffedDataModel item)
|
||||
{
|
||||
var canUsedTerminals = GetCanUsedTerminal(item.WireModel);
|
||||
var canUsedTerminals = new List<string>();
|
||||
//if(item.)
|
||||
if (item.Imprint.StartsWith("D-PE"))
|
||||
{
|
||||
canUsedTerminals = GetD_PECanUsedTerminal(item.WireModel);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
canUsedTerminals = GetCanUsedTerminal(item.WireModel);
|
||||
|
||||
}
|
||||
if (canUsedTerminals != null && canUsedTerminals.Any())
|
||||
{
|
||||
if (canUsedTerminals.All(it => it != item.FrontTerminalModel))
|
||||
|
@ -159,6 +173,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
var newModel = $"RV-{item.WireColor}-1x{item.CrossSection}-{item.WireLength + 5}-16×N2-{item.WireNumber}";
|
||||
if (StuffedData.Any(it => it.Model == newModel))
|
||||
{
|
||||
|
||||
SetItemError(item, $"{item.Model} 该型号存在重复!\r\n");
|
||||
}
|
||||
else
|
||||
|
@ -198,6 +213,39 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
|
|||
}
|
||||
return terminals;
|
||||
}
|
||||
/// <summary>
|
||||
/// 检查地线可以用的端子
|
||||
/// </summary>
|
||||
/// <param name="wireModel"></param>
|
||||
/// <returns></returns>
|
||||
private List<string> GetD_PECanUsedTerminal(string wireModel)
|
||||
{
|
||||
// 获取D-PE前缀的可用端子
|
||||
var resultWithPrefix = ExcelHelper.GetWireTerminalMappingTable(wireModel, "D-PE");
|
||||
// 获取不包含前缀的端子
|
||||
var resultWithoutPrefix = ExcelHelper.GetWireTerminalMappingTable(wireModel);
|
||||
var terminals = new List<string>();
|
||||
// 转换
|
||||
var withPrefixExcelModels = resultWithPrefix as List<ExcelModel> ?? resultWithPrefix.ToList();
|
||||
var withoutPrefixExcelModels = resultWithoutPrefix as List<ExcelModel> ?? resultWithoutPrefix.ToList();
|
||||
// 合并
|
||||
var excelModels = withPrefixExcelModels.Concat(withoutPrefixExcelModels);
|
||||
if (!excelModels.Any()) return terminals;
|
||||
foreach (var item in excelModels)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item.ForkTerminal))
|
||||
terminals.Add(item.ForkTerminal);
|
||||
if (!string.IsNullOrEmpty(item.FlatTerminal))
|
||||
terminals.Add(item.FlatTerminal);
|
||||
if (!string.IsNullOrEmpty(item.PinTerminal))
|
||||
terminals.Add(item.PinTerminal);
|
||||
if (!string.IsNullOrEmpty(item.OTypeTerminal))
|
||||
terminals.Add(item.OTypeTerminal);
|
||||
if (!string.IsNullOrEmpty(item.YTypeTerminal))
|
||||
terminals.Add(item.YTypeTerminal);
|
||||
}
|
||||
return terminals;
|
||||
}
|
||||
|
||||
private void CheckImprint(StuffedDataModel item)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue