集成mes接口,请求-响应-错误处理

This commit is contained in:
liming 蔡
2026-07-14 17:13:01 +08:00
parent 2ecfd549b3
commit 8c6c9a5dc1
6 changed files with 26 additions and 9 deletions
+4 -4
View File
@@ -214,17 +214,17 @@ namespace JY.Inspection.Mes
var sw = new Stopwatch();
sw.Start();
var mesCallResult = MESApiHelper.HttpPostJsonAPI<RespProductResult>(Global.systemConfig.ResultProcessMesUrl, p, Global.systemConfig.MesRequestTime);
resp = MESApiHelper.HttpPostJsonAPI<RespProductResult>(Global.systemConfig.ResultProcessMesUrl, p, Global.systemConfig.MesRequestTime);
sw.Stop();
if (mesCallResult?.OriResponse?.Success != true)
if (resp?.OriResponse != null && resp?.OriResponse.Success != true)
{
resp.IsSuccess = false;
resp.ErrorType = MesErrorType.BusinessError;
resp.ErrorMessage = mesCallResult?.OriResponse.Message ?? "MES业务处理失败";
resp.ErrorMessage = resp?.OriResponse?.Message ?? "MES业务处理失败, 错误消息为空";
}
new MesLog().LogProductResult(nowTime, p, mesCallResult.OriRespJsonStr, sw.ElapsedMilliseconds);
new MesLog().LogProductResult(nowTime, p, resp.OriRespJsonStr, sw.ElapsedMilliseconds);
}
catch (Exception ex)
{