feat:检测结果画面关闭内容添加

master
sunhonglei 5 months ago
parent 9c59fbb782
commit 72ffad07b4
  1. 4
      Language/zh_CN.xaml
  2. BIN
      SparkDB.db
  3. 20
      ViewModel/BaseWindow/BaseControlVM.cs
  4. 31
      ViewModel/Grading/GradingResultVM.cs
  5. 16
      Views/Grading/GradingResult.xaml

@ -176,8 +176,9 @@
<sys:String x:Key="DiamondResultGridCutLevel">切工等级</sys:String>
<sys:String x:Key="DiamondResultGridSymLevel">SYM等级</sys:String>
<sys:String x:Key="DiamondResultPopupFacet1">面1</sys:String>
<sys:String x:Key="DiamodResultCloseConfirm">确定需要关闭检测结果画面吗? ※如果关闭需重新检测</sys:String>
<!-- 外部接口MSG-->
<!-- 外部接口MSG-->
<sys:String x:Key="InProgress">采图正在进行中</sys:String>
<sys:String x:Key="CacheCleared">缓存图片被清理</sys:String>
<sys:String x:Key="CannotSendCommand">无法向单片机发送指令</sys:String>
@ -190,7 +191,6 @@
<sys:String x:Key="JsonParseFailure">JSON解析失败</sys:String>
<sys:String x:Key="ApplicationError">应用程序出现错误:</sys:String>

Binary file not shown.

@ -1,8 +1,9 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using HandyControl.Controls;
using SparkClient.Model.Helper;
using SparkClient.ViewModel.Grading;
using MessageBox = SparkClient.Views.Dialog.MessageBox;
namespace SparkClient.ViewModel.BaseWindow;
public class BaseControlVM : BaseViewModel
@ -61,7 +62,20 @@ public class BaseControlVM : BaseViewModel
/// <param name="parameter"></param>
public void CloseVM(object parameter)
{
WindowManager.mainViewModel.Content = WindowManager.PreviousVM();
if(Content is GradingResultVM)
{
MessageBox message = new MessageBox();
MessageBoxResult result = message.ShowAsk(MultilingualHelper.getString("DiamodResultCloseConfirm"));
if (MessageBoxResult.OK.Equals(result))
{
WindowManager.mainViewModel.Content = WindowManager.PreviousVM();
}
}
else
{
WindowManager.mainViewModel.Content = WindowManager.PreviousVM();
}
}
}

@ -20,6 +20,7 @@ using SharpDX;
using SparkClient.Views.UserControl.ViewportData.Entity;
using SparkClient.ViewModel.Configuration.SettingsPages;
using SparkClient.Views.UserControl.ViewportData.Helper;
using System.Diagnostics.Metrics;
namespace SparkClient.ViewModel.Grading;
@ -425,10 +426,10 @@ public class GradingResultVM : BaseViewModel
DataInfo info = new DataInfo();
info.TestItemId = "PAV_ANGLE";
info.TestItemName = GetName("PAV_ANGLE");
info.Avg = result.measurements.PAV_ANGLE.ToString(digitsFormat);
info.Dev = result.measurements.PAV_ANGLE_DEV.ToString(digitsFormat);
info.Min = result.measurements.PAV_ANGLE_MIN.ToString(digitsFormat);
info.Max = result.measurements.PAV_ANGLE_MAX.ToString(digitsFormat);
info.Avg = FormatDouble_A(result.measurements.PAV_ANGLE);
info.Dev = FormatDouble_A(result.measurements.PAV_ANGLE_DEV);
info.Min = FormatDouble_A(result.measurements.PAV_ANGLE_MIN);
info.Max = FormatDouble_A(result.measurements.PAV_ANGLE_MAX);
info.CutLevel = calGrade_PAV_ANGLE(result.measurements.PAV_ANGLE_MIN, result.measurements.PAV_ANGLE_MAX);
return info;
}
@ -551,6 +552,7 @@ public class GradingResultVM : BaseViewModel
ExcelFile(fullPath);
}
}
SaveTestResult(SaveStatus.AutoSave);
}
public void SaveFile(object param)
{
@ -572,6 +574,7 @@ public class GradingResultVM : BaseViewModel
}
string fullPath = Path.Combine(getFilePath(), this.DiamondCode);
ExportFile(fullPath);
SaveTestResult(SaveStatus.Save);
}
private string getFilePath()
{
@ -630,6 +633,7 @@ public class GradingResultVM : BaseViewModel
TxtFile(filePath);
}
}
SaveTestResult(SaveStatus.SaveAs);
}
private async void ExportFile(string filePath)
{
@ -1348,6 +1352,19 @@ public class GradingResultVM : BaseViewModel
calIndex(row);
}
#region 履历保存
private void SaveTestResult(SaveStatus saveStatus)
{
string ALGORITHM_RESULT = JsonConvert.SerializeObject(algorithmResult);
string DATA_RESULT = JsonConvert.SerializeObject(DtResults);
string STATUS = saveStatus.ToString();
string STONE_ID = DiamondCode;
string TIMESTAMPVALUE = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss:fff");
string sql = $"INSERT INTO TEST_RESULT (GUID,ALGORITHM_RESULT,DATA_RESULT,STATUS,STONE_ID,TIMESTAMPVALUE)VALUES" +
$"('{Guid.NewGuid()}','{ALGORITHM_RESULT}','{DATA_RESULT}','{STATUS}','{STONE_ID}','{TIMESTAMPVALUE}');";
DataBaseHelper.ExecuteNonQuery(sql);
}
#endregion
#region 钻石操作相关
//暂略
@ -1443,3 +1460,9 @@ public class RowDetail
public int? MaxIndex { get; set; }
public int? MinIndex { get; set; }
}
public enum SaveStatus
{
AutoSave = 0,
Save=1,
SaveAs=2
}

@ -359,7 +359,7 @@
FontSize="20" Foreground="#0063FF"/>
</Grid>
</Border>
<Border Grid.Column="3" Background="#EBEEF5" Width="100" Height="80" CornerRadius="10" Margin="0 0 5 0">
<Border Grid.Column="3" Background="#EBEEF5" Width="90" Height="80" CornerRadius="10" Margin="0 0 5 0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
@ -367,13 +367,13 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="1" TextAlignment="Center" VerticalAlignment="Center" Text="{StaticResource DiamondResultGridMaxValue}"
<TextBlock Grid.Row="1" TextAlignment="Center" VerticalAlignment="Center" Text="{StaticResource DiamondResultGridMinValue}"
FontSize="18" Foreground="Black" Margin="0 0 0 5"/>
<TextBlock Grid.Row="2" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding SelRowDataDetail.Max}"
<TextBlock Grid.Row="2" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding SelRowDataDetail.Min}"
FontSize="20" Foreground="#0063FF"/>
</Grid>
</Border>
<Border Grid.Column="4" Background="#EBEEF5" Width="90" Height="80" CornerRadius="10" Margin="0 0 5 0">
<Border Grid.Column="4" Background="#EBEEF5" Width="100" Height="80" CornerRadius="10" Margin="0 0 5 0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
@ -381,10 +381,10 @@
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="1" TextAlignment="Center" VerticalAlignment="Center" Text="{StaticResource DiamondResultGridMinValue}"
FontSize="18" Foreground="Black" Margin="0 0 0 5"/>
<TextBlock Grid.Row="2" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding SelRowDataDetail.Min}"
FontSize="20" Foreground="#0063FF"/>
<TextBlock Grid.Row="1" TextAlignment="Center" VerticalAlignment="Center" Text="{StaticResource DiamondResultGridMaxValue}"
FontSize="18" Foreground="Black" Margin="0 0 0 5"/>
<TextBlock Grid.Row="2" TextAlignment="Center" VerticalAlignment="Center" Text="{Binding SelRowDataDetail.Max}"
FontSize="20" Foreground="#0063FF"/>
</Grid>
</Border>
<Border Grid.Column="13" Background="#EBEEF5" Width="90" Height="80" CornerRadius="10" Margin="0 0 5 0">

Loading…
Cancel
Save