浏览代码

订单状态修改

master
pry 1年前
父节点
当前提交
fb878bb4e7
共有 3 个文件被更改,包括 50 次插入37 次删除
  1. +1
    -0
      BPASmartClient.Helper/ThreadManage.cs
  2. +47
    -37
      BPASmartClient.MorkS/Control_Morks.cs
  3. +2
    -0
      BPASmartClient.MorkS/GVL_MORKS.cs

+ 1
- 0
BPASmartClient.Helper/ThreadManage.cs 查看文件

@@ -65,6 +65,7 @@ namespace BPASmartClient.Helper
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx(ex.ToString());
MessageLog.GetInstance.ShowEx(ex.Message);
if (IsRestart)
{
Thread.Sleep(2000);


+ 47
- 37
BPASmartClient.MorkS/Control_Morks.cs 查看文件

@@ -129,51 +129,60 @@ namespace BPASmartClient.MorkS

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 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)
@@ -322,6 +331,7 @@ namespace BPASmartClient.MorkS
if (@event is DoOrderEvent order)
{
mORKS.doOrderEvents.Add(order);
mORKS.doe.TryAdd(order.MorkOrder.SuborderId, order);
DeviceProcessLogShow($"接收到{order.MorkOrder.SortNum}号订单");
if (order.MorkOrder.GoodBatchings == null) return;
if (mORKS.HistorySuborderId.Contains(order.MorkOrder.SuborderId)) return;


+ 2
- 0
BPASmartClient.MorkS/GVL_MORKS.cs 查看文件

@@ -313,6 +313,8 @@ namespace BPASmartClient.MorkS

public List<DoOrderEvent> doOrderEvents { get; set; } = new List<DoOrderEvent>();

public ConcurrentDictionary<string, DoOrderEvent> doe { get; set; } = new ConcurrentDictionary<string, DoOrderEvent>();

/// <summary>
/// 是否有面条
/// </summary>


正在加载...
取消
保存