fix:外部接口

master
handefeng 6 months ago
parent d2fef49b29
commit ffc33af0e1
  1. 4
      App.config
  2. 2
      Language/en_US.xaml
  3. 1
      Language/zh_CN.xaml
  4. 3
      Model/Entity/ApiEntity/StatusCodes.cs
  5. 4
      Model/Services/SOCClientService.cs
  6. 3
      ViewModel/Grading/DiamondSelectVM.cs

@ -2,8 +2,8 @@
<configuration> <configuration>
<appSettings> <appSettings>
<!-- 切工仪URL --> <!-- 切工仪URL -->
<!-- <add key="BaseUrl" value="http://localhost:5000/api/SoC"/> --> <add key="BaseUrl" value="http://localhost:5000/api/SoC"/>
<add key="BaseUrl" value="http://192.168.3.100:8080"/> <!-- <add key="BaseUrl" value="http://192.168.3.100:8080"/> -->
<!-- SOC下载图片目录 --> <!-- SOC下载图片目录 -->
<add key="ImageFileBasePath" value="D:\diamond_images"/> <add key="ImageFileBasePath" value="D:\diamond_images"/>
<!-- 算法失败时,历史图片保存文件夹路径 --> <!-- 算法失败时,历史图片保存文件夹路径 -->

@ -50,7 +50,7 @@
<sys:String x:Key="JsonParseFailure">P004:JSON parsing failed</sys:String> <sys:String x:Key="JsonParseFailure">P004:JSON parsing failed</sys:String>
<sys:String x:Key="Recheck">P021:Diamonds need to be cleaned if detected</sys:String> <sys:String x:Key="Recheck">P021:Diamonds need to be cleaned if detected</sys:String>
<sys:String x:Key="NoDiamond">P011:No diamond was detected</sys:String> <sys:String x:Key="NoDiamond">P011:No diamond was detected</sys:String>
<sys:String x:Key="OpenOfTheHatch">Check whether the cutting machine hatch is closed</sys:String>
<sys:String x:Key="MSVCRuntimeNoInstall">MSVC Runtime is not installed and errors may occur during program execution</sys:String> <sys:String x:Key="MSVCRuntimeNoInstall">MSVC Runtime is not installed and errors may occur during program execution</sys:String>
</ResourceDictionary> </ResourceDictionary>

@ -191,6 +191,7 @@
<sys:String x:Key="JsonParseFailure">P004:JSON解析失败</sys:String> <sys:String x:Key="JsonParseFailure">P004:JSON解析失败</sys:String>
<sys:String x:Key="Recheck">P021:检测到钻石需进行清洁</sys:String> <sys:String x:Key="Recheck">P021:检测到钻石需进行清洁</sys:String>
<sys:String x:Key="NoDiamond">P011:未检测到钻石</sys:String> <sys:String x:Key="NoDiamond">P011:未检测到钻石</sys:String>
<sys:String x:Key="OpenOfTheHatch">请检查切工仪设备舱门是否关闭</sys:String>
<sys:String x:Key="ApplicationError">应用程序出现错误:</sys:String> <sys:String x:Key="ApplicationError">应用程序出现错误:</sys:String>

@ -26,6 +26,9 @@
// 摄像头未连接 // 摄像头未连接
public const string CameraNotConnected = "S006"; public const string CameraNotConnected = "S006";
// 切工仪舱门未关闭
public const string OpenOfTheHatch = "S007";
// 未找到切工仪 // 未找到切工仪
public const string DeviceNotFound = "P001"; public const string DeviceNotFound = "P001";

@ -99,7 +99,7 @@ namespace SparkClient.Model.Services
if (!response.IsSuccessStatusCode) if (!response.IsSuccessStatusCode)
{ {
return new SocResultEntity { Status = StatusCodes.DeviceNotFound, Images = new List<string>() , DeviceId = ""}; return new SocResultEntity { Status = StatusCodes.DeviceNotFound, Images = new List<string>()};
} }
var jsonResponse = await response.Content.ReadAsStringAsync(); var jsonResponse = await response.Content.ReadAsStringAsync();
@ -107,7 +107,7 @@ namespace SparkClient.Model.Services
if (result == null) if (result == null)
{ {
return new SocResultEntity { Status = StatusCodes.DeviceNotFound, Images = new List<string>() , DeviceId = ""}; return new SocResultEntity { Status = StatusCodes.DeviceNotFound, Images = new List<string>()};
} }
return new SocResultEntity { Status = result.Status, Images = new List<string>() , DeviceId = result.device_id}; return new SocResultEntity { Status = result.Status, Images = new List<string>() , DeviceId = result.device_id};

@ -161,6 +161,9 @@ public class DiamondSelectVM : BaseViewModel
socResolt = await _socClientService.ProcessImageCollectionAsync(); socResolt = await _socClientService.ProcessImageCollectionAsync();
switch (socResolt.Status) switch (socResolt.Status)
{ {
case StatusCodes.OpenOfTheHatch:
ShowErrorMessage(MultilingualHelper.getString("OpenOfTheHatch"), loading);
return;
case StatusCodes.DeviceNotFound: case StatusCodes.DeviceNotFound:
ShowErrorMessage(MultilingualHelper.getString("DeviceNotFound"), loading); ShowErrorMessage(MultilingualHelper.getString("DeviceNotFound"), loading);
return; return;

Loading…
Cancel
Save