diff --git a/Model/Entity/AgileJsonConfigEntity.cs b/Model/Entity/AgileJsonConfigEntity.cs index 764529b..0636609 100644 --- a/Model/Entity/AgileJsonConfigEntity.cs +++ b/Model/Entity/AgileJsonConfigEntity.cs @@ -23,13 +23,7 @@ public class AgileJsonConfigEntity public Param Mode { get => _mode; - set - { - if (_mode == value) return; - _mode = value; - OnPropertyChanged(nameof(Mode)); - - } + set => SetField(ref _mode, value); } private Param _spec; @@ -146,6 +140,26 @@ public class AgileJsonConfigEntity { Value = "P8-P8-S4", Name = "P8-P8-S4" + }, + new Param() + { + Value = "P8-P8-S5", + Name = "P8-P8-S5" + }, + new Param() + { + Value = "P8-P8-S6", + Name = "P8-P8-S6" + }, + new Param() + { + Value = "P8-P8-S7", + Name = "P8-P8-S7" + }, + new Param() + { + Value = "P8-P8-S8", + Name = "P8-P8-S8" } }; } diff --git a/Model/Entity/ApiEntity/AlgorithmResultEntity.cs b/Model/Entity/ApiEntity/AlgorithmResultEntity.cs index 0de7f97..7c08937 100644 --- a/Model/Entity/ApiEntity/AlgorithmResultEntity.cs +++ b/Model/Entity/ApiEntity/AlgorithmResultEntity.cs @@ -487,6 +487,14 @@ namespace SparkClient.Model.Entity.ApiEntity /// 冠部高度8。 /// public double CROWN_HEIGHT_8 { get; set; } + public double CROWN_HEIGHT_9 { get; set; } + public double CROWN_HEIGHT_10 { get; set; } + public double CROWN_HEIGHT_11 { get; set; } + public double CROWN_HEIGHT_12 { get; set; } + public double CROWN_HEIGHT_13 { get; set; } + public double CROWN_HEIGHT_14 { get; set; } + public double CROWN_HEIGHT_15 { get; set; } + public double CROWN_HEIGHT_16 { get; set; } } @@ -527,6 +535,14 @@ namespace SparkClient.Model.Entity.ApiEntity /// 冠部角度8。 /// public double CROWN_ANGLE_8 { get; set; } + public double CROWN_ANGLE_9 { get; set; } + public double CROWN_ANGLE_10 { get; set; } + public double CROWN_ANGLE_11 { get; set; } + public double CROWN_ANGLE_12 { get; set; } + public double CROWN_ANGLE_13 { get; set; } + public double CROWN_ANGLE_14 { get; set; } + public double CROWN_ANGLE_15 { get; set; } + public double CROWN_ANGLE_16 { get; set; } } /// @@ -566,6 +582,15 @@ namespace SparkClient.Model.Entity.ApiEntity /// 亭部深度8。 /// public double PAV_DEPTH_8 { get; set; } + + public double PAV_DEPTH_9 { get; set; } + public double PAV_DEPTH_10 { get; set; } + public double PAV_DEPTH_11 { get; set; } + public double PAV_DEPTH_12 { get; set; } + public double PAV_DEPTH_13 { get; set; } + public double PAV_DEPTH_14 { get; set; } + public double PAV_DEPTH_15 { get; set; } + public double PAV_DEPTH_16 { get; set; } } /// @@ -605,6 +630,14 @@ namespace SparkClient.Model.Entity.ApiEntity /// 亭部角度8。 /// public double PAV_ANGLE_8 { get; set; } + public double PAV_ANGLE_9 { get; set; } + public double PAV_ANGLE_10 { get; set; } + public double PAV_ANGLE_11 { get; set; } + public double PAV_ANGLE_12 { get; set; } + public double PAV_ANGLE_13 { get; set; } + public double PAV_ANGLE_14 { get; set; } + public double PAV_ANGLE_15 { get; set; } + public double PAV_ANGLE_16 { get; set; } } /// diff --git a/Model/Extension/DefaultValueContractResolver.cs b/Model/Extension/DefaultValueContractResolver.cs new file mode 100644 index 0000000..4d5de78 --- /dev/null +++ b/Model/Extension/DefaultValueContractResolver.cs @@ -0,0 +1,22 @@ +using System.Reflection; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; + +namespace SparkClient.Model.Extension; + +public class DefaultValueContractResolver: DefaultContractResolver +{ + protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) + { + JsonProperty property = base.CreateProperty(member, memberSerialization); + + if (property.PropertyType.IsValueType && + Nullable.GetUnderlyingType(property.PropertyType) == null) // 非可空类型 + { + property.DefaultValue = Activator.CreateInstance(property.PropertyType); + property.DefaultValueHandling = DefaultValueHandling.Populate; + } + + return property; + } +} \ No newline at end of file diff --git a/SparkClient.csproj b/SparkClient.csproj index 6583d71..751fa00 100644 --- a/SparkClient.csproj +++ b/SparkClient.csproj @@ -286,7 +286,7 @@ C:\Windows\assembly\GAC_MSIL\office\15.0.0.0__71e9bce111e9429c\OFFICE.DLL - bin\Debug\net8.0-windows\SparkDotNetCore.dll + bin\Release\net8.0-windows\SparkDotNetCore.dll diff --git a/SparkDB.db b/SparkDB.db index 5813df3..fc291e6 100644 Binary files a/SparkDB.db and b/SparkDB.db differ diff --git a/ViewModel/Grading/DiamondSelectVM.cs b/ViewModel/Grading/DiamondSelectVM.cs index 4bf9b08..d0bd4ac 100644 --- a/ViewModel/Grading/DiamondSelectVM.cs +++ b/ViewModel/Grading/DiamondSelectVM.cs @@ -121,16 +121,26 @@ public class DiamondSelectVM : BaseViewModel }else if (Common.RunMode == 1) { var bitmap = new BitmapImage(new Uri("pack://application:,,,/Resource/Images/UIResource/round_P8-P8.png", UriKind.RelativeOrAbsolute)); - ButtonViewModel button1 = new ButtonViewModel() { Text = "P8-P8 Stage 1", ImageSource = bitmap, Type = "ROUND P8 P8 S1", Command = StartGradingCommand, IsFocused = true}; - ButtonViewModel button2 = new ButtonViewModel() { Text = "P8-P8 Stage 2", ImageSource = bitmap, Type = "ROUND P8 P8 S1 S2", Command = StartGradingCommand, IsFocused = true}; - ButtonViewModel button3 = new ButtonViewModel() { Text = "P8-P8 Stage 3", ImageSource = bitmap, Type = "ROUND P8 P8 S1 S2 S3", Command = StartGradingCommand, IsFocused = true}; - ButtonViewModel button4 = new ButtonViewModel() { Text = "P8-P8 Stage 4", ImageSource = bitmap, Type = "ROUND P8 P8 S1 S2 S3 S4", Command = StartGradingCommand, IsFocused = true}; - ButtonViewModel button5 = new ButtonViewModel() { Text = "P8-P8", ImageSource = bitmap, Type = "ROUND P8 P8", Command = StartGradingCommand, IsFocused = true}; - tempButtons2.Add(button1); - tempButtons2.Add(button2); - tempButtons2.Add(button3); - tempButtons2.Add(button4); - tempButtons2.Add(button5); + List listBtn = new List() + { + new ButtonViewModel() { Text = "P8-P8 Stage 1", ImageSource = bitmap, Type = "ROUND P8 P8 S1", Command = StartGradingCommand, IsFocused = true}, + new ButtonViewModel() { Text = "P8-P8 Stage 2", ImageSource = bitmap, Type = "ROUND P8 P8 S2", Command = StartGradingCommand, IsFocused = true}, + new ButtonViewModel() { Text = "P8-P8 Stage 3", ImageSource = bitmap, Type = "ROUND P8 P8 S3", Command = StartGradingCommand, IsFocused = true}, + new ButtonViewModel() { Text = "P8-P8 Stage 4", ImageSource = bitmap, Type = "ROUND P8 P8 S4", Command = StartGradingCommand, IsFocused = true}, + new ButtonViewModel() { Text = "P8-P8 Stage 5", ImageSource = bitmap, Type = "ROUND P8 P8 S5", Command = StartGradingCommand, IsFocused = true}, + new ButtonViewModel() { Text = "P8-P8 Stage 6", ImageSource = bitmap, Type = "ROUND P8 P8 S6", Command = StartGradingCommand, IsFocused = true}, + new ButtonViewModel() { Text = "P8-P8 Stage 7", ImageSource = bitmap, Type = "ROUND P8 P8 S7", Command = StartGradingCommand, IsFocused = true}, + new ButtonViewModel() { Text = "P8-P8 Stage 8", ImageSource = bitmap, Type = "ROUND P8 P8 S8", Command = StartGradingCommand, IsFocused = true}, + new ButtonViewModel() { Text = "P8-P8", ImageSource = bitmap, Type = "ROUND P8 P8", Command = StartGradingCommand, IsFocused = true}, + + }; + + listBtn.ForEach(e => tempButtons2.Add(e)); + // tempButtons2.Add(button1); + // tempButtons2.Add(button2); + // tempButtons2.Add(button3); + // tempButtons2.Add(button4); + // tempButtons2.Add(button5); } diff --git a/ViewModel/Grading/GradingLoadingVM.cs b/ViewModel/Grading/GradingLoadingVM.cs index 24ce01a..a3cf6d9 100644 --- a/ViewModel/Grading/GradingLoadingVM.cs +++ b/ViewModel/Grading/GradingLoadingVM.cs @@ -159,7 +159,12 @@ public class GradingLoadingVM : BaseViewModel,IDisposable { stringBuilder.Append(line); } - Parameter = JsonConvert.DeserializeObject(stringBuilder.ToString()); + var settings = new JsonSerializerSettings + { + ContractResolver = new DefaultValueContractResolver(), + NullValueHandling = NullValueHandling.Ignore + }; + Parameter = JsonConvert.DeserializeObject(stringBuilder.ToString(),settings); Parameter.DiamondCode = _diamondCode; Parameter.Standard = getStandardName(); Parameter.Shape = _diamnondType.Split(" ")[0]; diff --git a/Views/UserControl/Viewport3D.xaml.cs b/Views/UserControl/Viewport3D.xaml.cs index 16d93eb..628345c 100644 --- a/Views/UserControl/Viewport3D.xaml.cs +++ b/Views/UserControl/Viewport3D.xaml.cs @@ -91,18 +91,40 @@ public partial class Viewport3D ContextMenu.Items.Remove(ViewportRightMenuShowDefectFace); ViewportRightMenuShowLighting.IsChecked = false; //关灯 ViewportManager.DicValueParamToFacet.Clear(); - if (ViewportManager.DiamondType.Split(" ").Contains("S1")) - { - //有效数据 - ViewportManager.DicValueParamToFacet.Add("CROWN_ANGLE", PlaneType.CrownIncomplete); - ViewportManager.DicValueParamToFacet.Add("CROWN_HEIGHT", PlaneType.CrownIncomplete); - } - if (ViewportManager.DiamondType.Split(" ").Contains("S2")) + + switch (step) { - //有效数据 - ViewportManager.DicValueParamToFacet.Add("STAR_ANGLE", PlaneType.StarFacet); - ViewportManager.DicValueParamToFacet.Add("STAR", PlaneType.StarFacet); + case "S1": + case "S4": + ViewportManager.DicValueParamToFacet.Add("CROWN_ANGLE", PlaneType.CrownIncomplete); + ViewportManager.DicValueParamToFacet.Add("CROWN_HEIGHT", PlaneType.CrownIncomplete); + break; + case "S2": + ViewportManager.DicValueParamToFacet.Add("CROWN_ANGLE", PlaneType.CrownIncomplete); + ViewportManager.DicValueParamToFacet.Add("CROWN_HEIGHT", PlaneType.CrownIncomplete); + ViewportManager.DicValueParamToFacet.Add("STAR_ANGLE", PlaneType.StarFacet); + ViewportManager.DicValueParamToFacet.Add("STAR", PlaneType.StarFacet); + break; + case "S3": + ViewportManager.DicValueParamToFacet.Add("CROWN_ANGLE", PlaneType.CrownIncomplete); + ViewportManager.DicValueParamToFacet.Add("CROWN_HEIGHT", PlaneType.CrownIncomplete); + ViewportManager.DicValueParamToFacet.Add("UPPER_HALF_ANGLE", PlaneType.StarFacet); + break; + case "S5": + case "S6": + ViewportManager.DicValueParamToFacet.Add("PAVILION_ANGLE", PlaneType.PavilionIncomplete); + ViewportManager.DicValueParamToFacet.Add("PAVILION_HEIGHT", PlaneType.PavilionIncomplete); + break; + case "S7": + case "S8": + ViewportManager.DicValueParamToFacet.Add("PAVILION_ANGLE", PlaneType.PavilionIncomplete); + ViewportManager.DicValueParamToFacet.Add("PAVILION_HEIGHT", PlaneType.PavilionIncomplete); + ViewportManager.DicValueParamToFacet.Add("CROWN_ANGLE", PlaneType.CrownIncomplete); + ViewportManager.DicValueParamToFacet.Add("CROWN_HEIGHT", PlaneType.CrownIncomplete); + break; } + + } diff --git a/Views/UserControl/ViewportData/Enum/PlaneType.cs b/Views/UserControl/ViewportData/Enum/PlaneType.cs index 198d057..3d6ce38 100644 --- a/Views/UserControl/ViewportData/Enum/PlaneType.cs +++ b/Views/UserControl/ViewportData/Enum/PlaneType.cs @@ -28,6 +28,8 @@ public enum PlaneType Culet = 23, [Description("未完成的冠部")] CrownIncomplete = 32, + [Description("未完成的亭部")] + PavilionIncomplete = 33, [Description("其他")] Other = 99 } \ No newline at end of file diff --git a/Views/UserControl/ViewportData/Helper/ViewportHelperPro.cs b/Views/UserControl/ViewportData/Helper/ViewportHelperPro.cs index eaad048..4e33340 100644 --- a/Views/UserControl/ViewportData/Helper/ViewportHelperPro.cs +++ b/Views/UserControl/ViewportData/Helper/ViewportHelperPro.cs @@ -2449,24 +2449,23 @@ public class ViewportHelperPro private static bool FactoryShowTextCheck(string diamondType, PlaneType planeType) { - string[] diamondTypes = diamondType.Split(" "); - string endType = diamondTypes.Last(); - if ("S2".Equals(endType)) + Dictionary> stepPlaneMappings = new() { - if (diamondTypes.Contains("S1")) - { - if (planeType == PlaneType.CrownIncomplete || planeType == PlaneType.StarFacet) - return true; - } - } - - if ("S1".Equals(endType)) + ["S1"] = new() { PlaneType.CrownIncomplete }, + ["S2"] = new() { PlaneType.CrownIncomplete, PlaneType.StarFacet }, + ["S3"] = new() { PlaneType.CrownIncomplete, PlaneType.StarFacet }, + ["S4"] = new() { PlaneType.CrownIncomplete }, + ["S5"] = new() { PlaneType.PavilionIncomplete }, + ["S6"] = new() { PlaneType.PavilionIncomplete }, + ["S7"] = new() { PlaneType.PavilionIncomplete, PlaneType.CrownIncomplete }, + ["S8"] = new() { PlaneType.PavilionIncomplete, PlaneType.CrownIncomplete } + }; + var endType = diamondType.Split(' ').LastOrDefault(); + if (string.IsNullOrEmpty(endType) || !stepPlaneMappings.TryGetValue(endType, out var allowedTypes)) { - if (planeType == PlaneType.CrownIncomplete) - return true; + return false; } - - return false; + return allowedTypes.Contains(planeType); } }