瀏覽代碼

订单下发

样式分支
pry 2 年之前
父節點
當前提交
789ac67d25
共有 1 個文件被更改,包括 83 次插入37 次删除
  1. +83
    -37
      BPASmartClient.MorkS/Control.cs

+ 83
- 37
BPASmartClient.MorkS/Control.cs 查看文件

@@ -153,43 +153,88 @@ namespace BPASmartClient.MorkS
/// </summary>
public void DataParse<T>(T order)
{
OrderCount++;
MessageLog.GetInstance.Show($"接收到{OrderCount}次订单");
if (order is MorkOrderPush morkOrderPush)
{
foreach (var item in morkOrderPush.GoodBatchings)
{
//var res = Json<BatchingInfoPar>.Data.orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
if (res != null)
{
if (ushort.TryParse(res.BatchingLoc, out ushort loc))
{
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 });
}
else if (loc >= 10 && loc <= 11)
{
int index = 0;
if (recipeBoms != null)
{
index = Array.FindIndex(recipeBoms.RecipeIds?.ToArray(), p => p.RecipeId == morkOrderPush.RecipeId);
index++;
}
if (mORKS.TakeBowlTask.FirstOrDefault(p => p.SuborderId == morkOrderPush.SuborderId) == null)
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo()
{
Loc = ushort.Parse(res.BatchingLoc),
SuborderId = morkOrderPush.SuborderId,
RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0
});
}
}
}
}
}

EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle)
{
if (@event == null) return;
if (@event is DoOrderEvent order)
{
OrderCount++;
MessageLog.GetInstance.Show($"接收到{OrderCount}次订单");
foreach (var item in order.MorkOrder.GoodBatchings)
{
//var res = Json<BatchingInfoPar>.Data.orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
if (res != null)
{
if (ushort.TryParse(res.BatchingLoc, out ushort loc))
{
if (loc >= 1 && loc <= 5)
{
if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = ushort.Parse(res.BatchingLoc), SuborderId = order.MorkOrder.SuborderId, BatchingId = res.BatchingId });
}
else if (loc >= 10 && loc <= 11)
{
int index = 0;
if (recipeBoms != null)
{
index = Array.FindIndex(recipeBoms.RecipeIds?.ToArray(), p => p.RecipeId == order.MorkOrder.RecipeId);
index++;
}
if (mORKS.TakeBowlTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo()
{
Loc = ushort.Parse(res.BatchingLoc),
SuborderId = order.MorkOrder.SuborderId,
RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0
});
}
}
}
}
}
});





//if (order is MorkOrderPush morkOrderPush)
//{
// foreach (var item in morkOrderPush.GoodBatchings)
// {
// //var res = Json<BatchingInfoPar>.Data.orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
// var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
// if (res != null)
// {
// if (ushort.TryParse(res.BatchingLoc, out ushort loc))
// {
// 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 });
// }
// else if (loc >= 10 && loc <= 11)
// {
// int index = 0;
// if (recipeBoms != null)
// {
// index = Array.FindIndex(recipeBoms.RecipeIds?.ToArray(), p => p.RecipeId == morkOrderPush.RecipeId);
// index++;
// }
// if (mORKS.TakeBowlTask.FirstOrDefault(p => p.SuborderId == morkOrderPush.SuborderId) == null)
// mORKS.TakeBowlTask.Enqueue(new OrderLocInfo()
// {
// Loc = ushort.Parse(res.BatchingLoc),
// SuborderId = morkOrderPush.SuborderId,
// RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0
// });
// }
// }
// }
// }
//}

}

@@ -199,6 +244,7 @@ namespace BPASmartClient.MorkS
ThreadManage.GetInstance().StartLong(new Action(() =>
{
mORKS.AllowRun = mORKS.InitComplete;
IsHealth = mORKS.Error && mORKS.InitComplete;
//GeneralConfig.Healthy = mORKS.Error && mORKS.InitComplete && !GeneralConfig.EnableLocalSimOrder;

TakeBowlTask();


Loading…
取消
儲存