diff --git a/SparkDB.db b/SparkDB.db index 70ebe87..4479939 100644 Binary files a/SparkDB.db and b/SparkDB.db differ diff --git a/ViewModel/Grading/GradingResultVM.cs b/ViewModel/Grading/GradingResultVM.cs index 7d3e9be..de3b0bf 100644 --- a/ViewModel/Grading/GradingResultVM.cs +++ b/ViewModel/Grading/GradingResultVM.cs @@ -323,10 +323,10 @@ public class GradingResultVM : BaseViewModel DataInfo info = new DataInfo(); info.TestItemId = "DIAMETER"; info.TestItemName = GetName("DIAMETER"); - info.Avg = result.measurements.DIAMETER.ToString(digitsFormat); + info.Avg = FormatDouble_D(result.measurements.DIAMETER); info.Dev = result.measurements.DIAMETER_DEV.ToString(digitsFormat); - info.Min = result.measurements.M1.ToString(digitsFormat); - info.Max = result.measurements.M2.ToString(digitsFormat); + info.Min = FormatDouble_D(result.measurements.M1); + info.Max = FormatDouble_D(result.measurements.M2); return info; } private DataInfo getTOTAL_DEPTH(AlgorithmResultEntity result) @@ -408,11 +408,11 @@ public class GradingResultVM : BaseViewModel DataInfo info = new DataInfo(); info.TestItemId = "GIRDLE"; info.TestItemName = GetName("GIRDLE"); - info.Avg = FormatDouble_P(result.measurements.GIRDLE); - info.Dev = FormatDouble_P(result.measurements.GIRDLE_DEV); - info.Min = FormatDouble_P(result.measurements.GIRDLE_MIN); - info.Max = FormatDouble_P(result.measurements.GIRDLE_MAX); - info.CutLevel = calGrade_GIRDLE(result.measurements.GIRDLE_MIN, result.measurements.GIRDLE_MAX); + info.Avg = FormatDouble_P(result.measurements.GIRDLE_VALLEY); + 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); + info.CutLevel = calGrade_GIRDLE(result.measurements.GIRDLE_VALLEY_MIN, result.measurements.GIRDLE_VALLEY_MAX); return info; } @@ -925,6 +925,15 @@ public class GradingResultVM : BaseViewModel return girdleName; } /// + /// 直径的小数格式化 + /// + /// + /// + private string FormatDouble_D(double value) + { + return value.ToString("f2"); + } + /// /// 百分比用的小数格式化 /// /// @@ -1028,22 +1037,286 @@ public class GradingResultVM : BaseViewModel row.Dev = data != null ? data.Dev : ""; row.Max = data != null ? data.Max : ""; row.Min = data != null ? data.Min : ""; - row.item1 = "1"; - row.item2 = "2"; - row.item3 = "3"; - row.item4 = "4"; - row.item5 = "5"; - row.item6 = "6"; - row.item7 = "7"; - row.item8 = "8"; - row.MaxIndex = 0; - row.MinIndex = 7; row.CutLevel = data != null ? data.CutLevel : ""; row.SymLevel = GetGradeName(data != null ? data.SymLevel??0 : 0); - + setDetailItems(row, testItemId); this.SelRowDataDetail = row; return row; } + private void setDetailItems(RowDetail row,string TestItemId) + { + if ("DIAMETER".Equals(TestItemId)) + { + setDIAMETER_DETAIL(row); + } + else if ("TABLE".Equals(TestItemId)) + { + setTABLE_DETAIL(row); + } + else if ("CROWN_HEIGHT".Equals(TestItemId)) + { + setCROWN_HEIGHT_DETAIL(row); + } + else if ("CROWN_ANGLE".Equals(TestItemId)) + { + setCROWN_ANGLE_DETAIL(row); + } + else if ("PAV_DEPTH".Equals(TestItemId)) + { + setPAV_DEPTH_DETAIL(row); + } + else if ("PAV_ANGLE".Equals(TestItemId)) + { + setPAV_ANGLE_DETAIL(row); + } + else if ("GIRDLE_BEZEL".Equals(TestItemId)) + { + setGIRDLE_BEZEL_DETAIL(row); + } + else if ("GIRDLE_BONE".Equals(TestItemId)) + { + setGIRDLE_BONE_DETAIL(row); + } + else if ("GIRDLE".Equals(TestItemId)) + { + setGIRDLE_VALLEY_DETAIL(row); + } + else if ("STAR".Equals(TestItemId)) + { + setSTAR_DETAIL(row); + } + else if ("LOWER_HALVES_RATIO".Equals(TestItemId)) + { + setLOWER_HALVES_RATIO_DETAIL(row); + } + else if ("TWIST".Equals(TestItemId)) + { + setTWIST_DETAIL(row); + } + } + private void calIndex(RowDetail row) + { + // 最大值的Index计算 + if (row.Max.Equals(row.item1)) + { + row.MaxIndex = 0; + } + else if(row.Max.Equals(row.item2)) + { + row.MaxIndex = 1; + } + else if (row.Max.Equals(row.item3)) + { + row.MaxIndex = 2; + } + else if (row.Max.Equals(row.item4)) + { + row.MaxIndex = 3; + } + else if (row.Max.Equals(row.item5)) + { + row.MaxIndex = 4; + } + else if (row.Max.Equals(row.item6)) + { + row.MaxIndex = 5; + } + else if (row.Max.Equals(row.item7)) + { + row.MaxIndex = 6; + } + else if (row.Max.Equals(row.item8)) + { + row.MaxIndex = 7; + } + // 最小值的Index计算 + if (row.Min.Equals(row.item1)) + { + row.MinIndex = 0; + } + else if (row.Min.Equals(row.item2)) + { + row.MinIndex = 1; + } + else if (row.Min.Equals(row.item3)) + { + row.MinIndex = 2; + } + else if (row.Min.Equals(row.item4)) + { + row.MinIndex = 3; + } + else if (row.Min.Equals(row.item5)) + { + row.MinIndex = 4; + } + else if (row.Min.Equals(row.item6)) + { + row.MinIndex = 5; + } + else if (row.Min.Equals(row.item7)) + { + row.MinIndex = 6; + } + else if (row.Min.Equals(row.item8)) + { + row.MinIndex = 7; + } + } + private void setDIAMETER_DETAIL(RowDetail row) + { + DiameterDetail diameterDetail = algorithmResult.measurements.DIAMETER_DETAIL; + row.item1 = FormatDouble_D(diameterDetail.DIAMETER_1); + row.item2 = FormatDouble_D(diameterDetail.DIAMETER_2); + row.item3 = FormatDouble_D(diameterDetail.DIAMETER_3); + row.item4 = FormatDouble_D(diameterDetail.DIAMETER_4); + row.item5 = FormatDouble_D(diameterDetail.DIAMETER_5); + row.item6 = FormatDouble_D(diameterDetail.DIAMETER_6); + row.item7 = FormatDouble_D(diameterDetail.DIAMETER_7); + row.item8 = FormatDouble_D(diameterDetail.DIAMETER_8); + calIndex(row); + } + private void setTABLE_DETAIL(RowDetail row) + { + TableDetail diameterDetail = algorithmResult.measurements.TABLE_DETAIL; + row.item1 = FormatDouble_P(diameterDetail.TABLE_1); + row.item2 = FormatDouble_P(diameterDetail.TABLE_2); + row.item3 = FormatDouble_P(diameterDetail.TABLE_3); + row.item4 = FormatDouble_P(diameterDetail.TABLE_4); + calIndex(row); + } + private void setCROWN_HEIGHT_DETAIL(RowDetail row) + { + CrownHeightDetail crownHeightDetail = algorithmResult.measurements.CROWN_HEIGHT_DETAIL; + row.item1 = FormatDouble_P(crownHeightDetail.CROWN_HEIGHT_1); + row.item2 = FormatDouble_P(crownHeightDetail.CROWN_HEIGHT_2); + row.item3 = FormatDouble_P(crownHeightDetail.CROWN_HEIGHT_3); + row.item4 = FormatDouble_P(crownHeightDetail.CROWN_HEIGHT_4); + row.item5 = FormatDouble_P(crownHeightDetail.CROWN_HEIGHT_5); + row.item6 = FormatDouble_P(crownHeightDetail.CROWN_HEIGHT_6); + row.item7 = FormatDouble_P(crownHeightDetail.CROWN_HEIGHT_7); + row.item8 = FormatDouble_P(crownHeightDetail.CROWN_HEIGHT_8); + calIndex(row); + } + private void setCROWN_ANGLE_DETAIL(RowDetail row) + { + CrownAngleDetail crownAngleDetail = algorithmResult.measurements.CROWN_ANGLE_DETAIL; + row.item1 = FormatDouble_A(crownAngleDetail.CROWN_ANGLE_1); + row.item2 = FormatDouble_A(crownAngleDetail.CROWN_ANGLE_2); + row.item3 = FormatDouble_A(crownAngleDetail.CROWN_ANGLE_3); + row.item4 = FormatDouble_A(crownAngleDetail.CROWN_ANGLE_4); + row.item5 = FormatDouble_A(crownAngleDetail.CROWN_ANGLE_5); + row.item6 = FormatDouble_A(crownAngleDetail.CROWN_ANGLE_6); + row.item7 = FormatDouble_A(crownAngleDetail.CROWN_ANGLE_7); + row.item8 = FormatDouble_A(crownAngleDetail.CROWN_ANGLE_8); + calIndex(row); + } + private void setPAV_DEPTH_DETAIL(RowDetail row) + { + PavDepthDetail pavDepthDetail = algorithmResult.measurements.PAV_DEPTH_DETAIL; + row.item1 = FormatDouble_P(pavDepthDetail.PAV_DEPTH_1); + row.item2 = FormatDouble_P(pavDepthDetail.PAV_DEPTH_2); + row.item3 = FormatDouble_P(pavDepthDetail.PAV_DEPTH_3); + row.item4 = FormatDouble_P(pavDepthDetail.PAV_DEPTH_4); + row.item5 = FormatDouble_P(pavDepthDetail.PAV_DEPTH_5); + row.item6 = FormatDouble_P(pavDepthDetail.PAV_DEPTH_6); + row.item7 = FormatDouble_P(pavDepthDetail.PAV_DEPTH_7); + row.item8 = FormatDouble_P(pavDepthDetail.PAV_DEPTH_8); + calIndex(row); + } + private void setPAV_ANGLE_DETAIL(RowDetail row) + { + PavAngleDetail pavAngleDetail = algorithmResult.measurements.PAV_ANGLE_DETAIL; + row.item1 = FormatDouble_A(pavAngleDetail.PAV_ANGLE_1); + row.item2 = FormatDouble_A(pavAngleDetail.PAV_ANGLE_2); + row.item3 = FormatDouble_A(pavAngleDetail.PAV_ANGLE_3); + row.item4 = FormatDouble_A(pavAngleDetail.PAV_ANGLE_4); + row.item5 = FormatDouble_A(pavAngleDetail.PAV_ANGLE_5); + row.item6 = FormatDouble_A(pavAngleDetail.PAV_ANGLE_6); + row.item7 = FormatDouble_A(pavAngleDetail.PAV_ANGLE_7); + row.item8 = FormatDouble_A(pavAngleDetail.PAV_ANGLE_8); + calIndex(row); + } + private void setGIRDLE_BEZEL_DETAIL(RowDetail row) + { + GirdleBezelDetail girdleBezelDetail = algorithmResult.measurements.GIRDLE_BEZEL_DETAIL; + row.item1 = FormatDouble_P(girdleBezelDetail.GIRDLE_BEZEL_1); + row.item2 = FormatDouble_P(girdleBezelDetail.GIRDLE_BEZEL_2); + row.item3 = FormatDouble_P(girdleBezelDetail.GIRDLE_BEZEL_3); + row.item4 = FormatDouble_P(girdleBezelDetail.GIRDLE_BEZEL_4); + row.item5 = FormatDouble_P(girdleBezelDetail.GIRDLE_BEZEL_5); + row.item6 = FormatDouble_P(girdleBezelDetail.GIRDLE_BEZEL_6); + row.item7 = FormatDouble_P(girdleBezelDetail.GIRDLE_BEZEL_7); + row.item8 = FormatDouble_P(girdleBezelDetail.GIRDLE_BEZEL_8); + calIndex(row); + } + private void setGIRDLE_BONE_DETAIL(RowDetail row) + { + GirdleBoneDetail girdleBoneDetail = algorithmResult.measurements.GIRDLE_BONE_DETAIL; + row.item1 = FormatDouble_P(girdleBoneDetail.GIRDLE_BONE_1); + row.item2 = FormatDouble_P(girdleBoneDetail.GIRDLE_BONE_2); + row.item3 = FormatDouble_P(girdleBoneDetail.GIRDLE_BONE_3); + row.item4 = FormatDouble_P(girdleBoneDetail.GIRDLE_BONE_4); + row.item5 = FormatDouble_P(girdleBoneDetail.GIRDLE_BONE_5); + row.item6 = FormatDouble_P(girdleBoneDetail.GIRDLE_BONE_6); + row.item7 = FormatDouble_P(girdleBoneDetail.GIRDLE_BONE_7); + row.item8 = FormatDouble_P(girdleBoneDetail.GIRDLE_BONE_8); + calIndex(row); + } + + private void setGIRDLE_VALLEY_DETAIL(RowDetail row) + { + GirdleValleyDetail girdleValleyDetail = algorithmResult.measurements.GIRDLE_VALLEY_DETAIL; + row.item1 = FormatDouble_P(girdleValleyDetail.GIRDLE_VALLEY_1); + row.item2 = FormatDouble_P(girdleValleyDetail.GIRDLE_VALLEY_2); + row.item3 = FormatDouble_P(girdleValleyDetail.GIRDLE_VALLEY_3); + row.item4 = FormatDouble_P(girdleValleyDetail.GIRDLE_VALLEY_4); + row.item5 = FormatDouble_P(girdleValleyDetail.GIRDLE_VALLEY_5); + row.item6 = FormatDouble_P(girdleValleyDetail.GIRDLE_VALLEY_6); + row.item7 = FormatDouble_P(girdleValleyDetail.GIRDLE_VALLEY_7); + row.item8 = FormatDouble_P(girdleValleyDetail.GIRDLE_VALLEY_8); + calIndex(row); + } + private void setSTAR_DETAIL(RowDetail row) + { + StarDetail starDetail = algorithmResult.measurements.STAR_DETAIL; + row.item1 = FormatDouble_P(starDetail.STAR_1); + row.item2 = FormatDouble_P(starDetail.STAR_2); + row.item3 = FormatDouble_P(starDetail.STAR_3); + row.item4 = FormatDouble_P(starDetail.STAR_4); + row.item5 = FormatDouble_P(starDetail.STAR_5); + row.item6 = FormatDouble_P(starDetail.STAR_6); + row.item7 = FormatDouble_P(starDetail.STAR_7); + row.item8 = FormatDouble_P(starDetail.STAR_8); + calIndex(row); + } + private void setLOWER_HALVES_RATIO_DETAIL(RowDetail row) + { + LowerHalvesRatioDetail lowerHalvesRatioDetail = algorithmResult.measurements.LOWER_HALVES_RATIO_DETAIL; + row.item1 = FormatDouble_P(lowerHalvesRatioDetail.LOWER_HALVES_RATIO_1); + row.item2 = FormatDouble_P(lowerHalvesRatioDetail.LOWER_HALVES_RATIO_2); + row.item3 = FormatDouble_P(lowerHalvesRatioDetail.LOWER_HALVES_RATIO_3); + row.item4 = FormatDouble_P(lowerHalvesRatioDetail.LOWER_HALVES_RATIO_4); + row.item5 = FormatDouble_P(lowerHalvesRatioDetail.LOWER_HALVES_RATIO_5); + row.item6 = FormatDouble_P(lowerHalvesRatioDetail.LOWER_HALVES_RATIO_6); + row.item7 = FormatDouble_P(lowerHalvesRatioDetail.LOWER_HALVES_RATIO_7); + row.item8 = FormatDouble_P(lowerHalvesRatioDetail.LOWER_HALVES_RATIO_8); + calIndex(row); + } + private void setTWIST_DETAIL(RowDetail row) + { + TwistDetail twistDetail = algorithmResult.measurements.TWIST_DETAIL; + row.item1 = FormatDouble_A(twistDetail.TWIST_1); + row.item2 = FormatDouble_A(twistDetail.TWIST_2); + row.item3 = FormatDouble_A(twistDetail.TWIST_3); + row.item4 = FormatDouble_A(twistDetail.TWIST_4); + row.item5 = FormatDouble_A(twistDetail.TWIST_5); + row.item6 = FormatDouble_A(twistDetail.TWIST_6); + row.item7 = FormatDouble_A(twistDetail.TWIST_7); + row.item8 = FormatDouble_A(twistDetail.TWIST_8); + calIndex(row); + } + #region 钻石操作相关 //暂略