//global using CommunityToolkit.Mvvm.Input;
using BPA.Helper;
namespace BPASmartClient.MilkWithTea.ViewModel
{
partial class MainControlViewModel : NotifyBase
{
///
/// 本地奶茶列表
///
public ObservableCollection localTeaWithMilks { get; set; } = Json.Data.localRecipes;
///
/// 奶茶对应的原料列表
///
public ObservableCollection materialRecipes { get; set; } = new ObservableCollection();
///
/// 订单状态列表
///
public ObservableCollection orderStatusLists { get; set; } = new ObservableCollection();
///
/// 等待取餐列表
///
public ObservableCollection WaitTakeMeal { get; set; } = new ObservableCollection();
///
/// 当前正在制作的奶茶
///
public string CurrentGood { get { return _currentGood; } set { _currentGood = value; OnPropertyChanged(); } }
private string _currentGood = "茉莉花茶";
///
/// 奶茶制作百分比
///
public string MakePercent { get { return _makePercent; } set { _makePercent = value; OnPropertyChanged(); } }
private string _makePercent = "0";
///
/// 奶茶制作百分比
///
public LocalRecipe SelectedRecipe { get { return _selectedRecipe; } set { _selectedRecipe = value; OnPropertyChanged(); } }
private LocalRecipe _selectedRecipe;
/////
///// 当前正在制作的奶茶
/////
//[ObservableProperty]
//private string _currentGood = "茉莉花茶";
/////
///// 奶茶制作百分比
/////
//[ObservableProperty]
//private string _makePercent = "0";
//[ObservableProperty]
//private LocalRecipe _selectedRecipe;
///
/// 当前正在制作的奶茶
///
public bool MakeEnable { get { return GLobal.makeEnable; } set { GLobal.makeEnable = value; OnPropertyChanged(); } }
///
/// 本地奶茶制作
///
//[BPARelayCommand]
private void MakeGood()
{
if (SelectedRecipe == null) return;
foreach (var item in SelectedRecipe.localMaterails)
{
var res = Json.Data.localMaterails.FirstOrDefault(p => p.MaterialID == item.MaterialID);
if (res != null)
{
item.MaterialPosition = res.MaterialPosition;
}
else
{
MessageLog.GetInstance.ShowEx($"配料:{item.MaterialName}不存在,下单失败");
return;
}
}
ActionManage.GetInstance.Send("MakeGoods", SelectedRecipe);
}
public MainControlViewModel()
{
Init();
MorkOrderPush morkOrderPush = new MorkOrderPush() { GoodsName = "珍珠奶茶", SortNum = 1 };
MorkOrderPush morkOrderPush1 = new MorkOrderPush() { GoodsName = "茉莉花茶", SortNum = 2 };
MorkOrderPush morkOrderPush2 = new MorkOrderPush() { GoodsName = "芝芝梅梅", SortNum = 3 };
orderStatusLists.Add(new MorkOrder()
{
StartDate = "11:20",
EndDate = "11:24",
CompleteDate = "4",
OrderStatus = ORDER_STATUS.COMPLETED_COOK,
OrderPush = morkOrderPush
});
orderStatusLists.Add(new MorkOrder()
{
StartDate = "11:36",
EndDate = "11:40",
CompleteDate = "4",
OrderStatus = ORDER_STATUS.COOKING,
OrderPush = morkOrderPush1
});
orderStatusLists.Add(new MorkOrder()
{
StartDate = "10:33",
EndDate = "10:28",
CompleteDate = "5",
OrderStatus = ORDER_STATUS.COMPLETED_TAKE,
OrderPush = morkOrderPush2
});
}
///
/// MQTT 大屏取餐通知委托
///
public void Init()
{
//清除订单数据
//ActionManage.GetInstance.Register(new Action(() =>
//{
// Application.Current.Dispatcher.Invoke(() =>
// {
// orderStatusLists.Clear();
// WaitTakeMeal.Clear();
// });
//}), "ClearOrders");
ActionManage.GetInstance.Register(new Action