From ed8768b43baecf8bfb74ed8a949fdc541b5d326d Mon Sep 17 00:00:00 2001 From: sunhonglei Date: Thu, 6 Mar 2025 13:48:57 +0800 Subject: [PATCH] =?UTF-8?q?csv=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ViewModel/Grading/GradingResultVM.cs | 35 +++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/ViewModel/Grading/GradingResultVM.cs b/ViewModel/Grading/GradingResultVM.cs index afac558..a0aff48 100644 --- a/ViewModel/Grading/GradingResultVM.cs +++ b/ViewModel/Grading/GradingResultVM.cs @@ -34,6 +34,7 @@ using Brushes = System.Drawing.Brushes; using SparkClient.Model.Attributes; using SparkClient.Model.Common; using PaperSize = System.Drawing.Printing.PaperSize; +using SharpDX.Direct2D1.Effects; namespace SparkClient.ViewModel.Grading; /// @@ -284,7 +285,10 @@ public class GradingResultVM : BaseViewModel using (var writer = new StreamWriter(filePath,true)) { Measurements info = algorithmResult.measurements; - string line = $"{FormatDouble_A(info.M1)}(mm)," + + string line = + $"{DiamondCode}," + + $"{Wight}(ct)," + + $"{FormatDouble_A(info.M1)}(mm)," + $"{FormatDouble_A(info.M2)}(mm)," + $"{FormatDouble_A(info.M3)}(mm)," + $"{FormatDouble_P(info.TABLE)}%," + @@ -302,6 +306,35 @@ public class GradingResultVM : BaseViewModel writer.WriteLine(line); } } + else + { + File.Create(filePath).Close(); + string header = "Diamond Code,Wight,Measurement1, Measurement2, Measurement3, Table, Crown Height,Pavilion Depth, Total Depth,Crown Angle, Pavilion Angle,Culet Size, Girdle Percent,Girdle Name, POL or Pol/ Sym,SYM,CUT - PROP"; + Measurements info = algorithmResult.measurements; + string line = + $"{DiamondCode}," + + $"{Wight}(ct)," + + $"{FormatDouble_A(info.M1)}(mm)," + + $"{FormatDouble_A(info.M2)}(mm)," + + $"{FormatDouble_A(info.M3)}(mm)," + + $"{FormatDouble_P(info.TABLE)}%," + + $"{FormatDouble_P(info.CROWN_HEIGHT)}%," + + $"{FormatDouble_P(info.PAV_DEPTH)}%," + + $"{FormatDouble_P(info.TOTAL_DEPTH)}%," + + $"{FormatDouble_A(info.CROWN_ANGLE)}°," + + $"{FormatDouble_A(info.PAV_ANGLE)}°," + + $"{FormatDouble_A(info.CULET_SIZE)}(mm)," + + $"{FormatDouble_P(info.GIRDLE)}%," + + $"{calGirdleName(info)}," + + $"," + + $"," + + $"{GetGradeEnName(GetGradeOrder(CutLevelTotal))}"; + using (var writer = new StreamWriter(filePath, true)) + { + writer.WriteLine(header); + writer.WriteLine(line); + } + } } private void saveTempDS(string selValue)