diff --git a/Sinvo.EplanHpD.Plugin.Test/CheckTest.cs b/Sinvo.EplanHpD.Plugin.Test/CheckTest.cs index 63bc861..08888e8 100644 --- a/Sinvo.EplanHpD.Plugin.Test/CheckTest.cs +++ b/Sinvo.EplanHpD.Plugin.Test/CheckTest.cs @@ -93,7 +93,11 @@ namespace Sinvo.EplanHpD.Plugin.Test FrontTerminalMaterialCode= "42020100000382", FrontTerminalModel= "C45-1.5-CE/定制", Imprint= "D-PECP528", - Insulation= new InsulationModel(), + Insulation= new InsulationModel() + { + Specification = "V-1.5-CE(褐色)/定制", + + }, IsChecked= false, IsError= false, IsIgnore= false, @@ -160,5 +164,46 @@ namespace Sinvo.EplanHpD.Plugin.Test Assert.IsFalse(!stuffedData.IsError); } + + [TestMethod] + public void CheckSizeTest() + { + var vm = new MainViewModel(); + /* + 导线名称 线色 线材型号 线材编码 前端子型号 前端子物料编码 前端剥线长度 后端子型号 后端子物料编码 后端剥线长度 截面积 线长 线号 型号 数量 号码管型号 号码管料号 变色套型号 变色套料号 忽略异常 检查信息 异常数 +w_00196 BK 黑色RV1.5-CE/定制 42012300001005 C45-1.5-CE/定制 42020100000382 5.2 mm 红色SV5.5-6/定制 42020100000140 7.2 mm 1.5 367 L1SSR527 RV-BK-1x1.5-367-16×N2-L1SSR527 1 白色号码管φ3/定制 42020100000003 V-1.5-CE(褐色)/定制 42013500000414 0 + + */ + var stuffedData = new StuffedDataModel + { + WireName = "w_00196", + WireColor = "BK", + WireModel = "黑色RV1.0-CE/定制", + WireCode = "42012300001005", + FrontTerminalModel = "C45-1.0-CE/定制", + FrontTerminalMaterialCode = "42020100000382", + FrontStripLength = "5.2 mm", + RearTerminalModel = "红色SV5.5-6/定制", + RearTerminalMaterialCode = "42020100000140", + RearStripLength = "7.2 mm", + CrossSection = "1.5", + WireLength = "367", + WireNumber = "L1SSR527", + Model = "RV-BK-1x1.5-367-16×N2-L1SSR527", + Quantity = 1, + NumberTubeContent = "白色号码管φ3/定制", + NumberTubeMaterialNo = "42020100000003", + DiscolorationDesc = "V-1.5-CE(褐色)/定制", + Insulation = new InsulationModel() + { + Specification = "V-1.5-CE(褐色)/定制", + MaterialCode = "42013500000414" + }, + + }; + vm.CheckInsulation(stuffedData); + Assert.IsFalse(!stuffedData.IsError); + + } } } diff --git a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MainViewModel.Check.cs b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MainViewModel.Check.cs index 604a5ce..9ecc4a3 100644 --- a/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MainViewModel.Check.cs +++ b/Sinvo.EplanHpD.Plugin.WPFUI/ViewModel/MainViewModel.Check.cs @@ -88,7 +88,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel } } - private void CheckInsulation(StuffedDataModel item) + public void CheckInsulation(StuffedDataModel item) { if (item.Insulation != null && item.Insulation.Specification != null) { @@ -101,7 +101,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel { if (itemWireDiameter < 1.5d) { - if (insMatch.Value != "RV1.5") + if (insMatch.Value != "V1.5") { SetItemError(item, "变色套(绝缘软套)大小与线径不匹配!"); } @@ -186,8 +186,14 @@ 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"); + var newModel2 = $"RV-{item.WireColor}-1x{item.CrossSection}-{item.WireLength + 10}-16×N2-{item.WireNumber}"; + if (StuffedData.Any(it => it.Model == newModel2)) + SetItemError(item, $"{item.Model} 该型号存在重复!\r\n"); + else + { + item.WireLength += 10; + item.Model = newModel2; + } } else {