diff --git a/LoginWindow.xaml.cs b/LoginWindow.xaml.cs
index 9ae2cc1..e9a1ca6 100644
--- a/LoginWindow.xaml.cs
+++ b/LoginWindow.xaml.cs
@@ -22,7 +22,7 @@ public partial class LoginWindow : Window
PasswordBox.Password = Settings.SelectValueById("SAVE_PASSWORD");
try
{
- string version = AESHelper.Decrypt(ConfigurationHelper.ReadConfigValue("AppVersion"));
+ string version = Common.AssemblyFileVersion();
TBlockAppVersion.Text = $"Version {version}";
}
catch
diff --git a/Model/Helper/Common.cs b/Model/Helper/Common.cs
index 21566b6..6de4ec5 100644
--- a/Model/Helper/Common.cs
+++ b/Model/Helper/Common.cs
@@ -26,6 +26,7 @@ public class Common
public static object LastParam = "ROUND P8 P8";
+
///
/// 将 DataTable 转换为 JSON 字符串
///
@@ -104,4 +105,17 @@ public class Common
return string.Concat(hashBytes.Select(b => b.ToString("X2")));
}
}
+
+ public static string AssemblyFileVersion()
+ {
+ object[] attributes = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyFileVersionAttribute), false);
+ if (attributes.Length == 0)
+ {
+ return "";
+ }
+ else
+ {
+ return ((AssemblyFileVersionAttribute)attributes[0]).Version;
+ }
+ }
}
\ No newline at end of file
diff --git a/SparkClient.csproj b/SparkClient.csproj
index 544e17a..4429073 100644
--- a/SparkClient.csproj
+++ b/SparkClient.csproj
@@ -12,8 +12,8 @@
SparkClient钻石检测工具
Copyright ©2025 北京跃洋新视科技有限公司
北京跃洋新视科技有限公司
- 1.0.0
- 1.0.0
+ 1.0.2519
+ 1.0.2519
win-x64
diff --git a/ViewModel/Configuration/AlgorithmConfigVM.cs b/ViewModel/Configuration/AlgorithmConfigVM.cs
index bf37c8f..8e7ec34 100644
--- a/ViewModel/Configuration/AlgorithmConfigVM.cs
+++ b/ViewModel/Configuration/AlgorithmConfigVM.cs
@@ -438,6 +438,11 @@ public class AlgorithmConfigVM : BaseViewModel
{
Value = "P8-P8-S8",
Name = "P8-P8-S8"
+ },
+ new Param()
+ {
+ Value = "P8-P8-S9",
+ Name = "P8-P8-S9"
}
};
}
diff --git a/ViewModel/Grading/GradingResultVM.cs b/ViewModel/Grading/GradingResultVM.cs
index 966b977..f63a43b 100644
--- a/ViewModel/Grading/GradingResultVM.cs
+++ b/ViewModel/Grading/GradingResultVM.cs
@@ -27,16 +27,11 @@ using HandyControl.Controls;
using RectangleF = System.Drawing.RectangleF;
using FontFamily = System.Drawing.FontFamily;
using FontStyle = System.Drawing.FontStyle;
-using NPOI.SS.Formula.Functions;
-using System.Windows.Media;
-using HandyControl.Tools.Extension;
using NPOI.SS.Util;
using Brush = System.Drawing.Brush;
using Brushes = System.Drawing.Brushes;
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;
@@ -184,7 +179,7 @@ public class GradingResultVM : BaseViewModel
// 热敏标签打印
ThermalPrintCommand = new RelayCommand(ExecuteThermalPrint);
// 初始化 SerialPort
- InitializeSerialPort();
+ // InitializeSerialPort();
if (result != null)
{
@@ -193,15 +188,15 @@ public class GradingResultVM : BaseViewModel
machine = algorithmResult.DeviceId;
username = Settings.SelectValueById("PERMISSIONS");
- if (ruleId.StartsWith("IGI"))
- {
- IsEnabled = true;
- }
- else
- {
- IsEnabled = false;
- }
-
+ // if (ruleId.StartsWith("IGI"))
+ // {
+ // IsEnabled = true;
+ // }
+ // else
+ // {
+ // IsEnabled = false;
+ // }
+ IsEnabled = true;
if (algorithmResult.Status.Equals(StatusCodes.Recheck)) IsEnabled = false;
}
@@ -890,50 +885,11 @@ public class GradingResultVM : BaseViewModel
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, result.Measurements.GIRDLE);
+ info.Dev = calDev(info.Max, info.Min);
var data = result.Measurements;
var girdleValleyDetail = data.GIRDLE_VALLEY_DETAIL;
- // 变更 波谷评级计算方式
- // List gradeValues = new List();
- // gradeValues.Add(data.GIRDLE_VALLEY_DETAIL.GIRDLE_VALLEY_1);
- // gradeValues.Add(data.GIRDLE_VALLEY_DETAIL.GIRDLE_VALLEY_2);
- // gradeValues.Add(data.GIRDLE_VALLEY_DETAIL.GIRDLE_VALLEY_3);
- // gradeValues.Add(data.GIRDLE_VALLEY_DETAIL.GIRDLE_VALLEY_4);
- // gradeValues.Add(data.GIRDLE_VALLEY_DETAIL.GIRDLE_VALLEY_5);
- // gradeValues.Add(data.GIRDLE_VALLEY_DETAIL.GIRDLE_VALLEY_6);
- // gradeValues.Add(data.GIRDLE_VALLEY_DETAIL.GIRDLE_VALLEY_7);
- // gradeValues.Add(data.GIRDLE_VALLEY_DETAIL.GIRDLE_VALLEY_8);
- // gradeValues.Add(data.GIRDLE_VALLEY_DETAIL.GIRDLE_VALLEY_9);
- // gradeValues.Add(data.GIRDLE_VALLEY_DETAIL.GIRDLE_VALLEY_10);
- // gradeValues.Add(data.GIRDLE_VALLEY_DETAIL.GIRDLE_VALLEY_11);
- // gradeValues.Add(data.GIRDLE_VALLEY_DETAIL.GIRDLE_VALLEY_12);
- // gradeValues.Add(data.GIRDLE_VALLEY_DETAIL.GIRDLE_VALLEY_13);
- // gradeValues.Add(data.GIRDLE_VALLEY_DETAIL.GIRDLE_VALLEY_14);
- // gradeValues.Add(data.GIRDLE_VALLEY_DETAIL.GIRDLE_VALLEY_15);
- // gradeValues.Add(data.GIRDLE_VALLEY_DETAIL.GIRDLE_VALLEY_16);
- // gradeValues.Add(data.GIRDLE_BONE_DETAIL.GIRDLE_BONE_1);
- // gradeValues.Add(data.GIRDLE_BONE_DETAIL.GIRDLE_BONE_2);
- // gradeValues.Add(data.GIRDLE_BONE_DETAIL.GIRDLE_BONE_3);
- // gradeValues.Add(data.GIRDLE_BONE_DETAIL.GIRDLE_BONE_4);
- // gradeValues.Add(data.GIRDLE_BONE_DETAIL.GIRDLE_BONE_5);
- // gradeValues.Add(data.GIRDLE_BONE_DETAIL.GIRDLE_BONE_6);
- // gradeValues.Add(data.GIRDLE_BONE_DETAIL.GIRDLE_BONE_7);
- // gradeValues.Add(data.GIRDLE_BONE_DETAIL.GIRDLE_BONE_8);
- // gradeValues.Add(data.GIRDLE_BEZEL_DETAIL.GIRDLE_BEZEL_1);
- // gradeValues.Add(data.GIRDLE_BEZEL_DETAIL.GIRDLE_BEZEL_2);
- // gradeValues.Add(data.GIRDLE_BEZEL_DETAIL.GIRDLE_BEZEL_3);
- // gradeValues.Add(data.GIRDLE_BEZEL_DETAIL.GIRDLE_BEZEL_4);
- // gradeValues.Add(data.GIRDLE_BEZEL_DETAIL.GIRDLE_BEZEL_5);
- // gradeValues.Add(data.GIRDLE_BEZEL_DETAIL.GIRDLE_BEZEL_6);
- // gradeValues.Add(data.GIRDLE_BEZEL_DETAIL.GIRDLE_BEZEL_7);
- // gradeValues.Add(data.GIRDLE_BEZEL_DETAIL.GIRDLE_BEZEL_8);
- // double averageGrade = gradeValues.Average();
- info.CutLevel = calGrade_GIRDLE(data.GIRDLE, data.GIRDLE);
-
- // info.CutLevel = calGrade_GIRDLE(result.Measurements.GIRDLE_VALLEY_MIN, result.Measurements.GIRDLE_VALLEY_MAX);
- info.Dev = calDev(info.Max, info.Min);
-
-
if (girdleValleyDetail != null)
{
@@ -2370,217 +2326,233 @@ public class GradingResultVM : BaseViewModel
}
// 自定义打印预览窗体类
- public class CustomPrintPreviewForm : Form
- {
- private PrintPreviewControl printPreviewControl;
- private Button confirmButton;
- private Button systemPrintButton; // 新增的系统打印按钮
- private PrintDocument printDocument;
-
- public CustomPrintPreviewForm(PrintDocument document)
- {
- this.printDocument = document;
-
- // 初始化打印预览控件
- printPreviewControl = new PrintPreviewControl();
- printPreviewControl.Dock = DockStyle.Fill;
- printPreviewControl.Document = printDocument;
-
- // 初始化确认按钮
- confirmButton = new Button();
- confirmButton.Text = "确认打印";
- confirmButton.Dock = DockStyle.Bottom;
- confirmButton.Click += ConfirmButton_Click;
-
- // 初始化系统打印按钮
- // systemPrintButton = new Button();
- // systemPrintButton.Text = "系统打印";
- // systemPrintButton.Dock = DockStyle.Bottom;
- // systemPrintButton.Click += SystemPrintButton_Click;
-
- // 将控件添加到窗体
- this.Controls.Add(printPreviewControl);
- this.Controls.Add(confirmButton);
- this.Controls.Add(systemPrintButton);
-
- // 设置窗体属性
- this.Size = new System.Drawing.Size(800, 600);
- }
-
- [Log]
- private void ConfirmButton_Click(object sender, EventArgs e)
- {
- this.DialogResult = DialogResult.OK;
- this.Close();
- }
-
- [Log]
- private void SystemPrintButton_Click(object sender, EventArgs e)
- {
- // 创建一个打印对话框
- PrintDialog printDialog = new PrintDialog();
- // 将打印对话框关联到当前的 PrintDocument
- printDialog.Document = printDocument;
-
- // 显示打印对话框,如果用户点击了“确定”按钮
- if (printDialog.ShowDialog() == DialogResult.OK)
- {
- // 使用用户在对话框中选择的打印机和设置进行打印
- printDocument.Print();
- }
- }
- }
+ // public class CustomPrintPreviewForm : Form
+ // {
+ // private PrintPreviewControl printPreviewControl;
+ // private Button confirmButton;
+ // private Button systemPrintButton; // 新增的系统打印按钮
+ // private PrintDocument printDocument;
+ //
+ // public CustomPrintPreviewForm(PrintDocument document)
+ // {
+ // this.printDocument = document;
+ //
+ // // 初始化打印预览控件
+ // printPreviewControl = new PrintPreviewControl();
+ // printPreviewControl.Dock = DockStyle.Fill;
+ // printPreviewControl.Document = printDocument;
+ //
+ // // 初始化确认按钮
+ // confirmButton = new Button();
+ // confirmButton.Text = "确认打印";
+ // confirmButton.Dock = DockStyle.Bottom;
+ // confirmButton.Click += ConfirmButton_Click;
+ //
+ // // 初始化系统打印按钮
+ // // systemPrintButton = new Button();
+ // // systemPrintButton.Text = "系统打印";
+ // // systemPrintButton.Dock = DockStyle.Bottom;
+ // // systemPrintButton.Click += SystemPrintButton_Click;
+ //
+ // // 将控件添加到窗体
+ // this.Controls.Add(printPreviewControl);
+ // this.Controls.Add(confirmButton);
+ // this.Controls.Add(systemPrintButton);
+ //
+ // // 设置窗体属性
+ // this.Size = new System.Drawing.Size(800, 600);
+ // }
+ //
+ // [Log]
+ // private void ConfirmButton_Click(object sender, EventArgs e)
+ // {
+ // this.DialogResult = DialogResult.OK;
+ // this.Close();
+ // }
+ //
+ // [Log]
+ // private void SystemPrintButton_Click(object sender, EventArgs e)
+ // {
+ // // 创建一个打印对话框
+ // PrintDialog printDialog = new PrintDialog();
+ // // 将打印对话框关联到当前的 PrintDocument
+ // printDialog.Document = printDocument;
+ //
+ // // 显示打印对话框,如果用户点击了“确定”按钮
+ // if (printDialog.ShowDialog() == DialogResult.OK)
+ // {
+ // // 使用用户在对话框中选择的打印机和设置进行打印
+ // printDocument.Print();
+ // }
+ // }
+ //
+ // ///
+ // /// Required method for Designer support - do not modify
+ // /// the contents of this method with the code editor.
+ // ///
+ // private void InitializeComponent()
+ // {
+ // SuspendLayout();
+ // //
+ // // CustomPrintPreviewForm
+ // //
+ // ClientSize = new System.Drawing.Size(479, 388);
+ // ResumeLayout(false);
+ // }
+ //
+ //
+ // }
- [Log]
- private void PreparePrintData(object sender, PrintPageEventArgs e)
- {
- int width = e.PageSettings.PaperSize.Width;
-
-
- var result = algorithmResult.Measurements;
- 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, 6, FontStyle.Bold);
-
- // 设置颜色
- Brush brush = Brushes.Black;
-
- // 设置对齐方式
- StringFormat format = new StringFormat();
- format.Alignment = StringAlignment.Center; // 水平居中
- format.LineAlignment = StringAlignment.Center; // 垂直居中
- Brush backgroundBrush = new SolidBrush(System.Drawing.Color.Black); // 背景色为黑色
-
- // 绘制文本
- // 第一行
- 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(col5X, Y));
-
- // 第二行
- X = startX;
- 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(col4X, Y));
- e.Graphics.DrawString($"{MultilingualHelper.getString("DiamondResultSymmetryGrade")}", font, brush, new PointF(col5X, Y));
-
- // 第三行
- // 直径
- var d = getSelectData("DIAMETER");
- X = startX;
- 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(col4X, Y));
- e.Graphics.DrawString($"{d.SymLevel}", font, brush, new PointF(col5X, Y));
- // 第四行
- // 全深比
- var o = getSelectData("TOTAL_DEPTH");
- X = startX;
- 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(col4X, Y));
- e.Graphics.FillRectangle(backgroundBrush, new RectangleF(col5X, Y, 150, font.Height));
- // 第五行
- // 台宽比
- var t = getSelectData("TABLE");
- X = startX;
- 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(col4X, Y));
- e.Graphics.FillRectangle(backgroundBrush, new RectangleF(col5X, Y, 150, font.Height));
- // 第六行
- // 冠角
- var c = getSelectData("CROWN_ANGLE");
- X = startX;
- 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(col4X, Y));
- e.Graphics.DrawString($"{c.SymLevel}", font, brush, new PointF(col5X, Y));
- // 第七行
- // 冠高比
- var h = getSelectData("CROWN_HEIGHT");
- X = startX;
- 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(col4X, Y));
- e.Graphics.DrawString($"{h.SymLevel}", font, brush, new PointF(col5X, Y));
- // 第八行
- // 波谷腰厚
- var g = getSelectData("GIRDLE");
- X = startX;
- 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(col4X, Y));
- e.Graphics.DrawString($"{g.SymLevel}", font, brush, new PointF(col5X, Y));
- // 第九行
- // 亭深比
- var p = getSelectData("PAV_DEPTH");
- X = startX;
- 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(col4X, Y));
- e.Graphics.DrawString($"{p.SymLevel}", font, brush, new PointF(col5X, Y));
- // 第十行
- X = startX;
- 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.Black, new PointF(X, Y));
- // 第十一行
- X = startX;
- 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.Black, new PointF(X, Y));
- X = col3X;
- e.Graphics.DrawString($"{MultilingualHelper.getString("DateOfIssue")}: {DateTime.Now:yyyy/M/d}", font, brush, new PointF(X, Y));
-
- }
+ // [Log]
+ // private void PreparePrintData(object sender, PrintPageEventArgs e)
+ // {
+ // int width = e.PageSettings.PaperSize.Width;
+ //
+ //
+ // var result = algorithmResult.Measurements;
+ // 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, 6, FontStyle.Bold);
+ //
+ // // 设置颜色
+ // Brush brush = Brushes.Black;
+ //
+ // // 设置对齐方式
+ // StringFormat format = new StringFormat();
+ // format.Alignment = StringAlignment.Center; // 水平居中
+ // format.LineAlignment = StringAlignment.Center; // 垂直居中
+ // Brush backgroundBrush = new SolidBrush(System.Drawing.Color.Black); // 背景色为黑色
+ //
+ // // 绘制文本
+ // // 第一行
+ // 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(col5X, Y));
+ //
+ // // 第二行
+ // X = startX;
+ // 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(col4X, Y));
+ // e.Graphics.DrawString($"{MultilingualHelper.getString("DiamondResultSymmetryGrade")}", font, brush, new PointF(col5X, Y));
+ //
+ // // 第三行
+ // // 直径
+ // var d = getSelectData("DIAMETER");
+ // X = startX;
+ // 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(col4X, Y));
+ // e.Graphics.DrawString($"{d.SymLevel}", font, brush, new PointF(col5X, Y));
+ // // 第四行
+ // // 全深比
+ // var o = getSelectData("TOTAL_DEPTH");
+ // X = startX;
+ // 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(col4X, Y));
+ // e.Graphics.FillRectangle(backgroundBrush, new RectangleF(col5X, Y, 150, font.Height));
+ // // 第五行
+ // // 台宽比
+ // var t = getSelectData("TABLE");
+ // X = startX;
+ // 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(col4X, Y));
+ // e.Graphics.FillRectangle(backgroundBrush, new RectangleF(col5X, Y, 150, font.Height));
+ // // 第六行
+ // // 冠角
+ // var c = getSelectData("CROWN_ANGLE");
+ // X = startX;
+ // 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(col4X, Y));
+ // e.Graphics.DrawString($"{c.SymLevel}", font, brush, new PointF(col5X, Y));
+ // // 第七行
+ // // 冠高比
+ // var h = getSelectData("CROWN_HEIGHT");
+ // X = startX;
+ // 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(col4X, Y));
+ // e.Graphics.DrawString($"{h.SymLevel}", font, brush, new PointF(col5X, Y));
+ // // 第八行
+ // // 波谷腰厚
+ // var g = getSelectData("GIRDLE");
+ // X = startX;
+ // 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(col4X, Y));
+ // e.Graphics.DrawString($"{g.SymLevel}", font, brush, new PointF(col5X, Y));
+ // // 第九行
+ // // 亭深比
+ // var p = getSelectData("PAV_DEPTH");
+ // X = startX;
+ // 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(col4X, Y));
+ // e.Graphics.DrawString($"{p.SymLevel}", font, brush, new PointF(col5X, Y));
+ // // 第十行
+ // X = startX;
+ // 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.Black, new PointF(X, Y));
+ // // 第十一行
+ // X = startX;
+ // 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.Black, new PointF(X, Y));
+ // X = col3X;
+ // e.Graphics.DrawString($"{MultilingualHelper.getString("DateOfIssue")}: {DateTime.Now:yyyy/M/d}", font, brush, new PointF(X, Y));
+ //
+ // }
[Log]
private string GenerateTempExcelFile()
{
@@ -2683,116 +2655,116 @@ public class GradingResultVM : BaseViewModel
ICell cell = row.GetCell(cellRef.Col) ?? row.CreateCell(cellRef.Col);
cell.SetCellValue(value?.ToString() ?? "");
}
- [Log]
- private void PrintPageHandler(object sender, PrintPageEventArgs e)
- {
- var result = algorithmResult.Measurements;
- int startX = 10;
- int startY = 10;
- var col2X = startX + 90;
- var col3X = col2X + 70;
- // 设置字体
- Font font = new Font(FontFamily.GenericSerif, 12, FontStyle.Bold);
-
- // 设置颜色
- Brush brush = Brushes.Black;
-
- // 设置对齐方式
- StringFormat format = new StringFormat();
- format.Alignment = StringAlignment.Center; // 水平居中
- format.LineAlignment = StringAlignment.Center; // 垂直居中
-
- // 绘制文本
- // 第一行
- int X = startX;
- int Y = startY;
- e.Graphics.DrawString(Standard, font, brush, new PointF(X, Y));
- X += 70;
- e.Graphics.DrawString(Shape, font, brush, new PointF(X, Y));
- X += 50;
- e.Graphics.DrawString($"ID:{DiamondCode}", font, brush, new PointF(X, Y));
- X += 100;
- e.Graphics.DrawString($"Weight:{Wight}ct.", font, brush, new PointF(X, Y));
- X += 120;
- Brush backgroundBrush = new SolidBrush(System.Drawing.Color.Black); // 背景色为黄色
- e.Graphics.FillRectangle(backgroundBrush, new RectangleF(X, Y, 200, font.Height));
- e.Graphics.DrawString(CutLevelTotal, font, Brushes.White, new PointF(X, Y));
-
- // 第二行
- X = startX;
- Y += font.Height;
- e.Graphics.DrawString("Diameter", font, brush, new PointF(X, Y));
-
- e.Graphics.DrawString($"{FormatDouble_D(result.DIAMETER)}mm", font, brush, new PointF(col2X, Y));
-
- e.Graphics.DrawString($"({FormatDouble_D(result.M1)}mm-{FormatDouble_D(result.M2)}mm)", font, brush, new PointF(col3X, Y));
- e.Graphics.DrawString($"0.3%", font, brush, new PointF(310, Y));
- e.Graphics.FillRectangle(backgroundBrush, new RectangleF(350, Y, 200, font.Height));
- e.Graphics.DrawString(SymLevelTotal, font, Brushes.White, new PointF(X, Y));
-
- // 第三行
- X = startX;
- Y += font.Height;
- e.Graphics.DrawString("Total Dep.", font, brush, new PointF(X, Y));
- X = col2X;
- e.Graphics.DrawString($"{FormatDouble_D(result.DIAMETER * result.TOTAL_DEPTH)}mm", font, brush, new PointF(X, Y));
- X = col3X;
- e.Graphics.DrawString($"{FormatDouble_P(result.TOTAL_DEPTH)}%", font, brush, new PointF(X, Y));
- e.Graphics.DrawString($"{DtResults.Where(X=> "TOTAL_DEPTH".Equals(X.TestItemId)).Select(X=>X.CutLevel).FirstOrDefault()}", font, brush, new PointF(480, Y));
- // 第四行
- X = startX;
- Y += font.Height;
- e.Graphics.DrawString("Table", font, brush, new PointF(X, Y));
- X = col2X;
- e.Graphics.DrawString($"{FormatDouble_D(result.DIAMETER * result.TABLE)}mm", font, brush, new PointF(X, Y));
- X = col3X;
- e.Graphics.DrawString($"{FormatDouble_P(result.TABLE)}%", font, brush, new PointF(X, Y));
- e.Graphics.DrawString($"{DtResults.Where(X => "TABLE".Equals(X.TestItemId)).Select(X => X.CutLevel).FirstOrDefault()}", font, brush, new PointF(480, Y));
- // 第五行
- X = startX;
- Y += font.Height;
- e.Graphics.DrawString("Crown", font, brush, new PointF(X, Y));
- X = col2X;
- e.Graphics.DrawString($"{FormatDouble_A(result.CROWN_ANGLE)}°", font, brush, new PointF(X, Y));
- X = col3X;
- e.Graphics.DrawString($"({FormatDouble_A(result.CROWN_ANGLE_MIN)}°-{FormatDouble_A(result.CROWN_ANGLE_MAX)}°)", font, brush, new PointF(X, Y));
- X += 120;
- e.Graphics.DrawString($"({FormatDouble_A(result.CROWN_HEIGHT)}%)", font, brush, new PointF(X, Y));
- e.Graphics.DrawString($"{DtResults.Where(X => "CROWN_ANGLE".Equals(X.TestItemId)).Select(X => X.CutLevel).FirstOrDefault()}", font, brush, new PointF(410, Y));
- e.Graphics.DrawString($"{DtResults.Where(X => "CROWN_HEIGHT".Equals(X.TestItemId)).Select(X => X.CutLevel).FirstOrDefault()}", font, brush, new PointF(480, Y));
- // 第六行
- X = startX;
- Y += font.Height;
- e.Graphics.DrawString("Pavil.", font, brush, new PointF(X, Y));
- X = col2X;
- e.Graphics.DrawString($"{FormatDouble_A(result.PAV_ANGLE)}°", font, brush, new PointF(X, Y));
- X = col3X;
- e.Graphics.DrawString($"({FormatDouble_A(result.PAV_ANGLE_MIN)}°-{FormatDouble_A(result.PAV_ANGLE_MAX)}°)", font, brush, new PointF(X, Y));
- X += 120;
- e.Graphics.DrawString($"({FormatDouble_A(result.PAV_DEPTH)}%)", font, brush, new PointF(X, Y));
- e.Graphics.DrawString($"{DtResults.Where(X => "PAV_ANGLE".Equals(X.TestItemId)).Select(X => X.CutLevel).FirstOrDefault()}", font, brush, new PointF(410, Y));
- e.Graphics.DrawString($"{DtResults.Where(X => "PAV_DEPTH".Equals(X.TestItemId)).Select(X => X.CutLevel).FirstOrDefault()}", font, brush, new PointF(480, Y));
- // 第七行
- X = startX;
- Y += font.Height;
- e.Graphics.DrawString("Culet", font, brush, new PointF(X, Y));
- X = col2X;
- e.Graphics.DrawString($"{FormatDouble_P(result.CULET)}%", font, brush, new PointF(X, Y));
- X = col3X;
- e.Graphics.DrawString($"Twist", font, brush, new PointF(X, Y));
- X += 60;
- e.Graphics.DrawString($"({FormatDouble_A(result.TWIST_MIN)}°-{FormatDouble_A(result.TWIST_MAX)}°)", font, brush, new PointF(X, Y));
- // 第八行
- X = startX;
- Y += font.Height;
- e.Graphics.DrawString("Girdle 16M", font, brush, new PointF(X, Y));
- X = col2X;
- e.Graphics.DrawString($"{FormatDouble_D(result.GIRDLE_VALLEY)}", font, brush, new PointF(X, Y));
- X = col3X;
- e.Graphics.DrawString($"({FormatDouble_P(result.GIRDLE_VALLEY_MIN)}%-{FormatDouble_P(result.GIRDLE_VALLEY_MAX)}%)", font, brush, new PointF(X, Y));
- e.Graphics.DrawString($"{DtResults.Where(X => "GIRDLE".Equals(X.TestItemId)).Select(X => X.CutLevel).FirstOrDefault()}", font, brush, new PointF(480, Y));
-
- }
+ // [Log]
+ // private void PrintPageHandler(object sender, PrintPageEventArgs e)
+ // {
+ // var result = algorithmResult.Measurements;
+ // int startX = 10;
+ // int startY = 10;
+ // var col2X = startX + 90;
+ // var col3X = col2X + 70;
+ // // 设置字体
+ // Font font = new Font(FontFamily.GenericSerif, 12, FontStyle.Bold);
+ //
+ // // 设置颜色
+ // Brush brush = Brushes.Black;
+ //
+ // // 设置对齐方式
+ // StringFormat format = new StringFormat();
+ // format.Alignment = StringAlignment.Center; // 水平居中
+ // format.LineAlignment = StringAlignment.Center; // 垂直居中
+ //
+ // // 绘制文本
+ // // 第一行
+ // int X = startX;
+ // int Y = startY;
+ // e.Graphics.DrawString(Standard, font, brush, new PointF(X, Y));
+ // X += 70;
+ // e.Graphics.DrawString(Shape, font, brush, new PointF(X, Y));
+ // X += 50;
+ // e.Graphics.DrawString($"ID:{DiamondCode}", font, brush, new PointF(X, Y));
+ // X += 100;
+ // e.Graphics.DrawString($"Weight:{Wight}ct.", font, brush, new PointF(X, Y));
+ // X += 120;
+ // Brush backgroundBrush = new SolidBrush(System.Drawing.Color.Black); // 背景色为黄色
+ // e.Graphics.FillRectangle(backgroundBrush, new RectangleF(X, Y, 200, font.Height));
+ // e.Graphics.DrawString(CutLevelTotal, font, Brushes.White, new PointF(X, Y));
+ //
+ // // 第二行
+ // X = startX;
+ // Y += font.Height;
+ // e.Graphics.DrawString("Diameter", font, brush, new PointF(X, Y));
+ //
+ // e.Graphics.DrawString($"{FormatDouble_D(result.DIAMETER)}mm", font, brush, new PointF(col2X, Y));
+ //
+ // e.Graphics.DrawString($"({FormatDouble_D(result.M1)}mm-{FormatDouble_D(result.M2)}mm)", font, brush, new PointF(col3X, Y));
+ // e.Graphics.DrawString($"0.3%", font, brush, new PointF(310, Y));
+ // e.Graphics.FillRectangle(backgroundBrush, new RectangleF(350, Y, 200, font.Height));
+ // e.Graphics.DrawString(SymLevelTotal, font, Brushes.White, new PointF(X, Y));
+ //
+ // // 第三行
+ // X = startX;
+ // Y += font.Height;
+ // e.Graphics.DrawString("Total Dep.", font, brush, new PointF(X, Y));
+ // X = col2X;
+ // e.Graphics.DrawString($"{FormatDouble_D(result.DIAMETER * result.TOTAL_DEPTH)}mm", font, brush, new PointF(X, Y));
+ // X = col3X;
+ // e.Graphics.DrawString($"{FormatDouble_P(result.TOTAL_DEPTH)}%", font, brush, new PointF(X, Y));
+ // e.Graphics.DrawString($"{DtResults.Where(X=> "TOTAL_DEPTH".Equals(X.TestItemId)).Select(X=>X.CutLevel).FirstOrDefault()}", font, brush, new PointF(480, Y));
+ // // 第四行
+ // X = startX;
+ // Y += font.Height;
+ // e.Graphics.DrawString("Table", font, brush, new PointF(X, Y));
+ // X = col2X;
+ // e.Graphics.DrawString($"{FormatDouble_D(result.DIAMETER * result.TABLE)}mm", font, brush, new PointF(X, Y));
+ // X = col3X;
+ // e.Graphics.DrawString($"{FormatDouble_P(result.TABLE)}%", font, brush, new PointF(X, Y));
+ // e.Graphics.DrawString($"{DtResults.Where(X => "TABLE".Equals(X.TestItemId)).Select(X => X.CutLevel).FirstOrDefault()}", font, brush, new PointF(480, Y));
+ // // 第五行
+ // X = startX;
+ // Y += font.Height;
+ // e.Graphics.DrawString("Crown", font, brush, new PointF(X, Y));
+ // X = col2X;
+ // e.Graphics.DrawString($"{FormatDouble_A(result.CROWN_ANGLE)}°", font, brush, new PointF(X, Y));
+ // X = col3X;
+ // e.Graphics.DrawString($"({FormatDouble_A(result.CROWN_ANGLE_MIN)}°-{FormatDouble_A(result.CROWN_ANGLE_MAX)}°)", font, brush, new PointF(X, Y));
+ // X += 120;
+ // e.Graphics.DrawString($"({FormatDouble_A(result.CROWN_HEIGHT)}%)", font, brush, new PointF(X, Y));
+ // e.Graphics.DrawString($"{DtResults.Where(X => "CROWN_ANGLE".Equals(X.TestItemId)).Select(X => X.CutLevel).FirstOrDefault()}", font, brush, new PointF(410, Y));
+ // e.Graphics.DrawString($"{DtResults.Where(X => "CROWN_HEIGHT".Equals(X.TestItemId)).Select(X => X.CutLevel).FirstOrDefault()}", font, brush, new PointF(480, Y));
+ // // 第六行
+ // X = startX;
+ // Y += font.Height;
+ // e.Graphics.DrawString("Pavil.", font, brush, new PointF(X, Y));
+ // X = col2X;
+ // e.Graphics.DrawString($"{FormatDouble_A(result.PAV_ANGLE)}°", font, brush, new PointF(X, Y));
+ // X = col3X;
+ // e.Graphics.DrawString($"({FormatDouble_A(result.PAV_ANGLE_MIN)}°-{FormatDouble_A(result.PAV_ANGLE_MAX)}°)", font, brush, new PointF(X, Y));
+ // X += 120;
+ // e.Graphics.DrawString($"({FormatDouble_A(result.PAV_DEPTH)}%)", font, brush, new PointF(X, Y));
+ // e.Graphics.DrawString($"{DtResults.Where(X => "PAV_ANGLE".Equals(X.TestItemId)).Select(X => X.CutLevel).FirstOrDefault()}", font, brush, new PointF(410, Y));
+ // e.Graphics.DrawString($"{DtResults.Where(X => "PAV_DEPTH".Equals(X.TestItemId)).Select(X => X.CutLevel).FirstOrDefault()}", font, brush, new PointF(480, Y));
+ // // 第七行
+ // X = startX;
+ // Y += font.Height;
+ // e.Graphics.DrawString("Culet", font, brush, new PointF(X, Y));
+ // X = col2X;
+ // e.Graphics.DrawString($"{FormatDouble_P(result.CULET)}%", font, brush, new PointF(X, Y));
+ // X = col3X;
+ // e.Graphics.DrawString($"Twist", font, brush, new PointF(X, Y));
+ // X += 60;
+ // e.Graphics.DrawString($"({FormatDouble_A(result.TWIST_MIN)}°-{FormatDouble_A(result.TWIST_MAX)}°)", font, brush, new PointF(X, Y));
+ // // 第八行
+ // X = startX;
+ // Y += font.Height;
+ // e.Graphics.DrawString("Girdle 16M", font, brush, new PointF(X, Y));
+ // X = col2X;
+ // e.Graphics.DrawString($"{FormatDouble_D(result.GIRDLE_VALLEY)}", font, brush, new PointF(X, Y));
+ // X = col3X;
+ // e.Graphics.DrawString($"({FormatDouble_P(result.GIRDLE_VALLEY_MIN)}%-{FormatDouble_P(result.GIRDLE_VALLEY_MAX)}%)", font, brush, new PointF(X, Y));
+ // e.Graphics.DrawString($"{DtResults.Where(X => "GIRDLE".Equals(X.TestItemId)).Select(X => X.CutLevel).FirstOrDefault()}", font, brush, new PointF(480, Y));
+ //
+ // }
[Log]
private void InitializeSerialPort()
diff --git a/Views/Grading/GradingResult.xaml b/Views/Grading/GradingResult.xaml
index 9c36690..347ca5a 100644
--- a/Views/Grading/GradingResult.xaml
+++ b/Views/Grading/GradingResult.xaml
@@ -785,7 +785,7 @@
-
+
diff --git a/Views/UserControl/ViewportData/Helper/ViewportHelperPro.cs b/Views/UserControl/ViewportData/Helper/ViewportHelperPro.cs
index 51633dc..6d0d6cf 100644
--- a/Views/UserControl/ViewportData/Helper/ViewportHelperPro.cs
+++ b/Views/UserControl/ViewportData/Helper/ViewportHelperPro.cs
@@ -1107,6 +1107,12 @@ public class ViewportHelperPro
}
catch (Exception ex)
{
+ // S9暂不提示
+ if (step.ToLower().Equals("s9"))
+ {
+ return result;
+ }
+
new MessageBox().Show($"面取值错误:{ex.Message}");
return result;
}