feat: s7s8 lack: Show value

master
Tongg 9 months ago
parent 7c485f2305
commit e20339e60a
  1. 28
      Model/Entity/AgileJsonConfigEntity.cs
  2. 33
      Model/Entity/ApiEntity/AlgorithmResultEntity.cs
  3. 22
      Model/Extension/DefaultValueContractResolver.cs
  4. 2
      SparkClient.csproj
  5. BIN
      SparkDB.db
  6. 30
      ViewModel/Grading/DiamondSelectVM.cs
  7. 7
      ViewModel/Grading/GradingLoadingVM.cs
  8. 42
      Views/UserControl/Viewport3D.xaml.cs
  9. 2
      Views/UserControl/ViewportData/Enum/PlaneType.cs
  10. 29
      Views/UserControl/ViewportData/Helper/ViewportHelperPro.cs

@ -23,13 +23,7 @@ public class AgileJsonConfigEntity
public Param Mode public Param Mode
{ {
get => _mode; get => _mode;
set set => SetField(ref _mode, value);
{
if (_mode == value) return;
_mode = value;
OnPropertyChanged(nameof(Mode));
}
} }
private Param _spec; private Param _spec;
@ -146,6 +140,26 @@ public class AgileJsonConfigEntity
{ {
Value = "P8-P8-S4", Value = "P8-P8-S4",
Name = "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"
} }
}; };
} }

@ -487,6 +487,14 @@ namespace SparkClient.Model.Entity.ApiEntity
/// 冠部高度8。 /// 冠部高度8。
/// </summary> /// </summary>
public double CROWN_HEIGHT_8 { get; set; } 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。 /// 冠部角度8。
/// </summary> /// </summary>
public double CROWN_ANGLE_8 { get; set; } 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; }
} }
/// <summary> /// <summary>
@ -566,6 +582,15 @@ namespace SparkClient.Model.Entity.ApiEntity
/// 亭部深度8。 /// 亭部深度8。
/// </summary> /// </summary>
public double PAV_DEPTH_8 { get; set; } 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; }
} }
/// <summary> /// <summary>
@ -605,6 +630,14 @@ namespace SparkClient.Model.Entity.ApiEntity
/// 亭部角度8。 /// 亭部角度8。
/// </summary> /// </summary>
public double PAV_ANGLE_8 { get; set; } 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; }
} }
/// <summary> /// <summary>

@ -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;
}
}

@ -286,7 +286,7 @@
<HintPath>C:\Windows\assembly\GAC_MSIL\office\15.0.0.0__71e9bce111e9429c\OFFICE.DLL</HintPath> <HintPath>C:\Windows\assembly\GAC_MSIL\office\15.0.0.0__71e9bce111e9429c\OFFICE.DLL</HintPath>
</Reference> </Reference>
<Reference Include="SparkDotNetCore"> <Reference Include="SparkDotNetCore">
<HintPath>bin\Debug\net8.0-windows\SparkDotNetCore.dll</HintPath> <HintPath>bin\Release\net8.0-windows\SparkDotNetCore.dll</HintPath>
</Reference> </Reference>
</ItemGroup> </ItemGroup>

Binary file not shown.

@ -121,16 +121,26 @@ public class DiamondSelectVM : BaseViewModel
}else if (Common.RunMode == 1) }else if (Common.RunMode == 1)
{ {
var bitmap = new BitmapImage(new Uri("pack://application:,,,/Resource/Images/UIResource/round_P8-P8.png", UriKind.RelativeOrAbsolute)); 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}; List<ButtonViewModel> listBtn = new List<ButtonViewModel>()
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}; new ButtonViewModel() { Text = "P8-P8 Stage 1", ImageSource = bitmap, Type = "ROUND P8 P8 S1", 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}; new ButtonViewModel() { Text = "P8-P8 Stage 2", ImageSource = bitmap, Type = "ROUND P8 P8 S2", Command = StartGradingCommand, IsFocused = true},
ButtonViewModel button5 = new ButtonViewModel() { Text = "P8-P8", ImageSource = bitmap, Type = "ROUND P8 P8", Command = StartGradingCommand, IsFocused = true}; new ButtonViewModel() { Text = "P8-P8 Stage 3", ImageSource = bitmap, Type = "ROUND P8 P8 S3", Command = StartGradingCommand, IsFocused = true},
tempButtons2.Add(button1); new ButtonViewModel() { Text = "P8-P8 Stage 4", ImageSource = bitmap, Type = "ROUND P8 P8 S4", Command = StartGradingCommand, IsFocused = true},
tempButtons2.Add(button2); new ButtonViewModel() { Text = "P8-P8 Stage 5", ImageSource = bitmap, Type = "ROUND P8 P8 S5", Command = StartGradingCommand, IsFocused = true},
tempButtons2.Add(button3); new ButtonViewModel() { Text = "P8-P8 Stage 6", ImageSource = bitmap, Type = "ROUND P8 P8 S6", Command = StartGradingCommand, IsFocused = true},
tempButtons2.Add(button4); new ButtonViewModel() { Text = "P8-P8 Stage 7", ImageSource = bitmap, Type = "ROUND P8 P8 S7", Command = StartGradingCommand, IsFocused = true},
tempButtons2.Add(button5); 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);
} }

@ -159,7 +159,12 @@ public class GradingLoadingVM : BaseViewModel,IDisposable
{ {
stringBuilder.Append(line); stringBuilder.Append(line);
} }
Parameter = JsonConvert.DeserializeObject<AlgorithmResultEntity>(stringBuilder.ToString()); var settings = new JsonSerializerSettings
{
ContractResolver = new DefaultValueContractResolver(),
NullValueHandling = NullValueHandling.Ignore
};
Parameter = JsonConvert.DeserializeObject<AlgorithmResultEntity>(stringBuilder.ToString(),settings);
Parameter.DiamondCode = _diamondCode; Parameter.DiamondCode = _diamondCode;
Parameter.Standard = getStandardName(); Parameter.Standard = getStandardName();
Parameter.Shape = _diamnondType.Split(" ")[0]; Parameter.Shape = _diamnondType.Split(" ")[0];

@ -91,18 +91,40 @@ public partial class Viewport3D
ContextMenu.Items.Remove(ViewportRightMenuShowDefectFace); ContextMenu.Items.Remove(ViewportRightMenuShowDefectFace);
ViewportRightMenuShowLighting.IsChecked = false; //关灯 ViewportRightMenuShowLighting.IsChecked = false; //关灯
ViewportManager.DicValueParamToFacet.Clear(); ViewportManager.DicValueParamToFacet.Clear();
if (ViewportManager.DiamondType.Split(" ").Contains("S1"))
{ switch (step)
//有效数据
ViewportManager.DicValueParamToFacet.Add("CROWN_ANGLE", PlaneType.CrownIncomplete);
ViewportManager.DicValueParamToFacet.Add("CROWN_HEIGHT", PlaneType.CrownIncomplete);
}
if (ViewportManager.DiamondType.Split(" ").Contains("S2"))
{ {
//有效数据 case "S1":
ViewportManager.DicValueParamToFacet.Add("STAR_ANGLE", PlaneType.StarFacet); case "S4":
ViewportManager.DicValueParamToFacet.Add("STAR", PlaneType.StarFacet); 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;
} }
} }

@ -28,6 +28,8 @@ public enum PlaneType
Culet = 23, Culet = 23,
[Description("未完成的冠部")] [Description("未完成的冠部")]
CrownIncomplete = 32, CrownIncomplete = 32,
[Description("未完成的亭部")]
PavilionIncomplete = 33,
[Description("其他")] [Description("其他")]
Other = 99 Other = 99
} }

@ -2449,24 +2449,23 @@ public class ViewportHelperPro
private static bool FactoryShowTextCheck(string diamondType, PlaneType planeType) private static bool FactoryShowTextCheck(string diamondType, PlaneType planeType)
{ {
string[] diamondTypes = diamondType.Split(" "); Dictionary<string, HashSet<PlaneType>> stepPlaneMappings = new()
string endType = diamondTypes.Last();
if ("S2".Equals(endType))
{ {
if (diamondTypes.Contains("S1")) ["S1"] = new() { PlaneType.CrownIncomplete },
{ ["S2"] = new() { PlaneType.CrownIncomplete, PlaneType.StarFacet },
if (planeType == PlaneType.CrownIncomplete || planeType == PlaneType.StarFacet) ["S3"] = new() { PlaneType.CrownIncomplete, PlaneType.StarFacet },
return true; ["S4"] = new() { PlaneType.CrownIncomplete },
} ["S5"] = new() { PlaneType.PavilionIncomplete },
} ["S6"] = new() { PlaneType.PavilionIncomplete },
["S7"] = new() { PlaneType.PavilionIncomplete, PlaneType.CrownIncomplete },
if ("S1".Equals(endType)) ["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 false;
return true;
} }
return allowedTypes.Contains(planeType);
return false;
} }
} }

Loading…
Cancel
Save