fix:Csv输出

master
sunhonglei 4 months ago
parent 7d78976904
commit 038ea39d4e
  1. 30
      ViewModel/Grading/GradingResultVM.cs

@ -196,6 +196,7 @@ public class GradingResultVM : BaseViewModel
AutoSave();
}
SaveTestResult(SaveStatus.AutoSave);
SaveToCsv();
}
catch (Exception ex)
{
@ -261,7 +262,34 @@ public class GradingResultVM : BaseViewModel
DSList.Rows.Add("pass", "pass");
DSList.Rows.Add("refer", "refer");
}
[Log]
private void SaveToCsv()
{
string strBaseUrl = AppDomain.CurrentDomain.BaseDirectory;
string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "histroy.csv");
if (File.Exists(filePath)) {
using (var writer = new StreamWriter(filePath,true))
{
Measurements info = algorithmResult.measurements;
string line = $"{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))}";
writer.WriteLine(line);
}
}
}
[Log]
private void InitView(AlgorithmResultEntity result)
{

Loading…
Cancel
Save