|
|
@ -16,6 +16,9 @@ using NPOI.HPSF; |
|
|
|
using Application = System.Windows.Application; |
|
|
|
using Application = System.Windows.Application; |
|
|
|
using MessageBox = SparkClient.Views.Dialog.MessageBox; |
|
|
|
using MessageBox = SparkClient.Views.Dialog.MessageBox; |
|
|
|
using System.Windows; |
|
|
|
using System.Windows; |
|
|
|
|
|
|
|
using SharpDX; |
|
|
|
|
|
|
|
using SparkClient.Views.UserControl.ViewportData.Entity; |
|
|
|
|
|
|
|
using SparkClient.ViewModel.Configuration.SettingsPages; |
|
|
|
namespace SparkClient.ViewModel.Grading; |
|
|
|
namespace SparkClient.ViewModel.Grading; |
|
|
|
|
|
|
|
|
|
|
|
public class GradingResultVM : BaseViewModel |
|
|
|
public class GradingResultVM : BaseViewModel |
|
|
@ -87,6 +90,42 @@ public class GradingResultVM : BaseViewModel |
|
|
|
// DS下拉列表初始化 |
|
|
|
// DS下拉列表初始化 |
|
|
|
InitDSlist(); |
|
|
|
InitDSlist(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void InitViewportData(AlgorithmResultEntity result) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Dictionary<string,string> colorProperty = new Dictionary<string,string>(); |
|
|
|
|
|
|
|
colorProperty.Add("FACET_COLOR", "MainFacetColor"); |
|
|
|
|
|
|
|
colorProperty.Add("BORDER_COLOR", "MainBorderColor"); |
|
|
|
|
|
|
|
colorProperty.Add("SELECTED_FACET_COLOR", "SelFacetColor"); |
|
|
|
|
|
|
|
colorProperty.Add("SELECTED BORDER COLOR", "SelBorderColor"); |
|
|
|
|
|
|
|
colorProperty.Add("SELECTED_TYPE_COLOR", "SelTypeColor"); |
|
|
|
|
|
|
|
colorProperty.Add("SELECTED_FONT_COLOR", "SelFontColor"); |
|
|
|
|
|
|
|
colorProperty.Add("RULER_COLOR", "SelLineColor"); |
|
|
|
|
|
|
|
colorProperty.Add("ARROW_COLOR", "SelFrontColor"); |
|
|
|
|
|
|
|
colorProperty.Add("BLEMISH_FACET_COLOR", "ErrFacetColor"); |
|
|
|
|
|
|
|
colorProperty.Add("TABLE_FACET_COLOR", "TableFacetColor"); |
|
|
|
|
|
|
|
colorProperty.Add("UPPER_MAIN_FACET_COLOR", "UpperMainFacetColor"); |
|
|
|
|
|
|
|
colorProperty.Add("STAR_FACET_COLOR", "StarFacetColor"); |
|
|
|
|
|
|
|
colorProperty.Add("UPPER_GIRDLE_FACET_COLOR", "UpperGridleFacetColor"); |
|
|
|
|
|
|
|
colorProperty.Add("GIRDLE_FACET_COLOR", "GirdleFacetColor"); |
|
|
|
|
|
|
|
colorProperty.Add("PAVILION_MAIN_FACET_COLOR", "PavilionFacetColor"); |
|
|
|
|
|
|
|
colorProperty.Add("LOWER_GIRDLE_FACET_COLOR", "LowerGridleFacetColor"); |
|
|
|
|
|
|
|
colorProperty.Add("CULET_COLOR", "CuletFacetColor"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ColorConfigEntity colorConfigEntity = new ColorConfigEntity(); |
|
|
|
|
|
|
|
Type type = colorConfigEntity.GetType(); |
|
|
|
|
|
|
|
foreach (var property in colorProperty) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var value = Settings.SelectValueByName(property.Key); |
|
|
|
|
|
|
|
PropertyInfo? p = type.GetProperty(property.Value); |
|
|
|
|
|
|
|
if (p != null && !string.IsNullOrEmpty(value)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
p.SetValue(colorConfigEntity, value); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
string data = JsonConvert.SerializeObject(result); |
|
|
|
|
|
|
|
ViewportData = new ViewportData(result.DiamondCode, data,colorConfigEntity); |
|
|
|
|
|
|
|
ViewportData.LoadData(); |
|
|
|
|
|
|
|
} |
|
|
|
private void InitDSlist() |
|
|
|
private void InitDSlist() |
|
|
|
{ |
|
|
|
{ |
|
|
|
DSList = new DataTable(); |
|
|
|
DSList = new DataTable(); |
|
|
@ -99,9 +138,7 @@ public class GradingResultVM : BaseViewModel |
|
|
|
|
|
|
|
|
|
|
|
private void InitView(AlgorithmResultEntity result) |
|
|
|
private void InitView(AlgorithmResultEntity result) |
|
|
|
{ |
|
|
|
{ |
|
|
|
string data = JsonConvert.SerializeObject(result); |
|
|
|
InitViewportData(result); |
|
|
|
ViewportData = new ViewportData(result.DiamondCode, data); |
|
|
|
|
|
|
|
ViewportData.LoadData(); |
|
|
|
|
|
|
|
totalCutGrade = 0; |
|
|
|
totalCutGrade = 0; |
|
|
|
totalSymGrade = 0; |
|
|
|
totalSymGrade = 0; |
|
|
|
ruleId = getRuleId(); |
|
|
|
ruleId = getRuleId(); |
|
|
@ -919,28 +956,7 @@ public class GradingResultVM : BaseViewModel |
|
|
|
#region 各类名称取得 |
|
|
|
#region 各类名称取得 |
|
|
|
private string GetName(string id) |
|
|
|
private string GetName(string id) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// TODO DB没关联 |
|
|
|
return Name.getNameById(id); |
|
|
|
Dictionary<string, string> dictionary = new(); |
|
|
|
|
|
|
|
dictionary.Add("DIAMETER", "直径"); |
|
|
|
|
|
|
|
dictionary.Add("TOTAL_DEPTH", "全深比"); |
|
|
|
|
|
|
|
dictionary.Add("TABLE", "台宽比"); |
|
|
|
|
|
|
|
dictionary.Add("CROWN_ANGLE", "冠角"); |
|
|
|
|
|
|
|
dictionary.Add("CROWN_HEIGHT", "冠高比"); |
|
|
|
|
|
|
|
dictionary.Add("GIRDLE_BEZEL", "波峰(风筝面)"); |
|
|
|
|
|
|
|
dictionary.Add("GIRDLE_BONE", "波峰(上腰面)"); |
|
|
|
|
|
|
|
dictionary.Add("GIRDLE", "腰厚比"); |
|
|
|
|
|
|
|
dictionary.Add("PAV_ANGLE", "亭角"); |
|
|
|
|
|
|
|
dictionary.Add("PAV_DEPTH", "亭深比"); |
|
|
|
|
|
|
|
dictionary.Add("STAR", "星刻面长度比"); |
|
|
|
|
|
|
|
dictionary.Add("LOWER_HALVES_RATIO", "下腰比"); |
|
|
|
|
|
|
|
dictionary.Add("CULET", "底尖比"); |
|
|
|
|
|
|
|
dictionary.Add("TOC", "台面偏心比"); |
|
|
|
|
|
|
|
dictionary.Add("COC", "底尖偏心比"); |
|
|
|
|
|
|
|
dictionary.Add("TWIST", "扭曲度"); |
|
|
|
|
|
|
|
dictionary.Add("CULET_TO_TABLE", "底尖到台面偏心比"); |
|
|
|
|
|
|
|
dictionary.Add("round", "圆形"); |
|
|
|
|
|
|
|
dictionary.Add("", ""); |
|
|
|
|
|
|
|
return dictionary[id??""]; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
private string GetGradeName(int order) |
|
|
|
private string GetGradeName(int order) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1084,7 +1100,26 @@ public class DataInfo |
|
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
|
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public class Name |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
public string Id { get; set; } |
|
|
|
|
|
|
|
public string name { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static string getNameById(string id) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
string sql = $"SELECT NAME, EN_NAME FROM NAME WHERE ID = {id}"; |
|
|
|
|
|
|
|
DataTable data = DataBaseHelper.ExecuteQuery(sql); |
|
|
|
|
|
|
|
string nameType = MultilingualHelper.getString("NameType"); |
|
|
|
|
|
|
|
if (data.Rows.Count>0) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return data.Rows[0][nameType].ToString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return ""; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
public class RowDetail |
|
|
|
public class RowDetail |
|
|
|
{ |
|
|
|
{ |
|
|
|
public string? itemName { get; set; } |
|
|
|
public string? itemName { get; set; } |
|
|
|