|
|
|
@ -1,25 +1,22 @@ |
|
|
|
|
using EncryptFileTool.Entity; |
|
|
|
|
using HandyControl.Controls; |
|
|
|
|
using log4net; |
|
|
|
|
using Newtonsoft.Json; |
|
|
|
|
using Newtonsoft.Json.Converters; |
|
|
|
|
using NPOI.SS.Formula.Functions; |
|
|
|
|
using SharpDX; |
|
|
|
|
using SparkClient.Model.Helper; |
|
|
|
|
using System; |
|
|
|
|
using SparkClient.ViewModel.Grading; |
|
|
|
|
using System.Data; |
|
|
|
|
using System.Drawing; |
|
|
|
|
using System.IO; |
|
|
|
|
using System.Linq.Expressions; |
|
|
|
|
using System.Windows; |
|
|
|
|
using System.Windows.Controls; |
|
|
|
|
using System.Windows.Controls.Primitives; |
|
|
|
|
using System.Windows.Data; |
|
|
|
|
using System.Windows.Input; |
|
|
|
|
using MessageBox = SparkClient.Views.Dialog.MessageBox; |
|
|
|
|
|
|
|
|
|
namespace SparkClient.ViewModel.Configuration; |
|
|
|
|
|
|
|
|
|
public class LevelConfigVM : BaseViewModel |
|
|
|
|
{ |
|
|
|
|
private static readonly ILog Logger = LogManager.GetLogger(typeof(GradingResultVM)); |
|
|
|
|
public ICommand ChangeShapeModelCommand { get; } |
|
|
|
|
public ICommand ChangeInstituteModelCommand { get; } |
|
|
|
|
public ICommand LoadLevelConfigCommand { get; } |
|
|
|
@ -107,6 +104,8 @@ public class LevelConfigVM : BaseViewModel |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void setStandardList(DataTable gradeList, DataTable standardList) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
Style cellStyle = new Style(typeof(TextBlock)); |
|
|
|
|
Setter setSellStyle = new Setter(TextBlock.HorizontalAlignmentProperty, HorizontalAlignment.Center); |
|
|
|
@ -123,9 +122,9 @@ public class LevelConfigVM : BaseViewModel |
|
|
|
|
if ("1".Equals(columnInfo["GRADE_ORDER"].ToString())) |
|
|
|
|
{ |
|
|
|
|
columns.Add(new DataColumn(columnInfo["GRADE_EN_NAME"].ToString())); |
|
|
|
|
columns.Add(new DataColumn(columnInfo["GRADE_EN_NAME"].ToString()+"_"+1)); |
|
|
|
|
columns.Add(new DataColumn(columnInfo["GRADE_EN_NAME"].ToString() + "_" + 1)); |
|
|
|
|
//this.dataGrid.Columns.Add(new DataGridTextColumn() { Header = columnInfo[GRADE_NAME].ToString(), Binding = new Binding(columnInfo["GRADE_EN_NAME"].ToString()),ElementStyle = cellStyle }); |
|
|
|
|
this.dataGrid.Columns.Add(GetDataGridColumn(columnInfo[GRADE_NAME].ToString()??"", columnInfo["GRADE_EN_NAME"].ToString() ?? "")); |
|
|
|
|
this.dataGrid.Columns.Add(GetDataGridColumn(columnInfo[GRADE_NAME].ToString() ?? "", columnInfo["GRADE_EN_NAME"].ToString() ?? "")); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
@ -146,7 +145,8 @@ public class LevelConfigVM : BaseViewModel |
|
|
|
|
if (standardList != null) |
|
|
|
|
{ |
|
|
|
|
var standardRules = standardList.AsEnumerable().GroupBy(r => r["RULE_ID"].ToString()); |
|
|
|
|
foreach (var ruleStandardList in standardRules) { |
|
|
|
|
foreach (var ruleStandardList in standardRules) |
|
|
|
|
{ |
|
|
|
|
var standards = ruleStandardList.AsEnumerable().GroupBy(r => r[STANDARD_NAME].ToString()); |
|
|
|
|
foreach (var standard in standards) |
|
|
|
|
{ |
|
|
|
@ -156,7 +156,7 @@ public class LevelConfigVM : BaseViewModel |
|
|
|
|
// 每一行单元格内数据 |
|
|
|
|
var row = standard.Where(s => s["GRADE_ORDER"].ToString() == columnInfo["GRADE_ORDER"].ToString()).FirstOrDefault(); |
|
|
|
|
string value = ""; |
|
|
|
|
if (row == null ) |
|
|
|
|
if (row == null) |
|
|
|
|
{ |
|
|
|
|
if ("1".Equals(columnInfo["GRADE_ORDER"].ToString())) |
|
|
|
|
{ |
|
|
|
@ -201,7 +201,8 @@ public class LevelConfigVM : BaseViewModel |
|
|
|
|
|
|
|
|
|
var arr = value.Split("\r\n", 2); |
|
|
|
|
rowInfo.Add(arr[0]); |
|
|
|
|
if (arr.Length > 1) { |
|
|
|
|
if (arr.Length > 1) |
|
|
|
|
{ |
|
|
|
|
rowInfo.Add(arr[1]); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
@ -283,6 +284,8 @@ public class LevelConfigVM : BaseViewModel |
|
|
|
|
} |
|
|
|
|
string ruleId = ruleStandardList.Key; |
|
|
|
|
string prefix = ""; |
|
|
|
|
if (ruleId != null && !string.IsNullOrEmpty(ruleId)) |
|
|
|
|
{ |
|
|
|
|
string ta = ruleId.Substring(ruleId.Length - 2); |
|
|
|
|
if (ruleId.StartsWith("GB")) |
|
|
|
|
{ |
|
|
|
@ -299,6 +302,7 @@ public class LevelConfigVM : BaseViewModel |
|
|
|
|
prefix = "[台宽比=" + ruleId.Substring(ruleId.Length - 2) + "] "; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
rowInfo.Insert(0, prefix + standard.Key); |
|
|
|
|
var showRow = StandardList.NewRow(); |
|
|
|
|
showRow.ItemArray = rowInfo.ToArray(); |
|
|
|
@ -308,6 +312,12 @@ public class LevelConfigVM : BaseViewModel |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
new MessageBox().Show($"{MultilingualHelper.getString("ApplicationError")}{ex.Message}"); |
|
|
|
|
Logger.Error($"全局异常捕获:{ex.Message}", ex); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
private DataGridColumn GetDataGridColumn(string Header,string Binding,int lineCount = 2) |
|
|
|
|
{ |
|
|
|
|
//Style cellStyle = new Style(typeof(TextBlock)); |
|
|
|
@ -449,7 +459,7 @@ public class LevelConfigVM : BaseViewModel |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) { |
|
|
|
|
DataBaseHelper.rollback(); |
|
|
|
|
Console.WriteLine(ex.Message); |
|
|
|
|
Logger.Error($"全局异常捕获:{ex.Message}", ex); |
|
|
|
|
Growl.Error(save_fail_message); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -467,6 +477,8 @@ public class LevelConfigVM : BaseViewModel |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="param"></param> |
|
|
|
|
public void LoadLevelConfig(object param) |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
InstitutesEnabled = false; |
|
|
|
|
ShapesEnabled = false; |
|
|
|
@ -505,7 +517,7 @@ public class LevelConfigVM : BaseViewModel |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
ShapeId = shapes.Rows[0]["SHAPE_ID"].ToString()??""; |
|
|
|
|
ShapeId = shapes.Rows[0]["SHAPE_ID"].ToString() ?? ""; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 机构列表重新生成 |
|
|
|
@ -515,14 +527,14 @@ public class LevelConfigVM : BaseViewModel |
|
|
|
|
{ |
|
|
|
|
var row = Institutes.NewRow(); |
|
|
|
|
row["RULE_ID"] = jsonEntity.RULE_ID; |
|
|
|
|
row["RULE_NAME"]=jsonEntity.RULE_NAME; |
|
|
|
|
row["RULE_EN_NAME"]= jsonEntity.RULE_EN_NAME; |
|
|
|
|
row["RULE_NAME"] = jsonEntity.RULE_NAME; |
|
|
|
|
row["RULE_EN_NAME"] = jsonEntity.RULE_EN_NAME; |
|
|
|
|
Institutes.Rows.Add(row); |
|
|
|
|
InstituteId = jsonEntity.RULE_ID; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
InstituteId = institute.Rows[0]["RULE_ID"].ToString()??""; |
|
|
|
|
InstituteId = institute.Rows[0]["RULE_ID"].ToString() ?? ""; |
|
|
|
|
} |
|
|
|
|
// 表格内容重新生成 |
|
|
|
|
string gradeInfosJson = JsonConvert.SerializeObject(jsonEntity.gradeInfos); |
|
|
|
@ -532,6 +544,12 @@ public class LevelConfigVM : BaseViewModel |
|
|
|
|
setStandardList(gradeInfos, standardInfos); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
new MessageBox().Show($"{MultilingualHelper.getString("ApplicationError")}{ex.Message}"); |
|
|
|
|
Logger.Error($"全局异常捕获:{ex.Message}", ex); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 切换规则响应 |
|
|
|
|