105040 Fix 变色套管匹配错误

This commit is contained in:
lihanbo 2024-10-28 14:29:56 +08:00
parent d01b1838a9
commit 67a9e0c416
2 changed files with 56 additions and 5 deletions

View File

@ -93,7 +93,11 @@ namespace Sinvo.EplanHpD.Plugin.Test
FrontTerminalMaterialCode= "42020100000382", FrontTerminalMaterialCode= "42020100000382",
FrontTerminalModel= "C45-1.5-CE定制", FrontTerminalModel= "C45-1.5-CE定制",
Imprint= "D-PECP528", Imprint= "D-PECP528",
Insulation= new InsulationModel(), Insulation= new InsulationModel()
{
Specification = "V-1.5-CE(褐色)/定制",
},
IsChecked= false, IsChecked= false,
IsError= false, IsError= false,
IsIgnore= false, IsIgnore= false,
@ -160,5 +164,46 @@ namespace Sinvo.EplanHpD.Plugin.Test
Assert.IsFalse(!stuffedData.IsError); 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);
}
} }
} }

View File

@ -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) if (item.Insulation != null && item.Insulation.Specification != null)
{ {
@ -101,7 +101,7 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.ViewModel
{ {
if (itemWireDiameter < 1.5d) if (itemWireDiameter < 1.5d)
{ {
if (insMatch.Value != "RV1.5") if (insMatch.Value != "V1.5")
{ {
SetItemError(item, "变色套(绝缘软套)大小与线径不匹配!"); 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}"; var newModel = $"RV-{item.WireColor}-1x{item.CrossSection}-{item.WireLength + 5}-16×N2-{item.WireNumber}";
if (StuffedData.Any(it => it.Model == newModel)) if (StuffedData.Any(it => it.Model == newModel))
{ {
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"); SetItemError(item, $"{item.Model} 该型号存在重复!\r\n");
else
{
item.WireLength += 10;
item.Model = newModel2;
}
} }
else else
{ {