@@ -22,7 +22,7 @@ namespace BPASmartClient.Device | |||||
/// </summary> | /// </summary> | ||||
public abstract class BaseDevice : IDevice | public abstract class BaseDevice : IDevice | ||||
{ | { | ||||
public Action<bool>? stateAction; | |||||
public Action<bool> stateAction; | |||||
public BaseDevice() | public BaseDevice() | ||||
{ | { | ||||
} | } | ||||
@@ -183,12 +183,12 @@ namespace BPASmartClient.Device | |||||
TaskManage.GetInstance.StartLong(() => | TaskManage.GetInstance.StartLong(() => | ||||
{ | { | ||||
var res = this.peripherals.FindAll(o => o.IsConnected == true); | var res = this.peripherals.FindAll(o => o.IsConnected == true); | ||||
if (res.Count > 0&&IsConnected) | |||||
if (res.Count > 0&&!IsConnected) | |||||
{ | { | ||||
IsConnected = true; | IsConnected = true; | ||||
stateAction?.Invoke(true); | stateAction?.Invoke(true); | ||||
} | } | ||||
else if (res.Count<=0&&!IsConnected) | |||||
else if (res.Count<=0&&IsConnected) | |||||
{ | { | ||||
IsConnected= false; | IsConnected= false; | ||||
stateAction?.Invoke(false); | stateAction?.Invoke(false); | ||||
@@ -17,6 +17,7 @@ namespace BPASmartClient.MorkSUpgradedVer | |||||
private Alarm alarm = new Alarm(); | private Alarm alarm = new Alarm(); | ||||
public override void DoMain() | public override void DoMain() | ||||
{ | { | ||||
base.IsConnected = false; | |||||
base.stateAction = o => | base.stateAction = o => | ||||
{ | { | ||||
if (o) | if (o) | ||||
@@ -231,7 +232,7 @@ namespace BPASmartClient.MorkSUpgradedVer | |||||
private void TempOrderChange(string subid, ORDER_STATUS oRDER_STATUS, Action complete) | private void TempOrderChange(string subid, ORDER_STATUS oRDER_STATUS, Action complete) | ||||
{ | { | ||||
if (mORKS.doOrderEvents!=null&&mORKS.doOrderEvents.Count>0) | |||||
if (mORKS.doOrderEvents!=null&&mORKS.doOrderEvents.Count>0&&!string.IsNullOrEmpty(subid)) | |||||
{ | { | ||||
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; | ||||
@@ -605,6 +606,8 @@ namespace BPASmartClient.MorkSUpgradedVer | |||||
/// <summary>数据解析</summary> | /// <summary>数据解析</summary> | ||||
private void DataParse() | private void DataParse() | ||||
{ | { | ||||
EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle) | EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle) | ||||
{ | { | ||||
if (@event == null) | if (@event == null) | ||||
@@ -671,6 +674,57 @@ namespace BPASmartClient.MorkSUpgradedVer | |||||
} | } | ||||
} | } | ||||
}); | }); | ||||
#region 添加网络订单至本地展示 | |||||
//ActionManage.GetInstance.Register(new Action<object[]>((o) => | |||||
//{ | |||||
// if (o is object[] obj) | |||||
// { | |||||
// if (o.Length == 2) | |||||
// { | |||||
// if (o[0] is MorkOrderPush morkOrderpush && o[1] is IDevice device) | |||||
// { | |||||
// ObservableCollection<MorkOrder> observableCollection = new ObservableCollection<MorkOrder>(); | |||||
// MorkOrder morkOrder = new MorkOrder() | |||||
// { | |||||
// OrderPush = morkOrderpush, | |||||
// OrderStatus = ORDER_STATUS.WAIT, | |||||
// StartDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), | |||||
// FoodMenuModel = new FoodMenuModel() { } | |||||
// }; | |||||
// FoodMenuViewModel.orderStatusLists.Add(morkOrder); | |||||
// observableCollection.Add(morkOrder); | |||||
// Application.Current?.Dispatcher.BeginInvoke((Action)delegate | |||||
// { | |||||
// int index = Array.FindIndex(Json<KeepDataBase>.Data.orderLists.ToArray(), p => p.DeviceId == device.DeviceId.ToString()); | |||||
// if (index < 0) | |||||
// { | |||||
// Json<KeepDataBase>.Data.orderLists.Add(new OrderData() | |||||
// { | |||||
// DeviceId = device.DeviceId.ToString(), | |||||
// IsAllSelect = true, | |||||
// morkOrderPushes = observableCollection, | |||||
// }); | |||||
// } | |||||
// else | |||||
// { | |||||
// Json<KeepDataBase>.Data.orderLists.ElementAt(index).morkOrderPushes.Add(morkOrder); | |||||
// } | |||||
// orderStatusLists.Add(new MorkOrder() | |||||
// { | |||||
// OrderPush = morkOrderpush, | |||||
// OrderStatus = ORDER_STATUS.WAIT, | |||||
// StartDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), | |||||
// }); | |||||
// }); | |||||
// } | |||||
// } | |||||
// } | |||||
//}), "AddOrder"); | |||||
#endregion | |||||
} | } | ||||
public override void MainTask() | public override void MainTask() | ||||
@@ -679,7 +733,7 @@ namespace BPASmartClient.MorkSUpgradedVer | |||||
{ | { | ||||
NoodOrderCtrl.GetInstance.StateShow("设备正常运行"); | NoodOrderCtrl.GetInstance.StateShow("设备正常运行"); | ||||
} | } | ||||
if (!mORKS.InitComplete&& NoodOrderCtrl.GetInstance.stateInfo == "设备正常运行") | |||||
if (!mORKS.InitComplete) | |||||
{ | { | ||||
NoodOrderCtrl.GetInstance.StateShow("设备未初始化"); | NoodOrderCtrl.GetInstance.StateShow("设备未初始化"); | ||||
} | } | ||||
@@ -101,7 +101,7 @@ namespace BPASmartClient.ViewModel | |||||
{ | { | ||||
OrderPush = morkOrderpush, | OrderPush = morkOrderpush, | ||||
OrderStatus = ORDER_STATUS.WAIT, | OrderStatus = ORDER_STATUS.WAIT, | ||||
StartDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), | |||||
StartDate = DateTime.Now.ToString("HH:mm:ss"), | |||||
}; | }; | ||||
observableCollection.Add(morkOrder); | observableCollection.Add(morkOrder); | ||||
Application.Current?.Dispatcher.BeginInvoke((Action)delegate | Application.Current?.Dispatcher.BeginInvoke((Action)delegate | ||||
@@ -122,17 +122,17 @@ namespace BPASmartClient.ViewModel | |||||
Json<KeepDataBase>.Data.orderLists.ElementAt(index).morkOrderPushes.Add(morkOrder); | Json<KeepDataBase>.Data.orderLists.ElementAt(index).morkOrderPushes.Add(morkOrder); | ||||
} | } | ||||
orderStatusLists.Add(new MorkOrder() | |||||
orderStatusLists.Insert(0,new MorkOrder() | |||||
{ | { | ||||
OrderPush = morkOrderpush, | OrderPush = morkOrderpush, | ||||
OrderStatus = ORDER_STATUS.WAIT, | OrderStatus = ORDER_STATUS.WAIT, | ||||
StartDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), | |||||
StartDate = DateTime.Now.ToString("HH:mm:ss"), | |||||
}); | }); | ||||
}); | }); | ||||
if (orderStatusLists.Count > 0) | |||||
{ | |||||
orderStatusLists[0].OrderStatus = ORDER_STATUS.COOKING; | |||||
} | |||||
//if (orderStatusLists.Count > 0) | |||||
//{ | |||||
// orderStatusLists[0].OrderStatus = ORDER_STATUS.COOKING; | |||||
//} | |||||
} | } | ||||
} | } | ||||
@@ -72,7 +72,7 @@ | |||||
</ScrollViewer> | </ScrollViewer> | ||||
</Border> | </Border> | ||||
<Border Grid.Column="1" Margin="0,0,10,10" BorderBrush="{Binding ElementName=timeText,Path=Foreground}" BorderThickness="0,1,1,1"> | <Border Grid.Column="1" Margin="0,0,10,10" BorderBrush="{Binding ElementName=timeText,Path=Foreground}" BorderThickness="0,1,1,1"> | ||||
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"> | |||||
<ScrollViewer HorizontalScrollBarVisibility="Hidden" PanningMode="VerticalOnly" IsManipulationEnabled="True" VerticalScrollBarVisibility="Hidden" > | |||||
<ItemsControl x:Name="secCtrl"> | <ItemsControl x:Name="secCtrl"> | ||||
<ItemsControl.ItemTemplate> | <ItemsControl.ItemTemplate> | ||||
<DataTemplate> | <DataTemplate> | ||||
@@ -57,6 +57,9 @@ namespace BPASmartClient | |||||
case "设备未连接": | case "设备未连接": | ||||
errorText.Foreground = new SolidColorBrush(Colors.Red); | errorText.Foreground = new SolidColorBrush(Colors.Red); | ||||
break; | break; | ||||
case "设备未初始化": | |||||
errorText.Foreground = new SolidColorBrush(Colors.Purple); | |||||
break; | |||||
} | } | ||||
}); | }); | ||||
}; | }; | ||||