@ -61,7 +61,7 @@ public class GradingResultVM : BaseViewModel
private readonly static string digitsFormat = "f1" ;
private readonly static string digitsFormat = "f1" ;
private int totalCutGrade = 0 ;
private int totalCutGrade = 0 ;
private int totalSymGrade = 0 ;
private decimal totalSymGrade = 0 ;
private AlgorithmResultEntity algorithmResult ;
private AlgorithmResultEntity algorithmResult ;
private string username = "Lavanda" ;
private string username = "Lavanda" ;
private string machine = "71953" ;
private string machine = "71953" ;
@ -75,13 +75,13 @@ public class GradingResultVM : BaseViewModel
{
{
SaveAsCommand = new RelayCommand ( SaveAs ) ;
SaveAsCommand = new RelayCommand ( SaveAs ) ;
SaveFileCommand = new RelayCommand ( SaveFile ) ;
SaveFileCommand = new RelayCommand ( SaveFile ) ;
if ( result ! = null )
if ( result ! = null )
{
{
algorithmResult = result as AlgorithmResultEntity ? ? new AlgorithmResultEntity ( ) ;
algorithmResult = result as AlgorithmResultEntity ? ? new AlgorithmResultEntity ( ) ;
InitView ( algorithmResult ) ;
InitView ( algorithmResult ) ;
machine = "71953" ;
machine = "71953" ;
}
}
InitCombobox ( ) ;
DS = "NA" ;
DS = "NA" ;
AutoSave ( ) ;
AutoSave ( ) ;
}
}
@ -91,6 +91,9 @@ public class GradingResultVM : BaseViewModel
{
{
// DS下拉列表初始化
// DS下拉列表初始化
InitDSlist ( ) ;
InitDSlist ( ) ;
string sql = $"SELECT GRADE_NAME AS NAME, GRADE_EN_S_NAME AS EN_NAME, GRADE_EN_NAME AS EN_ALL_NAME, GRADE_ORDER FROM GRADE WHERE SHAPE_ID = '{shapeId}' AND RULE_ID = '{ruleId}'; " ;
GradeList = DataBaseHelper . ExecuteQuery ( sql ) ;
}
}
private void InitViewportData ( AlgorithmResultEntity result )
private void InitViewportData ( AlgorithmResultEntity result )
{
{
@ -146,6 +149,7 @@ public class GradingResultVM : BaseViewModel
ruleId = getRuleId ( ) ;
ruleId = getRuleId ( ) ;
Standard = result . Standard ;
Standard = result . Standard ;
shapeId = result . Shape ;
shapeId = result . Shape ;
InitCombobox ( ) ;
Shape = GetName ( result . Shape ) ;
Shape = GetName ( result . Shape ) ;
CrownType = result . CrownType ;
CrownType = result . CrownType ;
PavType = result . PavType ;
PavType = result . PavType ;
@ -164,6 +168,7 @@ public class GradingResultVM : BaseViewModel
DataInfo ? dataInfo = methodInfo . Invoke ( this , parameters ) as DataInfo ;
DataInfo ? dataInfo = methodInfo . Invoke ( this , parameters ) as DataInfo ;
if ( dataInfo ! = null )
if ( dataInfo ! = null )
{
{
dataInfo . GradeList = GradeList ;
DtResults . Add ( dataInfo ) ;
DtResults . Add ( dataInfo ) ;
}
}
}
}
@ -205,7 +210,6 @@ public class GradingResultVM : BaseViewModel
#region 定级计算
#region 定级计算
private List < CalGradeInfo > GetCalGradeInfos ( string item )
private List < CalGradeInfo > GetCalGradeInfos ( string item )
{
{
// TODO DB要改
string sql = $"Select GRADE_ORDER as gradeOrder,STANDARD_MIN Min, STANDARD_MAX Max,IS_MAX_EXIST as isMaxExist,IS_MIN_EXIST as isMinExist from STANDARD where TEST_ITEM_ID = '{item}' AND SHAPE_ID = UPPER('{shapeId}') AND RULE_ID = '{ruleId}' " ;
string sql = $"Select GRADE_ORDER as gradeOrder,STANDARD_MIN Min, STANDARD_MAX Max,IS_MAX_EXIST as isMaxExist,IS_MIN_EXIST as isMinExist from STANDARD where TEST_ITEM_ID = '{item}' AND SHAPE_ID = UPPER('{shapeId}') AND RULE_ID = '{ruleId}' " ;
List < CalGradeInfo > calGrades = DataBaseHelper . ExecuteQuery < CalGradeInfo > ( sql ) ;
List < CalGradeInfo > calGrades = DataBaseHelper . ExecuteQuery < CalGradeInfo > ( sql ) ;
return calGrades ;
return calGrades ;
@ -740,7 +744,7 @@ public class GradingResultVM : BaseViewModel
stream . WriteLine ( $"TOTAL DEPTH={info.TOTAL_DEPTH * 100}" ) ;
stream . WriteLine ( $"TOTAL DEPTH={info.TOTAL_DEPTH * 100}" ) ;
stream . WriteLine ( $"CULET={info.CULET*100}" ) ;
stream . WriteLine ( $"CULET={info.CULET*100}" ) ;
stream . WriteLine ( $"MACHINE={machine}" ) ;
stream . WriteLine ( $"MACHINE={machine}" ) ;
stream . WriteLine ( $"CUTGRADE={GetGradeEnName(totalCutGrade)}" ) ;
stream . WriteLine ( $"CUTGRADE={GetGradeEnName(totalCutGrade.ToString() )}" ) ;
stream . WriteLine ( $"LW RATIO={info.LW_RATIO}" ) ;
stream . WriteLine ( $"LW RATIO={info.LW_RATIO}" ) ;
stream . WriteLine ( $"DS={DS}" ) ;
stream . WriteLine ( $"DS={DS}" ) ;
stream . WriteLine ( $"COC={info.COC * 100}" ) ;
stream . WriteLine ( $"COC={info.COC * 100}" ) ;
@ -799,10 +803,9 @@ public class GradingResultVM : BaseViewModel
dataRow . CreateCell ( col + + ) . SetCellValue ( $"{FormatDouble_P(info.TOTAL_DEPTH)}%" ) ;
dataRow . CreateCell ( col + + ) . SetCellValue ( $"{FormatDouble_P(info.TOTAL_DEPTH)}%" ) ;
dataRow . CreateCell ( col + + ) . SetCellValue ( $"{FormatDouble_A(info.CROWN_ANGLE)}°" ) ;
dataRow . CreateCell ( col + + ) . SetCellValue ( $"{FormatDouble_A(info.CROWN_ANGLE)}°" ) ;
dataRow . CreateCell ( col + + ) . SetCellValue ( $"{FormatDouble_A(info.PAV_ANGLE)}°" ) ;
dataRow . CreateCell ( col + + ) . SetCellValue ( $"{FormatDouble_A(info.PAV_ANGLE)}°" ) ;
// TODO 底尖直径
dataRow . CreateCell ( col + + ) . SetCellValue ( $"{FormatDouble_A(info.CULET_SIZE)}(mm)" ) ;
dataRow . CreateCell ( col + + ) . SetCellValue ( $"{FormatDouble_A(info.CULET)}(mm)" ) ;
dataRow . CreateCell ( col + + ) . SetCellValue ( $"{FormatDouble_P(info.GIRDLE)}%" ) ;
dataRow . CreateCell ( col + + ) . SetCellValue ( $"{FormatDouble_P(info.GIRDLE)}%" ) ;
// TODO 腰部厚度英文
// 腰部厚度英文
dataRow . CreateCell ( col + + ) . SetCellValue ( $"{calGirdleName(info)}" ) ;
dataRow . CreateCell ( col + + ) . SetCellValue ( $"{calGirdleName(info)}" ) ;
dataRow . CreateCell ( col + + ) . SetCellValue ( $"" ) ;
dataRow . CreateCell ( col + + ) . SetCellValue ( $"" ) ;
string sysmlevel = "" ;
string sysmlevel = "" ;
@ -973,39 +976,49 @@ public class GradingResultVM : BaseViewModel
{
{
return Name . getNameById ( id ) ;
return Name . getNameById ( id ) ;
}
}
private string GetGradeName ( int order )
private string GetGradeName ( decimal order )
{
{
// TODO DB没关联
Dictionary < int , string > dictionary = new ( ) ;
string name = GradeList . AsEnumerable ( ) . Where ( x = > order . ToString ( ) . Equals ( x [ "GRADE_ORDER" ] . ToString ( ) ) )
dictionary . Add ( 0 , "" ) ;
. Select ( x = > x [ MultilingualHelper . getString ( "NameType" ) ] . ToString ( ) ) . FirstOrDefault ( "" ) ;
dictionary . Add ( 1 , "极好" ) ;
// DB没关联
dictionary . Add ( 2 , "很好" ) ;
// Dictionary<int, string> dictionary = new();
dictionary . Add ( 3 , "好" ) ;
// dictionary.Add(0, "");
dictionary . Add ( 4 , "一般" ) ;
// dictionary.Add(1,"极好");
dictionary . Add ( 5 , "差" ) ;
// dictionary.Add(2, "很好");
return dictionary [ order ] ;
// dictionary.Add(3, "好");
}
// dictionary.Add(4, "一般");
private int GetGradeOrder ( string Grade )
// dictionary.Add(5, "差");
{
// return dictionary[order];
// TODO DB没关联
return name ;
Dictionary < string , int > dictionary = new ( ) ;
}
dictionary . Add ( "极好" , 1 ) ;
private string GetGradeOrder ( string Grade )
dictionary . Add ( "很好" , 2 ) ;
{
dictionary . Add ( "好" , 3 ) ;
string order = GradeList . AsEnumerable ( ) . Where ( x = > Grade . Equals ( x [ MultilingualHelper . getString ( "NameType" ) ] . ToString ( ) ) )
dictionary . Add ( "一般" , 4 ) ;
. Select ( x = > x [ "GRADE_ORDER" ] . ToString ( ) ) . FirstOrDefault ( "" ) ;
dictionary . Add ( "差" , 5 ) ;
// DB没关联
return dictionary [ Grade ] ;
// Dictionary<string, int> dictionary = new();
}
// dictionary.Add("极好", 1);
private string GetGradeEnName ( int order )
// dictionary.Add("很好", 2);
{
// dictionary.Add("好", 3);
// TODO DB没关联
// dictionary.Add("一般", 4);
Dictionary < int , string > dictionary = new ( ) ;
// dictionary.Add("差", 5);
dictionary . Add ( 1 , "EXCELLENT-Ideal" ) ;
// return dictionary[Grade];
dictionary . Add ( 2 , "EXCELLENT" ) ;
return order ;
dictionary . Add ( 3 , "VERY GOOD" ) ;
}
dictionary . Add ( 4 , "GOOD" ) ;
private string GetGradeEnName ( string order )
dictionary . Add ( 5 , "FAIR-POOR" ) ;
{
return dictionary [ order ] ;
string name = GradeList . AsEnumerable ( ) . Where ( x = > order . Equals ( x [ "GRADE_ORDER" ] . ToString ( ) ) )
. Select ( x = > x [ "EN_ALL_NAME" ] . ToString ( ) ) . FirstOrDefault ( "" ) ;
// DB没关联
// Dictionary<int, string> dictionary = new();
// dictionary.Add(1, "EXCELLENT-Ideal");
// dictionary.Add(2, "EXCELLENT");
// dictionary.Add(3, "VERY GOOD");
// dictionary.Add(4, "GOOD");
// dictionary.Add(5, "FAIR-POOR");
// return dictionary[order];
return name ;
}
}
# endregion
# endregion
@ -1015,11 +1028,11 @@ public class GradingResultVM : BaseViewModel
/// <param name="norm"></param>
/// <param name="norm"></param>
public void ChangeSym ( object norm )
public void ChangeSym ( object norm )
{
{
int ? order = this . DtResults . Select ( x = > x . SymLevel ) . Max ( ) ;
decimal ? order = this . DtResults . Select ( x = > x . SymLevel ) . Max ( ) ;
if ( order . HasValue )
if ( order . HasValue )
{
{
totalSymGrade = order . Value ;
totalSymGrade = order . Value ;
SymLevelTotal = GetGradeName ( ( int ) order . Value ) ;
SymLevelTotal = GetGradeName ( ( decimal ) order . Value ) ;
}
}
else
else
{
{
@ -1340,9 +1353,9 @@ public class DataInfo
public string? Min { get ; set ; }
public string? Min { get ; set ; }
public string? Max { get ; set ; }
public string? Max { get ; set ; }
public string? CutLevel { get ; set ; }
public string? CutLevel { get ; set ; }
private int ? _ symLevel ;
private Int64 ? _ symLevel ;
//public int? SymLevel { get; set; }
//public int? SymLevel { get; set; }
public int ? SymLevel
public Int64 ? SymLevel
{
{
get { return _ symLevel ; }
get { return _ symLevel ; }
set
set
@ -1359,19 +1372,12 @@ public class DataInfo
public DataTable GradeList {
public DataTable GradeList {
get
get
{
{
// TODO DB没关联
if ( this . _ gradeList = = null ) {
_ gradeList = new DataTable ( ) ;
_ gradeList . Columns . Add ( "Key" ) ;
_ gradeList . Columns . Add ( "Value" ) ;
_ gradeList . Rows . Add ( "极好" , 1 ) ;
_ gradeList . Rows . Add ( "很好" , 2 ) ;
_ gradeList . Rows . Add ( "好" , 3 ) ;
_ gradeList . Rows . Add ( "一般" , 4 ) ;
_ gradeList . Rows . Add ( "差" , 5 ) ;
}
return _ gradeList ;
return _ gradeList ;
}
}
set
{
_ gradeList = value ;
}
}
}
public event PropertyChangedEventHandler PropertyChanged ;
public event PropertyChangedEventHandler PropertyChanged ;
protected void OnPropertyChanged ( string propertyName )
protected void OnPropertyChanged ( string propertyName )