|
|
|
@ -155,32 +155,39 @@ public class DiamondSelectVM : BaseViewModel |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 启动soc |
|
|
|
|
socResolt = await DoSoc(); |
|
|
|
|
if (socResolt.Status == "P001") |
|
|
|
|
{ |
|
|
|
|
// 使用 Dispatcher 将 UI 操作调度到主线程 |
|
|
|
|
Application.Current.Dispatcher.Invoke(() => |
|
|
|
|
{ |
|
|
|
|
MsgDialog msgDialog = new MsgDialog(); |
|
|
|
|
msgDialog.ShowDialog(); |
|
|
|
|
}); |
|
|
|
|
loading.Dispatcher.Invoke(() => loading.Close()); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
// socResolt = await DoSoc(); |
|
|
|
|
// if (socResolt.Status == "P001" || socResolt.Images.Count == 0) |
|
|
|
|
// { |
|
|
|
|
// // /*// 使用 Dispatcher 将 UI 操作调度到主线程 |
|
|
|
|
// // Application.Current.Dispatcher.Invoke(() => |
|
|
|
|
// // { |
|
|
|
|
// // MsgDialog msgDialog = new MsgDialog(); |
|
|
|
|
// // msgDialog.ShowDialog(); |
|
|
|
|
// // }); |
|
|
|
|
// // loading.Dispatcher.Invoke(() => loading.Close()); |
|
|
|
|
// // return;*/ |
|
|
|
|
// MessageBox.Show("未找到切工仪", "错误", MessageBoxButton.OK, MessageBoxImage.Error); |
|
|
|
|
// loading.Dispatcher.Invoke(() => loading.Close()); |
|
|
|
|
// return; |
|
|
|
|
// } |
|
|
|
|
// 启动算法 |
|
|
|
|
parameter = await DoAlgorithm(socResolt, parameter.Shape, parameter.CrownType); |
|
|
|
|
if (parameter.status == "P002" || parameter.status == "P003" || parameter.status == "P004") |
|
|
|
|
{ |
|
|
|
|
// 使用 Dispatcher 将 UI 操作调度到主线程 |
|
|
|
|
Application.Current.Dispatcher.Invoke(() => |
|
|
|
|
MessageBox.Show(parameter.error_msg); |
|
|
|
|
switch (parameter.status) |
|
|
|
|
{ |
|
|
|
|
MsgDialog msgDialog = new MsgDialog(); |
|
|
|
|
msgDialog.ShowDialog(); |
|
|
|
|
}); |
|
|
|
|
case "P002": |
|
|
|
|
MessageBox.Show("P002:调用算法失败", "错误", MessageBoxButton.OK, MessageBoxImage.Error); |
|
|
|
|
loading.Dispatcher.Invoke(() => loading.Close()); |
|
|
|
|
return; |
|
|
|
|
case "P003": |
|
|
|
|
MessageBox.Show("P003:图片文件读取失败", "错误", MessageBoxButton.OK, MessageBoxImage.Error); |
|
|
|
|
loading.Dispatcher.Invoke(() => loading.Close()); |
|
|
|
|
return; |
|
|
|
|
case "P004": |
|
|
|
|
MessageBox.Show("P004:JSON解析失败", "错误", MessageBoxButton.OK, MessageBoxImage.Error); |
|
|
|
|
loading.Dispatcher.Invoke(() => loading.Close()); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
parameter.Standard = "IGI 2024"; |
|
|
|
|
parameter.Shape = value.Split(" ")[0]; |
|
|
|
|
parameter.CrownType = value.Split(" ")[1]; |
|
|
|
@ -346,10 +353,12 @@ public class DiamondSelectVM : BaseViewModel |
|
|
|
|
//钻石子形状 |
|
|
|
|
string shape_mode = crownType; |
|
|
|
|
//图片根目录 |
|
|
|
|
string image_file_base_path = "d:\\diamond_images"; |
|
|
|
|
string image_file_base_path = "D:\\diamond_images"; |
|
|
|
|
//图片集合 |
|
|
|
|
//string image_files = JsonConvert.SerializeObject(socResolt.Images, Formatting.Indented); |
|
|
|
|
string image_files =$"[ \"image_0.bmp\", \"image_1.bmp\", \"image_2.bmp\", \"image_3.bmp\", \"image_4.bmp\", \"image_5.bmp\", \"image_6.bmp\", \"image_7.bmp\", \"image_8.bmp\", \"image_9.bmp\", \"image_10.bmp\", \"image_11.bmp\", \"image_12.bmp\", \"image_13.bmp\", \"image_14.bmp\", \"image_15.bmp\", \"image_16.bmp\", \"image_17.bmp\", \"image_18.bmp\", \"image_19.bmp\", \"image_20.bmp\", \"image_21.bmp\", \"image_22.bmp\", \"image_23.bmp\", \"image_24.bmp\", \"image_25.bmp\", \"image_26.bmp\", \"image_27.bmp\", \"image_28.bmp\", \"image_29.bmp\", \"image_30.bmp\", \"image_31.bmp\", \"image_32.bmp\", \"image_33.bmp\", \"image_34.bmp\", \"image_35.bmp\", \"image_36.bmp\", \"image_37.bmp\", \"image_38.bmp\", \"image_39.bmp\", \"image_40.bmp\", \"image_41.bmp\", \"image_42.bmp\", \"image_43.bmp\", \"image_44.bmp\", \"image_45.bmp\", \"image_46.bmp\", \"image_47.bmp\", \"image_48.bmp\", \"image_49.bmp\" ]" ; |
|
|
|
|
//半圆 |
|
|
|
|
Boolean half_circle = false; |
|
|
|
|
|
|
|
|
|
//算法配置参数 |
|
|
|
|
string sql = $"SELECT JSON FROM ALGORITHM_CONFIG ORDER BY JSON_ORDER ASC"; |
|
|
|
@ -357,7 +366,7 @@ public class DiamondSelectVM : BaseViewModel |
|
|
|
|
object lightLevelValue = table.Rows[0][0]; |
|
|
|
|
string algo_config = lightLevelValue.ToString() ?? throw new InvalidOperationException(); |
|
|
|
|
|
|
|
|
|
AlgorithmResultEntity algoResult = _algorithmServer.CallParseJsonAndReturnActions(shape, shape_mode, image_file_base_path, image_files, algo_config); |
|
|
|
|
AlgorithmResultEntity algoResult = _algorithmServer.CallParseJsonAndReturnActions(shape, shape_mode, image_file_base_path, image_files, algo_config,half_circle); |
|
|
|
|
|
|
|
|
|
return Task.FromResult(algoResult); |
|
|
|
|
} |
|
|
|
|