diff --git a/SlnMesnac.RfidUpload.Model/apiParam/CsbResult.cs b/SlnMesnac.RfidUpload.Model/apiParam/CsbResult.cs index 4cf6939..d76d2e3 100644 --- a/SlnMesnac.RfidUpload.Model/apiParam/CsbResult.cs +++ b/SlnMesnac.RfidUpload.Model/apiParam/CsbResult.cs @@ -1,6 +1,10 @@ -using System; +using Newtonsoft.Json.Linq; + +using System; using System.Collections.Generic; +using System.Collections.ObjectModel; using System.Text; +using Newtonsoft.Json; #region << 版 本 注 释 >> /*-------------------------------------------------------------------- @@ -32,9 +36,25 @@ namespace SlnMesnac.RfidUpload.Model.apiParam public string msg { get; set; } - public List @object { get; set; } + // public List @object { get; set; } + + public bool IsSuccess => code == "200"; + + public List ToObjectList() + { + JObject job = JObject.Parse(body); + string str = job["retBody"]?["object"]?.ToString(); + if (!string.IsNullOrEmpty(str)) + { + List institutionList = JsonConvert.DeserializeObject>(str); + return institutionList; + + } + + return new List(); + } - public string body { get; set; } + public string body { get; set; } public string code { get; set; } public string csbCode { get; set; } diff --git a/SlnMesnac.RfidUpload.UI/SelectRouterWindow.xaml.cs b/SlnMesnac.RfidUpload.UI/SelectRouterWindow.xaml.cs index bf2c8ce..0368f28 100644 --- a/SlnMesnac.RfidUpload.UI/SelectRouterWindow.xaml.cs +++ b/SlnMesnac.RfidUpload.UI/SelectRouterWindow.xaml.cs @@ -72,9 +72,11 @@ namespace SlnMesnac.RfidUpload.UI CsbResult res = csbHandleBusiness.findStationSequenceByCsb(_transferOrderInfo.ffjhNo, opBatch); if (res.code == "200") { - if (res.@object != null && res.@object.Count > 0) + if (res.IsSuccess) { - List institutionList = res.@object.ConvertAll(item => JsonConvert.DeserializeObject(item.ToString())); + List institutionList = res.ToObjectList(); + + // res.@object.ConvertAll(item => JsonConvert.DeserializeObject(item.ToString())); int count = 1; Console.WriteLine("机构信息:"); foreach (var institution in institutionList) diff --git a/SlnMesnac.RfidUpload.UI/viewModel/ContainerTransferOrderViewModel.cs b/SlnMesnac.RfidUpload.UI/viewModel/ContainerTransferOrderViewModel.cs index 2695eb6..6beee74 100644 --- a/SlnMesnac.RfidUpload.UI/viewModel/ContainerTransferOrderViewModel.cs +++ b/SlnMesnac.RfidUpload.UI/viewModel/ContainerTransferOrderViewModel.cs @@ -139,9 +139,9 @@ namespace SlnMesnac.RfidUpload.UI.viewModel MessageBox.Show(res.message); if (res.code == "200") { - if (res.@object != null && res.@object.Count > 0) + if (res.IsSuccess) { - List institutionList = res.@object.ConvertAll(item => JsonConvert.DeserializeObject(item.ToString())); + List institutionList = res.ToObjectList(); TransferOrderInfoItems = new ObservableCollection(institutionList); } }