fix: Unification diamond result

master
tongg 9 months ago
parent 9f68f17e95
commit d4c639ec84
  1. 167
      Model/Entity/ApiEntity/AlgorithmResultEntity.cs
  2. 22
      Model/Services/AlgorithmServer.cs
  3. 2
      ViewModel/Grading/DiamondSelectVM.cs
  4. 6
      ViewModel/Grading/GradingLoadingVM.cs
  5. 195
      ViewModel/Grading/GradingResultVM.cs

@ -1,12 +1,64 @@
using HandyControl.Expression.Shapes;
using System.Collections.Generic;
using SparkDotNetCore.DiamondScanner.Entity;
namespace SparkClient.Model.Entity.ApiEntity
{
/// <summary>
/// 算法结果实体类。
/// </summary>
public class AlgorithmResultEntity : DiaResult
{
// /// <summary>
// /// 钻石或宝石的各个面。
// /// </summary>
// public List<Facet> facets { get; set; }
// /// <summary>
// /// 各种测量数据。
// /// </summary>
// public Measurements measurements { get; set; }
// /// <summary>
// /// 标准。
// /// </summary>
// public string Standard { get; set; }
// /// <summary>
// /// 形状。
// /// </summary>
// public string Shape { get; set; }
// /// <summary>
// /// 冠部类型。
// /// </summary>
// public string CrownType { get; set; }
// /// <summary>
// /// 底尖类型。
// /// </summary>
// public string PavType { get; set; }
// /// <summary>
// /// 钻石编码。
// /// </summary>
// public string DiamondCode { get; set; }
// /// <summary>
// /// 错误消息。
// /// </summary>
// public string error_msg { get; set; }
// /// <summary>
// /// 状态。
// /// </summary>
// public string status { get; set; }
//
// /// <summary>
// /// 机器号
// /// </summary>
// public string DeviceId { get; set; }
}
#region 算法结果实体统一化引用 - 范围内属性/方法均过时
/// <summary>
/// 表示面在3D空间中的坐标。
/// </summary>
public class FacetCoord
public class FacetCoordObsolete
{
/// <summary>
/// 面的X坐标。
@ -25,12 +77,12 @@ namespace SparkClient.Model.Entity.ApiEntity
/// <summary>
/// 表示钻石或宝石的一个面。
/// </summary>
public class Facet
public class FacetObsolete
{
/// <summary>
/// 定义面的坐标列表。
/// </summary>
public List<FacetCoord> coords { get; set; }
public List<FacetCoordObsolete> coords { get; set; }
/// <summary>
/// 面的唯一标识符。
/// </summary>
@ -48,7 +100,7 @@ namespace SparkClient.Model.Entity.ApiEntity
/// <summary>
/// 包含钻石或宝石的各种测量数据。
/// </summary>
public class Measurements
public class MeasurementsObsolete
{
/// <summary>
/// 体积。
@ -289,109 +341,63 @@ namespace SparkClient.Model.Entity.ApiEntity
/// <summary>
/// 直径详细信息。
/// </summary>
public DiameterDetail DIAMETER_DETAIL { get; set; }
public DiameterDetailObsolete DIAMETER_DETAIL { get; set; }
/// <summary>
/// 台面详细信息。
/// </summary>
public TableDetail TABLE_DETAIL { get; set; }
public TableDetailObsolete TABLE_DETAIL { get; set; }
/// <summary>
/// 冠部高度详细信息。
/// </summary>
public CrownHeightDetail CROWN_HEIGHT_DETAIL { get; set; }
public CrownHeightDetailObsolete CROWN_HEIGHT_DETAIL { get; set; }
/// <summary>
/// 冠部角度详细信息。
/// </summary>
public CrownAngleDetail CROWN_ANGLE_DETAIL { get; set; }
public CrownAngleDetailObsolete CROWN_ANGLE_DETAIL { get; set; }
/// <summary>
/// 底尖深度详细信息。
/// </summary>
public PavDepthDetail PAV_DEPTH_DETAIL { get; set; }
public PavDepthDetailObsolete PAV_DEPTH_DETAIL { get; set; }
/// <summary>
/// 底尖角度详细信息。
/// </summary>
public PavAngleDetail PAV_ANGLE_DETAIL { get; set; }
public PavAngleDetailObsolete PAV_ANGLE_DETAIL { get; set; }
/// <summary>
/// 腰棱与冠部交点详细信息。
/// </summary>
public GirdleBezelDetail GIRDLE_BEZEL_DETAIL { get; set; }
public GirdleBezelDetailObsolete GIRDLE_BEZEL_DETAIL { get; set; }
/// <summary>
/// 腰棱与底部交点详细信息。
/// </summary>
public GirdleBoneDetail GIRDLE_BONE_DETAIL { get; set; }
public GirdleBoneDetailObsolete GIRDLE_BONE_DETAIL { get; set; }
/// <summary>
/// 腰棱谷详细信息。
/// </summary>
public GirdleValleyDetail GIRDLE_VALLEY_DETAIL { get; set; }
public GirdleValleyDetailObsolete GIRDLE_VALLEY_DETAIL { get; set; }
/// <summary>
/// 星形刻面详细信息。
/// </summary>
public StarDetail STAR_DETAIL { get; set; }
public StarDetailObsolete STAR_DETAIL { get; set; }
/// <summary>
/// 下半部分比例详细信息。
/// </summary>
public LowerHalvesRatioDetail LOWER_HALVES_RATIO_DETAIL { get; set; }
public LowerHalvesRatioDetailObsolete LOWER_HALVES_RATIO_DETAIL { get; set; }
/// <summary>
/// 扭曲度详细信息。
/// </summary>
public TwistDetail TWIST_DETAIL { get; set; }
public TwistDetailObsolete TWIST_DETAIL { get; set; }
public StarAngleDetail STAR_ANGLE_DETAIL { get; set; }
public UpperHalfAngleDetail UPPER_HALF_ANGLE_DETAIL { get; set; }
public LowerHalfAngleDetail LOWER_HALF_ANGLE_DETAIL { get; set; }
public StarAngleDetailObsolete STAR_ANGLE_DETAIL { get; set; }
public UpperHalfAngleDetailObsolete UPPER_HALF_ANGLE_DETAIL { get; set; }
public LowerHalfAngleDetailObsolete LOWER_HALF_ANGLE_DETAIL { get; set; }
}
/// <summary>
/// 算法结果实体类。
/// </summary>
public class AlgorithmResultEntity
{
/// <summary>
/// 钻石或宝石的各个面。
/// </summary>
public List<Facet> facets { get; set; }
/// <summary>
/// 各种测量数据。
/// </summary>
public Measurements measurements { get; set; }
/// <summary>
/// 标准。
/// </summary>
public string Standard { get; set; }
/// <summary>
/// 形状。
/// </summary>
public string Shape { get; set; }
/// <summary>
/// 冠部类型。
/// </summary>
public string CrownType { get; set; }
/// <summary>
/// 底尖类型。
/// </summary>
public string PavType { get; set; }
/// <summary>
/// 钻石编码。
/// </summary>
public string DiamondCode { get; set; }
/// <summary>
/// 错误消息。
/// </summary>
public string error_msg { get; set; }
/// <summary>
/// 状态。
/// </summary>
public string status { get; set; }
/// <summary>
/// 机器号
/// </summary>
public string DeviceId { get; set; }
}
/// <summary>
/// 直径详细信息。
/// </summary>
public class DiameterDetail
public class DiameterDetailObsolete
{
/// <summary>
/// 直径1。
@ -430,7 +436,7 @@ namespace SparkClient.Model.Entity.ApiEntity
/// <summary>
/// 台面详细信息。
/// </summary>
public class TableDetail
public class TableDetailObsolete
{
/// <summary>
/// 台面1。
@ -453,7 +459,7 @@ namespace SparkClient.Model.Entity.ApiEntity
/// <summary>
/// 表示冠部高度的详细信息。
/// </summary>
public class CrownHeightDetail
public class CrownHeightDetailObsolete
{
/// <summary>
/// 冠部高度1。
@ -501,7 +507,7 @@ namespace SparkClient.Model.Entity.ApiEntity
/// <summary>
/// 表示冠部角度的详细信息。
/// </summary>
public class CrownAngleDetail
public class CrownAngleDetailObsolete
{
/// <summary>
/// 冠部角度1。
@ -548,7 +554,7 @@ namespace SparkClient.Model.Entity.ApiEntity
/// <summary>
/// 表示亭部深度的详细信息。
/// </summary>
public class PavDepthDetail
public class PavDepthDetailObsolete
{
/// <summary>
/// 亭部深度1。
@ -596,7 +602,7 @@ namespace SparkClient.Model.Entity.ApiEntity
/// <summary>
/// 表示亭部角度的详细信息。
/// </summary>
public class PavAngleDetail
public class PavAngleDetailObsolete
{
/// <summary>
/// 亭部角度1。
@ -643,7 +649,7 @@ namespace SparkClient.Model.Entity.ApiEntity
/// <summary>
/// 表示腰棱的详细信息。
/// </summary>
public class GirdleBezelDetail
public class GirdleBezelDetailObsolete
{
/// <summary>
/// 腰棱1。
@ -682,7 +688,7 @@ namespace SparkClient.Model.Entity.ApiEntity
/// <summary>
/// 表示腰骨的详细信息。
/// </summary>
public class GirdleBoneDetail
public class GirdleBoneDetailObsolete
{
/// <summary>
/// 腰骨1。
@ -721,7 +727,7 @@ namespace SparkClient.Model.Entity.ApiEntity
/// <summary>
/// 表示腰谷的详细信息。
/// </summary>
public class GirdleValleyDetail
public class GirdleValleyDetailObsolete
{
/// <summary>
/// 腰谷1。
@ -792,7 +798,7 @@ namespace SparkClient.Model.Entity.ApiEntity
/// <summary>
/// 表示星形的详细信息。
/// </summary>
public class StarDetail
public class StarDetailObsolete
{
/// <summary>
/// 星形1。
@ -831,7 +837,7 @@ namespace SparkClient.Model.Entity.ApiEntity
/// <summary>
/// 表示不同段的下半部分比例的详细信息。
/// </summary>
public class LowerHalvesRatioDetail
public class LowerHalvesRatioDetailObsolete
{
/// <summary>
/// 获取或设置第1段的下半部分比例。
@ -870,7 +876,7 @@ namespace SparkClient.Model.Entity.ApiEntity
/// <summary>
/// 表示不同段的扭转值的详细信息。
/// </summary>
public class TwistDetail
public class TwistDetailObsolete
{
/// <summary>
/// 获取或设置第1段的扭转值。
@ -906,7 +912,7 @@ namespace SparkClient.Model.Entity.ApiEntity
public double TWIST_8 { get; set; }
}
public class StarAngleDetail {
public class StarAngleDetailObsolete {
public double STAR_ANGLE_1 { get; set; }
public double STAR_ANGLE_2 { get; set; }
public double STAR_ANGLE_3 { get; set; }
@ -916,7 +922,7 @@ namespace SparkClient.Model.Entity.ApiEntity
public double STAR_ANGLE_7 { get; set; }
public double STAR_ANGLE_8 { get; set; }
}
public class UpperHalfAngleDetail {
public class UpperHalfAngleDetailObsolete {
public double UPPER_HALF_ANGLE_1 { get; set; }
public double UPPER_HALF_ANGLE_2 { get; set; }
public double UPPER_HALF_ANGLE_3 { get; set; }
@ -934,7 +940,7 @@ namespace SparkClient.Model.Entity.ApiEntity
public double UPPER_HALF_ANGLE_15 { get; set; }
public double UPPER_HALF_ANGLE_16 { get; set; }
}
public class LowerHalfAngleDetail {
public class LowerHalfAngleDetailObsolete {
public double LOWER_HALF_ANGLE_1 { get; set; }
public double LOWER_HALF_ANGLE_2 { get; set; }
public double LOWER_HALF_ANGLE_3 { get; set; }
@ -952,4 +958,5 @@ namespace SparkClient.Model.Entity.ApiEntity
public double LOWER_HALF_ANGLE_15 { get; set; }
public double LOWER_HALF_ANGLE_16 { get; set; }
}
#endregion
}

@ -13,6 +13,8 @@ using System.Text;
using System.Text.RegularExpressions;
using SparkClient.Model.Common;
using SparkClient.ViewModel.Configuration;
using SparkDotNetCore.DiamondScanner.Entity;
using SparkDotNetCore.DiamondScanner.Entity.Child;
namespace SparkClient.Model.Services
{
@ -27,7 +29,7 @@ namespace SparkClient.Model.Services
private static readonly ILog Logger = LogManager.GetLogger(typeof(AlgorithmServer));
// 添加公共方法
public AlgorithmResultEntity CallParseJsonAndReturnActions(string shape, string shape_mode, string image_files)
public DiaResult CallParseJsonAndReturnActions(string shape, string shape_mode, string image_files)
{
try
{
@ -161,10 +163,10 @@ namespace SparkClient.Model.Services
if (string.IsNullOrEmpty(resultJson))
{
Logger.Error("Algorithm failed or no result returned.");
return new AlgorithmResultEntity
return new DiaResult()
{
facets = new List<Facet>(),
measurements = new Measurements()
Facets = new List<Facet>(),
Measurements = new Measurements()
};
}
@ -177,15 +179,15 @@ namespace SparkClient.Model.Services
// 返回一个默认的 AlgorithmResultEntity 对象表示解析失败
return new AlgorithmResultEntity
{
facets = new List<Facet>(),
measurements = new Measurements()
Facets = new List<Facet>(),
Measurements = new Measurements()
};
}
// 记录算法失败的状态
Logger.Info($"Algorithm failed with status: {result.status}");
Logger.Info($"Algorithm failed with status: {result.Status}");
// 记录算法失败的错误信息
Logger.Info($"Algorithm failed with errorMsg: {result.error_msg}");
Logger.Info($"Algorithm failed with errorMsg: {result.ErrorMsg}");
// 处理 C++ DLL 日志文件
// 算法调用失败时,保存图片到历史记录文件夹
// if (result.status == StatusCodes.AlgorithmFailed)
@ -210,8 +212,8 @@ namespace SparkClient.Model.Services
// 返回一个默认的 AlgorithmResultEntity 对象表示解析失败
return new AlgorithmResultEntity
{
facets = new List<Facet>(),
measurements = new Measurements()
Facets = new List<Facet>(),
Measurements = new Measurements()
};
}
}

@ -670,7 +670,7 @@ public class DiamondSelectVM : BaseViewModel
//WindowManager.mainViewModel.Content = WindowManager.PreviousVM();
Logger.Info($"检测完毕,跳转至结果页面:");
BaseControlVM vm = new BaseControlVM(new GradingResultVM(param), MultilingualHelper.getString("DetectionResult"));
var ct = param.measurements.VOLUME / 57;
var ct = param.Measurements.VOLUME / 57;
vm.WindowTitle = string.IsNullOrWhiteSpace(param.DiamondCode) ? vm.WindowTitle : $"{vm.WindowTitle} - {param.DiamondCode}({ct.ToString("F3")}ct)";
vm.ShowFunctionButton = System.Windows.Visibility.Visible;
WindowManager.mainViewModel.Content = vm;

@ -171,7 +171,7 @@ public class GradingLoadingVM : BaseViewModel,IDisposable
Parameter.Shape = _diamnondType.Split(" ")[0];
Parameter.CrownType = _diamnondType.Split(" ")[1];
Parameter.PavType = _diamnondType.Split(" ")[2];
Parameter.error_msg = _diamnondType;
Parameter.ErrorMsg = _diamnondType;
await CompleteProgressQuicklyAsync();
return 0;
@ -368,7 +368,7 @@ public class GradingLoadingVM : BaseViewModel,IDisposable
parameter.Shape = _diamnondType.Split(" ")[0];
parameter.CrownType = _diamnondType.Split(" ")[1];
parameter.PavType = _diamnondType.Split(" ")[2];
parameter.error_msg = _diamnondType;
parameter.ErrorMsg = _diamnondType;
try
{
@ -400,7 +400,7 @@ public class GradingLoadingVM : BaseViewModel,IDisposable
;
if (parameter.status == StatusCodes.Recheck)
if (parameter.Status == StatusCodes.Recheck)
{
new MessageBox().Show(MultilingualHelper.getString("Recheck"));
}

@ -37,6 +37,7 @@ using SparkClient.Model.Attributes;
using SparkClient.Model.Common;
using PaperSize = System.Drawing.Printing.PaperSize;
using SharpDX.Direct2D1.Effects;
using SparkDotNetCore.DiamondScanner.Entity.Child;
using Exception = System.Exception;
@ -201,7 +202,7 @@ public class GradingResultVM : BaseViewModel
IsEnabled = false;
}
if (algorithmResult.status.Equals(StatusCodes.Recheck)) IsEnabled = false;
if (algorithmResult.Status.Equals(StatusCodes.Recheck)) IsEnabled = false;
}
@ -287,7 +288,7 @@ public class GradingResultVM : BaseViewModel
{
string strBaseUrl = AppDomain.CurrentDomain.BaseDirectory;
string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "csv", "histroy.csv");
Measurements info = algorithmResult.measurements;
var info = algorithmResult.Measurements;
string line =
$"{DiamondCode}," +
$"{Wight}(ct)," +
@ -426,7 +427,7 @@ public class GradingResultVM : BaseViewModel
}
else if (ruleId.StartsWith("GB"))
{
double ta = algorithmResult.measurements.TABLE * 100;
double ta = algorithmResult.Measurements.TABLE * 100;
ta = (RoundFiveDownSixUp(ta * 2) / 2);
if (ta < 49)
{
@ -715,12 +716,12 @@ public class GradingResultVM : BaseViewModel
DataInfo info = new DataInfo();
info.TestItemId = "DIAMETER";
info.TestItemName = GetName("DIAMETER");
info.Avg = FormatDouble_D(result.measurements.DIAMETER);
info.Dev = result.measurements.DIAMETER_DEV.ToString(digitsFormat);
info.Min = FormatDouble_D(result.measurements.M1);
info.Max = FormatDouble_D(result.measurements.M2);
info.Avg = FormatDouble_D(result.Measurements.DIAMETER);
info.Dev = result.Measurements.DIAMETER_DEV.ToString(digitsFormat);
info.Min = FormatDouble_D(result.Measurements.M1);
info.Max = FormatDouble_D(result.Measurements.M2);
info.Dev = calDev(info.Max, info.Min);
var data = result.measurements;
var data = result.Measurements;
if (data.DIAMETER_DETAIL != null)
{
info.Dtl1 = FormatDouble_D(data.DIAMETER_DETAIL.DIAMETER_1);
@ -741,8 +742,8 @@ public class GradingResultVM : BaseViewModel
DataInfo info = new DataInfo();
info.TestItemId = "TOTAL_DEPTH";
info.TestItemName = GetName("TOTAL_DEPTH");
info.Avg = FormatDouble_Avg(result.measurements.TOTAL_DEPTH*100,Accuracy.ZD1);
info.CutLevel = calGrade_TOTAL_DEPTH(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;
}
@ -753,12 +754,12 @@ public class GradingResultVM : BaseViewModel
DataInfo info = new DataInfo();
info.TestItemId = "TABLE";
info.TestItemName = GetName("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);
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);
info.isEnabled = false;
var data = result.measurements;
var data = result.Measurements;
if (data.TABLE_DETAIL != null)
{
info.Dtl1 = FormatDouble_P(data.TABLE_DETAIL.TABLE_1);
@ -775,13 +776,13 @@ public class GradingResultVM : BaseViewModel
DataInfo info = new DataInfo();
info.TestItemId = "CROWN_ANGLE";
info.TestItemName = GetName("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);
info.CutLevel = calGrade_CROWN_ANGLE(result.measurements.CROWN_ANGLE_MIN, result.measurements.CROWN_ANGLE_MAX);
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);
info.CutLevel = calGrade_CROWN_ANGLE(result.Measurements.CROWN_ANGLE_MIN, result.Measurements.CROWN_ANGLE_MAX);
info.Dev = calDev(info.Max, info.Min);
var data = result.measurements;
var data = result.Measurements;
if (data.CROWN_ANGLE_DETAIL != null)
{
info.Dtl1 = FormatDouble_A(data.CROWN_ANGLE_DETAIL.CROWN_ANGLE_1);
@ -803,13 +804,13 @@ public class GradingResultVM : BaseViewModel
DataInfo info = new DataInfo();
info.TestItemId = "CROWN_HEIGHT";
info.TestItemName = GetName("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);
info.CutLevel = calGrade_CROWN_HEIGHT(result.measurements.CROWN_H_MIN, result.measurements.CROWN_H_MAX);
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);
info.CutLevel = calGrade_CROWN_HEIGHT(result.Measurements.CROWN_H_MIN, result.Measurements.CROWN_H_MAX);
info.Dev = calDev(info.Max, info.Min);
var data = result.measurements;
var data = result.Measurements;
if (data.CROWN_HEIGHT_DETAIL != null)
{
info.Dtl1 = FormatDouble_P(data.CROWN_HEIGHT_DETAIL.CROWN_HEIGHT_1);
@ -831,12 +832,12 @@ public class GradingResultVM : BaseViewModel
DataInfo info = new DataInfo();
info.TestItemId = "GIRDLE_BEZEL";
info.TestItemName = GetName("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);
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);
info.Dev = calDev(info.Max, info.Min);
var data = result.measurements;
var data = result.Measurements;
if (data.GIRDLE_BEZEL_DETAIL != null)
{
info.Dtl1 = FormatDouble_P(data.GIRDLE_BEZEL_DETAIL.GIRDLE_BEZEL_1);
@ -858,11 +859,11 @@ public class GradingResultVM : BaseViewModel
DataInfo info = new DataInfo();
info.TestItemId = "GIRDLE_BONE";
info.TestItemName = GetName("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.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;
var data = result.measurements;
var data = result.Measurements;
if (data.GIRDLE_BONE_DETAIL != null)
{
info.Dtl1 = FormatDouble_P(data.GIRDLE_BONE_DETAIL.GIRDLE_BONE_1);
@ -885,13 +886,13 @@ public class GradingResultVM : BaseViewModel
DataInfo info = new DataInfo();
info.TestItemId = "GIRDLE";
info.TestItemName = GetName("GIRDLE");
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);
info.CutLevel = calGrade_GIRDLE(result.measurements.GIRDLE_VALLEY_MIN, result.measurements.GIRDLE_VALLEY_MAX);
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);
info.CutLevel = calGrade_GIRDLE(result.Measurements.GIRDLE_VALLEY_MIN, result.Measurements.GIRDLE_VALLEY_MAX);
info.Dev = calDev(info.Max, info.Min);
var data = result.measurements;
var data = result.Measurements;
var girdleValleyDetail = data.GIRDLE_VALLEY_DETAIL;
if (girdleValleyDetail != null)
@ -935,13 +936,13 @@ public class GradingResultVM : BaseViewModel
DataInfo info = new DataInfo();
info.TestItemId = "PAV_ANGLE";
info.TestItemName = GetName("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);
info.CutLevel = calGrade_PAV_ANGLE(result.measurements.PAV_ANGLE_MIN, result.measurements.PAV_ANGLE_MAX);
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);
info.CutLevel = calGrade_PAV_ANGLE(result.Measurements.PAV_ANGLE_MIN, result.Measurements.PAV_ANGLE_MAX);
info.Dev = calDev(info.Max, info.Min);
var data = result.measurements;
var data = result.Measurements;
if (data.PAV_ANGLE_DETAIL != null)
{
info.Dtl1 = FormatDouble_A(data.PAV_ANGLE_DETAIL.PAV_ANGLE_1);
@ -963,13 +964,13 @@ public class GradingResultVM : BaseViewModel
DataInfo info = new DataInfo();
info.TestItemId = "PAV_DEPTH";
info.TestItemName = GetName("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);
info.CutLevel = calGrade_PAV_DEPTH(result.measurements.PAV_DEPTH_MIN, result.measurements.PAV_DEPTH_MAX);
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);
info.CutLevel = calGrade_PAV_DEPTH(result.Measurements.PAV_DEPTH_MIN, result.Measurements.PAV_DEPTH_MAX);
info.Dev = calDev(info.Max, info.Min);
var data = result.measurements;
var data = result.Measurements;
if (data.PAV_DEPTH_DETAIL != null)
{
info.Dtl1 = FormatDouble_P(data.PAV_DEPTH_DETAIL.PAV_DEPTH_1);
@ -992,12 +993,12 @@ public class GradingResultVM : BaseViewModel
DataInfo info = new DataInfo();
info.TestItemId = "STAR";
info.TestItemName = GetName("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.CutLevel = calGrade_STAR(result.measurements.STAR_MIN, result.measurements.STAR_MAX);
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.CutLevel = calGrade_STAR(result.Measurements.STAR_MIN, result.Measurements.STAR_MAX);
info.isEnabled = false;
var data = result.measurements;
var data = result.Measurements;
if (data.STAR_DETAIL != null)
{
info.Dtl1 = FormatDouble_P(data.STAR_DETAIL.STAR_1);
@ -1018,12 +1019,12 @@ public class GradingResultVM : BaseViewModel
DataInfo info = new DataInfo();
info.TestItemId = "LOWER_HALVES_RATIO";
info.TestItemName = GetName("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.CutLevel = calGrade_LOWER_HALVES_RATIO(result.measurements.LOWER_HALVES_RATIO_MIN, result.measurements.LOWER_HALVES_RATIO_MAX);
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.CutLevel = calGrade_LOWER_HALVES_RATIO(result.Measurements.LOWER_HALVES_RATIO_MIN, result.Measurements.LOWER_HALVES_RATIO_MAX);
info.isEnabled = false;
var data = result.measurements;
var data = result.Measurements;
if (data.LOWER_HALVES_RATIO_DETAIL != null)
{
info.Dtl1 = FormatDouble_P(data.LOWER_HALVES_RATIO_DETAIL.LOWER_HALVES_RATIO_1);
@ -1044,8 +1045,8 @@ public class GradingResultVM : BaseViewModel
DataInfo info = new DataInfo();
info.TestItemId = "CULET";
info.TestItemName = GetName("CULET");
info.Avg = FormatDouble_Avg(result.measurements.CULET * 100, Accuracy.ZD1);
info.CutLevel = calGrade_CULET(result.measurements.CULET);
info.Avg = FormatDouble_Avg(result.Measurements.CULET * 100, Accuracy.ZD1);
info.CutLevel = calGrade_CULET(result.Measurements.CULET);
info.isEnabled = false;
return info;
@ -1057,8 +1058,8 @@ public class GradingResultVM : BaseViewModel
DataInfo info = new DataInfo();
info.TestItemId = "TOC";
info.TestItemName = GetName("TOC");
info.Avg = FormatDouble_Avg(result.measurements.TOC * 100, Accuracy.ZD1);
var data = result.measurements;
info.Avg = FormatDouble_Avg(result.Measurements.TOC * 100, Accuracy.ZD1);
var data = result.Measurements;
info.SymLevel = calGradeSym(info.TestItemId, data.TOC * 100);
return info;
@ -1070,8 +1071,8 @@ public class GradingResultVM : BaseViewModel
DataInfo info = new DataInfo();
info.TestItemId = "COC";
info.TestItemName = GetName("COC");
info.Avg = FormatDouble_Avg(result.measurements.COC*100, Accuracy.ZD1);
var data = result.measurements;
info.Avg = FormatDouble_Avg(result.Measurements.COC*100, Accuracy.ZD1);
var data = result.Measurements;
info.SymLevel = calGradeSym(info.TestItemId, data.COC * 100);
return info;
@ -1083,12 +1084,12 @@ public class GradingResultVM : BaseViewModel
DataInfo info = new DataInfo();
info.TestItemId = "TWIST";
info.TestItemName = GetName("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);
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);
info.Dev = calDev(info.Max, info.Min);
var data = result.measurements;
var data = result.Measurements;
if (data.TWIST_DETAIL != null)
{
info.Dtl1 = FormatDouble_A(data.TWIST_DETAIL.TWIST_1);
@ -1110,8 +1111,8 @@ public class GradingResultVM : BaseViewModel
DataInfo info = new DataInfo();
info.TestItemId = "CULET_TO_TABLE";
info.TestItemName = GetName("CULET_TO_TABLE");
info.Avg = FormatDouble_Avg(result.measurements.CULET_TO_TABLE*100,Accuracy.ZD1);
var data = result.measurements;
info.Avg = FormatDouble_Avg(result.Measurements.CULET_TO_TABLE*100,Accuracy.ZD1);
var data = result.Measurements;
info.SymLevel = calGradeSym(info.TestItemId, data.CULET_TO_TABLE * 100);
return info;
}
@ -1119,11 +1120,11 @@ public class GradingResultVM : BaseViewModel
[Log]
private double CalWight(AlgorithmResultEntity result)
{
// var M1 = result.measurements.M1;
// var M2 = result.measurements.M2;
// var M3 = result.measurements.M3;
// var M1 = result.Measurements.M1;
// var M2 = result.Measurements.M2;
// var M3 = result.Measurements.M3;
// var wight = Square((M1+M2)/2)*M3*0.0061;
var VOLUME = result.measurements.VOLUME;
var VOLUME = result.Measurements.VOLUME;
var wight = VOLUME/57;
Wight = wight.ToString("f3");
return wight;
@ -1379,7 +1380,7 @@ public class GradingResultVM : BaseViewModel
using (var file = File.Create(fileName))
{
Measurements info = algorithmResult.measurements;
Measurements info = algorithmResult.Measurements;
StreamWriter stream = new StreamWriter(file);
stream.WriteLine($"IGI REPORT NUMBER={DiamondCode}");
stream.WriteLine($"SARIN WEIGHT={Double.Parse(Wight).ToString("f3")}");
@ -1471,7 +1472,7 @@ public class GradingResultVM : BaseViewModel
row++;
col = 0;
dataRow = sheet.CreateRow(row);
Measurements info = algorithmResult.measurements;
Measurements info = algorithmResult.Measurements;
dataRow.CreateCell(col++).SetCellValue($"{FormatDouble_A2(info.M1)}(mm)");
dataRow.CreateCell(col++).SetCellValue($"{FormatDouble_A2(info.M2)}(mm)");
dataRow.CreateCell(col++).SetCellValue($"{FormatDouble_A2(info.M3)}(mm)");
@ -1947,7 +1948,7 @@ public class GradingResultVM : BaseViewModel
[Log]
private void setDIAMETER_DETAIL(RowDetail row)
{
DiameterDetail diameterDetail = algorithmResult.measurements.DIAMETER_DETAIL;
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);
@ -1961,7 +1962,7 @@ public class GradingResultVM : BaseViewModel
[Log]
private void setTABLE_DETAIL(RowDetail row)
{
TableDetail diameterDetail = algorithmResult.measurements.TABLE_DETAIL;
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);
@ -1971,7 +1972,7 @@ public class GradingResultVM : BaseViewModel
[Log]
private void setCROWN_HEIGHT_DETAIL(RowDetail row)
{
CrownHeightDetail crownHeightDetail = algorithmResult.measurements.CROWN_HEIGHT_DETAIL;
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);
@ -1985,7 +1986,7 @@ public class GradingResultVM : BaseViewModel
[Log]
private void setCROWN_ANGLE_DETAIL(RowDetail row)
{
CrownAngleDetail crownAngleDetail = algorithmResult.measurements.CROWN_ANGLE_DETAIL;
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);
@ -1999,7 +2000,7 @@ public class GradingResultVM : BaseViewModel
[Log]
private void setPAV_DEPTH_DETAIL(RowDetail row)
{
PavDepthDetail pavDepthDetail = algorithmResult.measurements.PAV_DEPTH_DETAIL;
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);
@ -2013,7 +2014,7 @@ public class GradingResultVM : BaseViewModel
[Log]
private void setPAV_ANGLE_DETAIL(RowDetail row)
{
PavAngleDetail pavAngleDetail = algorithmResult.measurements.PAV_ANGLE_DETAIL;
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);
@ -2027,7 +2028,7 @@ public class GradingResultVM : BaseViewModel
[Log]
private void setGIRDLE_BEZEL_DETAIL(RowDetail row)
{
GirdleBezelDetail girdleBezelDetail = algorithmResult.measurements.GIRDLE_BEZEL_DETAIL;
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);
@ -2041,7 +2042,7 @@ public class GradingResultVM : BaseViewModel
[Log]
private void setGIRDLE_BONE_DETAIL(RowDetail row)
{
GirdleBoneDetail girdleBoneDetail = algorithmResult.measurements.GIRDLE_BONE_DETAIL;
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);
@ -2056,7 +2057,7 @@ public class GradingResultVM : BaseViewModel
[Log]
private void setGIRDLE_VALLEY_DETAIL(RowDetail row)
{
GirdleValleyDetail girdleValleyDetail = algorithmResult.measurements.GIRDLE_VALLEY_DETAIL;
GirdleValleyDetail girdleValleyDetail = algorithmResult.Measurements.GIRDLE_VALLEY_DETAIL;
List<double> doubles = new List<double>();
doubles.Add(girdleValleyDetail.GIRDLE_VALLEY_1);
doubles.Add(girdleValleyDetail.GIRDLE_VALLEY_2);
@ -2088,7 +2089,7 @@ public class GradingResultVM : BaseViewModel
[Log]
private void setSTAR_DETAIL(RowDetail row)
{
StarDetail starDetail = algorithmResult.measurements.STAR_DETAIL;
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);
@ -2102,7 +2103,7 @@ public class GradingResultVM : BaseViewModel
[Log]
private void setLOWER_HALVES_RATIO_DETAIL(RowDetail row)
{
LowerHalvesRatioDetail lowerHalvesRatioDetail = algorithmResult.measurements.LOWER_HALVES_RATIO_DETAIL;
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);
@ -2116,7 +2117,7 @@ public class GradingResultVM : BaseViewModel
[Log]
private void setTWIST_DETAIL(RowDetail row)
{
TwistDetail twistDetail = algorithmResult.measurements.TWIST_DETAIL;
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);
@ -2365,7 +2366,7 @@ public class GradingResultVM : BaseViewModel
int width = e.PageSettings.PaperSize.Width;
var result = algorithmResult.measurements;
var result = algorithmResult.Measurements;
int startX = 3;
int startY = 3;
var col2X = startX + (width * 0.2f);
@ -2614,7 +2615,7 @@ public class GradingResultVM : BaseViewModel
[Log]
private void PrintPageHandler(object sender, PrintPageEventArgs e)
{
var result = algorithmResult.measurements;
var result = algorithmResult.Measurements;
int startX = 10;
int startY = 10;
var col2X = startX + 90;

Loading…
Cancel
Save