diff --git a/SlnMesnac.RfidUpload.UI/DbTool.cs b/SlnMesnac.RfidUpload.UI/DbTool.cs new file mode 100644 index 0000000..25276a4 --- /dev/null +++ b/SlnMesnac.RfidUpload.UI/DbTool.cs @@ -0,0 +1,109 @@ +using SlnMesnac.RfidUpload.Business; +using SlnMesnac.RfidUpload.Common; +using SlnMesnac.RfidUpload.Model.apiParam; + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace SlnMesnac.RfidUpload.UI +{ + public class Tool + { + public static void Push(List strList, Dbt dtDbt, Action action) + { + string opBatch = dtDbt.opBatch; + + CsbHandleBusiness csbHandleBusiness = CsbHandleBusiness.Instance; + int batchNo = 0; + ListPage ls = new ListPage(strList, 500); + CsbResult res = new CsbResult(); + foreach (var enumerable in ls.GetPage()) + { + batchNo++; + res = csbHandleBusiness.containerScanSealByCsb(dtDbt.ffjhNo, + opBatch, + dtDbt.ffjhscrq, batchNo.ToString(), enumerable.ToList()); + + action.Invoke(0,res.GetMsg()); + } + + // MainPageTipMessage = $"封发-按调拨单 [{res.GetMsg()}]"; + if (res.IsSuccess) + { + Task.Run(() => + { + // 五、6.10反馈接收结果(利用上一步的opBatch) + Task.Delay(3000); + CsbResult res1 = csbHandleBusiness.containerScanSealResultByCsb(dtDbt.ffjhNo, opBatch); + action.Invoke(1,res1.GetMsg()); + if (!res1.IsSuccess) return; + + //六、6.12 效验发运计划(利用上一步的opBatch) + string stationOrgCode = dtDbt != null ? dtDbt.stationOrgCode : ""; + string stationOrgName = dtDbt != null ? dtDbt.stationOrgName : ""; + CsbResult res2 = csbHandleBusiness.tranPlanCheckByCsb(dtDbt.ffjhNo, opBatch, stationOrgCode, stationOrgName); + + action.Invoke(2,res2.GetMsg()); + + if (res2.IsSuccess) + { + // 七、6.13.容器直连配发-开始配发 + + CsbResult res3 = csbHandleBusiness.containerAllotByCsb(dtDbt.ffjhNo, opBatch); + action.Invoke(3,res3.GetMsg()); + if (res3.IsSuccess) + { + Task.Delay(3000); + + //八、反馈接收接口,确认是否和实际相符 + + for (int i = 0; i < 3; i++) + { + try + { + CsbResult res4 = csbHandleBusiness.containerAllotResultByCsb(dtDbt.ffjhNo, opBatch); + action.Invoke(4,res4.GetMsg()); + if (res4.IsSuccess) + { + break; + + }; + } + catch (Exception ex) + { + + Task.Delay(3000); + } + + + } + } + + } + + }); + } + + } + } + + + + + public class Dbt + { + public string opBatch { get; set; } + public string ffjhNo { get; set; } + public string ffjhscrq { get; set; } + + + public string No { get; set; } + public string stationOrgCode { get; set; } + public string stationOrgName { get; set; } + + } + +} diff --git a/SlnMesnac.RfidUpload.UI/viewModel/MainWindowViewModel.cs b/SlnMesnac.RfidUpload.UI/viewModel/MainWindowViewModel.cs index e1fddd2..9dd6da6 100644 --- a/SlnMesnac.RfidUpload.UI/viewModel/MainWindowViewModel.cs +++ b/SlnMesnac.RfidUpload.UI/viewModel/MainWindowViewModel.cs @@ -26,7 +26,7 @@ namespace SlnMesnac.RfidUpload.UI.viewModel { public class MainWindowViewModel : ViewModelBase { - + private CsbHandleBusiness csbHandleBusiness = CsbHandleBusiness.Instance; TransferOrderViewModel transferOrderViewModel = new TransferOrderViewModel(); ContainerTransferOrderViewModel containerTransferOrderViewModel = new ContainerTransferOrderViewModel(); private readonly LogHelper logger = LogHelper.Instance; @@ -34,7 +34,7 @@ namespace SlnMesnac.RfidUpload.UI.viewModel private readonly SerialPortBusiness _serialPortBusiness = SerialPortBusiness.Instance; private ObservableCollection listItems = new ObservableCollection(); private ObservableCollection labelItems = new ObservableCollection(); - private CsbHandleBusiness csbHandleBusiness = CsbHandleBusiness.Instance; + private WebApiServerApp webApiServerApp = WebApiServerApp.Instance; private ApiServer apiServer = ApiServer.GetInstance(); private AppConfig appConfig = AppConfig.Instance; @@ -440,77 +440,48 @@ namespace SlnMesnac.RfidUpload.UI.viewModel var strList = info.Select(x => x.result).ToList(); int batchNo = 0; string opBatch = OpBatchManager.BathNo; - ListPage ls = new ListPage(strList, 500); - CsbResult res = new CsbResult(); - foreach (var enumerable in ls.GetPage()) - { - batchNo++; - res = csbHandleBusiness.containerScanSealByCsb(TransferOrderInfoItem.ffjhNo, - opBatch, - TransferOrderInfoItem.ffjhscrq, batchNo.ToString(), enumerable.ToList()); - PrintMessageToListBox($"封发-按调拨单接口结果 [{res.GetMsg()}]"); - } + var dt = new Dbt(); + dt.opBatch = opBatch; + dt.ffjhNo = TransferOrderInfoItem.ffjhNo; + dt.No = ""; + dt.ffjhscrq = TransferOrderInfoItem.ffjhscrq; + dt.stationOrgCode = Institution.stationOrgCode; + dt.stationOrgName = Institution.stationOrgName; - MainPageTipMessage = $"封发-按调拨单 [{res.GetMsg()}]"; - if (res.IsSuccess) + + Action ac = (x, msg) => { - Task.Run(() => + if (x == 0) { - // 五、6.10反馈接收结果(利用上一步的opBatch) - Task.Delay(3000); - CsbResult res1 = csbHandleBusiness.containerScanSealResultByCsb(TransferOrderInfoItem.ffjhNo, opBatch); - MainPageTipMessage = $"封发-按调拨单反馈接口,[{res1.GetMsg()}]"; - PrintMessageToListBox($"封发-按调拨单反馈接口,[{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(); - PrintMessageToListBox("校验发运计划结果:" + res2.GetMsg()); - if (res2.IsSuccess) - { - // 七、6.13.容器直连配发-开始配发 - - CsbResult res3 = csbHandleBusiness.containerAllotByCsb(TransferOrderInfoItem.ffjhNo, opBatch); - MainPageTipMessage = $"库存容器封发配发 -- 6.13.容器直连配发-开始配发 [{res3.GetMsg()}]"; - PrintMessageToListBox($"库存容器封发配发 -- 6.13.容器直连配发-开始配发 [{res3.GetMsg()}]"); - if (res3.IsSuccess) - { - Task.Delay(3000); - // Thread.Sleep(3000); - //八、反馈接收接口,确认是否和实际相符 - - for (int i = 0; i < 3; i++) - { - try - { - CsbResult res4 = csbHandleBusiness.containerAllotResultByCsb(TransferOrderInfoItem.ffjhNo, opBatch); - MainPageTipMessage = $"八、反馈接收接口,确认是否和实际相符[{res4.GetMsg()}]"; - PrintMessageToListBox($"库存容器封发配发反馈接收接口 [{res4.GetMsg()}]"); - if (res4.IsSuccess) - { - break; - - }; - } - catch (Exception ex) - { - logger.Info(ex.Message); - Task.Delay(3000); - } - - - } - } - - } + PrintMessageToListBox($"封发-按调拨单接口结果 [{msg}]"); + } - }); - } - + if (x == 1) + { + MainPageTipMessage = $"封发-按调拨单反馈接口,[{msg}]"; + PrintMessageToListBox($"封发-按调拨单反馈接口,[{msg}"); + } + + if (x == 2) + { + MainPageTipMessage = $"校验发运计划结果,[{msg}]"; + PrintMessageToListBox($"校验发运计划结果,[{msg}"); + } + + if (x == 3) + { + MainPageTipMessage = $"库存容器封发配发 -- 6.13.容器直连配发-开始配发,[{msg}]"; + PrintMessageToListBox($"库存容器封发配发 -- 6.13.容器直连配发-开始配发,[{msg}"); + } + if (x == 4) + { + MainPageTipMessage = $"反馈接收接口,确认是否和实际相符,[{msg}]"; + PrintMessageToListBox($"反馈接收接口,确认是否和实际相符,[{msg}"); + } + }; + + Tool.Push(strList, dt,ac); @@ -723,7 +694,12 @@ namespace SlnMesnac.RfidUpload.UI.viewModel TrackNo = trackNo; } + + + } + + } class DataGridEnt @@ -733,3 +709,4 @@ class DataGridEnt public string result { get; set; } public DateTime recordtime { get; set; } } +