From 4193c7cc9d38f7056064d1c5a6a2d8db482aec6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A6=82=E6=84=8F=20=E5=BD=AD?= <2417589739@qq.com> Date: Tue, 26 Apr 2022 10:17:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=86=92=E8=8F=9C=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HBLConsole.MORKM/Control_MORKM.cs | 29 ++++++++++++++++++++++++++--- HBLConsole/App.xaml.cs | 1 - 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/HBLConsole.MORKM/Control_MORKM.cs b/HBLConsole.MORKM/Control_MORKM.cs index 6245e8b..2ac7842 100644 --- a/HBLConsole.MORKM/Control_MORKM.cs +++ b/HBLConsole.MORKM/Control_MORKM.cs @@ -256,6 +256,7 @@ namespace HBLConsole.MORKM MessageLog.GetInstance.Show($"接收到{OrderCount}次订单"); if (order is MorkOrderPush morkOrderPush) { + List locs = new List(); foreach (var item in morkOrderPush.GoodBatchings) { var res = Json.Data.orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId); @@ -265,8 +266,7 @@ namespace HBLConsole.MORKM { if (loc >= 1 && loc <= 5) { - if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == morkOrderPush.SuborderId) == null) - mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = ushort.Parse(res.BatchingLoc), SuborderId = morkOrderPush.SuborderId, BatchingId = res.BatchingId }); + locs.Add(new OrderLocInfo() { Loc = ushort.Parse(res.BatchingLoc), SuborderId = morkOrderPush.SuborderId, BatchingId = res.BatchingId }); } else if (loc >= 10 && loc <= 11) { @@ -287,8 +287,31 @@ namespace HBLConsole.MORKM } } } - } + + while (locs.Count > 0) + { + for (int i = 0; i < locs.Count; i++) + { + var res = locs.FirstOrDefault(p => p.Loc % 2 != 0); + if (res != null) + { + if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == res.SuborderId) == null) + mORKS.RBTakeNoodleTask.Enqueue(res); + locs.Remove(res); + + } + else + { + if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == locs[i].SuborderId) == null) + mORKS.RBTakeNoodleTask.Enqueue(locs[i]); + locs.RemoveAt(i); + + } + } + } + + } } public void Main() diff --git a/HBLConsole/App.xaml.cs b/HBLConsole/App.xaml.cs index 614bfcd..0e9913a 100644 --- a/HBLConsole/App.xaml.cs +++ b/HBLConsole/App.xaml.cs @@ -36,7 +36,6 @@ namespace HBLConsole protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); - //SystemHelper.GetInstance.AutoStart(true); ViewModelBase.Init(); SystemHelper.GetInstance.CreateDesktopShortcut(); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;