|
|
|
@ -339,7 +339,7 @@ public class GradingResultVM : BaseViewModel |
|
|
|
|
DataInfo info = new DataInfo(); |
|
|
|
|
info.TestItemId = "TOTAL_DEPTH"; |
|
|
|
|
info.TestItemName = GetName("TOTAL_DEPTH"); |
|
|
|
|
info.Avg = FormatDouble_P(result.measurements.TOTAL_DEPTH); |
|
|
|
|
info.Avg = FormatDouble_Avg(result.measurements.TOTAL_DEPTH*100,Accuracy.ZD1); |
|
|
|
|
info.CutLevel = calGrade_TOTAL_DEPTH(result.measurements.TOTAL_DEPTH); |
|
|
|
|
info.isEnabled = false; |
|
|
|
|
return info; |
|
|
|
@ -350,7 +350,7 @@ public class GradingResultVM : BaseViewModel |
|
|
|
|
DataInfo info = new DataInfo(); |
|
|
|
|
info.TestItemId = "TABLE"; |
|
|
|
|
info.TestItemName = GetName("TABLE"); |
|
|
|
|
info.Avg = FormatDouble_P(result.measurements.TABLE); |
|
|
|
|
info.Avg = FormatDouble_Avg(result.measurements.TABLE*100, Accuracy.ZD5); |
|
|
|
|
info.Min = FormatDouble_P(result.measurements.TABLE_MIN); |
|
|
|
|
info.Max = FormatDouble_P(result.measurements.TABLE_MAX); |
|
|
|
|
info.CutLevel = calGrade_TABLE(result.measurements.TABLE_MIN, result.measurements.TABLE_MAX); |
|
|
|
@ -363,7 +363,7 @@ public class GradingResultVM : BaseViewModel |
|
|
|
|
DataInfo info = new DataInfo(); |
|
|
|
|
info.TestItemId = "CROWN_ANGLE"; |
|
|
|
|
info.TestItemName = GetName("CROWN_ANGLE"); |
|
|
|
|
info.Avg = FormatDouble_A(result.measurements.CROWN_ANGLE); |
|
|
|
|
info.Avg = FormatDouble_Avg(result.measurements.CROWN_ANGLE, Accuracy.ZD5); |
|
|
|
|
info.Dev = FormatDouble_A(result.measurements.CROWN_ANGLE_DEV); |
|
|
|
|
info.Min = FormatDouble_A(result.measurements.CROWN_ANGLE_MIN); |
|
|
|
|
info.Max = FormatDouble_A(result.measurements.CROWN_ANGLE_MAX); |
|
|
|
@ -376,7 +376,7 @@ public class GradingResultVM : BaseViewModel |
|
|
|
|
DataInfo info = new DataInfo(); |
|
|
|
|
info.TestItemId = "CROWN_HEIGHT"; |
|
|
|
|
info.TestItemName = GetName("CROWN_HEIGHT"); |
|
|
|
|
info.Avg = FormatDouble_P(result.measurements.CROWN_HEIGHT); |
|
|
|
|
info.Avg = FormatDouble_Avg(result.measurements.CROWN_HEIGHT * 100, Accuracy.ZD5); |
|
|
|
|
info.Dev = FormatDouble_P(result.measurements.CROWN_H_DEV); |
|
|
|
|
info.Min = FormatDouble_P(result.measurements.CROWN_H_MIN); |
|
|
|
|
info.Max = FormatDouble_P(result.measurements.CROWN_H_MAX); |
|
|
|
@ -389,7 +389,7 @@ public class GradingResultVM : BaseViewModel |
|
|
|
|
DataInfo info = new DataInfo(); |
|
|
|
|
info.TestItemId = "GIRDLE_BEZEL"; |
|
|
|
|
info.TestItemName = GetName("GIRDLE_BEZEL"); |
|
|
|
|
info.Avg = FormatDouble_P(result.measurements.GIRDLE_BEZEL); |
|
|
|
|
info.Avg = FormatDouble_Avg(result.measurements.GIRDLE_BEZEL * 100, Accuracy.ZD1); |
|
|
|
|
info.Dev = FormatDouble_P(result.measurements.GIRDLE_BEZEL_DEV); |
|
|
|
|
info.Min = FormatDouble_P(result.measurements.GIRDLE_BEZEL_MIN); |
|
|
|
|
info.Max = FormatDouble_P(result.measurements.GIRDLE_BEZEL_MAX); |
|
|
|
@ -401,7 +401,7 @@ public class GradingResultVM : BaseViewModel |
|
|
|
|
DataInfo info = new DataInfo(); |
|
|
|
|
info.TestItemId = "GIRDLE_BONE"; |
|
|
|
|
info.TestItemName = GetName("GIRDLE_BONE"); |
|
|
|
|
info.Avg = FormatDouble_P(result.measurements.GIRDLE_BONE); |
|
|
|
|
info.Avg = FormatDouble_Avg(result.measurements.GIRDLE_BONE * 100, Accuracy.ZD1); |
|
|
|
|
info.Min = FormatDouble_P(result.measurements.GIRDLE_BONE_MIN); |
|
|
|
|
info.Max = FormatDouble_P(result.measurements.GIRDLE_BONE_MAX); |
|
|
|
|
info.isEnabled = false; |
|
|
|
@ -413,7 +413,7 @@ public class GradingResultVM : BaseViewModel |
|
|
|
|
DataInfo info = new DataInfo(); |
|
|
|
|
info.TestItemId = "GIRDLE"; |
|
|
|
|
info.TestItemName = GetName("GIRDLE"); |
|
|
|
|
info.Avg = FormatDouble_P(result.measurements.GIRDLE_VALLEY); |
|
|
|
|
info.Avg = FormatDouble_Avg(result.measurements.GIRDLE_VALLEY * 100, Accuracy.ZD1); |
|
|
|
|
info.Dev = FormatDouble_P(result.measurements.GIRDLE_VALLEY_DEV); |
|
|
|
|
info.Min = FormatDouble_P(result.measurements.GIRDLE_VALLEY_MIN); |
|
|
|
|
info.Max = FormatDouble_P(result.measurements.GIRDLE_VALLEY_MAX); |
|
|
|
@ -426,7 +426,7 @@ public class GradingResultVM : BaseViewModel |
|
|
|
|
DataInfo info = new DataInfo(); |
|
|
|
|
info.TestItemId = "PAV_ANGLE"; |
|
|
|
|
info.TestItemName = GetName("PAV_ANGLE"); |
|
|
|
|
info.Avg = FormatDouble_A(result.measurements.PAV_ANGLE); |
|
|
|
|
info.Avg = FormatDouble_Avg(result.measurements.PAV_ANGLE, Accuracy.ZD1); |
|
|
|
|
info.Dev = FormatDouble_A(result.measurements.PAV_ANGLE_DEV); |
|
|
|
|
info.Min = FormatDouble_A(result.measurements.PAV_ANGLE_MIN); |
|
|
|
|
info.Max = FormatDouble_A(result.measurements.PAV_ANGLE_MAX); |
|
|
|
@ -439,7 +439,7 @@ public class GradingResultVM : BaseViewModel |
|
|
|
|
DataInfo info = new DataInfo(); |
|
|
|
|
info.TestItemId = "PAV_DEPTH"; |
|
|
|
|
info.TestItemName = GetName("PAV_DEPTH"); |
|
|
|
|
info.Avg = FormatDouble_P(result.measurements.PAV_DEPTH); |
|
|
|
|
info.Avg = FormatDouble_Avg(result.measurements.PAV_DEPTH*100, Accuracy.ZD5); |
|
|
|
|
info.Dev = FormatDouble_P(result.measurements.PAV_DEPTH_DEV); |
|
|
|
|
info.Min = FormatDouble_P(result.measurements.PAV_DEPTH_MIN); |
|
|
|
|
info.Max = FormatDouble_P(result.measurements.PAV_DEPTH_MAX); |
|
|
|
@ -452,7 +452,7 @@ public class GradingResultVM : BaseViewModel |
|
|
|
|
DataInfo info = new DataInfo(); |
|
|
|
|
info.TestItemId = "STAR"; |
|
|
|
|
info.TestItemName = GetName("STAR"); |
|
|
|
|
info.Avg = FormatDouble_P(result.measurements.STAR); |
|
|
|
|
info.Avg = FormatDouble_Avg(result.measurements.STAR*100, Accuracy.Z5); |
|
|
|
|
info.Min = FormatDouble_P(result.measurements.STAR_MIN); |
|
|
|
|
info.Max = FormatDouble_P(result.measurements.STAR_MAX); |
|
|
|
|
info.isEnabled = false; |
|
|
|
@ -464,7 +464,7 @@ public class GradingResultVM : BaseViewModel |
|
|
|
|
DataInfo info = new DataInfo(); |
|
|
|
|
info.TestItemId = "LOWER_HALVES_RATIO"; |
|
|
|
|
info.TestItemName = GetName("LOWER_HALVES_RATIO"); |
|
|
|
|
info.Avg = FormatDouble_P(result.measurements.LOWER_HALVES_RATIO); |
|
|
|
|
info.Avg = FormatDouble_Avg(result.measurements.LOWER_HALVES_RATIO*100, Accuracy.Z5); |
|
|
|
|
info.Min = FormatDouble_P(result.measurements.LOWER_HALVES_RATIO_MIN); |
|
|
|
|
info.Max = FormatDouble_P(result.measurements.LOWER_HALVES_RATIO_MAX); |
|
|
|
|
info.isEnabled = false; |
|
|
|
@ -476,7 +476,7 @@ public class GradingResultVM : BaseViewModel |
|
|
|
|
DataInfo info = new DataInfo(); |
|
|
|
|
info.TestItemId = "CULET"; |
|
|
|
|
info.TestItemName = GetName("CULET"); |
|
|
|
|
info.Avg = FormatDouble_P(result.measurements.CULET); |
|
|
|
|
info.Avg = FormatDouble_Avg(result.measurements.CULET * 100, Accuracy.ZD1); |
|
|
|
|
info.isEnabled = false; |
|
|
|
|
return info; |
|
|
|
|
} |
|
|
|
@ -486,7 +486,7 @@ public class GradingResultVM : BaseViewModel |
|
|
|
|
DataInfo info = new DataInfo(); |
|
|
|
|
info.TestItemId = "TOC"; |
|
|
|
|
info.TestItemName = GetName("TOC"); |
|
|
|
|
info.Avg = FormatDouble_P(result.measurements.TOC); |
|
|
|
|
info.Avg = FormatDouble_Avg(result.measurements.TOC * 100, Accuracy.ZD1); |
|
|
|
|
return info; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -495,7 +495,7 @@ public class GradingResultVM : BaseViewModel |
|
|
|
|
DataInfo info = new DataInfo(); |
|
|
|
|
info.TestItemId = "COC"; |
|
|
|
|
info.TestItemName = GetName("COC"); |
|
|
|
|
info.Avg = FormatDouble_P(result.measurements.COC); |
|
|
|
|
info.Avg = FormatDouble_Avg(result.measurements.COC*100, Accuracy.ZD1); |
|
|
|
|
return info; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -504,7 +504,7 @@ public class GradingResultVM : BaseViewModel |
|
|
|
|
DataInfo info = new DataInfo(); |
|
|
|
|
info.TestItemId = "TWIST"; |
|
|
|
|
info.TestItemName = GetName("TWIST"); |
|
|
|
|
info.Avg = FormatDouble_A(result.measurements.TWIST); |
|
|
|
|
info.Avg = FormatDouble_Avg(result.measurements.TWIST, Accuracy.ZD1); |
|
|
|
|
info.Dev = FormatDouble_A(result.measurements.TWIST_DEV); |
|
|
|
|
info.Min = FormatDouble_A(result.measurements.TWIST_MIN); |
|
|
|
|
info.Max = FormatDouble_A(result.measurements.TWIST_MAX); |
|
|
|
@ -516,7 +516,7 @@ public class GradingResultVM : BaseViewModel |
|
|
|
|
DataInfo info = new DataInfo(); |
|
|
|
|
info.TestItemId = "CULET_TO_TABLE"; |
|
|
|
|
info.TestItemName = GetName("CULET_TO_TABLE"); |
|
|
|
|
info.Avg = FormatDouble_P(result.measurements.CULET_TO_TABLE); |
|
|
|
|
info.Avg = FormatDouble_Avg(result.measurements.CULET_TO_TABLE*100,Accuracy.ZD1); |
|
|
|
|
return info; |
|
|
|
|
} |
|
|
|
|
#endregion |
|
|
|
@ -951,6 +951,48 @@ public class GradingResultVM : BaseViewModel |
|
|
|
|
return (Math.Floor(value*1000)/10).ToString(digitsFormat); |
|
|
|
|
} |
|
|
|
|
/// <summary> |
|
|
|
|
/// 百分比用的小数格式化 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="value"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
private string FormatDouble_Avg(double value, Accuracy accuracy) |
|
|
|
|
{ |
|
|
|
|
string result = ""; |
|
|
|
|
switch (accuracy) |
|
|
|
|
{ |
|
|
|
|
case Accuracy.ZDZ1: |
|
|
|
|
result = (Math.Floor(value * 100) / 100).ToString("f2"); |
|
|
|
|
break; |
|
|
|
|
case Accuracy.ZD1: |
|
|
|
|
result = (Math.Floor(value * 10) / 10).ToString(digitsFormat); |
|
|
|
|
break; |
|
|
|
|
case Accuracy.ZD5: |
|
|
|
|
result = (RoundFiveDownSixUp(value * 2) / 2).ToString("f1"); |
|
|
|
|
break; |
|
|
|
|
case Accuracy.Z5: |
|
|
|
|
result = (RoundFiveDownSixUp(value / 5) * 5).ToString(); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
private static double RoundFiveDownSixUp(double value) |
|
|
|
|
{ |
|
|
|
|
// 提取整数部分 |
|
|
|
|
double integerPart = Math.Truncate(value); |
|
|
|
|
// 提取小数部分 |
|
|
|
|
double fractionalPart = value - integerPart; |
|
|
|
|
|
|
|
|
|
// 判断小数部分是否大于 0.5 |
|
|
|
|
if (fractionalPart > 0.5) |
|
|
|
|
{ |
|
|
|
|
return integerPart + 1; // 大于 0.5,进一 |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
return integerPart; // 小于或等于 0.5,舍去 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/// <summary> |
|
|
|
|
/// 直接值(角度,直径)用的小数格式化 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="value"></param> |
|
|
|
@ -1466,4 +1508,12 @@ public enum SaveStatus |
|
|
|
|
AutoSave = 0, |
|
|
|
|
Save=1, |
|
|
|
|
SaveAs=2 |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public enum Accuracy |
|
|
|
|
{ |
|
|
|
|
ZDZ1 = 0, |
|
|
|
|
ZD1 = 1, |
|
|
|
|
ZD5 = 2, |
|
|
|
|
Z5 = 3 |
|
|
|
|
} |