feat:导出excel修正

master
sunhonglei 7 months ago
parent bf6a579f6a
commit c43b128960
  1. 92
      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<CalGradeInfo> 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<int, string> thinDic = new Dictionary<int, string>();
thinDic.Add(1, "Thin");
thinDic.Add(2,"Thin");
thinDic.Add(3, "Very Thin");
thinDic.Add(4, "Extremely Thin");
Dictionary<int, string> thickDic = new Dictionary<int, string>();
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;
}
/// <summary>
/// 百分比用的小数格式化

Loading…
Cancel
Save