fix: 部署更新

master
Tongg 5 months ago
parent eb78978e50
commit aa090862f2
  1. 3
      App.config
  2. 32
      Model/Attributes/LogAttribute.cs
  3. 5
      SparkClient.sln.DotSettings.user
  4. 30
      ViewModel/Grading/DiamondSelectVM.cs
  5. 163
      ViewModel/Grading/GradingResultVM.cs
  6. 1
      Views/UserControl/ViewportData/Helper/ViewportHelperPro.cs
  7. 21
      Views/UserControl/ViewportData/Helper/ViewportManager.cs

@ -8,6 +8,9 @@
<add key="ImageFileBasePath" value="D:\diamond_images"/>
<!-- 算法失败时,历史图片保存文件夹路径 -->
<add key="ImageHistoryPath" value="D:\ImageHistory"/>
<add key="PrintName" value="Deli DL-770D"/>
<add key="PrintWidth" value="400"/>
<add key="PrintHeight" value="300"/>
</appSettings>
<connectionStrings>
<add name="" connectionString=""/>

@ -3,6 +3,7 @@ using MethodDecorator.Fody.Interfaces;
using Rougamo;
using Rougamo.Context;
using System.Reflection;
using System.Text;
namespace SparkClient.Model.Attributes
{
@ -11,24 +12,33 @@ namespace SparkClient.Model.Attributes
{
private static readonly ILog Logger = LogManager.GetLogger(typeof(LogAttribute));
//public void OnEntry(MethodBase method)
//{
// Logger.Debug($"Entering {method.DeclaringType?.Name}.{method.Name}");
//}
//public void OnExit(MethodBase method)
//{
// Logger.Debug($"Exiting {method.DeclaringType?.Name}.{method.Name}");
//}
public override void OnEntry(MethodContext context)
{
Logger.Debug($"Entering {context.Method.DeclaringType?.Name}.{context.Method.Name}");
//Logger.Debug($"Entering {context.Method.DeclaringType?.Name}.{context.Method.Name}");
// 获取方法参数
var parameters = context.Method.GetParameters();
var arguments = context.Arguments;
// 构建参数字符串
var parameterLog = new StringBuilder();
for (int i = 0; i < parameters.Length; i++)
{
parameterLog.Append($"{parameters[i].Name} = {arguments[i]}, ");
}
// 记录日志
Logger.Debug($"Entering {context.Method.DeclaringType?.Name}.{context.Method.Name} with parameters: {parameterLog}");
}
public override void OnExit(MethodContext context)
{
Logger.Debug($"Exiting {context.Method.DeclaringType?.Name}.{context.Method.Name}");
//Logger.Debug($"Exiting {context.Method.DeclaringType?.Name}.{context.Method.Name}");
// 获取返回值
var returnValue = context.ReturnValue;
// 记录日志
Logger.Debug($"Exiting {context.Method.DeclaringType?.Name}.{context.Method.Name} with return value: {returnValue}");
}
}
}

@ -40,6 +40,7 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFrameworkElement_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6412d4331611499aab4eb63809a2a83bf60910_003F07_003Fdab5922a_003FFrameworkElement_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFrameworkElement_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6412d4331611499aab4eb63809a2a83bf60910_003F07_003Fdab5922a_003FFrameworkElement_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AFuture_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F6f90c6c13479b8c2a5be98f3d75dfc3bd885a055652d8a32904ca2448132949e_003FFuture_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AGraphics_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb6416db4533e4255bc43c1cfd556a910175930_003Fa9_003Ff7e2a9a8_003FGraphics_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AGuid_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F211e6f3b24fa438a92f1815153647ce2c8f908_003Faa_003Fa49e75b9_003FGuid_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AHorizontalAlignment_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6412d4331611499aab4eb63809a2a83bf60910_003F45_003F96f9f663_003FHorizontalAlignment_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AILog_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fcd69d110241e68c102d90de60fe9abbdef79631973c35119af9fe6139bcdbc_003FILog_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
@ -60,8 +61,10 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMethodBaseInvoker_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fd882146b4f265f10bcbec2663fce248db9ffec5fa1aeaf76e32a11ba5eafcd6_003FMethodBaseInvoker_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AObjExporter_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F68d37d16685244cf9996bf767117a771210200_003Fb5_003F8d39bfb2_003FObjExporter_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003APictureBoxSizeMode_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F1f2f0b08d2574f1aa35973d1cd0ae347cef920_003Fb2_003F76f4e66c_003FPictureBoxSizeMode_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003APrintController_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb6416db4533e4255bc43c1cfd556a910175930_003Fd9_003Fccfaf320_003FPrintController_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003APrintPreviewDialog_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F1f2f0b08d2574f1aa35973d1cd0ae347cef920_003F07_003Fd26ee918_003FPrintPreviewDialog_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003APropertyChangedEventArgs_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F4a37508f5f72412da47f18c02ce8145313928_003F27_003F53f616d3_003FPropertyChangedEventArgs_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARougamoPool_00601_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fe6791e39471d4d42a4a2478530abe7195a00_003F5e_003Fc0560022_003FRougamoPool_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARoutedEventArgs_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F1a88b4a860176dd5f825206bbebf3ee3d44ff3f058ceed9eb693c1eaa018_003FRoutedEventArgs_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARuntimeType_002ECoreCLR_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F955ec549fe664629353c3b5424b6ad6c7dfcec4ab59bae709ab962c228cf45_003FRuntimeType_002ECoreCLR_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ARuntimeType_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F5147b10c5a8c4522b56fba0a889139cfc8f908_003F45_003F2a5f113e_003FRuntimeType_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
@ -72,6 +75,7 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AStaticResourceExtension_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F6412d4331611499aab4eb63809a2a83bf60910_003F88_003Fef12a016_003FStaticResourceExtension_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATaskCompletionSource_00601_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F5147b10c5a8c4522b56fba0a889139cfc8f908_003Ffc_003Fe9092391_003FTaskCompletionSource_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATask_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F211e6f3b24fa438a92f1815153647ce2c8f908_003F72_003F6381d5d3_003FTask_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATask_00601_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F211e6f3b24fa438a92f1815153647ce2c8f908_003Fc7_003F4331ea58_003FTask_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATextInfo_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F68d37d16685244cf9996bf767117a771210200_003F3a_003Ff14dd285_003FTextInfo_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThrowHelper_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fcca5cfb955e146648d91eb22ffe4627a84930_003F7a_003F2d86be72_003FThrowHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThrowHelper_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003Fc7da56581ee7b20208f09e80b735961e4d5d7b9e5562bfdec94a75c57b391_003FThrowHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
@ -80,6 +84,7 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThrowHelper_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F2c8e7ca976f350cba9836d5565dac56b11e0b56656fa786460eb1395857a6fa_003FThrowHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATriggerAction_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F95b2fd5cb826a0d61aff88f87b258644cfe6df15959e521eb9d6cc8da70dc52_003FTriggerAction_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AUIElement_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F96a561fe76144633acef44f09d0dcb8a825920_003F3e_003Fdefca5b2_003FUIElement_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AUIElement_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F96a561fe76144633acef44f09d0dcb8a825920_003F3e_003Fdefca5b2_003FUIElement_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AUIElement_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fbfd90ad81939493b96034353abcd1045825908_003F4b_003F18f975e4_003FUIElement_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AUndoStack_002Ecs_002Fl_003AC_0021_003FUsers_003Ftongg_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F85eb3e3af2ef415e8072243864dec55a97e00_003F18_003F3f9ef08f_003FUndoStack_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AUnsafeNativeMethodsCLR_002Ecs_002Fl_003AC_0021_003FUsers_003FAdministrator_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FSourcesCache_003F2e8b8aa5d488ba9b46d9ca2a747d6895994b3519f2f231f4e3d1af87b86320_003FUnsafeNativeMethodsCLR_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>

@ -22,6 +22,7 @@ using SparkClient.Model.Common;
using Color = System.Windows.Media.Color;
using MessageBox = SparkClient.Views.Dialog.MessageBox;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices.JavaScript;
using SparkClient.Model.Attributes;
namespace SparkClient.ViewModel.Grading;
@ -220,10 +221,10 @@ public class DiamondSelectVM : BaseViewModel
_algorithmServer = new AlgorithmServer();
// //图片集合
string image_files = JsonConvert.SerializeObject(socResolt.Images, Formatting.Indented);
//string image_files =$"[ \"image_0.bmp\", \"image_1.bmp\", \"image_2.bmp\", \"image_3.bmp\", \"image_4.bmp\", \"image_5.bmp\", \"image_6.bmp\", \"image_7.bmp\", \"image_8.bmp\", \"image_9.bmp\", \"image_10.bmp\", \"image_11.bmp\", \"image_12.bmp\", \"image_13.bmp\", \"image_14.bmp\", \"image_15.bmp\", \"image_16.bmp\", \"image_17.bmp\", \"image_18.bmp\", \"image_19.bmp\", \"image_20.bmp\", \"image_21.bmp\", \"image_22.bmp\", \"image_23.bmp\", \"image_24.bmp\", \"image_25.bmp\", \"image_26.bmp\", \"image_27.bmp\", \"image_28.bmp\", \"image_29.bmp\", \"image_30.bmp\", \"image_31.bmp\", \"image_32.bmp\", \"image_33.bmp\", \"image_34.bmp\", \"image_35.bmp\", \"image_36.bmp\", \"image_37.bmp\", \"image_38.bmp\", \"image_39.bmp\", \"image_40.bmp\", \"image_41.bmp\", \"image_42.bmp\", \"image_43.bmp\", \"image_44.bmp\", \"image_45.bmp\", \"image_46.bmp\", \"image_47.bmp\", \"image_48.bmp\", \"image_49.bmp\", \"image_50.bmp\", \"image_51.bmp\", \"image_52.bmp\", \"image_53.bmp\", \"image_54.bmp\", \"image_55.bmp\", \"image_56.bmp\", \"image_57.bmp\", \"image_58.bmp\", \"image_59.bmp\", \"image_60.bmp\", \"image_61.bmp\", \"image_62.bmp\", \"image_63.bmp\", \"image_64.bmp\", \"image_65.bmp\", \"image_66.bmp\", \"image_67.bmp\", \"image_68.bmp\", \"image_69.bmp\", \"image_70.bmp\", \"image_71.bmp\", \"image_72.bmp\", \"image_73.bmp\", \"image_74.bmp\", \"image_75.bmp\", \"image_76.bmp\", \"image_77.bmp\", \"image_78.bmp\", \"image_79.bmp\", \"image_80.bmp\", \"image_81.bmp\", \"image_82.bmp\", \"image_83.bmp\", \"image_84.bmp\", \"image_85.bmp\", \"image_86.bmp\", \"image_87.bmp\", \"image_88.bmp\", \"image_89.bmp\", \"image_90.bmp\", \"image_91.bmp\", \"image_92.bmp\", \"image_93.bmp\", \"image_94.bmp\", \"image_95.bmp\", \"image_96.bmp\", \"image_97.bmp\", \"image_98.bmp\", \"image_99.bmp\"]" ;
// string image_files =$"[ \"image_0.bmp\", \"image_1.bmp\", \"image_2.bmp\", \"image_3.bmp\", \"image_4.bmp\", \"image_5.bmp\", \"image_6.bmp\", \"image_7.bmp\", \"image_8.bmp\", \"image_9.bmp\", \"image_10.bmp\", \"image_11.bmp\", \"image_12.bmp\", \"image_13.bmp\", \"image_14.bmp\", \"image_15.bmp\", \"image_16.bmp\", \"image_17.bmp\", \"image_18.bmp\", \"image_19.bmp\", \"image_20.bmp\", \"image_21.bmp\", \"image_22.bmp\", \"image_23.bmp\", \"image_24.bmp\", \"image_25.bmp\", \"image_26.bmp\", \"image_27.bmp\", \"image_28.bmp\", \"image_29.bmp\", \"image_30.bmp\", \"image_31.bmp\", \"image_32.bmp\", \"image_33.bmp\", \"image_34.bmp\", \"image_35.bmp\", \"image_36.bmp\", \"image_37.bmp\", \"image_38.bmp\", \"image_39.bmp\", \"image_40.bmp\", \"image_41.bmp\", \"image_42.bmp\", \"image_43.bmp\", \"image_44.bmp\", \"image_45.bmp\", \"image_46.bmp\", \"image_47.bmp\", \"image_48.bmp\", \"image_49.bmp\", \"image_50.bmp\", \"image_51.bmp\", \"image_52.bmp\", \"image_53.bmp\", \"image_54.bmp\", \"image_55.bmp\", \"image_56.bmp\", \"image_57.bmp\", \"image_58.bmp\", \"image_59.bmp\", \"image_60.bmp\", \"image_61.bmp\", \"image_62.bmp\", \"image_63.bmp\", \"image_64.bmp\", \"image_65.bmp\", \"image_66.bmp\", \"image_67.bmp\", \"image_68.bmp\", \"image_69.bmp\", \"image_70.bmp\", \"image_71.bmp\", \"image_72.bmp\", \"image_73.bmp\", \"image_74.bmp\", \"image_75.bmp\", \"image_76.bmp\", \"image_77.bmp\", \"image_78.bmp\", \"image_79.bmp\", \"image_80.bmp\", \"image_81.bmp\", \"image_82.bmp\", \"image_83.bmp\", \"image_84.bmp\", \"image_85.bmp\", \"image_86.bmp\", \"image_87.bmp\", \"image_88.bmp\", \"image_89.bmp\", \"image_90.bmp\", \"image_91.bmp\", \"image_92.bmp\", \"image_93.bmp\", \"image_94.bmp\", \"image_95.bmp\", \"image_96.bmp\", \"image_97.bmp\", \"image_98.bmp\", \"image_99.bmp\"]" ;
// 保存图片到历史记录文件夹
HandleAlgorithmFailure(image_files);
HandleAlgorithmFailure(image_files, DiamondCode);
// 启动算法
@ -250,6 +251,27 @@ public class DiamondSelectVM : BaseViewModel
parameter.CrownType = value.Split(" ")[1];
parameter.PavType = value.Split(" ")[2];
parameter.DiamondCode = DiamondCode;
//参数实体转json输出
try
{
string parameterJson = JsonConvert.SerializeObject(parameter);
;
string outputPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "logs", "result");
if (!Directory.Exists(outputPath))
Directory.CreateDirectory(outputPath);
string outputFilePath = $"{outputPath}/{DiamondCode}-{DateTime.Now:yyyyMMdd_HHmmss}.json";
using (var file = File.Create(outputFilePath))
using (StreamWriter stream = new StreamWriter(file))
{
stream.Write(parameterJson);
}
}
catch (Exception ex)
{
Logger.Error("output输出失败:"+ex.Message);
}
isEnd = true;
//GradingResult(parameter);
await loading.Dispatcher.Invoke(async () =>
@ -423,7 +445,7 @@ public class DiamondSelectVM : BaseViewModel
///
private static readonly ILog Logger = LogManager.GetLogger(typeof(AlgorithmServer));
[Log]
private void HandleAlgorithmFailure(string image_files)
private void HandleAlgorithmFailure(string image_files, string dCode = "")
{
// 从配置文件中读取 imageHistoryPath
@ -438,7 +460,7 @@ public class DiamondSelectVM : BaseViewModel
// 生成时间戳,格式为 yyyyMMddHHmmss
string timestamp = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss");
// 组合新的文件夹路径
string newFolderPath = Path.Combine(imageHistoryPath, $"image-{timestamp}");
string newFolderPath = Path.Combine(imageHistoryPath, string.IsNullOrWhiteSpace(dCode) ? $"image-{timestamp}" : $"image-{dCode}-{timestamp}" );
// 检查 D 盘内存空间
DriveInfo dDrive = new DriveInfo("D");

@ -1,4 +1,5 @@
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.IO;
using System.IO.Ports;
@ -31,6 +32,7 @@ using System.Windows.Media;
using Brush = System.Drawing.Brush;
using Brushes = System.Drawing.Brushes;
using SparkClient.Model.Attributes;
using PaperSize = System.Drawing.Printing.PaperSize;
namespace SparkClient.ViewModel.Grading;
/// <summary>
@ -1833,40 +1835,60 @@ public class GradingResultVM : BaseViewModel
CustomPrintPreviewForm customPreviewForm = new CustomPrintPreviewForm(printDocument);
// 显示自定义打印预览窗体
// DialogResult result = customPreviewForm.ShowDialog();
MessageBox messageBox = new MessageBox();
MessageBoxResult boxResult = messageBox.ShowAsk(MultilingualHelper.getString("YesOrNo"));
if (boxResult == MessageBoxResult.OK)
{
// 打开串口
if (!_serialPort.IsOpen)
{
_serialPort.Open();
}
// if (!_serialPort.IsOpen)
// {
// _serialPort.Open();
// }
// 将绘制内容转换为字节数组
MemoryStream memoryStream = new MemoryStream();
using (Bitmap bitmap = new Bitmap((int)printDocument.DefaultPageSettings.PrintableArea.Width, (int)printDocument.DefaultPageSettings.PrintableArea.Height))
{
using (var graphics = Graphics.FromImage(bitmap))
{
// 计算可打印区域的 Rectangle
var margins = new Margins(0, 0, 0, 0);
var printableArea = new System.Drawing.Rectangle(margins.Left, margins.Top,
(int)printDocument.DefaultPageSettings.PrintableArea.Width - margins.Left - margins.Right,
(int)printDocument.DefaultPageSettings.PrintableArea.Height - margins.Top - margins.Bottom);
// 调用 PreparePrintData 方法绘制内容到 Graphics 对象
// 注意这里的第三个参数应该是 Rectangle 类型
PreparePrintData(printDocument, new PrintPageEventArgs(graphics, printableArea, printableArea, new PageSettings()));
}
// 将 Bitmap 保存到 MemoryStream 中
bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Png);
}
byte[] dataToSend = memoryStream.ToArray();
// MemoryStream memoryStream = new MemoryStream();
// using (Bitmap bitmap = new Bitmap((int)printDocument.DefaultPageSettings.PrintableArea.Width, (int)printDocument.DefaultPageSettings.PrintableArea.Height))
// {
// using (var graphics = Graphics.FromImage(bitmap))
// {
// // 计算可打印区域的 Rectangle
// var margins = new Margins(0, 0, 0, 0);
// var printableArea = new System.Drawing.Rectangle(margins.Left, margins.Top,
// (int)printDocument.DefaultPageSettings.PrintableArea.Width - margins.Left - margins.Right,
// (int)printDocument.DefaultPageSettings.PrintableArea.Height - margins.Top - margins.Bottom);
//
// // 调用 PreparePrintData 方法绘制内容到 Graphics 对象
// // 注意这里的第三个参数应该是 Rectangle 类型
// PreparePrintData(printDocument, new PrintPageEventArgs(graphics, printableArea, printableArea, new PageSettings()));
// }
// // 将 Bitmap 保存到 MemoryStream 中
// bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Png);
// }
// byte[] dataToSend = memoryStream.ToArray();
string? printName = ConfigurationManager.AppSettings["PrintName"];
string? printWidth = ConfigurationManager.AppSettings["PrintWidth"];
string? printHeight = ConfigurationManager.AppSettings["PrintHeight"];
int pageWidth = 400;
int pageHeight = 300;
if (string.IsNullOrWhiteSpace(printName) || string.IsNullOrWhiteSpace(printWidth) ||
string.IsNullOrWhiteSpace(printHeight) )
{
Logger.Info("缺少打印配置。");
throw new Exception("The printer parameter is invalid");
}
int.TryParse(printWidth, out pageWidth);
int.TryParse(printHeight, out pageHeight);
printDocument.PrinterSettings.PrinterName = printName;
printDocument.DefaultPageSettings.PaperSize = new PaperSize("mm", pageWidth, pageHeight);
printDocument.PrintController = new System.Drawing.Printing.StandardPrintController();
// DialogResult result = customPreviewForm.ShowDialog();
printDocument.Print();
// 发送数据到串口
_serialPort.Write(dataToSend, 0, dataToSend.Length);
//_serialPort.Write(dataToSend, 0, dataToSend.Length);
Logger.Info("数据已发送到热敏打印机。");
}
@ -1879,10 +1901,10 @@ public class GradingResultVM : BaseViewModel
finally
{
// 关闭串口
if (_serialPort.IsOpen)
{
_serialPort.Close();
}
// if (_serialPort.IsOpen)
// {
// _serialPort.Close();
// }
}
}
@ -1951,13 +1973,18 @@ public class GradingResultVM : BaseViewModel
[Log]
private void PreparePrintData(object sender, PrintPageEventArgs e)
{
int width = e.PageSettings.PaperSize.Width;
var result = algorithmResult.measurements;
int startX = 10;
int startY = 10;
var col2X = startX + 160;
var col3X = col2X + 100;
int startX = 3;
int startY = 3;
var col2X = startX + (width * 0.2f);
var col3X = col2X + (width * 0.2f);
var col4X = col3X + (width * 0.2f);
var col5X = col4X + (width * 0.2f);
// 设置字体
Font font = new Font(FontFamily.GenericSerif, 12, FontStyle.Bold);
Font font = new Font(FontFamily.GenericSerif, 6, FontStyle.Bold);
// 设置颜色
Brush brush = Brushes.Black;
@ -1970,125 +1997,125 @@ public class GradingResultVM : BaseViewModel
// 绘制文本
// 第一行
int X = startX;
int Y = startY;
float X = startX;
float Y = startY;
e.Graphics.DrawString($"{MultilingualHelper.getString("Organization")}:{Standard}", font, brush, new PointF(X, Y));
e.Graphics.DrawString($"{MultilingualHelper.getString("DiamondResultShape")}:{Shape}", font, brush, new PointF(col2X, Y));
e.Graphics.DrawString($"{MultilingualHelper.getString("Code")}:{DiamondCode}", font, brush, new PointF(col3X, Y));
e.Graphics.DrawString($"{MultilingualHelper.getString("Wight")}:{Wight}ct.", font, brush, new PointF(540, Y));
e.Graphics.DrawString($"{MultilingualHelper.getString("Wight")}:{Wight}ct.", font, brush, new PointF(col5X, Y));
// 第二行
X = startX;
Y += font.Height;
Y += font.Height + 2;
e.Graphics.DrawString($"{MultilingualHelper.getString("Parameters")}", font, brush, new PointF(X, Y));
e.Graphics.DrawString($"{MultilingualHelper.getString("DiamondResultGridAvgValue")}", font, brush, new PointF(col2X, Y));
e.Graphics.DrawString($"{MultilingualHelper.getString("Interval")}(Min~Max)", font, brush, new PointF(col3X, Y));
e.Graphics.DrawString($"{MultilingualHelper.getString("DiamondResultGridCutLevel")}", font, brush, new PointF(420, Y));
e.Graphics.DrawString($"{MultilingualHelper.getString("DiamondResultSymmetryGrade")}", font, brush, new PointF(540, Y));
e.Graphics.DrawString($"{MultilingualHelper.getString("Interval")}(Min~Max)", font, brush, new PointF(col3X, Y));
e.Graphics.DrawString($"{MultilingualHelper.getString("DiamondResultGridCutLevel")}", font, brush, new PointF(col4X, Y));
e.Graphics.DrawString($"{MultilingualHelper.getString("DiamondResultSymmetryGrade")}", font, brush, new PointF(col5X, Y));
// 第三行
// 直径
var d = getSelectData("DIAMETER");
X = startX;
Y += font.Height;
Y += font.Height + 2;
e.Graphics.DrawString($"{GetName("DIAMETER")}(mm)", font, brush, new PointF(X, Y));
X = col2X;
e.Graphics.DrawString(d.Avg, font, brush, new PointF(X, Y));
X = col3X;
e.Graphics.DrawString($"({d.Min}-{d.Max})", font, brush, new PointF(X, Y));
e.Graphics.DrawString($"-", font, brush, new PointF(420, Y));
e.Graphics.DrawString($"{d.SymLevel}", font, brush, new PointF(540, Y));
e.Graphics.DrawString($"-", font, brush, new PointF(col4X, Y));
e.Graphics.DrawString($"{d.SymLevel}", font, brush, new PointF(col5X, Y));
// 第四行
// 全深比
var o = getSelectData("TOTAL_DEPTH");
X = startX;
Y += font.Height;
Y += font.Height + 2;
e.Graphics.DrawString($"{GetName("TOTAL_DEPTH")}(%)", font, brush, new PointF(X, Y));
X = col2X;
e.Graphics.DrawString(o.Avg, font, brush, new PointF(X, Y));
X = col3X;
e.Graphics.DrawString($"-", font, brush, new PointF(X, Y));
e.Graphics.DrawString($"{o.CutLevel}", font, brush, new PointF(420, Y));
e.Graphics.FillRectangle(backgroundBrush, new RectangleF(540, Y, 100, font.Height));
e.Graphics.DrawString($"{o.CutLevel}", font, brush, new PointF(col4X, Y));
e.Graphics.FillRectangle(backgroundBrush, new RectangleF(col5X, Y, 150, font.Height));
// 第五行
// 台宽比
var t = getSelectData("TABLE");
X = startX;
Y += font.Height;
Y += font.Height + 2;
e.Graphics.DrawString($"{GetName("TABLE")}(%)", font, brush, new PointF(X, Y));
X = col2X;
e.Graphics.DrawString(t.Avg, font, brush, new PointF(X, Y));
X = col3X;
e.Graphics.DrawString($"({t.Min}-{t.Max})", font, brush, new PointF(X, Y));
e.Graphics.DrawString($"{t.CutLevel}", font, brush, new PointF(420, Y));
e.Graphics.FillRectangle(backgroundBrush, new RectangleF(540, Y, 100, font.Height));
e.Graphics.DrawString($"{t.CutLevel}", font, brush, new PointF(col4X, Y));
e.Graphics.FillRectangle(backgroundBrush, new RectangleF(col5X, Y, 150, font.Height));
// 第六行
// 冠角
var c = getSelectData("CROWN_ANGLE");
X = startX;
Y += font.Height;
Y += font.Height + 2;
e.Graphics.DrawString($"{GetName("CROWN_ANGLE")}(°)", font, brush, new PointF(X, Y));
X = col2X;
e.Graphics.DrawString(c.Avg, font, brush, new PointF(X, Y));
X = col3X;
e.Graphics.DrawString($"({c.Min}-{c.Max})", font, brush, new PointF(X, Y));
X += 120;
e.Graphics.DrawString($"{c.CutLevel}", font, brush, new PointF(420, Y));
e.Graphics.DrawString($"{c.SymLevel}", font, brush, new PointF(540, Y));
e.Graphics.DrawString($"{c.CutLevel}", font, brush, new PointF(col4X, Y));
e.Graphics.DrawString($"{c.SymLevel}", font, brush, new PointF(col5X, Y));
// 第七行
// 冠高比
var h = getSelectData("CROWN_HEIGHT");
X = startX;
Y += font.Height;
Y += font.Height + 2;
e.Graphics.DrawString($"{GetName("CROWN_HEIGHT")}(%)", font, brush, new PointF(X, Y));
X = col2X;
e.Graphics.DrawString(h.Avg, font, brush, new PointF(X, Y));
X = col3X;
e.Graphics.DrawString($"({h.Min}-{h.Max})", font, brush, new PointF(X, Y));
X += 60;
e.Graphics.DrawString($"{h.CutLevel}", font, brush, new PointF(420, Y));
e.Graphics.DrawString($"{h.SymLevel}", font, brush, new PointF(540, Y));
e.Graphics.DrawString($"{h.CutLevel}", font, brush, new PointF(col4X, Y));
e.Graphics.DrawString($"{h.SymLevel}", font, brush, new PointF(col5X, Y));
// 第八行
// 波谷腰厚
var g = getSelectData("GIRDLE");
X = startX;
Y += font.Height;
Y += font.Height + 2;
e.Graphics.DrawString($"{GetName("GIRDLE")}(%)", font, brush, new PointF(X, Y));
X = col2X;
e.Graphics.DrawString(g.Avg, font, brush, new PointF(X, Y));
X = col3X;
e.Graphics.DrawString($"({g.Min}-{g.Max})", font, brush, new PointF(X, Y));
e.Graphics.DrawString($"{g.CutLevel}", font, brush, new PointF(420, Y));
e.Graphics.DrawString($"{g.SymLevel}", font, brush, new PointF(540, Y));
e.Graphics.DrawString($"{g.CutLevel}", font, brush, new PointF(col4X, Y));
e.Graphics.DrawString($"{g.SymLevel}", font, brush, new PointF(col5X, Y));
// 第九行
// 亭深比
var p = getSelectData("PAV_DEPTH");
X = startX;
Y += font.Height;
Y += font.Height + 2;
e.Graphics.DrawString($"{GetName("PAV_DEPTH")}(%)", font, brush, new PointF(X, Y));
X = col2X;
e.Graphics.DrawString(p.Avg, font, brush, new PointF(X, Y));
X = col3X;
e.Graphics.DrawString($"({p.Min}-{p.Max})", font, brush, new PointF(X, Y));
e.Graphics.DrawString($"{p.CutLevel}", font, brush, new PointF(420, Y));
e.Graphics.DrawString($"{p.SymLevel}", font, brush, new PointF(540, Y));
e.Graphics.DrawString($"{p.CutLevel}", font, brush, new PointF(col4X, Y));
e.Graphics.DrawString($"{p.SymLevel}", font, brush, new PointF(col5X, Y));
// 第十行
X = startX;
Y += font.Height;
e.Graphics.FillRectangle(backgroundBrush, new RectangleF(X, Y, 130, font.Height));
Y += font.Height + 2;
e.Graphics.FillRectangle(backgroundBrush, new RectangleF(X, Y, col2X - 5, font.Height));
e.Graphics.DrawString($"{MultilingualHelper.getString("CuttingGrade")}", font, Brushes.White, new PointF(X, Y));
X = col2X;
e.Graphics.DrawString(CutLevelTotal, font, Brushes.Red, new PointF(X, Y));
e.Graphics.DrawString(CutLevelTotal, font, Brushes.Black, new PointF(X, Y));
// 第十一行
X = startX;
Y += font.Height;
e.Graphics.FillRectangle(backgroundBrush, new RectangleF(X, Y, 130, font.Height));
Y += font.Height + 2;
e.Graphics.FillRectangle(backgroundBrush, new RectangleF(X, Y, col2X - 5, font.Height));
e.Graphics.DrawString($"{MultilingualHelper.getString("SymmetryLevel")}", font, Brushes.White, new PointF(X, Y));
X = col2X;
e.Graphics.DrawString(SymLevelTotal, font, Brushes.Red, new PointF(X, Y));
e.Graphics.DrawString(SymLevelTotal, font, Brushes.Black, new PointF(X, Y));
X = col3X;
e.Graphics.DrawString($"{MultilingualHelper.getString("DateOfIssue")}: {DateTime.Now:yyyy/M/d}", font, brush, new PointF(X, Y));

@ -363,6 +363,7 @@ public class ViewportHelperPro
foreach (var yaoFace in feactList)
{
if (feactList.Count == 1 && "0_0".Equals(yaoFace.Key)) return null;
List<Vector3> selFaceVector = new List<Vector3>();
foreach (var entity in yaoFace.Value)
{

@ -6,6 +6,7 @@ using HelixToolkit.Wpf.SharpDX;
using MathNet.Numerics;
using SharpDX;
using SharpDX.Direct3D11;
using SparkClient.Views.Dialog;
using SparkClient.Views.UserControl.ViewportData.Entity;
using SparkClient.Views.UserControl.ViewportData.Enum;
using GeometryModel3D = HelixToolkit.Wpf.SharpDX.GeometryModel3D;
@ -337,7 +338,25 @@ public class ViewportManager
MainModelLighting = ViewportHelperPro.GenerateLightingForModel(_viewport);
MainModelMeshes = ViewportHelperPro.GenerateModelByEntityGroupByType(entities);
MainModelLines.AddRange(ViewportHelperPro.GentrateLineGirdleByEntity(entities));
var gridle = ViewportHelperPro.GentrateLineGirdleByEntity(entities);
if (gridle == null)
{
gridle = new List<LineGeometryModel3D>();
DicValueParamToFacet.Remove("DIAMETER");
DicValueParamToFacet.Remove("GIRDLE_BEZEL");
DicValueParamToFacet.Remove("GIRDLE_BONE");
DicValueParamToFacet.Remove("GIRDLE_VALLEY");
}
else
{
DicValueParamToFacet.TryAdd("DIAMETER", PlaneType.Girdle);
DicValueParamToFacet.TryAdd("GIRDLE_BEZEL", PlaneType.Girdle);
DicValueParamToFacet.TryAdd("GIRDLE_BONE", PlaneType.Girdle);
DicValueParamToFacet.TryAdd("GIRDLE_VALLEY", PlaneType.Girdle);
}
MainModelLines.AddRange(gridle);
//切换相机视角
_viewport.Camera = ViewportHelperPro.CalculateCamera(PositiveDirection, ModelBounds);

Loading…
Cancel
Save