1.解析失败抛异常就不上传了 避免一直上传造成的日志记录繁多 以及请求次数过多

2.增加物料规格的显示
This commit is contained in:
hehaibing-1996
2025-06-06 08:12:28 +08:00
parent 18be7b8119
commit b64103e6f3
3 changed files with 24 additions and 3 deletions

View File

@ -355,7 +355,18 @@ namespace WCS.BLL.HardWare
jsonString.Replace("\\\\\"\\", string.Empty);
// 去除所有双引号前面的反斜杠
jsonString = Regex.Replace(jsonString, @"\\(.)", "$1"); ;
var data = JsonConvert.DeserializeObject<List<StockQueryResponseDataItem>>(jsonString);
List<StockQueryResponseDataItem>? data = null;
try
{
data = JsonConvert.DeserializeObject<List<StockQueryResponseDataItem>>(jsonString);
}
catch (Exception ex)
{
Logs.Write($"【库存信息反序列化失败】返回的json字符串为:\r\n{jsonString},无法成功反序列化");
module.IsNeedRefresh = false;
continue;
}
if (data != null && data.Count > 0)
{
//硬件只能显示7个 只保留前7个
@ -371,7 +382,7 @@ namespace WCS.BLL.HardWare
module.SendTaskId(taskid++, TcpCleint);
module.SendMatCode(item.material_code, TcpCleint);
module.SendMatName(item.material_name, TcpCleint);
module.SendMatSpec("-", TcpCleint);
module.SendMatSpec(item.material_spec, TcpCleint);
module.SendMatBatch(item.batch_no, TcpCleint);
module.SendMatQty((int)item.qty, TcpCleint);
}