From 07709d37c03ca04e280a068ce6fe61539670a413 Mon Sep 17 00:00:00 2001 From: lyw <刘耀文@DESKTOP-E1TI268> Date: Fri, 31 May 2024 18:05:59 +0800 Subject: [PATCH] zancun --- .../RecDictionarys/RecComboBox.xaml | 143 ++++++++++++++++++ BPASmartClient.Model/FoodMenuModel.cs | 7 +- .../订单/MorksSimorderModel.cs | 3 +- .../Control_MorkSUpgradedVer.cs | 44 ++++-- .../EditRecipeViewModel.cs | 4 +- BPASmartClient.ViewModel/NoodOrderCtrl.cs | 107 +++++++------ .../OrderStatusViewModel.cs | 19 +-- BPASmartClient/App.xaml | 91 ++++++++++- BPASmartClient/BPASmartClient.csproj | 6 +- BPASmartClient/Control/EditRecipeView.xaml | 37 ++--- BPASmartClient/Control/EditRecipeView.xaml.cs | 4 + BPASmartClient/Control/OrderStatusView.xaml | 90 ++++++++--- BPASmartClient/Image/iconfont.ttf | Bin 0 -> 1604 bytes BPASmartClient/Image/noodle_1.jpeg | Bin 354844 -> 0 bytes BPASmartClient/Image/noodle_1.jpg | Bin 0 -> 1041657 bytes BPASmartClient/LoginOrderView.xaml | 4 +- BPASmartClient/MyConvert/TextConvert.cs | 116 ++++++++++++++ 17 files changed, 545 insertions(+), 130 deletions(-) create mode 100644 BPASmartClient/Image/iconfont.ttf delete mode 100644 BPASmartClient/Image/noodle_1.jpeg create mode 100644 BPASmartClient/Image/noodle_1.jpg create mode 100644 BPASmartClient/MyConvert/TextConvert.cs diff --git a/BPASmartClient.CustomResource/RecDictionarys/RecComboBox.xaml b/BPASmartClient.CustomResource/RecDictionarys/RecComboBox.xaml index 2eeb9850..1f8882e5 100644 --- a/BPASmartClient.CustomResource/RecDictionarys/RecComboBox.xaml +++ b/BPASmartClient.CustomResource/RecDictionarys/RecComboBox.xaml @@ -202,4 +202,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/BPASmartClient.Model/FoodMenuModel.cs b/BPASmartClient.Model/FoodMenuModel.cs index fdf8f812..6226543a 100644 --- a/BPASmartClient.Model/FoodMenuModel.cs +++ b/BPASmartClient.Model/FoodMenuModel.cs @@ -20,8 +20,9 @@ namespace BPASmartClient.Model private int _bowLoc; public int NoodleLoc { get { return _noodleLoc; } set { _noodleLoc = value; OnPropertyChanged(); } } private int _noodleLoc; - public double Frytime { get { return _frytime; } set { _frytime = value; OnPropertyChanged(); } } - private double _frytime; - + public int FrytimeMin { get { return _frytimeMin; } set { _frytimeMin = value; OnPropertyChanged(); } } + private int _frytimeMin; + public int FrytimeS { get { return _frytimeS; } set { _frytimeS = value; OnPropertyChanged(); } } + private int _frytimeS; } } diff --git a/BPASmartClient.Model/订单/MorksSimorderModel.cs b/BPASmartClient.Model/订单/MorksSimorderModel.cs index fe8c35fb..d3a98251 100644 --- a/BPASmartClient.Model/订单/MorksSimorderModel.cs +++ b/BPASmartClient.Model/订单/MorksSimorderModel.cs @@ -10,6 +10,7 @@ namespace BPASmartClient.Model { public int NoodleLoc { get; set ; } public int Bowloc { get; set; } - public double FryTime { get; set; } + public int FryTimeS { get; set; } + public int FryTimeMin { get; set; } } } diff --git a/BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs b/BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs index 70c2a924..121d016d 100644 --- a/BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs +++ b/BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs @@ -43,24 +43,42 @@ namespace BPASmartClient.MorkSUpgradedVer { if (FoodMenuViewModel.orderStatusLists.Count > 0) { - foreach (var item in FoodMenuViewModel.orderStatusLists) + for (int i = 0; i < FoodMenuViewModel.orderStatusLists.Count; i++) { - if (string.IsNullOrEmpty(item.OrderPush.SuborderId)) + var res = FoodMenuViewModel.orderStatusLists.FirstOrDefault(o => o.OrderPush.SortNum == 1+i); + if (res != null) { - item.OrderPush.SuborderId = Guid.NewGuid().ToString(); - var res = mORKS.RBTakeNoodleTask.FirstOrDefault(o => o.SuborderId == item.OrderPush.SuborderId); - if (res == null) + if (string.IsNullOrEmpty(res.OrderPush.SuborderId)) { - mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)Json.Data.localOrder[item.OrderPush.GoodsName].NoodleLoc, SuborderId = item.OrderPush.SuborderId }); - MessageLog.GetInstance.Show($"添加订单:面条位置【{Json.Data.localOrder[item.OrderPush.GoodsName].NoodleLoc}】"); - mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)Json.Data.localOrder[item.OrderPush.GoodsName].Bowloc, SuborderId = item.OrderPush.SuborderId }); - MessageLog.GetInstance.Show($"添加订单:碗位置【{Json.Data.localOrder[item.OrderPush.GoodsName].Bowloc}】"); + NoodOrderCtrl.GetInstance.WorkList(res); + mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)Json.Data.localOrder[res.OrderPush.GoodsName].NoodleLoc, SuborderId = res.OrderPush.SuborderId }); + MessageLog.GetInstance.Show($"添加订单:面条位置【{Json.Data.localOrder[res.OrderPush.GoodsName].NoodleLoc}】"); + mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)Json.Data.localOrder[res.OrderPush.GoodsName].Bowloc, SuborderId = res.OrderPush.SuborderId }); + MessageLog.GetInstance.Show($"添加订单:碗位置【{Json.Data.localOrder[res.OrderPush.GoodsName].Bowloc}】"); Global.EnableLocalSimOrder = true; } - } - + } + //foreach (var item in FoodMenuViewModel.orderStatusLists) + //{ + // if (string.IsNullOrEmpty(item.OrderPush.SuborderId)) + // { + // item.OrderPush.SortNum = FoodMenuViewModel.SortNum++; + // item.OrderPush.SuborderId = Guid.NewGuid().ToString(); + // var res = mORKS.RBTakeNoodleTask.FirstOrDefault(o => o.SuborderId == item.OrderPush.SuborderId); + // if (res == null) + // { + // mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)Json.Data.localOrder[item.OrderPush.GoodsName].NoodleLoc, SuborderId = item.OrderPush.SuborderId }); + // MessageLog.GetInstance.Show($"添加订单:面条位置【{Json.Data.localOrder[item.OrderPush.GoodsName].NoodleLoc}】"); + // mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)Json.Data.localOrder[item.OrderPush.GoodsName].Bowloc, SuborderId = item.OrderPush.SuborderId }); + // MessageLog.GetInstance.Show($"添加订单:碗位置【{Json.Data.localOrder[item.OrderPush.GoodsName].Bowloc}】"); + // Global.EnableLocalSimOrder = true; + // } + + // } + + //} } }), "EnableForOrder"); @@ -785,8 +803,8 @@ namespace BPASmartClient.MorkSUpgradedVer List values = new List(); if (Json.Data.localOrder.ContainsKey(re.OrderPush.GoodsName)) { - values.Add((ushort)Json.Data.localOrder[re.OrderPush.GoodsName].FryTime); - values.Add(0); + values.Add((ushort)Json.Data.localOrder[re.OrderPush.GoodsName].FryTimeMin); + values.Add((ushort)Json.Data.localOrder[re.OrderPush.GoodsName].FryTimeS); } else { diff --git a/BPASmartClient.ViewModel/EditRecipeViewModel.cs b/BPASmartClient.ViewModel/EditRecipeViewModel.cs index 983facd5..d97b4f26 100644 --- a/BPASmartClient.ViewModel/EditRecipeViewModel.cs +++ b/BPASmartClient.ViewModel/EditRecipeViewModel.cs @@ -25,8 +25,8 @@ namespace BPASmartClient.ViewModel EditOrder = new BPARelayCommand(NoodOrderCtrl.GetInstance.EditOrder); DeleteOrder = new BPARelayCommand(NoodOrderCtrl.GetInstance.DeleteRecipe); } - public LocalOrder LocalOrder { get { return _localOrder; } set { _localOrder = value; OnPropertyChanged(); } } - private LocalOrder _localOrder = new LocalOrder(); + public FoodMenuModel LocalOrder { get { return _localOrder; } set { _localOrder = value; OnPropertyChanged(); } } + private FoodMenuModel _localOrder = new FoodMenuModel(); public ObservableCollection FoodMenus { get; set; } = FoodMenuViewModel.FoodMenus; } } diff --git a/BPASmartClient.ViewModel/NoodOrderCtrl.cs b/BPASmartClient.ViewModel/NoodOrderCtrl.cs index 32646041..98be5bbb 100644 --- a/BPASmartClient.ViewModel/NoodOrderCtrl.cs +++ b/BPASmartClient.ViewModel/NoodOrderCtrl.cs @@ -21,20 +21,20 @@ namespace BPASmartClient { private static NoodOrderCtrl _instance; public static NoodOrderCtrl GetInstance { get; set; }=_instance??=new NoodOrderCtrl(); - public Action? orderStatusAction; - public Action? editRecipeAction; + public Action? orderStatusAction; + public Action? editRecipeAction; public ConcurrentDictionary allViews = new ConcurrentDictionary (); public Action? showInfo; - public LocalOrder LocalOrder { get; set; } = new LocalOrder(); - public void CheckOrder(object o) - { - if (o is string x) - { - var res = FoodMenuViewModel.FoodMenus.FirstOrDefault(o => o.GoodName == x); - if (res != null) - OrderStatusViewModel.orderMenus.Add(res); - } - } + public FoodMenuModel LocalOrder { get; set; } = new FoodMenuModel(); + //public void CheckOrder(object o) + //{ + // if (o is string x) + // { + // var res = FoodMenuViewModel.FoodMenus.FirstOrDefault(o => o.GoodName == x); + // if (res != null) + // OrderStatusViewModel.orderMenus.Add(res); + // } + //} public void Show(string info) { showInfo?.Invoke(info); @@ -43,10 +43,10 @@ namespace BPASmartClient { FoodMenuViewModel.FoodMenus.Clear(); - Json.Data.localOrder?.Keys?.ToList().ForEach(key => FoodMenuViewModel.FoodMenus.Add(new FoodMenuModel { GoodName = key, BowLoc = Json.Data.localOrder[key].Bowloc, NoodleLoc = Json.Data.localOrder[key].NoodleLoc, Frytime = Json.Data.localOrder[key].FryTime })); + Json.Data.localOrder?.Keys?.ToList().ForEach(key => FoodMenuViewModel.FoodMenus.Add(new FoodMenuModel { GoodName = key, BowLoc = Json.Data.localOrder[key].Bowloc, NoodleLoc = Json.Data.localOrder[key].NoodleLoc, FrytimeMin = Json.Data.localOrder[key].FryTimeMin,FrytimeS = Json.Data.localOrder[key].FryTimeS })); Json.Data.localOrder.addItem = ((key, value) => { - FoodMenuViewModel.FoodMenus.Add(new FoodMenuModel { GoodName = key ,BowLoc = value.Bowloc,NoodleLoc = value.NoodleLoc,Frytime = value.FryTime}); + FoodMenuViewModel.FoodMenus.Add(new FoodMenuModel { GoodName = key ,BowLoc = value.Bowloc,NoodleLoc = value.NoodleLoc,FrytimeS = value.FryTimeS,FrytimeMin = value.FryTimeMin}); }); Json.Data.localOrder.removeItem = ((key, value) => { @@ -57,41 +57,45 @@ namespace BPASmartClient } }); } - public void RemoveOrder(object o) + //public void RemoveOrder(object o) + //{ + // if (o is string re) + // { + // var res = OrderStatusViewModel.orderMenus.FirstOrDefault(o => o.GoodName == re); + // if (res != null) + // OrderStatusViewModel.orderMenus.Remove(res); + // } + //} + public void StartOrder(FoodMenuModel localOrder,int amount) { - if (o is string re) + if (amount > 0 && !string.IsNullOrEmpty(localOrder.GoodName)) { - var res = OrderStatusViewModel.orderMenus.FirstOrDefault(o => o.GoodName == re); - if (res != null) - OrderStatusViewModel.orderMenus.Remove(res); - } - } - public void StartOrder(LocalOrder localOrder,int amount) - { - if (amount > 0 && !string.IsNullOrEmpty(localOrder.Name)) - { - MorksSimorderModel res = Json.Data.localOrder[localOrder.Name]; + MorksSimorderModel res = Json.Data.localOrder[localOrder.GoodName]; if (res != null) { for (int i = 0; i < amount; i++) { Application.Current.Dispatcher.Invoke(() => { - FoodMenuViewModel.orderStatusLists.Add(new MorkOrder() + FoodMenuViewModel.orderStatusLists.Insert(0,new MorkOrder() { - OrderPush = new MorkOrderPush() { DeviceId = res.DeviceId, GoodsName = localOrder.Name, SortNum = FoodMenuViewModel.SortNum++ }, + OrderPush = new MorkOrderPush() { DeviceId = res.DeviceId, GoodsName = localOrder.GoodName,SortNum = FoodMenuViewModel.SortNum++}, OrderStatus = ORDER_STATUS.WAIT, StartDate = DateTime.Now.ToString("HH:mm:ss"), }); }); - Json.Data.localOrder[localOrder.Name].Publish(); + Json.Data.localOrder[localOrder.GoodName].Publish(); } - Show($"成功下单{localOrder.Name}/{amount}次!"); + Show($"成功下发{localOrder.GoodName}!共{amount}单!"); ActionManage.GetInstance.Send("EnableForOrder"); } } + else + { + Show($"请选择后下单"); + } } public void EditOrder(object o) { @@ -102,7 +106,7 @@ namespace BPASmartClient var res = Json.Data.localOrder[re]; if (res != null) { - LocalOrder = new LocalOrder() { Name = re, NoodleLoc = res.NoodleLoc, Bowloc = res.Bowloc, FryTime = res.FryTime }; + LocalOrder = new FoodMenuModel() { GoodName = re, NoodleLoc = res.NoodleLoc, BowLoc = res.Bowloc, FrytimeMin = res.FryTimeMin,FrytimeS = res.FryTimeS }; orderStatusAction?.Invoke(LocalOrder); editRecipeAction?.Invoke(LocalOrder); } @@ -110,31 +114,31 @@ namespace BPASmartClient } } - public void SaveRecipe(LocalOrder order) + public void SaveRecipe(FoodMenuModel order) { - if (Json.Data.localOrder.ContainsKey(order.Name)) + if (Json.Data.localOrder.ContainsKey(order.GoodName)) { - Json.Data.localOrder.ReMove(order.Name); - Json.Data.localOrder.Add(order.Name, new Model.MorksSimorderModel() { NoodleLoc = order.NoodleLoc, Bowloc = order.Bowloc, FryTime = order.FryTime,DeviceId=42}); + Json.Data.localOrder.ReMove(order.GoodName); + Json.Data.localOrder.Add(order.GoodName, new Model.MorksSimorderModel() { NoodleLoc = order.NoodleLoc, Bowloc = order.BowLoc, FryTimeMin = order.FrytimeMin, FryTimeS = order.FrytimeS, DeviceId=42}); Show("已更改!"); } else { - Json.Data.localOrder.Add(order.Name, new Model.MorksSimorderModel() { NoodleLoc = order.NoodleLoc, Bowloc = order.Bowloc, FryTime = order.FryTime, DeviceId = 42 }); + Json.Data.localOrder.Add(order.GoodName, new Model.MorksSimorderModel() { NoodleLoc = order.NoodleLoc, Bowloc = order.BowLoc, FryTimeMin = order.FrytimeMin, FryTimeS = order.FrytimeS, DeviceId = 42 }); Show("已添加!"); } } - public void NewRecipe(LocalOrder order) - { - if (!Json.Data.localOrder.ContainsKey(order.Name)) - { - Json.Data.localOrder.Add(order.Name, new Model.MorksSimorderModel() { NoodleLoc = order.NoodleLoc, Bowloc = order.Bowloc, FryTime = order.FryTime }); - } - else - { - MessageBox.Show("已存在该菜品,请注意菜品名称", "提示", MessageBoxButton.OK); - } - } + //public void NewRecipe(LocalOrder order) + //{ + // if (!Json.Data.localOrder.ContainsKey(order.Name)) + // { + // Json.Data.localOrder.Add(order.Name, new Model.MorksSimorderModel() { NoodleLoc = order.NoodleLoc, Bowloc = order.Bowloc, FryTime = order.FryTime }); + // } + // else + // { + // MessageBox.Show("已存在该菜品,请注意菜品名称", "提示", MessageBoxButton.OK); + // } + //} public void DeleteRecipe(object o) { if (o is string re) @@ -163,7 +167,12 @@ namespace BPASmartClient FoodMenuViewModel.WaitTakeMeal.Insert(0, res); }); } - + public void WorkList(MorkOrder res) + { + Application.Current.Dispatcher.Invoke(() => { + res.OrderPush.SuborderId = Guid.NewGuid().ToString(); + }); + } public Task FinishOrder(MorkOrder res) { return Task.Factory.StartNew(() => @@ -171,7 +180,7 @@ namespace BPASmartClient Thread.Sleep(1000); Application.Current.Dispatcher.Invoke(() => { - FoodMenuViewModel.WaitTakeMeal.Remove(res); + FoodMenuViewModel.WaitTakeMeal.Remove(res); }); }); } diff --git a/BPASmartClient.ViewModel/OrderStatusViewModel.cs b/BPASmartClient.ViewModel/OrderStatusViewModel.cs index 69313721..36e1e4d5 100644 --- a/BPASmartClient.ViewModel/OrderStatusViewModel.cs +++ b/BPASmartClient.ViewModel/OrderStatusViewModel.cs @@ -37,26 +37,13 @@ namespace BPASmartClient.ViewModel EditOrder = new BPARelayCommand(NoodOrderCtrl.GetInstance.EditOrder); } #endregion - + public ObservableCollection orderStatusLists { get; set; } = FoodMenuViewModel.orderStatusLists; public ObservableCollection FoodMenus { get; set; } = FoodMenuViewModel.FoodMenus; - public static ObservableCollection orderMenus { get; set; } = new ObservableCollection(); - public LocalOrder LocalOrder { get { return _localOrder; } set { _localOrder = value; OnPropertyChanged(); } } - private LocalOrder _localOrder= new LocalOrder(); + public FoodMenuModel LocalOrder { get { return _localOrder; } set { _localOrder = value; OnPropertyChanged(); } } + private FoodMenuModel _localOrder = new FoodMenuModel(); public int OrderAmount { get { return _orderAmount; } set { _orderAmount = value; OnPropertyChanged(); } } private int _orderAmount = 1; } - public class LocalOrder : NotifyBase - { - public string Name { get { return _name; } set { _name = value; OnPropertyChanged(); } } - private string _name = string.Empty; - - public int NoodleLoc { get { return _noodleLoc; } set { _noodleLoc = value; OnPropertyChanged(); } } - private int _noodleLoc; - public int Bowloc { get { return _bowloc; } set { _bowloc = value; OnPropertyChanged(); } } - private int _bowloc; - public double FryTime { get { return _fryTime; } set { _fryTime = value; OnPropertyChanged(); } } - private double _fryTime; - } } diff --git a/BPASmartClient/App.xaml b/BPASmartClient/App.xaml index e459b247..ea07c88d 100644 --- a/BPASmartClient/App.xaml +++ b/BPASmartClient/App.xaml @@ -3,7 +3,8 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:con="clr-namespace:BPASmartClient.CustomResource.Converters;assembly=BPASmartClient.CustomResource" - xmlns:local="clr-namespace:BPASmartClient"> + xmlns:myConvert ="clr-namespace:MyConvert" + xmlns:local="clr-namespace:BPASmartClient" xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2"> @@ -34,7 +35,7 @@ - + @@ -58,7 +59,7 @@ - + @@ -219,6 +220,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BPASmartClient/BPASmartClient.csproj b/BPASmartClient/BPASmartClient.csproj index e9b94786..9da8ec13 100644 --- a/BPASmartClient/BPASmartClient.csproj +++ b/BPASmartClient/BPASmartClient.csproj @@ -21,8 +21,9 @@ + - + @@ -62,8 +63,9 @@ + - + diff --git a/BPASmartClient/Control/EditRecipeView.xaml b/BPASmartClient/Control/EditRecipeView.xaml index bb6db13a..0d04b9d8 100644 --- a/BPASmartClient/Control/EditRecipeView.xaml +++ b/BPASmartClient/Control/EditRecipeView.xaml @@ -39,31 +39,32 @@ - + - + - - - + - - - - - + + - + - + + + + + + + @@ -93,11 +94,11 @@ - + - + @@ -105,9 +106,11 @@ - - - + + + + +