|
|
|
@ -35,9 +35,32 @@ public class AlgorithmConfigVM : BaseViewModel |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ObservableCollection<Param> _modeList; |
|
|
|
|
|
|
|
public ObservableCollection<Param> ModeList |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
get => _modeList; |
|
|
|
|
|
|
|
set |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
_modeList = value; |
|
|
|
|
|
|
|
OnPropertyChanged(nameof(ModeList)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public List<string> _jsonKeysBak; |
|
|
|
private ObservableCollection<Param> _specList; |
|
|
|
|
|
|
|
public ObservableCollection<Param> SpecList |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
get => _specList; |
|
|
|
|
|
|
|
set { |
|
|
|
|
|
|
|
_specList = value; |
|
|
|
|
|
|
|
OnPropertyChanged(nameof(ModeList)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<string> _jsonKeysBak; |
|
|
|
|
|
|
|
public List<string> JsonKeysBak |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
get => _jsonKeysBak; |
|
|
|
|
|
|
|
} |
|
|
|
private bool _isEnabled; |
|
|
|
private bool _isEnabled; |
|
|
|
public bool IsEnabled { get { return _isEnabled; } set { _isEnabled = value; OnPropertyChanged(nameof(IsEnabled)); } } |
|
|
|
public bool IsEnabled { get { return _isEnabled; } set { _isEnabled = value; OnPropertyChanged(nameof(IsEnabled)); } } |
|
|
|
|
|
|
|
|
|
|
|
@ -48,6 +71,8 @@ public class AlgorithmConfigVM : BaseViewModel |
|
|
|
SaveAlgorithmDataCommand = new RelayCommand(SaveAlgorithmData); |
|
|
|
SaveAlgorithmDataCommand = new RelayCommand(SaveAlgorithmData); |
|
|
|
BeautifyJsonCommand = new RelayCommand(BeautifyJson); |
|
|
|
BeautifyJsonCommand = new RelayCommand(BeautifyJson); |
|
|
|
UglifyJsonCommand = new RelayCommand(UglifyJson); |
|
|
|
UglifyJsonCommand = new RelayCommand(UglifyJson); |
|
|
|
|
|
|
|
ModeList = GetRunModelList(); |
|
|
|
|
|
|
|
SpecList = GetRunSpecList(); |
|
|
|
InitAlgorithmData(null); |
|
|
|
InitAlgorithmData(null); |
|
|
|
IsEnabledByRole(); |
|
|
|
IsEnabledByRole(); |
|
|
|
_jsonKeysBak = GetNestedKeys(JObject.Parse(AlgorithmConfigJson)); |
|
|
|
_jsonKeysBak = GetNestedKeys(JObject.Parse(AlgorithmConfigJson)); |
|
|
|
@ -69,15 +94,20 @@ public class AlgorithmConfigVM : BaseViewModel |
|
|
|
{ |
|
|
|
{ |
|
|
|
AgileJsonConfigEntities.Add(new AgileJsonConfigEntity(_jsonKeysBak) |
|
|
|
AgileJsonConfigEntities.Add(new AgileJsonConfigEntity(_jsonKeysBak) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Mode = baseData.ModeList.Find(e => e.Value.Equals(row["Mode"].ToSafeString())), |
|
|
|
ModeValue = row["Mode"].ToSafeString(), |
|
|
|
Spec = baseData.SpceList.Find(e => e.Value.Equals(row["Spec"].ToSafeString())), |
|
|
|
SpecValue = row["Spec"].ToSafeString(), |
|
|
|
Shape = row["Shape"].ToSafeString(), |
|
|
|
Shape = row["Shape"].ToSafeString(), |
|
|
|
JsonKey = row["JsonKey"].ToSafeString(), |
|
|
|
JsonKey = row["JsonKey"].ToSafeString(), |
|
|
|
Value = row["Value"].ToSafeString() |
|
|
|
Value = row["Value"].ToSafeString() |
|
|
|
}); |
|
|
|
}); |
|
|
|
} catch { } |
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception ex) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Logger.Error(ex.Message); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
[Log] |
|
|
|
[Log] |
|
|
|
private bool CheckAndSaveAgileJson() |
|
|
|
private bool CheckAndSaveAgileJson() |
|
|
|
@ -89,10 +119,10 @@ public class AlgorithmConfigVM : BaseViewModel |
|
|
|
if (string.IsNullOrWhiteSpace(row.JsonKey) || string.IsNullOrWhiteSpace(row.Value) || |
|
|
|
if (string.IsNullOrWhiteSpace(row.JsonKey) || string.IsNullOrWhiteSpace(row.Value) || |
|
|
|
string.IsNullOrWhiteSpace(row.Shape)) |
|
|
|
string.IsNullOrWhiteSpace(row.Shape)) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
if (row.Mode == null || row.Spec == null) |
|
|
|
if (row.ModeValue.IsNullOrEmpty()|| row.SpecValue.IsNullOrEmpty()) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
insertSql.Add($"INSERT INTO AGILE_ALGORITHM_CONFIG (GUID, Mode, Spec, Shape, JsonKey, Value)" + |
|
|
|
insertSql.Add($"INSERT INTO AGILE_ALGORITHM_CONFIG (GUID, Mode, Spec, Shape, JsonKey, Value)" + |
|
|
|
$@"VALUES ('{row.GenerateSign()}',{row.Mode.Value},'{row.Spec.Value}','{row.Shape}','{row.JsonKey}','{row.Value}');"); |
|
|
|
$@"VALUES ('{row.GenerateSign()}',{row.ModeValue},'{row.SpecValue}','{row.Shape}','{row.JsonKey}','{row.Value}');"); |
|
|
|
finalSaveData.Add(row); |
|
|
|
finalSaveData.Add(row); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -204,6 +234,7 @@ public class AlgorithmConfigVM : BaseViewModel |
|
|
|
// 命令实现 |
|
|
|
// 命令实现 |
|
|
|
public ICommand AddCommand => new RelayCommand((param) => |
|
|
|
public ICommand AddCommand => new RelayCommand((param) => |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
string data = GetAlgorithmConfig("P8 P8"); |
|
|
|
AgileJsonConfigEntities.Add(new AgileJsonConfigEntity(_jsonKeysBak)); |
|
|
|
AgileJsonConfigEntities.Add(new AgileJsonConfigEntity(_jsonKeysBak)); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
@ -341,6 +372,77 @@ public class AlgorithmConfigVM : BaseViewModel |
|
|
|
return AlgorithmConfigJson; |
|
|
|
return AlgorithmConfigJson; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ObservableCollection<Param> GetRunModelList() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return new ObservableCollection<Param> |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new Param() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Value = "0", |
|
|
|
|
|
|
|
Name = "实验室模式" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
new Param() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Value = "1", |
|
|
|
|
|
|
|
Name = "工厂模式" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ObservableCollection<Param> GetRunSpecList() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return new ObservableCollection<Param> |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
new Param() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Value = "P8-P8", |
|
|
|
|
|
|
|
Name = "P8-P8" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
new Param() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Value = "P8-P8-S1", |
|
|
|
|
|
|
|
Name = "P8-P8-S1" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
new Param() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Value = "P8-P8-S2", |
|
|
|
|
|
|
|
Name = "P8-P8-S2" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
new Param() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Value = "P8-P8-S3", |
|
|
|
|
|
|
|
Name = "P8-P8-S3" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
new Param() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Value = "P8-P8-S4", |
|
|
|
|
|
|
|
Name = "P8-P8-S4" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
new Param() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Value = "P8-P8-S5", |
|
|
|
|
|
|
|
Name = "P8-P8-S5" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
new Param() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Value = "P8-P8-S6", |
|
|
|
|
|
|
|
Name = "P8-P8-S6" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
new Param() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Value = "P8-P8-S7", |
|
|
|
|
|
|
|
Name = "P8-P8-S7" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
new Param() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
Value = "P8-P8-S8", |
|
|
|
|
|
|
|
Name = "P8-P8-S8" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public class Param |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
public string Value { get; set; } |
|
|
|
|
|
|
|
public string Name { get; set; } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|