|
@@ -129,51 +129,60 @@ namespace BPASmartClient.MorkS |
|
|
|
|
|
|
|
|
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS) |
|
|
private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS) |
|
|
{ |
|
|
{ |
|
|
var res = mORKS.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid); |
|
|
|
|
|
|
|
|
//var res = mORKS.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid); |
|
|
string goodName = string.Empty; |
|
|
string goodName = string.Empty; |
|
|
string SortNum = string.Empty; |
|
|
string SortNum = string.Empty; |
|
|
if (res != null) |
|
|
|
|
|
{ |
|
|
|
|
|
goodName = res.MorkOrder.GoodsName; |
|
|
|
|
|
SortNum = res.MorkOrder.SortNum.ToString(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { SortNum = SortNum, GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType }); |
|
|
|
|
|
|
|
|
//if (res != null) |
|
|
|
|
|
//{ |
|
|
|
|
|
// goodName = res.MorkOrder.GoodsName; |
|
|
|
|
|
// SortNum = res.MorkOrder.SortNum.ToString(); |
|
|
|
|
|
//} |
|
|
|
|
|
|
|
|
var index = DataServer.GetInstance.morkS.MakeOrder.FindIndex(p => p.SortNum == SortNum); |
|
|
|
|
|
if (index >= 0 && index < DataServer.GetInstance.morkS.MakeOrder.Count) |
|
|
|
|
|
|
|
|
if (mORKS.doe.ContainsKey(subid)) |
|
|
{ |
|
|
{ |
|
|
if (oRDER_STATUS == ORDER_STATUS.COMPLETED_COOK) |
|
|
|
|
|
|
|
|
goodName = mORKS.doe[subid].MorkOrder.GoodsName; |
|
|
|
|
|
SortNum = mORKS.doe[subid].MorkOrder.SortNum.ToString(); |
|
|
|
|
|
if (!string.IsNullOrEmpty(goodName) && !string.IsNullOrEmpty(SortNum)) |
|
|
{ |
|
|
{ |
|
|
DataServer.GetInstance.morkS.MakeOrder.RemoveAt(index); |
|
|
|
|
|
DataServer.GetInstance.morkS.MakeOrderOver.Add(new OrderMakeModel() |
|
|
|
|
|
|
|
|
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { SortNum = SortNum, GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType }); |
|
|
|
|
|
var index = DataServer.GetInstance.morkS.MakeOrder.FindIndex(p => p.SortNum == SortNum); |
|
|
|
|
|
if (index >= 0 && index < DataServer.GetInstance.morkS.MakeOrder.Count) |
|
|
{ |
|
|
{ |
|
|
Status = oRDER_STATUS, |
|
|
|
|
|
GoodName = goodName, |
|
|
|
|
|
SortNum = SortNum, |
|
|
|
|
|
StopTime = DateTime.Now.ToString("HH:mm:ss") |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
else if (oRDER_STATUS == ORDER_STATUS.COMPLETED_TAKE) |
|
|
|
|
|
{ |
|
|
|
|
|
var temp = DataServer.GetInstance.morkS.MakeOrderOver.FirstOrDefault(p => p.SortNum == SortNum); |
|
|
|
|
|
if (temp != null) DataServer.GetInstance.morkS.MakeOrderOver.Remove(temp); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
DataServer.GetInstance.morkS.MakeOrder.ElementAt(index).Status = oRDER_STATUS; |
|
|
|
|
|
|
|
|
if (oRDER_STATUS == ORDER_STATUS.COMPLETED_COOK) |
|
|
|
|
|
{ |
|
|
|
|
|
DataServer.GetInstance.morkS.MakeOrder.RemoveAt(index); |
|
|
|
|
|
DataServer.GetInstance.morkS.MakeOrderOver.Add(new OrderMakeModel() |
|
|
|
|
|
{ |
|
|
|
|
|
Status = oRDER_STATUS, |
|
|
|
|
|
GoodName = goodName, |
|
|
|
|
|
SortNum = SortNum, |
|
|
|
|
|
StopTime = DateTime.Now.ToString("HH:mm:ss") |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
else if (oRDER_STATUS == ORDER_STATUS.COMPLETED_TAKE) |
|
|
|
|
|
{ |
|
|
|
|
|
var temp = DataServer.GetInstance.morkS.MakeOrderOver.FirstOrDefault(p => p.SortNum == SortNum); |
|
|
|
|
|
if (temp != null) DataServer.GetInstance.morkS.MakeOrderOver.Remove(temp); |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
DataServer.GetInstance.morkS.MakeOrder.ElementAt(index).Status = oRDER_STATUS; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
DataServer.GetInstance.morkS.MakeOrder.Add(new OrderMakeModel() |
|
|
|
|
|
{ |
|
|
|
|
|
Status = oRDER_STATUS, |
|
|
|
|
|
GoodName = goodName, |
|
|
|
|
|
SortNum = SortNum, |
|
|
|
|
|
StartTime = DateTime.Now.ToString("HH:mm:ss") |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
mORKS.doe.Remove(subid, out _); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
DataServer.GetInstance.morkS.MakeOrder.Add(new OrderMakeModel() |
|
|
|
|
|
{ |
|
|
|
|
|
Status = oRDER_STATUS, |
|
|
|
|
|
GoodName = goodName, |
|
|
|
|
|
SortNum = SortNum, |
|
|
|
|
|
StartTime = DateTime.Now.ToString("HH:mm:ss") |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private void GetStatus(string key, Action<object> action) |
|
|
private void GetStatus(string key, Action<object> action) |
|
@@ -322,6 +331,7 @@ namespace BPASmartClient.MorkS |
|
|
if (@event is DoOrderEvent order) |
|
|
if (@event is DoOrderEvent order) |
|
|
{ |
|
|
{ |
|
|
mORKS.doOrderEvents.Add(order); |
|
|
mORKS.doOrderEvents.Add(order); |
|
|
|
|
|
mORKS.doe.TryAdd(order.MorkOrder.SuborderId, order); |
|
|
DeviceProcessLogShow($"接收到{order.MorkOrder.SortNum}号订单"); |
|
|
DeviceProcessLogShow($"接收到{order.MorkOrder.SortNum}号订单"); |
|
|
if (order.MorkOrder.GoodBatchings == null) return; |
|
|
if (order.MorkOrder.GoodBatchings == null) return; |
|
|
if (mORKS.HistorySuborderId.Contains(order.MorkOrder.SuborderId)) return; |
|
|
if (mORKS.HistorySuborderId.Contains(order.MorkOrder.SuborderId)) return; |
|
|