|
|
@ -111,24 +111,50 @@ public class GradingResultVM : BaseViewModel |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
public DataTable GradeList { get { return _gradeList; } set { _gradeList = value; OnPropertyChanged(nameof(GradeList)); } } |
|
|
|
public DataTable GradeList { get { return _gradeList; } set { _gradeList = value; OnPropertyChanged(nameof(GradeList)); } } |
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
/// 活性 |
|
|
|
/// 保存和导出的按钮可用性 |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
public bool IsEnabled { get{ return _isEnabled; } set { _isEnabled = value; OnPropertyChanged(nameof(IsEnabled)); } } |
|
|
|
public bool IsEnabled { get{ return _isEnabled; } set { _isEnabled = value; OnPropertyChanged(nameof(IsEnabled)); } } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// 格式为小数点后一位 |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
private readonly static string digitsFormat = "f1"; |
|
|
|
private readonly static string digitsFormat = "f1"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// 切工总等级(辅助计算用) |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
private int totalCutGrade = 0; |
|
|
|
private int totalCutGrade = 0; |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// 对称行总等级(辅助计算用) |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
private decimal totalSymGrade = 0; |
|
|
|
private decimal totalSymGrade = 0; |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// 计算数据 |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
private AlgorithmResultEntity algorithmResult; |
|
|
|
private AlgorithmResultEntity algorithmResult; |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// 用户名 |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
private string username = ""; |
|
|
|
private string username = ""; |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// 机器号 |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
private string machine = ""; |
|
|
|
private string machine = ""; |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// 形状id |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
private string shapeId = string.Empty; |
|
|
|
private string shapeId = string.Empty; |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// 规则id |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
private string ruleId = string.Empty; |
|
|
|
private string ruleId = string.Empty; |
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
/// 构造 |
|
|
|
/// 构造 |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
/// <param name="result">检测结果</param> |
|
|
|
/// <param name="result">检测结果</param> |
|
|
|
public GradingResultVM(object result) |
|
|
|
public GradingResultVM(object result) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
SaveAsCommand = new RelayCommand(SaveAs); |
|
|
|
SaveAsCommand = new RelayCommand(SaveAs); |
|
|
|
SaveFileCommand = new RelayCommand(SaveFile); |
|
|
|
SaveFileCommand = new RelayCommand(SaveFile); |
|
|
@ -155,6 +181,12 @@ public class GradingResultVM : BaseViewModel |
|
|
|
} |
|
|
|
} |
|
|
|
SaveTestResult(SaveStatus.AutoSave); |
|
|
|
SaveTestResult(SaveStatus.AutoSave); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new MessageBox().Show($"{MultilingualHelper.getString("ApplicationError")}{ex.Message}"); |
|
|
|
|
|
|
|
Logger.Error($"全局异常捕获:{ex.Message}", ex); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
#region 画面初始化相关操作 |
|
|
|
#region 画面初始化相关操作 |
|
|
|
private void InitCombobox() |
|
|
|
private void InitCombobox() |
|
|
@ -212,6 +244,8 @@ public class GradingResultVM : BaseViewModel |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void InitView(AlgorithmResultEntity result) |
|
|
|
private void InitView(AlgorithmResultEntity result) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
InitViewportData(result); |
|
|
|
InitViewportData(result); |
|
|
|
totalCutGrade = 0; |
|
|
|
totalCutGrade = 0; |
|
|
@ -245,6 +279,12 @@ public class GradingResultVM : BaseViewModel |
|
|
|
} |
|
|
|
} |
|
|
|
CutLevelTotal = GetGradeName(totalCutGrade); |
|
|
|
CutLevelTotal = GetGradeName(totalCutGrade); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new MessageBox().Show($"{MultilingualHelper.getString("ApplicationError")}{ex.Message}"); |
|
|
|
|
|
|
|
Logger.Error($"全局异常捕获:{ex.Message}", ex); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
private string getRuleId() |
|
|
|
private string getRuleId() |
|
|
|
{ |
|
|
|
{ |
|
|
|
return Settings.SelectValueById("RuleId"); |
|
|
|
return Settings.SelectValueById("RuleId"); |
|
|
@ -316,6 +356,9 @@ public class GradingResultVM : BaseViewModel |
|
|
|
return calGrades; |
|
|
|
return calGrades; |
|
|
|
} |
|
|
|
} |
|
|
|
private int calGrade(string item ,double value) |
|
|
|
private int calGrade(string item ,double value) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
int order = 1; |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
decimal cValue = Convert.ToDecimal(value); |
|
|
|
decimal cValue = Convert.ToDecimal(value); |
|
|
|
List<CalGradeInfo> calGrades = GetCalGradeInfos(item); |
|
|
|
List<CalGradeInfo> calGrades = GetCalGradeInfos(item); |
|
|
@ -323,7 +366,6 @@ public class GradingResultVM : BaseViewModel |
|
|
|
{ |
|
|
|
{ |
|
|
|
return 0; |
|
|
|
return 0; |
|
|
|
} |
|
|
|
} |
|
|
|
int order = 1; |
|
|
|
|
|
|
|
foreach (CalGradeInfo gradeInfo in calGrades) |
|
|
|
foreach (CalGradeInfo gradeInfo in calGrades) |
|
|
|
{ |
|
|
|
{ |
|
|
|
bool isThisGrade = true; |
|
|
|
bool isThisGrade = true; |
|
|
@ -363,6 +405,12 @@ public class GradingResultVM : BaseViewModel |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
totalCutGrade = Math.Max(order, totalCutGrade); |
|
|
|
totalCutGrade = Math.Max(order, totalCutGrade); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new MessageBox().Show($"{MultilingualHelper.getString("ApplicationError")}{ex.Message}"); |
|
|
|
|
|
|
|
Logger.Error($"全局异常捕获:{ex.Message}", ex); |
|
|
|
|
|
|
|
} |
|
|
|
return order; |
|
|
|
return order; |
|
|
|
} |
|
|
|
} |
|
|
|
private string calGrade_TOTAL_DEPTH(double avg) |
|
|
|
private string calGrade_TOTAL_DEPTH(double avg) |
|
|
@ -735,6 +783,8 @@ public class GradingResultVM : BaseViewModel |
|
|
|
} |
|
|
|
} |
|
|
|
#region 文件导出相关 |
|
|
|
#region 文件导出相关 |
|
|
|
public void SaveAs(object param) |
|
|
|
public void SaveAs(object param) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(DiamondCode)) |
|
|
|
if (string.IsNullOrEmpty(DiamondCode)) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -779,6 +829,12 @@ public class GradingResultVM : BaseViewModel |
|
|
|
} |
|
|
|
} |
|
|
|
SaveTestResult(SaveStatus.SaveAs); |
|
|
|
SaveTestResult(SaveStatus.SaveAs); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new MessageBox().Show($"{MultilingualHelper.getString("ApplicationError")}{ex.Message}"); |
|
|
|
|
|
|
|
Logger.Error($"全局异常捕获:{ex.Message}", ex); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
private async void ExportFile(string filePath) |
|
|
|
private async void ExportFile(string filePath) |
|
|
|
{ |
|
|
|
{ |
|
|
|
try { |
|
|
|
try { |
|
|
@ -866,7 +922,13 @@ public class GradingResultVM : BaseViewModel |
|
|
|
} |
|
|
|
} |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// txt文件导出 |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="filePath"></param> |
|
|
|
private void TxtFile(string filePath) |
|
|
|
private void TxtFile(string filePath) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
string fileName = filePath + ".txt"; |
|
|
|
string fileName = filePath + ".txt"; |
|
|
|
using (var file = File.Create(fileName)) |
|
|
|
using (var file = File.Create(fileName)) |
|
|
@ -922,7 +984,19 @@ public class GradingResultVM : BaseViewModel |
|
|
|
stream.Close(); |
|
|
|
stream.Close(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new MessageBox().Show($"{MultilingualHelper.getString("ApplicationError")}{ex.Message}"); |
|
|
|
|
|
|
|
Logger.Error($"全局异常捕获:{ex.Message}", ex); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// excel文件导出 |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
/// <param name="filePath"></param> |
|
|
|
private void ExcelFile(string filePath) |
|
|
|
private void ExcelFile(string filePath) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
{ |
|
|
|
string fileName = filePath + ".xlsx"; |
|
|
|
string fileName = filePath + ".xlsx"; |
|
|
|
IWorkbook workbook = new XSSFWorkbook(); |
|
|
|
IWorkbook workbook = new XSSFWorkbook(); |
|
|
@ -978,6 +1052,12 @@ public class GradingResultVM : BaseViewModel |
|
|
|
workbook.Write(stream); |
|
|
|
workbook.Write(stream); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new MessageBox().Show($"{MultilingualHelper.getString("ApplicationError")}{ex.Message}"); |
|
|
|
|
|
|
|
Logger.Error($"全局异常捕获:{ex.Message}", ex); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private string calGirdleName(Measurements info) |
|
|
|
private string calGirdleName(Measurements info) |
|
|
|
{ |
|
|
|
{ |
|
|
|