PDA扫码入库逻辑修改

This commit is contained in:
alex
2023-09-06 09:53:12 +08:00
parent 589803f1d9
commit 10a907d927
2 changed files with 22 additions and 8 deletions

View File

@@ -24,6 +24,7 @@ using JNPF.VisualDev;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
@@ -96,9 +97,18 @@ namespace Tnb.WarehouseMgr
if (locDest == null) throw new ArgumentNullException(nameof(locDest));
if (!carry.carrystd_id.IsNullOrEmpty() && !locDest.carrystd_id.IsNullOrEmpty())
{
var jsonArr = JArray.Parse(locDest.carrystd_id);
var locCarryStdArr = jsonArr.Select(x => x.ToObject<string>()).ToArray();
isMatch = locCarryStdArr.Contains(carry.carrystd_id);
JArray? jsonArr = null;
try
{
jsonArr = JArray.Parse(locDest.carrystd_id);
var locCarryStdArr = jsonArr.Select(x => x.ToObject<string>()).ToArray();
isMatch = locCarryStdArr.Contains(carry.carrystd_id);
}
catch (Exception ex) when (ex is JsonException jex)
{
isMatch = carry.carrystd_id.Equals(locDest.carrystd_id, StringComparison.OrdinalIgnoreCase);
}
}
return Task.FromResult(isMatch);
}