From f13f66878382018d2c816b3304f493ded310e5da Mon Sep 17 00:00:00 2001 From: "nodyang@aliyun.com" Date: Tue, 17 Dec 2024 13:03:48 +0800 Subject: [PATCH] fix --- .../CsbHandleBusiness.cs | 20 +-- .../apiParam/CsbResult.cs | 21 ++- .../SelectRouterWindow.xaml.cs | 23 ++- .../ContainerTransferOrderViewModel.cs | 15 +- .../viewModel/MainWindowViewModel.cs | 143 +++++++++--------- .../viewModel/TransferOrderViewModel.cs | 4 +- .../containerStorageQueryByCsbViewModel.cs | 4 +- 7 files changed, 119 insertions(+), 111 deletions(-) diff --git a/SlnMesnac.RfidUpload.Business/CsbHandleBusiness.cs b/SlnMesnac.RfidUpload.Business/CsbHandleBusiness.cs index 2a4bb90..9e89d43 100644 --- a/SlnMesnac.RfidUpload.Business/CsbHandleBusiness.cs +++ b/SlnMesnac.RfidUpload.Business/CsbHandleBusiness.cs @@ -132,7 +132,7 @@ namespace SlnMesnac.RfidUpload.Business catch (Exception ex) { logHelper.Error($"容器入库接口处理异常:{ex.Message}", ex); - res.status = "500"; + res.message= $"新容器入库接口处理异常:{ex.Message}"; return res; } @@ -172,7 +172,7 @@ namespace SlnMesnac.RfidUpload.Business catch (Exception ex) { logHelper.Error($"新容器入库-调拨单号验证接口处理异常:{ex.Message}", ex); - res.status = "500"; + //res.status = "500"; res.message= $"新容器入库-调拨单号验证接口处理异常:{ex.Message}"; } @@ -263,7 +263,7 @@ namespace SlnMesnac.RfidUpload.Business catch (Exception ex) { logHelper.Error($"容器封发-获取调拨单和封发计划接口处理异常:{ex.Message}", ex); - res.status = "500"; + // res.status = "500"; res.message= $"容器封发-获取调拨单和封发计划接口处理异常:{ex.Message}"; return res; } @@ -295,7 +295,7 @@ namespace SlnMesnac.RfidUpload.Business catch (Exception ex) { logHelper.Error($"容器封发-验证封发计划接口处理异常:{ex.Message}", ex); - res.code = "500"; + // res.code = "500"; res.message= $"容器封发-验证封发计划接口处理异常:{ex.Message}"; return res; } @@ -335,7 +335,7 @@ namespace SlnMesnac.RfidUpload.Business catch (Exception ex) { logHelper.Error($"容器封发-接收容器条码接口处理异常:{ex.Message}", ex); - res.status = "500"; + //res.status = "500"; res.message= $"容器封发-接收容器条码接口处理异常:{ex.Message}"; return res; } @@ -370,7 +370,7 @@ namespace SlnMesnac.RfidUpload.Business { logHelper.Error($"容器封发-反馈接收结果接口处理异常:{ex.Message}", ex); res.message= $"容器封发-反馈接收结果接口处理异常:{ex.Message}"; - res.status = "500"; + //res.status = "500"; return res; } } @@ -403,7 +403,7 @@ namespace SlnMesnac.RfidUpload.Business { logHelper.Error($"容器直连配发-获取邮路卸交站接口处理异常:{ex.Message}", ex); res.message = $"容器直连配发-获取邮路卸交站接口处理异常:{ex.Message}"; - res.code = "500"; + // res.code = "500"; return res; } } @@ -441,7 +441,7 @@ namespace SlnMesnac.RfidUpload.Business { logHelper.Error($"容器直连配发-校验发运计划接口处理异常:{ex.Message}", ex); res.message = $"容器直连配发-校验发运计划接口处理异常:{ex.Message}"; - res.code = "500"; + // res.code = "500"; return res; } } @@ -482,7 +482,7 @@ namespace SlnMesnac.RfidUpload.Business { logHelper.Error($"容器直连配发-开始配发接口处理异常:{ex.Message}", ex); res.message = $"容器直连配发-开始配发接口处理异常:{ex.Message}"; - res.code = "500"; + // res.code = "500"; return res; } } @@ -516,7 +516,7 @@ namespace SlnMesnac.RfidUpload.Business { logHelper.Error($"容器直连配发-反馈接收结果接口处理异常:{ex.Message}", ex); res.message = $"容器直连配发-反馈接收结果接口处理异常:{ex.Message}"; - res.code = "500"; + // res.code = "500"; return res; } } diff --git a/SlnMesnac.RfidUpload.Model/apiParam/CsbResult.cs b/SlnMesnac.RfidUpload.Model/apiParam/CsbResult.cs index 4e5def7..291032f 100644 --- a/SlnMesnac.RfidUpload.Model/apiParam/CsbResult.cs +++ b/SlnMesnac.RfidUpload.Model/apiParam/CsbResult.cs @@ -32,13 +32,13 @@ namespace SlnMesnac.RfidUpload.Model.apiParam { public class CsbResult { - public string status { get; set; } + // public string status { get; set; } public string msg { get; set; } // public List @object { get; set; } - public bool IsSuccess => code == "200"; + public bool IsSuccess => status().StartsWith("0"); public List ToObjectList() { @@ -70,13 +70,26 @@ namespace SlnMesnac.RfidUpload.Model.apiParam if (job != null) { var s = job?["msg"]?.ToString(); - var b = job?["status"].ToString(); + var b = ""; return s +" "+ b??""; } return ""; } + public string status() + { + var job = GetRetBodyJObject(); + if (job != null) + { + var s = job?["status"]?.ToString(); + var b = ""; + return s + " " + b ?? ""; + } + + return ""; + } + public string GetRetBody() { JObject job = JObject.Parse(body); @@ -89,7 +102,7 @@ namespace SlnMesnac.RfidUpload.Model.apiParam return message; } - public string code { get; set; } + // public string code { get; set; } public string csbCode { get; set; } public string message { get; set; } } diff --git a/SlnMesnac.RfidUpload.UI/SelectRouterWindow.xaml.cs b/SlnMesnac.RfidUpload.UI/SelectRouterWindow.xaml.cs index 5be7d3a..1a7e9c1 100644 --- a/SlnMesnac.RfidUpload.UI/SelectRouterWindow.xaml.cs +++ b/SlnMesnac.RfidUpload.UI/SelectRouterWindow.xaml.cs @@ -67,21 +67,18 @@ namespace SlnMesnac.RfidUpload.UI CsbResult res = csbHandleBusiness.findStationSequenceByCsb(_transferOrderInfo.ffjhNo, opBatch); this.PageMessage.Content = res.GetMsg(); - if (res.code == "200") + if (res.IsSuccess) { - if (res.IsSuccess) + List institutionList = res.ToObjectList(); + int count = 1; + Console.WriteLine("机构信息:"); + foreach (var institution in institutionList) { - List institutionList = res.ToObjectList(); - int count = 1; - Console.WriteLine("机构信息:"); - foreach (var institution in institutionList) - { - institution.No = count++.ToString(); - institution.opBatch = opBatch; - - } - InstitutionList.ItemsSource = institutionList; + institution.No = count++.ToString(); + institution.opBatch = opBatch; + } + InstitutionList.ItemsSource = institutionList; } else { @@ -153,7 +150,7 @@ namespace SlnMesnac.RfidUpload.UI //6.8 验证封发计划接口 CsbResult res = csbHandleBusiness.transferOrderFfjhCheckByCsb(_transferOrderInfo.ffjhNo, _transferOrderInfo.ffjhscrq); this.PageMessage.Content = $"验证封发计划接口:{res.GetMsg()}"; - if (res.code == "200") + if (res.IsSuccess) { //封发计划正常可封发 RefreshSubmitVerifyEvent?.Invoke(BelongPage, res.GetMsg(), _transferOrderInfo,institution); diff --git a/SlnMesnac.RfidUpload.UI/viewModel/ContainerTransferOrderViewModel.cs b/SlnMesnac.RfidUpload.UI/viewModel/ContainerTransferOrderViewModel.cs index ffc6e55..a86b454 100644 --- a/SlnMesnac.RfidUpload.UI/viewModel/ContainerTransferOrderViewModel.cs +++ b/SlnMesnac.RfidUpload.UI/viewModel/ContainerTransferOrderViewModel.cs @@ -193,21 +193,18 @@ namespace SlnMesnac.RfidUpload.UI.viewModel #region 正式启用 CsbResult res = csbHandleBusiness.transferOrderFfjhByCsb("", _startDate.Value.ToString(), _endDate.Value.ToString()); TransferMsg = "获取调拨单结果:" + res.GetMsg(); - // MessageBox.Show("容器封发-获取调拨单和封发计划:"+res.message); - if (res.code == "200") + // MessageBox.Show("容器封发-获取调拨单和封发计划:"+res.message); + if (res.IsSuccess) { - if (res.IsSuccess) - { - List institutionList = res.ToObjectList(); - TransferOrderInfoItems = new ObservableCollection(institutionList); - TotalAmount = TransferOrderInfoItems.Count.ToString(); - } + List institutionList = res.ToObjectList(); + TransferOrderInfoItems = new ObservableCollection(institutionList); + TotalAmount = TransferOrderInfoItems.Count.ToString(); } #endregion - + } diff --git a/SlnMesnac.RfidUpload.UI/viewModel/MainWindowViewModel.cs b/SlnMesnac.RfidUpload.UI/viewModel/MainWindowViewModel.cs index b3c6f2e..3cf5658 100644 --- a/SlnMesnac.RfidUpload.UI/viewModel/MainWindowViewModel.cs +++ b/SlnMesnac.RfidUpload.UI/viewModel/MainWindowViewModel.cs @@ -450,32 +450,23 @@ namespace SlnMesnac.RfidUpload.UI.viewModel res = csbHandleBusiness.containerStorageBatchQueryByCsb(TrackNo,batchNo.ToString(), enumerable.ToList()); } MainPageTipMessage = $"新容器入库 [{res.GetMsg()}]"; - Task.Run(() => - { - Thread.Sleep(3000); - CsbResult res = csbHandleBusiness.receContainerStorageByCsb(TrackNo, "1"); - - Application.Current.Dispatcher.Invoke(() => + if (res.IsSuccess) + { + Task.Run(() => { - MainPageTipMessage = $"新容器入库反馈接口,[{res.GetMsg()}]"; - - }); - }); + Thread.Sleep(3000); + CsbResult res = csbHandleBusiness.receContainerStorageByCsb(TrackNo, "1"); + Application.Current.Dispatcher.Invoke(() => + { + MainPageTipMessage = $"新容器入库反馈接口,[{res.GetMsg()}]"; + }); - ////取出托盘号并调用接口 - //var palletInfo = labelItems.FirstOrDefault(); - //if (palletInfo == null) - //{ - // MessageBox.Show("请先放包裹读条码!"); - // return; - //} - //else - //{ - // CsbResult res = csbHandleBusiness.scanAnyContainerCodeByCsb(palletInfo.result); - // MessageBox.Show("新容器入库" + res.message); - //} + }); + + } + } else if (workModelParam == 2) //封发-按调拨单 { @@ -497,20 +488,25 @@ namespace SlnMesnac.RfidUpload.UI.viewModel MainPageTipMessage = $"封发-按调拨单 [{res.GetMsg()}]"; - Task.Run(() => - { //若干秒以后调反馈接口,确认是否和实际相符 - Thread.Sleep(3000); + if (res.IsSuccess) + { + Task.Run(() => + { //若干秒以后调反馈接口,确认是否和实际相符 - CsbResult res = csbHandleBusiness.containerScanSealResultByCsb(TransferOrderInfoItem.ffjhNo, opBatch); + Thread.Sleep(3000); + + CsbResult res = csbHandleBusiness.containerScanSealResultByCsb(TransferOrderInfoItem.ffjhNo, opBatch); + + Application.Current.Dispatcher.Invoke(() => + { + MainPageTipMessage = $"封发-按调拨单反馈接口,[{res.GetMsg()}]"; + // 如果需要弹出消息框,也需要在 UI 线程调用 MessageBox + // MessageBox.Show($"封发-按调拨单反馈接口,[{res.GetMsg()}]"); + }); - Application.Current.Dispatcher.Invoke(() => - { - MainPageTipMessage = $"封发-按调拨单反馈接口,[{res.GetMsg()}]"; - // 如果需要弹出消息框,也需要在 UI 线程调用 MessageBox - // MessageBox.Show($"封发-按调拨单反馈接口,[{res.GetMsg()}]"); }); - }); + } } @@ -532,56 +528,61 @@ namespace SlnMesnac.RfidUpload.UI.viewModel } MainPageTipMessage = $"封发-按调拨单 [{res.GetMsg()}]"; - - Task.Run(() => + if (res.IsSuccess) { - // 五、6.10反馈接收结果(利用上一步的opBatch) - Thread.Sleep(3000); - CsbResult res1 = csbHandleBusiness.containerScanSealResultByCsb(TransferOrderInfoItem.ffjhNo, opBatch); - MainPageTipMessage = $"封发-按调拨单反馈接口,[{res1.GetMsg()}]"; - - //六、6.12 效验发运计划(利用上一步的opBatch) - string stationOrgCode = Institution != null ? Institution.stationOrgCode : ""; - string stationOrgName = Institution != null ? Institution.stationOrgName : ""; - CsbResult res2 = csbHandleBusiness.tranPlanCheckByCsb(_transferOrderInfo.ffjhNo, opBatch, stationOrgCode, stationOrgName); - MainPageTipMessage = "校验发运计划结果:" + res2.GetMsg(); - if (res2.code == "200") + Task.Run(() => { - // 七、6.13.容器直连配发-开始配发 - - CsbResult res3 = csbHandleBusiness.containerAllotByCsb(TransferOrderInfoItem.ffjhNo, opBatch); - MainPageTipMessage = $"库存容器封发配发 -- 6.13.容器直连配发-开始配发 [{res3.GetMsg()}]"; - Task.Run(() => + // 五、6.10反馈接收结果(利用上一步的opBatch) + Task.Delay(3000); + CsbResult res1 = csbHandleBusiness.containerScanSealResultByCsb(TransferOrderInfoItem.ffjhNo, opBatch); + MainPageTipMessage = $"封发-按调拨单反馈接口,[{res1.GetMsg()}]"; + + if(!res1.IsSuccess) return; + + //六、6.12 效验发运计划(利用上一步的opBatch) + string stationOrgCode = Institution != null ? Institution.stationOrgCode : ""; + string stationOrgName = Institution != null ? Institution.stationOrgName : ""; + CsbResult res2 = csbHandleBusiness.tranPlanCheckByCsb(_transferOrderInfo.ffjhNo, opBatch, stationOrgCode, stationOrgName); + MainPageTipMessage = "校验发运计划结果:" + res2.GetMsg(); + if (res2.IsSuccess) { - Task.Delay(3000); - // Thread.Sleep(3000); - //八、反馈接收接口,确认是否和实际相符 + // 七、6.13.容器直连配发-开始配发 - for (int i = 0; i < 3; i++) + CsbResult res3 = csbHandleBusiness.containerAllotByCsb(TransferOrderInfoItem.ffjhNo, opBatch); + MainPageTipMessage = $"库存容器封发配发 -- 6.13.容器直连配发-开始配发 [{res3.GetMsg()}]"; + if (res3.IsSuccess) { - try + Task.Delay(3000); + // Thread.Sleep(3000); + //八、反馈接收接口,确认是否和实际相符 + + for (int i = 0; i < 3; i++) { - CsbResult res4 = csbHandleBusiness.containerAllotResultByCsb(TransferOrderInfoItem.ffjhNo, opBatch); - MainPageTipMessage = $"八、反馈接收接口,确认是否和实际相符[{res4.GetMsg()}]"; - if (res4.IsSuccess) + try + { + CsbResult res4 = csbHandleBusiness.containerAllotResultByCsb(TransferOrderInfoItem.ffjhNo, opBatch); + MainPageTipMessage = $"八、反馈接收接口,确认是否和实际相符[{res4.GetMsg()}]"; + if (res4.IsSuccess) + { + break; + + }; + } + catch (Exception ex) { - break; + logger.Info(ex.Message); + Task.Delay(3000); + } - }; - } - catch (Exception ex) - { - logger.Info(ex.Message); - Task.Delay(3000); - } - + } } + + } - }); - } - - }); + }); + } + diff --git a/SlnMesnac.RfidUpload.UI/viewModel/TransferOrderViewModel.cs b/SlnMesnac.RfidUpload.UI/viewModel/TransferOrderViewModel.cs index 73de889..5ac7618 100644 --- a/SlnMesnac.RfidUpload.UI/viewModel/TransferOrderViewModel.cs +++ b/SlnMesnac.RfidUpload.UI/viewModel/TransferOrderViewModel.cs @@ -193,7 +193,7 @@ namespace SlnMesnac.RfidUpload.UI.viewModel CsbResult res = csbHandleBusiness.transferOrderFfjhByCsb(_drj, _startDate.Value.ToString(), _endDate.Value.ToString()); TransferMsg = $"获取调拨单结果:{res.GetMsg()}"; // MessageBox.Show("容器封发-获取调拨单和封发计划:" + res.GetMsg()); - if (res.code == "200") + if (res.IsSuccess) { JObject job = JObject.Parse(res.body); @@ -228,7 +228,7 @@ namespace SlnMesnac.RfidUpload.UI.viewModel CsbResult res = csbHandleBusiness.transferOrderFfjhCheckByCsb(transferOrderInfo.ffjhNo, transferOrderInfo.ffjhscrq); TransferMsg = $"验证调拨单结果:{res.GetMsg()}"; - if (res.code== "200") + if (res.IsSuccess) { //封发计划正常可封发 // MessageBox.Show($"验证调拨单结果,[{res.GetMsg()}];"); SuccessEvent?.Invoke(); diff --git a/SlnMesnac.RfidUpload.UI/viewModel/containerStorageQueryByCsbViewModel.cs b/SlnMesnac.RfidUpload.UI/viewModel/containerStorageQueryByCsbViewModel.cs index eb91feb..b64d774 100644 --- a/SlnMesnac.RfidUpload.UI/viewModel/containerStorageQueryByCsbViewModel.cs +++ b/SlnMesnac.RfidUpload.UI/viewModel/containerStorageQueryByCsbViewModel.cs @@ -136,7 +136,7 @@ namespace SlnMesnac.RfidUpload.UI.viewModel { CsbResult res = csbHandleBusiness.containerStorageQueryByCsb(dbbh,rqtmStart,rqtmEnd); - if (res.code == "200") + if (res.IsSuccess) { JObject job = JObject.Parse(res.body); string str = job["retBody"]?["object"]?.ToString(); @@ -165,7 +165,7 @@ namespace SlnMesnac.RfidUpload.UI.viewModel } else { - MessageBox.Show($"新容器入库-调拨单号验证失败,status:{res.code};msg:{res.GetMsg()};"); + MessageBox.Show($"新容器入库-调拨单号验证失败,status:{res.status()};msg:{res.GetMsg()};"); } }catch (Exception ex)