From c43b128960fffd5ddacb4ed306523b25be01c74a Mon Sep 17 00:00:00 2001 From: sunhonglei Date: Mon, 16 Dec 2024 13:27:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=AF=BC=E5=87=BAexcel=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ViewModel/Grading/GradingResultVM.cs | 92 ++++++++++++++++++++++++++-- 1 file changed, 86 insertions(+), 6 deletions(-) diff --git a/ViewModel/Grading/GradingResultVM.cs b/ViewModel/Grading/GradingResultVM.cs index 490c467..0d56b0c 100644 --- a/ViewModel/Grading/GradingResultVM.cs +++ b/ViewModel/Grading/GradingResultVM.cs @@ -693,14 +693,94 @@ public class GradingResultVM : BaseViewModel private string calGirdleName(Measurements info) { - string gridleName = ""; + string girdleName = ""; // 有问题 问题1 1.6时为thin to slight thick,那么 thin为什么时刻出现 // 问题2 假如最小值为very thin,最大值为thick时用哪个 - // if (info.GIRDLE) - // { - // - // } - return gridleName; + decimal min = Convert.ToDecimal(info.GIRDLE_MIN * 100); + girdleName += calGirdleName(min,true); + girdleName += " to "; + decimal max = Convert.ToDecimal(info.GIRDLE_MAX * 100); + girdleName += calGirdleName(max,false); + return girdleName; + } + private string calGirdleName(decimal cValue,bool isMin) + { + string girdleName = ""; + List calGrades = GetCalGradeInfos("GIRDLE"); + int order = 1; + bool isthin = false; + bool isthick = false; + foreach (CalGradeInfo gradeInfo in calGrades) + { + bool isThisGrade = true; + + if (gradeInfo.Max != null) + { + if (gradeInfo.isMaxExist == 1 && cValue.CompareTo(gradeInfo.Max) <= 0) + { + } + else if (gradeInfo.isMaxExist == 0 && cValue.CompareTo(gradeInfo.Max) < 0) + { + } + else + { + isthick = true; + isThisGrade = false; + } + } + if (gradeInfo.Min != null) + { + if (gradeInfo.isMinExist == 1 && cValue.CompareTo(gradeInfo.Min) >= 0) + { + } + else if (gradeInfo.isMinExist == 0 && cValue.CompareTo(gradeInfo.Min) > 0) + { + } + else + { + isthin = true; + isThisGrade = false; + } + } + if (isThisGrade) + { + break; + } + else + { + order++; + } + } + Dictionary thinDic = new Dictionary(); + thinDic.Add(1, "Thin"); + thinDic.Add(2,"Thin"); + thinDic.Add(3, "Very Thin"); + thinDic.Add(4, "Extremely Thin"); + Dictionary thickDic = new Dictionary(); + thickDic.Add(1, "Slightly Thick"); + thickDic.Add(2, "Slightly Thick"); + thickDic.Add(3, "Thick"); + thickDic.Add(4, "VeryThick"); + if (order == 1) + { + if (isMin) + { + girdleName = thinDic[order]; + } + else + { + girdleName = thickDic[order]; + } + } + else if (isthin) + { + girdleName = thinDic[order]; + } + else if (isthick) + { + girdleName = thickDic[order]; + } + return girdleName; } /// /// 百分比用的小数格式化