Browse Source

新建煮面机分支----lyw 24/5/30

煮面机(新)
lyw 5 months ago
parent
commit
fd12f1450f
53 changed files with 1901 additions and 612 deletions
  1. +36
    -0
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  2. BIN
     
  3. BIN
     
  4. BIN
     
  5. BIN
     
  6. BIN
     
  7. BIN
     
  8. BIN
     
  9. BIN
     
  10. BIN
     
  11. BIN
     
  12. BIN
     
  13. BIN
     
  14. BIN
     
  15. BIN
     
  16. BIN
     
  17. BIN
     
  18. BIN
     
  19. +16
    -4
      BPASmartClient.Model/FoodMenuModel.cs
  20. +36
    -1
      BPASmartClient.Model/小炒机/MaterialAndFryingTime.cs
  21. +14
    -0
      BPASmartClient.Model/煮面机/NoodAction.cs
  22. +2
    -1
      BPASmartClient.Model/订单/MorksSimorderModel.cs
  23. +1
    -0
      BPASmartClient.MorkSUpgradedVer/BPASmartClient.MorkSUpgradedVer.csproj
  24. +165
    -58
      BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs
  25. +1
    -1
      BPASmartClient.MorkSUpgradedVer/GVL_MorkSUpgradedVer.cs
  26. +0
    -1
      BPASmartClient.ViewModel/AdminstratorsViewModel.cs
  27. +0
    -1
      BPASmartClient.ViewModel/BPASmartClient.ViewModel.csproj
  28. +32
    -0
      BPASmartClient.ViewModel/EditRecipeViewModel.cs
  29. +146
    -8
      BPASmartClient.ViewModel/FoodMenuViewModel.cs
  30. +25
    -0
      BPASmartClient.ViewModel/LoginViewModel.cs
  31. +7
    -3
      BPASmartClient.ViewModel/MainViewModel.cs
  32. +179
    -0
      BPASmartClient.ViewModel/NoodOrderCtrl.cs
  33. +34
    -125
      BPASmartClient.ViewModel/OrderStatusViewModel.cs
  34. +189
    -0
      BPASmartClient/App.xaml
  35. +8
    -2
      BPASmartClient/App.xaml.cs
  36. +25
    -7
      BPASmartClient/BPASmartClient.csproj
  37. +126
    -0
      BPASmartClient/Control/EditRecipeView.xaml
  38. +26
    -0
      BPASmartClient/Control/EditRecipeView.xaml.cs
  39. +286
    -37
      BPASmartClient/Control/FoodMenuView.xaml
  40. +27
    -1
      BPASmartClient/Control/FoodMenuView.xaml.cs
  41. +127
    -338
      BPASmartClient/Control/OrderStatusView.xaml
  42. +42
    -0
      BPASmartClient/Control/OrderStatusView.xaml.cs
  43. BIN
     
  44. BIN
     
  45. BIN
     
  46. BIN
     
  47. BIN
     
  48. BIN
     
  49. BIN
     
  50. +177
    -0
      BPASmartClient/LoginOrderView.xaml
  51. +108
    -0
      BPASmartClient/LoginOrderView.xaml.cs
  52. +3
    -8
      BPASmartClient/MainWindow.xaml
  53. +63
    -16
      BPASmartClient/MainWindow.xaml.cs

+ 36
- 0
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj View File

@@ -24,6 +24,7 @@

<ItemGroup>
<None Remove="Fonts\80号-萌趣小鱼体.ttf" />
<None Remove="Fonts\AlimamaDaoLiTi.ttf" />
<None Remove="Fonts\font\iconfont.ttf" />
<None Remove="Fonts\iconfont.ttf" />
<None Remove="Fonts\MT\iconfont.ttf" />
@@ -81,6 +82,7 @@
<None Remove="Image\Scroll_↑.png" />
<None Remove="Image\Scroll_→.png" />
<None Remove="Image\Scroll_↓.png" />
<None Remove="Image\Settings.png" />
<None Remove="Image\shape.png" />
<None Remove="Image\shape1.png" />
<None Remove="Image\textBox.png" />
@@ -103,7 +105,10 @@
<None Remove="Image\产品制作.png" />
<None Remove="Image\光柱.png" />
<None Remove="Image\内部.png" />
<None Remove="Image\减.png" />
<None Remove="Image\删除.png" />
<None Remove="Image\功能列表.png" />
<None Remove="Image\加.png" />
<None Remove="Image\发光按钮.png" />
<None Remove="Image\告警.png" />
<None Remove="Image\告警\Wifi_NO.ico" />
@@ -161,11 +166,13 @@
<None Remove="Image\按钮\组 8.png" />
<None Remove="Image\按钮背景蓝色.png" />
<None Remove="Image\按钮背景黄.png" />
<None Remove="Image\提示.png" />
<None Remove="Image\搜索按钮.png" />
<None Remove="Image\搜索框.png" />
<None Remove="Image\文字.png" />
<None Remove="Image\日历.png" />
<None Remove="Image\日期1.png" />
<None Remove="Image\时间.png" />
<None Remove="Image\智慧城市科技风登录页面.png" />
<None Remove="Image\智慧城市科技风登录页面边框.png" />
<None Remove="Image\有告警.png" />
@@ -173,6 +180,8 @@
<None Remove="Image\标签.png" />
<None Remove="Image\标题背景.png" />
<None Remove="Image\浅色背景.jpeg" />
<None Remove="Image\点餐.png" />
<None Remove="Image\状态.png" />
<None Remove="Image\环形切图\内圈\未选中.png" />
<None Remove="Image\环形切图\内圈\选中.png" />
<None Remove="Image\环形切图\占位.png" />
@@ -187,6 +196,7 @@
<None Remove="Image\矩形2.png" />
<None Remove="Image\矩形样式.png" />
<None Remove="Image\矩形边框.png" />
<None Remove="Image\碗.png" />
<None Remove="Image\窗体样式\datagrid\data_标题栏背景.png" />
<None Remove="Image\窗体样式\datagrid\data_行背景.png" />
<None Remove="Image\窗体样式\From\内部背景.png" />
@@ -218,6 +228,7 @@
<None Remove="Image\窗体样式\Tab\Tab_SelectBJ.png" />
<None Remove="Image\窗体样式\Tab\Tab_SelectWZBJ.png" />
<None Remove="Image\竖线.png" />
<None Remove="Image\管理员-用户查询.png" />
<None Remove="Image\系统名称.png" />
<None Remove="Image\红色圆角矩形背景.png" />
<None Remove="Image\纹理背景.jpeg" />
@@ -247,6 +258,8 @@
<None Remove="Image\荧光\立体三角.png" />
<None Remove="Image\荧光\蓝色提示框.png" />
<None Remove="Image\荧光\返回.png" />
<None Remove="Image\菜品_1.png" />
<None Remove="Image\菜谱.png" />
<None Remove="Image\营销额.png" />
<None Remove="Image\蓝色背景.png" />
<None Remove="Image\蓝边框.png" />
@@ -261,10 +274,12 @@
<None Remove="Image\表格\表格顶左.png" />
<None Remove="Image\表格标题背景2.png" />
<None Remove="Image\调味品.jpeg" />
<None Remove="Image\购物车.png" />
<None Remove="Image\边框效果2.png" />
<None Remove="Image\边框线.png" />
<None Remove="Image\边角.png" />
<None Remove="Image\退出.png" />
<None Remove="Image\退出_1.png" />
<None Remove="Image\退出按钮.png" />
<None Remove="Image\透明背景.png" />
<None Remove="Image\配方背景\圆角矩形.png" />
@@ -274,6 +289,8 @@
<None Remove="Image\配方背景\蓝色背景2.png" />
<None Remove="Image\配方背景\黄色背景.png" />
<None Remove="Image\阴影边框.png" />
<None Remove="Image\面条.png" />
<None Remove="Image\面条_1.png" />
<None Remove="Image\顶部.png" />
<None Remove="Image\顶部切图\Button_No.png" />
<None Remove="Image\顶部切图\Button_Select.png" />
@@ -317,6 +334,7 @@

<ItemGroup>
<Resource Include="Fonts\80号-萌趣小鱼体.ttf" />
<Resource Include="Fonts\AlimamaDaoLiTi.ttf" />
<Resource Include="Fonts\font\iconfont.ttf" />
<Resource Include="Fonts\iconfont.ttf" />
<Resource Include="Fonts\MT\iconfont.ttf" />
@@ -345,6 +363,7 @@
<Resource Include="Image\leftback.png" />
<Resource Include="Image\leftImage.png" />
<Resource Include="Image\Login.png" />
<Resource Include="Image\Settings.png" />
<Resource Include="Image\textBox.png" />
<Resource Include="Image\WindowImages.png" />
<Resource Include="Image\上箭头.png" />
@@ -356,7 +375,10 @@
<Resource Include="Image\临时模板.png" />
<Resource Include="Image\产品制作.png" />
<Resource Include="Image\光柱.png" />
<Resource Include="Image\减.png" />
<Resource Include="Image\删除.png" />
<Resource Include="Image\功能列表.png" />
<Resource Include="Image\加.png" />
<Resource Include="Image\发光按钮.png" />
<Resource Include="Image\告警\Wifi_NO.png" />
<Resource Include="Image\告警\Wifi_OK.png" />
@@ -398,11 +420,15 @@
<Resource Include="Image\按钮\组 8.png" />
<Resource Include="Image\按钮背景蓝色.png" />
<Resource Include="Image\按钮背景黄.png" />
<Resource Include="Image\提示.png" />
<Resource Include="Image\时间.png" />
<Resource Include="Image\智慧城市科技风登录页面.png" />
<Resource Include="Image\智慧城市科技风登录页面边框.png" />
<Resource Include="Image\权限背景.png" />
<Resource Include="Image\标签.png" />
<Resource Include="Image\浅色背景.jpeg" />
<Resource Include="Image\点餐.png" />
<Resource Include="Image\状态.png" />
<Resource Include="Image\界面2.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Resource>
@@ -412,6 +438,8 @@
<Resource Include="Image\直线.png" />
<Resource Include="Image\矩形2.png" />
<Resource Include="Image\矩形边框.png" />
<Resource Include="Image\碗.png" />
<Resource Include="Image\管理员-用户查询.png" />
<Resource Include="Image\系统名称.png" />
<Resource Include="Image\红色圆角矩形背景.png" />
<Resource Include="Image\纹理背景.jpeg" />
@@ -432,9 +460,12 @@
<Resource Include="Image\荧光\立体三角.png" />
<Resource Include="Image\荧光\蓝色提示框.png" />
<Resource Include="Image\荧光\返回.png" />
<Resource Include="Image\菜品_1.png" />
<Resource Include="Image\菜谱.png" />
<Resource Include="Image\蓝色背景.png" />
<Resource Include="Image\蓝边框.png" />
<Resource Include="Image\调味品.jpeg" />
<Resource Include="Image\购物车.png" />
<Resource Include="Image\边框线.png" />
<Resource Include="Image\边角.png" />
</ItemGroup>
@@ -443,6 +474,7 @@
<Resource Include="Image\HBL.png" />
<Resource Include="Image\告警\Wifi_NO.ico" />
<Resource Include="Image\告警\Wifi_OK.ico" />
<Resource Include="Image\退出_1.png" />
<Resource Include="Image\透明背景.png" />
<Resource Include="Image\配方背景\圆角矩形.png" />
<Resource Include="Image\配方背景\竖背景框.png" />
@@ -451,6 +483,10 @@
<Resource Include="Image\配方背景\蓝色背景2.png" />
<Resource Include="Image\配方背景\黄色背景.png" />
<Resource Include="Image\阴影边框.png" />
<Resource Include="Image\面条.png" />
<Resource Include="Image\面条_1.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
<Resource Include="Image\顶部切图\Button_No.png" />
<Resource Include="Image\顶部切图\Button_Select.png" />
<Resource Include="Image\顶部切图\Top_L.png" />


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


+ 16
- 4
BPASmartClient.Model/FoodMenuModel.cs View File

@@ -6,10 +6,22 @@ using System.Threading.Tasks;

namespace BPASmartClient.Model
{
public class FoodMenuModel
public class FoodMenuModel:NotifyBase
{
public string GoodName { get; set; }
public string GoodKey { get; set; }

public string GoodName { get { return _goodName; } set { _goodName = value; OnPropertyChanged(); } }
private string _goodName;

public string GoodKey { get { return _goodKey; } set { _goodKey = value; OnPropertyChanged(); } }
private string _goodKey;

public int BowLoc { get { return _bowLoc; } set { _bowLoc = value; OnPropertyChanged(); } }
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;

}
}

+ 36
- 1
BPASmartClient.Model/小炒机/MaterialAndFryingTime.cs View File

@@ -3,6 +3,7 @@ using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

@@ -10,6 +11,40 @@ namespace BPASmartClient.Model.小炒机
{
public class MaterialAndFryingTime
{
public Dictionary<string, ObservableCollection<PotActions>> materials { get; set; } = new Dictionary<string, ObservableCollection<PotActions>>();
public MaterialDiction<string, ObservableCollection<PotActions>> materials { get; set; } = new MaterialDiction<string, ObservableCollection<PotActions>>();
}


public class MaterialDiction<TKey, TValue> : Dictionary<TKey, TValue>
{
public Action<TKey, TValue>? addItem;
public Action<TKey, TValue>? removeItem;
public new void Update()
{

}
public new void Add(TKey key, TValue value)
{
if (!base.ContainsKey(key))
{
base.Add(key, value);
addItem?.Invoke(key, value);
}
}

public new bool ReMove(TKey key)
{
if (base.ContainsKey(key))
{
TValue value = base[key];
bool res = base.Remove(key);
if (res)
{
removeItem?.Invoke(key, value);
}
return res;
}
return false;
}
}
}

+ 14
- 0
BPASmartClient.Model/煮面机/NoodAction.cs View File

@@ -0,0 +1,14 @@
using BPASmartClient.Model.小炒机;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Model.煮面机
{
public class NoodOrder
{
public MaterialDiction<string, MorksSimorderModel> localOrder = new MaterialDiction<string, MorksSimorderModel> ();
}
}

+ 2
- 1
BPASmartClient.Model/订单/MorksSimorderModel.cs View File

@@ -8,7 +8,8 @@ namespace BPASmartClient.Model
{
public class MorksSimorderModel : BaseEvent
{
public int NoodleLoc { get; set; }
public int NoodleLoc { get; set ; }
public int Bowloc { get; set; }
public double FryTime { get; set; }
}
}

+ 1
- 0
BPASmartClient.MorkSUpgradedVer/BPASmartClient.MorkSUpgradedVer.csproj View File

@@ -17,6 +17,7 @@
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" />
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.MORKSM.BK.PLC\BPASmartClient.PLC.csproj" />
<ProjectReference Include="..\BPASmartClient.ViewModel\BPASmartClient.ViewModel.csproj" />
</ItemGroup>

<ItemGroup>


+ 165
- 58
BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs View File

@@ -1,6 +1,10 @@
using BPASmartClient.CustomResource;
using static BPA.Helper.EventBus;
using System.Collections.Concurrent;
using BPASmartClient.Model.煮面机;
using BPASmartClient.ViewModel;
using AlarModel = BPA.Message.AlarmModel;
using Microsoft.VisualBasic.Logging;
//using BPA.Helper;

namespace BPASmartClient.MorkSUpgradedVer
@@ -35,28 +39,53 @@ namespace BPASmartClient.MorkSUpgradedVer
});
}
}

ActionManage.GetInstance.Register(new Action<object[]>((o) =>
ActionManage.GetInstance.Register(new Action(() =>
{
if (o.Length > 0)
if (FoodMenuViewModel.orderStatusLists.Count > 0)
{
Random rd = new Random();
TaskManage.GetInstance.StartLong(new Action(() =>
foreach (var item in FoodMenuViewModel.orderStatusLists)
{
int NoodleLoc = (int)o[0] == 0 ? rd.Next(1, 6) : (int)o[0];
int BowlLoc = (int)o[1] == 0 ? rd.Next(10, 12) : (int)o[1];

string guid = Guid.NewGuid().ToString();
if (string.IsNullOrEmpty(item.OrderPush.SuborderId))
{
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<NoodOrder>.Data.localOrder[item.OrderPush.GoodsName].NoodleLoc, SuborderId = item.OrderPush.SuborderId });
MessageLog.GetInstance.Show($"添加订单:面条位置【{Json<NoodOrder>.Data.localOrder[item.OrderPush.GoodsName].NoodleLoc}】");
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)Json<NoodOrder>.Data.localOrder[item.OrderPush.GoodsName].Bowloc, SuborderId = item.OrderPush.SuborderId });
MessageLog.GetInstance.Show($"添加订单:碗位置【{Json<NoodOrder>.Data.localOrder[item.OrderPush.GoodsName].Bowloc}】");
Global.EnableLocalSimOrder = true;
}

mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)NoodleLoc, SuborderId = guid });
MessageLog.GetInstance.Show($"添加订单:面条位置【{NoodleLoc}】");
}

mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)BowlLoc, SuborderId = guid });
MessageLog.GetInstance.Show($"添加订单:碗位置【{BowlLoc}】");
Thread.Sleep(60000);
}), "ForOrder");
}
}

}), "EnableForOrder");
//ActionManage.GetInstance.Register(new Action<object[]>((o) =>
//{
// if (o.Length > 0)
// {
// Random rd = new Random();
// TaskManage.GetInstance.StartLong(new Action(() =>
// {
// int NoodleLoc = (int)o[0] == 0 ? rd.Next(1, 6) : (int)o[0];

// int BowlLoc = (int)o[1] == 0 ? rd.Next(10, 12) : (int)o[1];

// string guid = Guid.NewGuid().ToString();

// mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)NoodleLoc, SuborderId = guid });
// MessageLog.GetInstance.Show($"添加订单:面条位置【{NoodleLoc}】");

// mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)BowlLoc, SuborderId = guid });
// MessageLog.GetInstance.Show($"添加订单:碗位置【{BowlLoc}】");
// Thread.Sleep(60000);
// }), "ForOrder");
// }
//}), "EnableForOrder");

ActionManage.GetInstance.Register(new Action<object>((o) =>
{
@@ -129,51 +158,55 @@ namespace BPASmartClient.MorkSUpgradedVer

private void TempOrderChange(string subid, ORDER_STATUS oRDER_STATUS, Action complete)
{
var res = mORKS.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid);
string goodName = string.Empty;
string SortNum = string.Empty;
if (res != null)
if (mORKS.doOrderEvents.Count>0)
{
goodName = res.MorkOrder.GoodsName;
SortNum = res.MorkOrder.SortNum.ToString();
}
if (!string.IsNullOrEmpty(goodName) && !string.IsNullOrEmpty(SortNum))
{
EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { SortNum = SortNum, GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType }, e => { complete?.Invoke(); });

var index = DataServer.GetInstance.morkS.MakeOrder.FindIndex(p => p.SortNum == SortNum);
//如果订单信息已经存在,则修改状态,否则新增。
if (index >= 0 && index < DataServer.GetInstance.morkS.MakeOrder.Count)
var res = mORKS.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid);
string goodName = string.Empty;
string SortNum = string.Empty;
if (res != null)
{
if (oRDER_STATUS == ORDER_STATUS.COMPLETED_COOK)
goodName = res.MorkOrder.GoodsName;
SortNum = res.MorkOrder.SortNum.ToString();
}
if (!string.IsNullOrEmpty(goodName) && !string.IsNullOrEmpty(SortNum))
{
EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { SortNum = SortNum, GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType }, e => { complete?.Invoke(); });

var index = DataServer.GetInstance.morkS.MakeOrder.FindIndex(p => p.SortNum == SortNum);
//如果订单信息已经存在,则修改状态,否则新增。
if (index >= 0 && index < DataServer.GetInstance.morkS.MakeOrder.Count)
{
DataServer.GetInstance.morkS.MakeOrder.RemoveAt(index);
DataServer.GetInstance.morkS.MakeOrderOver.Add(new OrderMakeModel()
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,
StopTime = DateTime.Now.ToString("HH:mm:ss")
StartTime = 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")
});
}
}
}
#endregion

@@ -304,7 +337,7 @@ namespace BPASmartClient.MorkSUpgradedVer
DataServer.GetInstance.morkS.Alarm.Clear();
alarms.ForEach(item =>
{
DataServer.GetInstance.morkS.Alarm.Add(new AlarmModel()
DataServer.GetInstance.morkS.Alarm.Add(new BPA.Message.AlarmModel()
{
AlarmTime = $"{item.Date} {item.Time}",
AlarmMs = item.Info
@@ -366,6 +399,7 @@ namespace BPASmartClient.MorkSUpgradedVer
mORKS.SiloInPlace = bools[0];
}
}));

GetStatus("M16.7", new Action<object>((obj) =>
{
@@ -541,7 +575,11 @@ namespace BPASmartClient.MorkSUpgradedVer

//OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING);
OrderChange(orderLocInfo.SuborderId, ORDER_STATUS.COOKING);

var res = FoodMenuViewModel.orderStatusLists.FirstOrDefault(o => o.OrderPush.SuborderId == orderLocInfo.SuborderId );
if (res != null)
res.OrderStatus = ORDER_STATUS.COOKING;
else
DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】异常");
//DeviceProcessLogShow($"订单【{mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
//2023-8-5修改修改取碗打印日志。
//DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
@@ -599,16 +637,47 @@ namespace BPASmartClient.MorkSUpgradedVer
{
if (Global.EnableLocalSimOrder)
{
//不做轮询,直接取面,模拟订单使用
//不做轮询,直接取面,本地订单使用
if (mORKS.SiloInPlace && !mORKS.Feeding && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0)
{
if (mORKS.TurntableLowPosition)
if (!mORKS.TurntableLowPosition)
{
if (mORKS.RBTakeNoodleTask.ElementAt(0).Loc !=0)
{
if (!mORKS.TurntableLocLists.Contains(mORKS.RBTakeNoodleTask.ElementAt(0).Loc))
{
TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc);
}
else
{
DeviceProcessLogShow("未找到可用的物料信息");
mORKS.TurntableLocLists.Clear();
}
}
else
{
TurntableStart((ushort)(mORKS.CurrentFeedbackLoc + 1));
}

}
else
{
if (mORKS.RBTakeNoodleTask.ElementAt(0).Loc == 0)
{
mORKS.RBTakeNoodleTask.ElementAt(0).Loc = mORKS.CurrentFeedbackLoc;
}
TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc);
mORKS.TurntableLocLists.Clear();
mORKS.AllowTakeNoodle = true;
DeviceProcessLogShow($"控制机器人去转台【{mORKS.RBTakeNoodleTask.ElementAt(0).Loc}】号位置取面");
}
//if (mORKS.TurntableLowPosition)
//{
// TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc);
// mORKS.TurntableLocLists.Clear();
// mORKS.AllowTakeNoodle = true;
// DeviceProcessLogShow($"控制机器人去转台【{mORKS.RBTakeNoodleTask.ElementAt(0).Loc}】号位置取面");
//}
}
}
else
@@ -712,19 +781,38 @@ namespace BPASmartClient.MorkSUpgradedVer
var x = Json<MorksPar>.Data.DishLibraryParSets.FirstOrDefault(p => p.TextBlockContext == mORKS.CurrentFeedbackLoc.ToString());
if (x != null)
{
var re = FoodMenuViewModel.orderStatusLists.FirstOrDefault(o => o.OrderPush.SuborderId == orderLocInfo.SuborderId);
List<ushort> values = new List<ushort>();
values.Add(x.Minute);
values.Add(x.Second);
if (Json<NoodOrder>.Data.localOrder.ContainsKey(re.OrderPush.GoodsName))
{
values.Add((ushort)Json<NoodOrder>.Data.localOrder[re.OrderPush.GoodsName].FryTime);
values.Add(0);
}
else
{
values.Add(2);
values.Add(0);
}
/*
values.Add(re);
values.Add(x.Second);*/
WriteData($"VW{324 + (loc * 4)}", values.ToArray());
DeviceProcessLogShow($"转盘位置[{mORKS.CurrentFeedbackLoc}]:写入煮面时间{x.Minute}分{x.Second}秒。");
}
}

mORKS.CurrentLoc = 0;
mORKS.CookNodelId[loc] = orderLocInfo.SuborderId;
mORKS.NoodleCookerStatus[loc] = true;
SetFallNoodleLoc((ushort)(loc + 1));
//机器人开始取面
OrderChange(orderLocInfo.SuborderId, ORDER_STATUS.COOKING);
var res = FoodMenuViewModel.orderStatusLists.FirstOrDefault(o => o.OrderPush.SuborderId == orderLocInfo.SuborderId);
if (res != null)
res.OrderStatus = ORDER_STATUS.COOKING;
else
DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】异常");
DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】,机器人倒面至【{loc + 1}】号煮面栏");

mORKS.TakeNoodleInterlock = true;
@@ -772,6 +860,13 @@ namespace BPASmartClient.MorkSUpgradedVer
mORKS.NoodleCookerStatus[loc] = false;
WriteData($"VW260", (ushort)0);//设置出汤时间
OrderChange(mORKS.CookNodelId[loc], ORDER_STATUS.COMPLETED_COOK);
var res = FoodMenuViewModel.orderStatusLists.FirstOrDefault(o => o.OrderPush.SuborderId == mORKS.CookNodelId[loc]);
if (res != null)
{
NoodOrderCtrl.GetInstance.statusList(res);
}
else
DeviceProcessLogShow($"订单【{mORKS.CookNodelId[loc]}】异常");
DeviceProcessLogShow($"订单【{mORKS.CookNodelId[loc]}】制作完成");
mORKS.CookCompleteFlatBit = true;
mORKS.OutMealId = mORKS.CookNodelId[loc];
@@ -809,6 +904,14 @@ namespace BPASmartClient.MorkSUpgradedVer
if (RTrig.GetInstance("CompleteChange1").Start(mORKS.DiningComplete) && mORKS.CookCompleteFlatBit == true)
{
OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE);
var res = FoodMenuViewModel.WaitTakeMeal.FirstOrDefault(o => o.OrderPush.SuborderId == mORKS.OutMealId);
if (res != null)
{
res.OrderStatus = ORDER_STATUS.COMPLETED_TAKE;
NoodOrderCtrl.GetInstance.FinishOrder(res);
}
else
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】异常");
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成");
WriteData("M10.1", false);

@@ -893,11 +996,15 @@ namespace BPASmartClient.MorkSUpgradedVer
/// <param name="loc"></param>
private void TurntableStart(ushort loc)
{
if (loc >= 1 && loc <= 5)
if (loc >= 1 && loc <= 5 )
{
mORKS.CurrentLoc = loc;
mORKS.TurntableInterlock = true;
mORKS.TurntableLocLists.Add(loc);
if (!mORKS.TurntableLocLists.Contains(loc))
{
mORKS.TurntableLocLists.Add(loc);
}
//mORKS.TurntableLocLists.Add(loc);
WriteData($"M13.{loc - 1}", true);
}
}


+ 1
- 1
BPASmartClient.MorkSUpgradedVer/GVL_MorkSUpgradedVer.cs View File

@@ -137,7 +137,7 @@ namespace BPASmartClient.MorkSUpgradedVer
/// </summary>
public int TakeBowSortNum { get; set; } = 0;

public ushort RandomLoc { get; set; }
/// <summary>
/// 允许倒面位置ID
/// </summary>


+ 0
- 1
BPASmartClient.ViewModel/AdminstratorsViewModel.cs View File

@@ -26,7 +26,6 @@ namespace BPASmartClient.ViewModel
{
AdminLoginCommand = new BPARelayCommand(() =>
{

ActionManage.GetInstance.Send("LoginSuccess");
});
}


+ 0
- 1
BPASmartClient.ViewModel/BPASmartClient.ViewModel.csproj View File

@@ -17,7 +17,6 @@
<ProjectReference Include="..\BPASmartClient.DRCoffee\BPASmartClient.DRCoffee.csproj" />
<ProjectReference Include="..\BPASmartClient.GSIceCream\BPASmartClient.GSIceCream.csproj" />
<ProjectReference Include="..\BPASmartClient.IoT\BPASmartClient.IoT.csproj" />
<ProjectReference Include="..\BPASmartClient.Lebai\BPASmartClient.Lebai.csproj" />
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.SCChip\BPASmartClient.SCChip.csproj" />
</ItemGroup>


+ 32
- 0
BPASmartClient.ViewModel/EditRecipeViewModel.cs View File

@@ -0,0 +1,32 @@
using BPA.Helper;
using BPASmartClient.Model;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Printing;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.ViewModel
{
public class EditRecipeViewModel:NotifyBase
{
public BPARelayCommand<object> EditOrder { get; set; }
public BPARelayCommand<object> DeleteOrder { get; set; }
public BPARelayCommand SaveOrder { get; set; }
public EditRecipeViewModel()
{
NoodOrderCtrl.GetInstance.editRecipeAction = s =>
{
LocalOrder = s;
};
SaveOrder = new BPARelayCommand(() => { NoodOrderCtrl.GetInstance.SaveRecipe(LocalOrder); });
EditOrder = new BPARelayCommand<object>(NoodOrderCtrl.GetInstance.EditOrder);
DeleteOrder = new BPARelayCommand<object>(NoodOrderCtrl.GetInstance.DeleteRecipe);
}
public LocalOrder LocalOrder { get { return _localOrder; } set { _localOrder = value; OnPropertyChanged(); } }
private LocalOrder _localOrder = new LocalOrder();
public ObservableCollection<FoodMenuModel> FoodMenus { get; set; } = FoodMenuViewModel.FoodMenus;
}
}

+ 146
- 8
BPASmartClient.ViewModel/FoodMenuViewModel.cs View File

@@ -9,6 +9,18 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.CustomResource.UserControls;
using BPA.Message.Enum;
using BPA.Message;
using BPASmartClient.Device;
using System.Threading;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Business;
using BPASmartClient.Model.煮面机;
using System.Windows.Controls;
using static Opc.Ua.RelativePathFormatter;

namespace BPASmartClient.ViewModel
{
@@ -16,21 +28,147 @@ namespace BPASmartClient.ViewModel
{
/// <summary>
/// 菜单
///
///
/// </summary>
public ObservableCollection<FoodMenuModel> FoodMenus { get; set; } = new ObservableCollection<FoodMenuModel>();
public static ObservableCollection<FoodMenuModel> FoodMenus { get; set; } = new ObservableCollection<FoodMenuModel>();
public static int SortNum { get; set; } = 1;
public static ObservableCollection<MorkOrder> orderStatusLists { get; set; } = new ObservableCollection<MorkOrder>();
/// <summary>
/// 等待取餐列表
/// </summary>
public static ObservableCollection<MorkOrder> WaitTakeMeal { get; set; } = new ObservableCollection<MorkOrder>();
public FoodMenuViewModel()
{
}

public BPARelayCommand<object> StartOrder { get; set; }

public FoodMenuViewModel()

/// <summary>
/// MQTT 大屏取餐通知委托
/// </summary>
public static void Init()
{
Json<MaterialAndFryingTime>.Data.materials?.Keys?.ToList().ForEach(key => FoodMenus.Add(new FoodMenuModel { GoodName = key }));

StartOrder = new BPARelayCommand<object>((o) =>
//清除订单数据
ActionManage.GetInstance.Register(new Action(() =>
{
ActionManage.GetInstance.Send("开始下单", o);
});
Application.Current.Dispatcher.Invoke(() =>
{
orderStatusLists.Clear();
WaitTakeMeal.Clear();
});
}), "ClearOrders");

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"),
};
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"),
});
});
if (orderStatusLists.Count > 0)
{

orderStatusLists[0].OrderStatus = ORDER_STATUS.COOKING;
}

}
}
}

}), "AddOrder");

EventBus.GetInstance().Subscribe<OrderStatusChangedEvent>(0, OrderStatusChangedHandle);
}

private static void OrderStatusChangedHandle(IEvent @event, EventBus.EventCallBackHandle callBack)
{
OrderStatusChangedEvent orderStatusChange = @event as OrderStatusChangedEvent;
int index = Array.FindIndex(orderStatusLists.ToArray(), p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId);
switch (orderStatusChange.Status)
{
case ORDER_STATUS.COOKING:
if (index >= 0 && index < orderStatusLists.Count)
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;
break;
case ORDER_STATUS.COMPLETED_COOK:
if (index >= 0 && index < orderStatusLists.Count)
{
Application.Current.Dispatcher.BeginInvoke((Action)delegate
{
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;
orderStatusLists.ElementAt(index).EndDate = DateTime.Now.ToString("HH:mm:ss");
TimeSpan timeSpan = DateTime.Now.Subtract(Convert.ToDateTime(orderStatusLists.ElementAt(index).StartDate));
orderStatusLists.ElementAt(index).CompleteDate = $"{timeSpan.TotalSeconds.ToString("0.00")} S";

//压力测试时注释,正常使用需要取消注释
if (!BPASmartClient.Business.InternetInfo.IsEnableTest)
{
WaitTakeMeal.Insert(0, orderStatusLists.ElementAt(index));
orderStatusLists.RemoveAt(index);
}
});
}

break;
case ORDER_STATUS.COMPLETED_TAKE:
if (BPASmartClient.Business.InternetInfo.IsEnableTest && index >= 0 && index < orderStatusLists.Count)
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;

//压力测试时注释,正常使用需要取消注释
var re = WaitTakeMeal.FirstOrDefault(p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId);
if (re != null)
{
Application.Current.Dispatcher.BeginInvoke((Action)delegate
{
WaitTakeMeal.Remove(re);
var removeObj = Json<KeepDataBase>.Data.orderLists.FirstOrDefault(p => p.morkOrderPushes.FirstOrDefault(s => s.OrderPush.SuborderId == re.OrderPush.SuborderId) != null);
if (removeObj != null) Json<KeepDataBase>.Data.orderLists.Remove(removeObj);
});
}
break;
default:
break;

}
}

}
}

+ 25
- 0
BPASmartClient.ViewModel/LoginViewModel.cs View File

@@ -0,0 +1,25 @@
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace BPASmartClient.ViewModel
{
public class LoginViewModel:NotifyBase
{
public LoginViewModel()
{
ThreadManage.GetInstance.StartLong(() =>
{
Date = DateTime.Now;
Thread.Sleep(500);
},"更新时间");
}
private DateTime _date = DateTime.Now;
public DateTime Date { get { return _date; } set { _date = value; OnPropertyChanged(); } }
}
}

+ 7
- 3
BPASmartClient.ViewModel/MainViewModel.cs View File

@@ -13,6 +13,8 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Threading;
using System.Windows.Controls;
using System.Collections.Concurrent;

namespace BPASmartClient.ViewModel
{
@@ -50,11 +52,15 @@ namespace BPASmartClient.ViewModel
public static MainViewModel GetInstance() => _Instance ?? (_Instance = new MainViewModel());

#endregion
#region 页面存储
public ConcurrentDictionary<string, FrameworkElement> MenuItems = new ConcurrentDictionary<string, FrameworkElement>();
#endregion


public MainViewModel()
{
IsAlarm = new AlarmModel();
OrderStatusViewModel.Init();
FoodMenuViewModel.Init();
//设备告警日志
MessageLog.GetInstance.AlarmLogNotify = new Action(() =>
{
@@ -77,10 +83,8 @@ namespace BPASmartClient.ViewModel
};
dispatcherTimer.Interval = TimeSpan.FromSeconds(1);
dispatcherTimer.Start();

}


public int CurrentOrderCount { get { return _mCurrentOrderCount; } set { _mCurrentOrderCount = value; OnPropertyChanged(); } }
private int _mCurrentOrderCount;



+ 179
- 0
BPASmartClient.ViewModel/NoodOrderCtrl.cs View File

@@ -0,0 +1,179 @@
using BPA.Helper;
using BPA.Message.Enum;
using BPA.Message;
using BPASmartClient.Model;
using BPASmartClient.Model.煮面机;
using BPASmartClient.ViewModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Windows;
using Org.BouncyCastle.Asn1.Crmf;
using System.Collections.Concurrent;
using System.Threading.Tasks;
using System.Threading;

namespace BPASmartClient
{
public class NoodOrderCtrl:NotifyBase
{
private static NoodOrderCtrl _instance;
public static NoodOrderCtrl GetInstance { get; set; }=_instance??=new NoodOrderCtrl();
public Action<LocalOrder>? orderStatusAction;
public Action<LocalOrder>? editRecipeAction;
public ConcurrentDictionary<string,FrameworkElement> allViews = new ConcurrentDictionary<string, FrameworkElement> ();
public Action<string>? 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 void Show(string info)
{
showInfo?.Invoke(info);
}
public void Init()
{
FoodMenuViewModel.FoodMenus.Clear();
Json<NoodOrder>.Data.localOrder?.Keys?.ToList().ForEach(key => FoodMenuViewModel.FoodMenus.Add(new FoodMenuModel { GoodName = key, BowLoc = Json<NoodOrder>.Data.localOrder[key].Bowloc, NoodleLoc = Json<NoodOrder>.Data.localOrder[key].NoodleLoc, Frytime = Json<NoodOrder>.Data.localOrder[key].FryTime }));
Json<NoodOrder>.Data.localOrder.addItem = ((key, value) =>
{
FoodMenuViewModel.FoodMenus.Add(new FoodMenuModel { GoodName = key ,BowLoc = value.Bowloc,NoodleLoc = value.NoodleLoc,Frytime = value.FryTime});
});
Json<NoodOrder>.Data.localOrder.removeItem = ((key, value) =>
{
var re = FoodMenuViewModel.FoodMenus.FirstOrDefault(o => o.GoodName == key);
if (re != null)
{
FoodMenuViewModel.FoodMenus.Remove(re);
}
});
}
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(LocalOrder localOrder,int amount)
{
if (amount > 0 && !string.IsNullOrEmpty(localOrder.Name))
{
MorksSimorderModel res = Json<NoodOrder>.Data.localOrder[localOrder.Name];
if (res != null)
{
for (int i = 0; i < amount; i++)
{
Application.Current.Dispatcher.Invoke(() =>
{
FoodMenuViewModel.orderStatusLists.Add(new MorkOrder()
{
OrderPush = new MorkOrderPush() { DeviceId = res.DeviceId, GoodsName = localOrder.Name, SortNum = FoodMenuViewModel.SortNum++ },
OrderStatus = ORDER_STATUS.WAIT,
StartDate = DateTime.Now.ToString("HH:mm:ss"),
});
});
Json<NoodOrder>.Data.localOrder[localOrder.Name].Publish();
}
Show($"成功下单{localOrder.Name}/{amount}次!");
ActionManage.GetInstance.Send("EnableForOrder");

}

}
}
public void EditOrder(object o)
{
if (o is string re)
{
if (Json<NoodOrder>.Data.localOrder.ContainsKey(re))
{
var res = Json<NoodOrder>.Data.localOrder[re];
if (res != null)
{
LocalOrder = new LocalOrder() { Name = re, NoodleLoc = res.NoodleLoc, Bowloc = res.Bowloc, FryTime = res.FryTime };
orderStatusAction?.Invoke(LocalOrder);
editRecipeAction?.Invoke(LocalOrder);
}
}

}
}
public void SaveRecipe(LocalOrder order)
{
if (Json<NoodOrder>.Data.localOrder.ContainsKey(order.Name))
{
Json<NoodOrder>.Data.localOrder.ReMove(order.Name);
Json<NoodOrder>.Data.localOrder.Add(order.Name, new Model.MorksSimorderModel() { NoodleLoc = order.NoodleLoc, Bowloc = order.Bowloc, FryTime = order.FryTime,DeviceId=42});
Show("已更改!");
}
else
{
Json<NoodOrder>.Data.localOrder.Add(order.Name, new Model.MorksSimorderModel() { NoodleLoc = order.NoodleLoc, Bowloc = order.Bowloc, FryTime = order.FryTime, DeviceId = 42 });
Show("已添加!");
}
}
public void NewRecipe(LocalOrder order)
{
if (!Json<NoodOrder>.Data.localOrder.ContainsKey(order.Name))
{
Json<NoodOrder>.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)
{
if (Json<NoodOrder>.Data.localOrder.ContainsKey(re))
{
Json<NoodOrder>.Data.localOrder.ReMove(re);
Show("已删除!");
}
else
{
MessageBox.Show("未找到本地菜品", "提示", MessageBoxButton.OK);
}

}
}


public void statusList(MorkOrder res)
{
Application.Current.Dispatcher.Invoke(() => {
FoodMenuViewModel.orderStatusLists.Remove(res);
res.OrderStatus = ORDER_STATUS.COMPLETED_COOK;
res.EndDate = DateTime.Now.ToString("HH:mm:ss");
FoodMenuViewModel.WaitTakeMeal.Insert(0, res);
});
}

public Task FinishOrder(MorkOrder res)
{
return Task.Factory.StartNew(() =>
{
Thread.Sleep(1000);
Application.Current.Dispatcher.Invoke(() =>
{
FoodMenuViewModel.WaitTakeMeal.Remove(res);
});
});
}
}
}

+ 34
- 125
BPASmartClient.ViewModel/OrderStatusViewModel.cs View File

@@ -12,142 +12,51 @@ using BPASmartClient.Device;
using BPA.Helper;
using BPASmartClient.Model;
using BPA.Helper;
using System.Xml.Linq;
using BPASmartClient.Model.煮面机;
using System.Security.RightsManagement;

namespace BPASmartClient.ViewModel
{
public class OrderStatusViewModel : NotifyBase
{
public OrderStatusViewModel()
{

}

/// <summary>
/// 订单状态列表
/// </summary>
public static ObservableCollection<MorkOrder> orderStatusLists { get; set; } = new ObservableCollection<MorkOrder>();

/// <summary>
/// 等待取餐列表
/// </summary>
public static ObservableCollection<MorkOrder> WaitTakeMeal { get; set; } = new ObservableCollection<MorkOrder>();
#region 事件
public BPARelayCommand StartOrder { get; set; }
public BPARelayCommand<object> EditOrder { get; set; }
#endregion

/// <summary>
/// MQTT 大屏取餐通知委托
/// </summary>
public static void Init()
#region 初始化
public OrderStatusViewModel()
{
//清除订单数据
ActionManage.GetInstance.Register(new Action(() =>
{
Application.Current.Dispatcher.Invoke(() =>
{
orderStatusLists.Clear();
WaitTakeMeal.Clear();
});
}), "ClearOrders");

ActionManage.GetInstance.Register(new Action<object[]>((o) =>
NoodOrderCtrl.GetInstance.orderStatusAction = s =>
{
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"),
};
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");

EventBus.GetInstance().Subscribe<OrderStatusChangedEvent>(0, OrderStatusChangedHandle);
LocalOrder = s;
};
StartOrder = new BPARelayCommand(()=> { NoodOrderCtrl.GetInstance.StartOrder(LocalOrder, OrderAmount); });
EditOrder = new BPARelayCommand<object>(NoodOrderCtrl.GetInstance.EditOrder);
}
#endregion

private static void OrderStatusChangedHandle(IEvent @event, EventBus.EventCallBackHandle callBack)
{
OrderStatusChangedEvent orderStatusChange = @event as OrderStatusChangedEvent;
int index = Array.FindIndex(orderStatusLists.ToArray(), p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId);
switch (orderStatusChange.Status)
{
case ORDER_STATUS.COOKING:
if (index >= 0 && index < orderStatusLists.Count)
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;
break;
case ORDER_STATUS.COMPLETED_COOK:
if (index >= 0 && index < orderStatusLists.Count)
{
Application.Current.Dispatcher.BeginInvoke((Action)delegate
{
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;
orderStatusLists.ElementAt(index).EndDate = DateTime.Now.ToString("HH:mm:ss");
TimeSpan timeSpan = DateTime.Now.Subtract(Convert.ToDateTime(orderStatusLists.ElementAt(index).StartDate));
orderStatusLists.ElementAt(index).CompleteDate = $"{timeSpan.TotalSeconds.ToString("0.00")} S";

//压力测试时注释,正常使用需要取消注释
if (!BPASmartClient.Business.InternetInfo.IsEnableTest)
{
WaitTakeMeal.Insert(0, orderStatusLists.ElementAt(index));
orderStatusLists.RemoveAt(index);
}
});
}

break;
case ORDER_STATUS.COMPLETED_TAKE:
if (BPASmartClient.Business.InternetInfo.IsEnableTest && index >= 0 && index < orderStatusLists.Count)
orderStatusLists.ElementAt(index).OrderStatus = orderStatusChange.Status;
public ObservableCollection<FoodMenuModel> FoodMenus { get; set; } = FoodMenuViewModel.FoodMenus;
public static ObservableCollection<FoodMenuModel> orderMenus { get; set; } = new ObservableCollection<FoodMenuModel>();

//压力测试时注释,正常使用需要取消注释
var re = WaitTakeMeal.FirstOrDefault(p => p.OrderPush.SuborderId == orderStatusChange.SubOrderId);
if (re != null)
{
Application.Current.Dispatcher.BeginInvoke((Action)delegate
{
WaitTakeMeal.Remove(re);
var removeObj = Json<KeepDataBase>.Data.orderLists.FirstOrDefault(p => p.morkOrderPushes.FirstOrDefault(s => s.OrderPush.SuborderId == re.OrderPush.SuborderId) != null);
if (removeObj != null) Json<KeepDataBase>.Data.orderLists.Remove(removeObj);
});
}
break;
default:
break;
public LocalOrder LocalOrder { get { return _localOrder; } set { _localOrder = value; OnPropertyChanged(); } }
private LocalOrder _localOrder= new LocalOrder();
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;
}
}

+ 189
- 0
BPASmartClient/App.xaml View File

@@ -30,6 +30,195 @@
</ResourceDictionary>

</ResourceDictionary.MergedDictionaries>
<Style x:Key="viewBtn_1" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Border x:Name="btnBorder" Height="60" Width="60" Background="{TemplateBinding Background}"/>
<ContentControl x:Name="ctrl" Margin="40,0,0,0" Content="{TemplateBinding Content}" Background="Transparent" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}"/>
</StackPanel>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value="0.8" TargetName="btnBorder"/>
<Setter Property="Opacity" Value="0.8" TargetName="ctrl"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Opacity" Value="0.5" TargetName="btnBorder"/>
<Setter Property="Opacity" Value="0.5" TargetName="ctrl"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="viewBtn_2" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Vertical">
<Border Height="60" x:Name="btnBorder" Width="60" Background="{TemplateBinding Background}"/>
<ContentControl x:Name="ctrl" Margin="0,40,0,0" Content="{TemplateBinding Content}" Background="Transparent" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}"/>
</StackPanel>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value="0.8" TargetName="btnBorder"/>
<Setter Property="Opacity" Value="0.8" TargetName="ctrl"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Opacity" Value="0.5" TargetName="btnBorder"/>
<Setter Property="Opacity" Value="0.5" TargetName="ctrl"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="toggle" TargetType="{x:Type RadioButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Grid x:Name="tGrid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<ContentControl x:Name="content" BorderThickness="0" Background="Transparent" Content="{TemplateBinding Content}" FontSize="{TemplateBinding FontSize}" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background" Value="#D7D7D7" TargetName="tGrid"/>
</Trigger>
<Trigger Property="IsChecked" Value="False">
<Setter Property="Background" Value="Transparent" TargetName="tGrid"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="togrecipebtn" TargetType="{x:Type RadioButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Grid x:Name="tGrid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<ContentControl x:Name="content" BorderThickness="0" Background="White" Content="{TemplateBinding Content}" FontSize="{TemplateBinding FontSize}" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background" TargetName="tGrid">
<Setter.Value>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1" >
<GradientStop Offset="0" Color="#7796E5"/>
<GradientStop Offset="1" Color="#235CEC"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsChecked" Value="False">
<Setter Property="Background" Value="White" TargetName="tGrid"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value="0.8" TargetName="tGrid"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="togrecipebtn_1" TargetType="{x:Type RadioButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Grid x:Name="tGrid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<ContentControl x:Name="content" BorderThickness="0" Background="White" Content="{TemplateBinding Content}" FontSize="{TemplateBinding FontSize}" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Background" TargetName="tGrid">
<Setter.Value>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1" >
<GradientStop Offset="0" Color="#7796E5"/>
<GradientStop Offset="1" Color="#235CEC"/>
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsChecked" Value="False">
<Setter Property="Background" Value="#D7D7D7" TargetName="tGrid"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value="0.8" TargetName="tGrid"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="godbtn" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="btnBorder" Background="{TemplateBinding Background}" Height="200" Width="300">
<ContentControl Content="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="{TemplateBinding FontSize}" Foreground="{TemplateBinding Foreground}" Background="Transparent"/>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Height" Value="220" TargetName="btnBorder"/>
<Setter Property="Width" Value="320" TargetName="btnBorder"/>
<Setter Property="Opacity" Value="0.8" TargetName="btnBorder"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="adbtn" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="btnBorder" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{TemplateBinding Background}">
<ContentControl x:Name="con" Content="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center" Background="Transparent" FontSize="{TemplateBinding FontSize}" Foreground="{TemplateBinding Foreground}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value="0.8" TargetName="btnBorder"/>
<Setter Property="Opacity" Value="0.8" TargetName="con"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Opacity" Value="0.6" TargetName="btnBorder"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="viewBtn_3" TargetType="{x:Type Button}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Border x:Name="btnBorder" Height="20" Width="20" Background="{TemplateBinding Background}"/>
<ContentControl x:Name="ctrl" Margin="5,0,0,0" Content="{TemplateBinding Content}" Background="Transparent" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="{TemplateBinding Foreground}" FontSize="{TemplateBinding FontSize}"/>
</StackPanel>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value="0.8" TargetName="btnBorder"/>
<Setter Property="Opacity" Value="0.8" TargetName="ctrl"/>
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="Opacity" Value="0.5" TargetName="btnBorder"/>
<Setter Property="Opacity" Value="0.5" TargetName="ctrl"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>

+ 8
- 2
BPASmartClient/App.xaml.cs View File

@@ -17,6 +17,7 @@ using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;
using BPASmartClient.Model.煮面机;

namespace BPASmartClient
{
@@ -28,11 +29,14 @@ namespace BPASmartClient
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
DataRead();
SystemHelper.GetInstance.CreateDesktopShortcut();
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
DataRead();
MainWindow mainView = new MainWindow();
mainView.Show();

SplitScreenDisplay();
NoCompleteOrderInit();
ActionManage.GetInstance.Register(new Action<object>(par =>
@@ -48,7 +52,7 @@ namespace BPASmartClient
/// </summary>
private void SplitScreenDisplay()
{
if (Screen.AllScreens.Length == 3)
if (Screen.AllScreens.Length == 2)
{
//left = new MORKD_Window_Left();
//right = new MORKD_Window_Right();
@@ -124,6 +128,7 @@ namespace BPASmartClient
private void DataSave()
{
Json<KeepDataBase>.Save();
Json<NoodOrder>.Save();
//Sqlite<Alarm>.GetInstance.Save();
}

@@ -133,6 +138,7 @@ namespace BPASmartClient
private void DataRead()
{
Json<KeepDataBase>.Read();
Json<NoodOrder>.Read();
Task.Run(new Action(() => { Sqlite<BPASmartClient.Model.Alarm>.GetInstance.GetData(); }));
}



+ 25
- 7
BPASmartClient/BPASmartClient.csproj View File

@@ -10,6 +10,23 @@
<ApplicationIcon>hbl.ico</ApplicationIcon>
</PropertyGroup>

<ItemGroup>
<Compile Remove="新文件夹1\**" />
<EmbeddedResource Remove="新文件夹1\**" />
<None Remove="新文件夹1\**" />
<Page Remove="新文件夹1\**" />
</ItemGroup>

<ItemGroup>
<None Remove="Image\bk.png" />
<None Remove="Image\bk_1.png" />
<None Remove="Image\ebg.jpg" />
<None Remove="Image\noodle.jpg" />
<None Remove="Image\noodle_1.jpeg" />
<None Remove="Image\主页.png" />
<None Remove="Image\表头.jpg" />
</ItemGroup>

<ItemGroup>
<Content Include="hbl.ico" />
</ItemGroup>
@@ -29,7 +46,6 @@
<ProjectReference Include="..\BPASmartClient.GSIceCream\BPASmartClient.GSIceCream.csproj" />
<ProjectReference Include="..\BPASmartClient.IoT\BPASmartClient.IoT.csproj" />
<ProjectReference Include="..\BPASmartClient.KLMCoffee\BPASmartClient.KLMCoffee.csproj" />
<ProjectReference Include="..\BPASmartClient.Lebai\BPASmartClient.Lebai.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkBF\BPASmartClient.MorkBF.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkF\BPASmartClient.MorkF.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkMV1\BPASmartClient.MorkMV1.csproj" />
@@ -38,18 +54,20 @@
<ProjectReference Include="..\BPASmartClient.MorkSUpgradedVer\BPASmartClient.MorkSUpgradedVer.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkSWithNoodleMachine\BPASmartClient.MorkSVer3.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkS\BPASmartClient.MorkS.csproj" />
<ProjectReference Include="..\BPASmartClient.Morkt.JAKA.JC\BPASmartClient.MorkTJAKAJC.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT.Lebai.JC\BPASmartClient.MorkTLebaiJC.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkTSingle\BPASmartClient.MorkTSingle.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT\BPASmartClient.MorkT.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT_BarCounter\BPASmartClient.MorkT_BarCounter.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT_Container\BPASmartClient.MorkT_Container.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT_HQ\BPASmartClient.MorkTHQ.csproj" />
<ProjectReference Include="..\BPASmartClient.SCChip\BPASmartClient.SCChip.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkCL\BPASmartClient.MorkCL.csproj" />
<ProjectReference Include="..\BPASmartClient.ViewModel\BPASmartClient.ViewModel.csproj" />
</ItemGroup>

<ItemGroup>
<Resource Include="Image\ebg.jpg" />
<Resource Include="Image\noodle.jpg" />
<Resource Include="Image\noodle_1.jpeg" />
<Resource Include="Image\主页.png" />
<Resource Include="Image\表头.jpg" />
</ItemGroup>

<ItemGroup>
<None Update="DeviceInfo.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>


+ 126
- 0
BPASmartClient/Control/EditRecipeView.xaml View File

@@ -0,0 +1,126 @@
<UserControl x:Class="BPASmartClient.Control.EditRecipeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel"
xmlns:local="clr-namespace:Control"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<vm:EditRecipeViewModel x:Name="editView"/>
</UserControl.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
<LinearGradientBrush x:Key="wordColor" EndPoint="1,1" StartPoint="0,0">
<GradientStop Offset="0.0" Color="#F66412"/>
<GradientStop Offset="1" Color="#ECBB52"/>
</LinearGradientBrush>
</ResourceDictionary>
</UserControl.Resources>
<Grid Background="#D7D7D7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.4*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Background="#ACD3FE" BorderThickness="0">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="2.0*"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Image Source="../../Image/ebg.jpg" Stretch="Fill"/>
<Grid>
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,120,0,0" Text="菜谱" FontFamily="STHupo" FontSize="40" Foreground="{StaticResource wordColor}"/>
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Image Source="/BPASmartClient.CustomResource;component/Image/菜品_1.png" Height="40" Width="40"/>
<TextBlock Margin="20,0,0,0" Text="菜品名称 :" Foreground="Black" FontSize="30" FontWeight="Black"/>
<Border BorderBrush="Black" BorderThickness="0,0,0,2" Width="200">
<TextBox x:Name="nameText" Margin="0,0,0,2" Foreground="Black" Text="{Binding LocalOrder.Name}" Style="{StaticResource ComboBoxEditableTextBox}" FontSize="28" Background="Transparent" Height="40" />
</Border>
</StackPanel>
<StackPanel Margin="0,40,0,0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Image Source="/BPASmartClient.CustomResource;component/Image/面条_1.png" Height="40" Width="40"/>
<TextBlock Margin="20,0,0,0" Text="面条位置 :" Foreground="#F08454" FontSize="30" FontWeight="Black"/>
<Border BorderBrush="#F08454" BorderThickness="0,0,0,2" Width="200">
<TextBox Margin="0,0,0,2" Text="{Binding LocalOrder.NoodleLoc}" Style="{StaticResource ComboBoxEditableTextBox}" Foreground="#F08454" FontSize="28" Background="Transparent" Height="40" />
</Border>
</StackPanel>
<StackPanel Margin="0,40,0,0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Image Source="/BPASmartClient.CustomResource;component/Image/碗.png" Height="40" Width="40"/>
<TextBlock Margin="20,0,0,0" Text="面碗位置 :" Foreground="#F3CE98" FontSize="30" FontWeight="Black"/>
<Border BorderBrush="#F3CE98" BorderThickness="0,0,0,2" Width="200">
<TextBox Margin="0,0,0,2" Text="{Binding LocalOrder.Bowloc}" Style="{StaticResource ComboBoxEditableTextBox}" Foreground="#F3CE98" FontSize="28" Background="Transparent" Height="40" />
</Border>
</StackPanel>
<StackPanel Margin="0,40,0,0" Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Image Source="/BPASmartClient.CustomResource;component/Image/时间.png" Height="40" Width="40"/>
<TextBlock Margin="20,0,0,0" Text="炒制时间 :" Foreground="#ECBB52" FontSize="30" FontWeight="Black"/>
<Border BorderBrush="#ECBB52" BorderThickness="0,0,0,2" Width="200">
<TextBox Margin="0,0,0,2" Text="{Binding LocalOrder.FryTime}" Style="{StaticResource ComboBoxEditableTextBox}" Foreground="#ECBB52" FontSize="28" Background="Transparent" Height="40" />
</Border>
</StackPanel>

</StackPanel>
<Border CornerRadius="20" Background="#ECBB52" Margin="0,0,0,100" HorizontalAlignment="Center" VerticalAlignment="Bottom" Height="40" Width="200" BorderBrush="Black" BorderThickness="2">
<Button Background="Transparent" Style="{StaticResource adbtn}" Command="{Binding SaveOrder}" Content="保 存" FontSize="20" />
</Border>
</Grid>
</Grid>
</Border>
<Grid Margin="40" Background="White" Grid.Column="1">
<Grid x:Name="localRecipe" Margin="10">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding FoodMenus}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" Width="1300"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Height="220" Width="320" >
<RadioButton Content="{Binding GoodName}" Foreground="Black" Background="#D7D7D7" x:Name="checkOrder" Command="{Binding ElementName=editView,Path=EditOrder}" GroupName="hh" FontSize="40" FontWeight="Black" CommandParameter="{Binding ElementName=checkOrder,Path=Content}" Margin="5" Style="{DynamicResource togrecipebtn_1}"/>
<Grid Height="80" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="20,0">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<Image Height="20" Width="20" Source="C:\Users\刘耀文\Desktop\煮面机测试\BPASmartClient.CustomResource\Image\面条_1.png"/>
<StackPanel Margin="10,0,0,0" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" >
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBlock Text="面条位置:" Foreground="#F08454" FontSize="16" FontWeight="Black"/>
<TextBlock Margin="20,0,0,0" Text="{Binding NoodleLoc}" FontSize="14" Foreground="#F08454" FontWeight="Black"/>
</StackPanel>
<StackPanel Margin="0,5,0,0" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBlock Text="面碗位置:" Foreground="#F08454" FontSize="16" FontWeight="Black"/>
<TextBlock Margin="20,0,0,0" Text="{Binding BowLoc}" Foreground="#F08454" FontSize="14" FontWeight="Black"/>
</StackPanel>
</StackPanel>
</StackPanel>
</Grid>
<Grid HorizontalAlignment="Right" Height="60" Margin="0,0,20,0" VerticalAlignment="Top">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<Image Height="20" Width="20" Source="/BPASmartClient.CustomResource;component/Image/时间.png"/>
<TextBlock Text="炒制时间:" Foreground="#ECBB52" FontSize="16" FontWeight="Black"/>
<TextBlock Margin="10,0,0,0" Text="{Binding Frytime}" Foreground="#ECBB52" FontSize="14" FontWeight="Black"/>
<TextBlock Text="min" Foreground="#ECBB52" FontSize="16" FontWeight="Black"/>
</StackPanel>
</Grid>
<Button Style="{StaticResource viewBtn_3}" Content="删除" Foreground="White" Command="{Binding ElementName=editView,Path=DeleteOrder}" CommandParameter="{Binding ElementName=checkOrder,Path=Content}" HorizontalAlignment="Left" VerticalAlignment="Top" Height="20" Width="60" Margin="20">
<Button.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/删除.png"/>
</Button.Background>
</Button>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</Grid>
</Grid>
</UserControl>

+ 26
- 0
BPASmartClient/Control/EditRecipeView.xaml.cs View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.Control
{
/// <summary>
/// EditRecipeView.xaml 的交互逻辑
/// </summary>
public partial class EditRecipeView : UserControl
{
public EditRecipeView()
{
InitializeComponent();
}
}
}

+ 286
- 37
BPASmartClient/Control/FoodMenuView.xaml View File

@@ -5,55 +5,304 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Control"
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel"
mc:Ignorable="d"
d:DesignHeight="850" d:DesignWidth="800">
mc:Ignorable="d" Background="{x:Null}"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<vm:FoodMenuViewModel x:Name="data"/>
</UserControl.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
<LinearGradientBrush x:Key="wordColor" EndPoint="1,1" StartPoint="0,0">
<GradientStop Offset="0.0" Color="#F4925C"/>
<GradientStop Offset="0.75" Color="#F66412"/>
</LinearGradientBrush>
<LinearGradientBrush x:Key="nameColor" EndPoint="1,1" StartPoint="0,0">
<GradientStop Offset="0.0" Color="#9EC7F7" />
<GradientStop Offset="0.75" Color="#368CF2"/>
</LinearGradientBrush>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid Margin="50">
<Grid Background="#D7D7D7">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.1*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid Background="#23282E">
<StackPanel Orientation="Vertical" VerticalAlignment="Top">
<RadioButton IsChecked="True" Click="RadioButton_Click" Style="{StaticResource toggle}" GroupName="or" Width="180" Height="60" FontSize="30" Content="正在制作" Foreground="White"/>
<RadioButton IsChecked="False" Click="RadioButton_Click" Style="{StaticResource toggle}" GroupName="or" Width="180" Height="60" FontSize="30" Content="等待取餐" Foreground="White"/>
</StackPanel>
</Grid>
<Border Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Top" >
<Grid Margin="20,50,10,0" >
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="50"/>
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock x:Name="title" Text="制作列表" Foreground="White" HorizontalAlignment="Left" FontSize="30" FontWeight="Black" VerticalAlignment="Top" Margin="20,0"/>
<Grid Grid.Row="1" Background="#D7D7D7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="取餐号" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" />
<TextBlock Grid.Column="1" Text="菜品名称" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="2" Text="开始时间" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" />
<TextBlock Grid.Column="3" Text="结束时间" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" />
<TextBlock Grid.Column="4" Text="完成时间" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center" />
<TextBlock Grid.Column="5" Text="状态" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Grid>
<Grid Grid.Row="2" x:Name="makeGrid">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl Background="#D7D7D7" ItemsSource="{Binding orderStatusLists}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border CornerRadius="10" Height="60" Margin="0,10,0,0" Background="White">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" FontSize="25" FontFamily="黑体" Foreground="#609FE7" HorizontalAlignment="Center" Style="{StaticResource TextBlockStyle}" Text="{Binding OrderPush.SortNum}" />
<Border Grid.Column="1" Background="{StaticResource nameColor}" CornerRadius="10" Margin="40,10">
<TextBlock Margin="5,0,0,0" FontSize="20" FontWeight="Black" VerticalAlignment="Center" FontFamily="黑体" Foreground="White" HorizontalAlignment="Center" Style="{StaticResource TextBlockStyle}" Text="{Binding OrderPush.GoodsName}"/>
</Border>
<TextBlock HorizontalAlignment="Center" Grid.Column="2" Foreground="{StaticResource wordColor}" FontWeight="Black" FontFamily="黑体" FontSize="25" Style="{StaticResource TextBlockStyle}" Text="{Binding StartDate}" />

<Grid Grid.Column="3">
<TextBlock HorizontalAlignment="Center" Foreground="{StaticResource wordColor}" FontWeight="Black" FontFamily="黑体" FontSize="25" Style="{StaticResource TextBlockStyle}" Text="{Binding EndDate}" />
</Grid>
<Grid Grid.Column="4">
<TextBlock HorizontalAlignment="Center" Foreground="{StaticResource wordColor}" FontWeight="Black" FontFamily="黑体" FontSize="25" Style="{StaticResource TextBlockStyle}" Text="{Binding CompleteDate}" />
</Grid>
<Grid Grid.Column="5">
<TextBlock HorizontalAlignment="Center" FontSize="25" FontFamily="黑体" Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" Style="{StaticResource TextBlockStyle}" Text="{Binding OrderStatus, Converter={StaticResource TextConverter}}" />
</Grid>
</Grid>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
<Grid Grid.Row="2" x:Name="takeGrid" Visibility="Collapsed">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl Background="#D7D7D7" ItemsSource="{Binding WaitTakeMeal}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border CornerRadius="10" Height="60" Margin="0,10,0,0" Background="White">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" FontSize="25" FontFamily="黑体" Foreground="#609FE7" HorizontalAlignment="Center" Style="{StaticResource TextBlockStyle}" Text="{Binding OrderPush.SortNum}" />
<Border Grid.Column="1" CornerRadius="10" Margin="40,10">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1">
<GradientStop Offset="0.0" Color="#9EC7F7" />
<GradientStop Offset="0.75" Color="#368CF2"/>
</LinearGradientBrush>
</Border.Background>
<TextBlock Margin="5,0,0,0" FontSize="20" FontWeight="Black" VerticalAlignment="Center" FontFamily="黑体" Foreground="White" HorizontalAlignment="Center" Style="{StaticResource TextBlockStyle}" Text="{Binding OrderPush.GoodsName}"/>
</Border>
<TextBlock HorizontalAlignment="Center" Grid.Column="2" Foreground="{StaticResource wordColor}" FontWeight="Black" FontFamily="黑体" FontSize="25" Style="{StaticResource TextBlockStyle}" Text="{Binding StartDate}" />

<Grid Grid.Column="3">
<TextBlock HorizontalAlignment="Center" Foreground="{StaticResource wordColor}" FontWeight="Black" FontFamily="黑体" FontSize="25" Style="{StaticResource TextBlockStyle}" Text="{Binding EndDate}" />
</Grid>
<Grid Grid.Column="4">
<TextBlock HorizontalAlignment="Center" Foreground="{StaticResource wordColor}" FontWeight="Black" FontFamily="黑体" FontSize="25" Style="{StaticResource TextBlockStyle}" Text="{Binding CompleteDate}" />
</Grid>
<Grid Grid.Column="5">
<TextBlock HorizontalAlignment="Center" FontSize="25" FontFamily="黑体" Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" Style="{StaticResource TextBlockStyle}" Text="{Binding OrderStatus, Converter={StaticResource TextConverter}}" />
</Grid>

</Grid>
</Border>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</Grid>
</Border>
<!--<Border Grid.Column="1" HorizontalAlignment="Stretch" Margin="5,0">
<Grid HorizontalAlignment="Stretch" VerticalAlignment="Top">
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="2">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl Background="Transparent" ItemsSource="{Binding WaitTakeMeal}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Height="40">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="250"/>
<ColumnDefinition Width="250"/>
<ColumnDefinition Width="250"/>
<ColumnDefinition Width="250"/>
<ColumnDefinition Width="150"/>
</Grid.ColumnDefinitions>

<TextBlock Grid.Column="0" FontSize="16" HorizontalAlignment="Center" Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" Style="{StaticResource TextBlockStyle}" Text="{Binding OrderPush.SuborderId}" />
<Border BorderThickness="0.3" Grid.ColumnSpan="1" BorderBrush="White"/>
<Grid Grid.Column="1">
<TextBlock Margin="5,0,0,0" FontSize="16" HorizontalAlignment="Center" Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" Style="{StaticResource TextBlockStyle}" Text="{Binding OrderPush.GoodsName}" />
<Border BorderThickness="0,0.3,0.3,0.3" BorderBrush="White"/>
</Grid>


<TextBlock HorizontalAlignment="Center" Grid.Column="2" FontSize="16" Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" Style="{StaticResource TextBlockStyle}" Text="{Binding StartDate}" />
<Border BorderThickness="0,0.3,0.3,0.3" Grid.Column="2" BorderBrush="White"/>
<Grid Grid.Column="3">
<TextBlock HorizontalAlignment="Center" FontSize="16" Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" Style="{StaticResource TextBlockStyle}" Text="{Binding EndDate}" />
<Border BorderThickness="0,0.3,0.3,0.3" BorderBrush="White"/>
</Grid>


<Grid Grid.Column="5">
<TextBlock HorizontalAlignment="Center" FontSize="16" Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" Style="{StaticResource TextBlockStyle}" Text="{Binding OrderStatus, Converter={StaticResource TextConverter}}" />
<Border BorderThickness="0,0.3,0.6,0.3" BorderBrush="White"/>
</Grid>

<Grid Grid.Column="4">
<TextBlock FontSize="16" HorizontalAlignment="Center" Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" Style="{StaticResource TextBlockStyle}" Text="{Binding CompleteDate}" />
<Border BorderThickness="0,0.3,0.3,0.3" BorderBrush="White"/>
</Grid>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</Grid>


</Border>-->
</Grid>
<!--<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
<RowDefinition Height="0.6*"/>
<RowDefinition/>
<RowDefinition Height="1.5*"/>
</Grid.RowDefinitions>
<Grid HorizontalAlignment="Center">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="250"/>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="0.48*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="菜品ID" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="1" Text="菜品名称" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="2" Text="下单" HorizontalAlignment="Center"/>
</Grid>
<ListBox Grid.Row="1" Background="Transparent" ItemsSource="{Binding FoodMenus}" HorizontalAlignment="Center" >
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type ListBoxItem}">
<Grid HorizontalAlignment="Center" Height="50" VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"/>
<ColumnDefinition Width="250"/>
<ColumnDefinition Width="120"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" FontSize="16" Text="{Binding GoodKey}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Grid.Column="1" FontSize="18" Text="{Binding GoodName}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Button Grid.Column="2" Width="120" Content="下单" HorizontalAlignment="Center" VerticalAlignment="Center" Height="30"
Command="{Binding DataContext.StartOrder, RelativeSource={RelativeSource AncestorType=UserControl,Mode=FindAncestor}}"
CommandParameter="{Binding .}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
<Border Grid.Row="1" >
<Grid Margin="10,0" >
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="30"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock HorizontalAlignment="Center" Text="正在制作列表"/>
<Grid Grid.Row="1" >
<Grid.Background>
<ImageBrush ImageSource="../../Image/表头.jpg"/>
</Grid.Background>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="3*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="取餐号" HorizontalAlignment="Center"/>
<Border BorderThickness="0.5" BorderBrush="White" Grid.Column="0" />
<TextBlock Grid.Column="1" Text="菜品名称" HorizontalAlignment="Center"/>
<Border BorderThickness="0,0.5,0.5,0.5" BorderBrush="White" Grid.Column="1" />
<TextBlock Grid.Column="2" Text="开始时间" HorizontalAlignment="Center"/>
<Border BorderThickness="0,0.5,0.5,0.5" BorderBrush="White" Grid.Column="2" />
<TextBlock Grid.Column="3" Text="结束时间" HorizontalAlignment="Center"/>
<Border BorderThickness="0,0.5,0.5,0.5" BorderBrush="White" Grid.Column="3" />
<TextBlock Grid.Column="4" Text="完成时间" HorizontalAlignment="Center"/>
<Border BorderThickness="0,0.5,0.5,0.5" BorderBrush="White" Grid.Column="4" />
<TextBlock Grid.Column="5" Text="状态" HorizontalAlignment="Center"/>
<Border BorderThickness="0,0.5,0.5,0.5" BorderBrush="White" Grid.Column="5" />
</Grid>
<Grid Grid.Row="2">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl Background="Transparent" ItemsSource="{Binding orderStatusLists}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Height="40">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="3*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>

<TextBlock Grid.Column="0" FontSize="16" HorizontalAlignment="Center" Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" Style="{StaticResource TextBlockStyle}" Text="{Binding OrderPush.SortNum}" />
<Border BorderThickness="0.3" Grid.ColumnSpan="1" BorderBrush="White"/>

<Grid Grid.Column="1">
<TextBlock Margin="5,0,0,0" FontSize="16" HorizontalAlignment="Center" Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" Style="{StaticResource TextBlockStyle}" Text="{Binding OrderPush.GoodsName}" />
<Border BorderThickness="0,0.3,0.3,0.3" BorderBrush="White"/>
</Grid>


<TextBlock HorizontalAlignment="Center" Grid.Column="2" FontSize="16" Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" Style="{StaticResource TextBlockStyle}" Text="{Binding StartDate}" />
<Border BorderThickness="0,0.3,0.3,0.3" Grid.Column="2" BorderBrush="White"/>
<Grid Grid.Column="3">
<TextBlock HorizontalAlignment="Center" FontSize="16" Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" Style="{StaticResource TextBlockStyle}" Text="{Binding EndDate}" />
<Border BorderThickness="0,0.3,0.3,0.3" BorderBrush="White"/>
</Grid>


<Grid Grid.Column="5">
<TextBlock HorizontalAlignment="Center" FontSize="16" Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" Style="{StaticResource TextBlockStyle}" Text="{Binding OrderStatus, Converter={StaticResource TextConverter}}" />
<Border BorderThickness="0,0.3,0.3,0.3" BorderBrush="White"/>
</Grid>

<Grid Grid.Column="4">
<TextBlock FontSize="16" HorizontalAlignment="Center" Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}" Style="{StaticResource TextBlockStyle}" Text="{Binding CompleteDate}" />
<Border BorderThickness="0,0.3,0.3,0.3" BorderBrush="White"/>
</Grid>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</Grid>


</Border>


</Grid>-->
</Grid>
</UserControl>

+ 27
- 1
BPASmartClient/Control/FoodMenuView.xaml.cs View File

@@ -22,7 +22,33 @@ namespace BPASmartClient.Control
public FoodMenuView()
{
InitializeComponent();
this.DataContext = new FoodMenuViewModel();
}

private void Button_Click(object sender, RoutedEventArgs e)
{

}

private void RadioButton_Click(object sender, RoutedEventArgs e)
{
if (sender is RadioButton rb)
{
if (!string.IsNullOrEmpty(rb.Content.ToString()))
{
if (rb.Content.ToString() == "正在制作")
{
makeGrid.Visibility = Visibility.Visible;
takeGrid.Visibility = Visibility.Collapsed;
title.Text = "制作订单列表";
}
else
{
makeGrid.Visibility = Visibility.Collapsed;
takeGrid.Visibility = Visibility.Visible;
title.Text = "等待取餐列表";
}
}
}
}
}
}

+ 127
- 338
BPASmartClient/Control/OrderStatusView.xaml View File

@@ -12,353 +12,142 @@
mc:Ignorable="d">

<UserControl.DataContext>
<vm:OrderStatusViewModel />
<vm:OrderStatusViewModel x:Name="orderstatusView"/>
</UserControl.DataContext>

<UserControl.Resources>
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" />
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" />
<SolidColorBrush x:Key="CursorColor" Color="Aqua" />
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="TextBlockForeground" Color="#9934F7F7" />

<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="16" />
<Setter Property="Background" Value="Transparent" />
<!--<Setter Property="Foreground" Value="{StaticResource FontColor}" />-->
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" />
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" />
<SolidColorBrush x:Key="CursorColor" Color="Aqua" />
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="TextBlockForeground" Color="#9934F7F7" />
</ResourceDictionary>
</UserControl.Resources>

<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<!--#region 制作中的订单列表-->
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>

<!--#region 表格标题栏设置-->
<Grid Background="#dd2AB2E7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.5*" />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="取餐号" />

<Grid Grid.Column="1">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="商品名" />
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="开始时间" />

<Grid Grid.Column="3">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="结束时间" />
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="1,0,1,0" />
</Grid>

<Grid Grid.Column="5">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="制作状态" />
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="0,0,1,0" />
</Grid>

<TextBlock
Grid.Column="6"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="完成时间" />

</Grid>
<!--#endregion-->

<!--#region 表格数据显示-->
<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding orderStatusLists}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.5*" />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding OrderPush.SortNum}" />

<Grid Grid.Column="1">
<TextBlock
Margin="5,0,0,0"
HorizontalAlignment="Left"
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding OrderPush.GoodsName}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>


<TextBlock
Grid.Column="2"
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding StartDate}" />

<Grid Grid.Column="3">
<TextBlock
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding EndDate}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>


<Grid Grid.Column="5">
<TextBlock
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding OrderStatus, Converter={StaticResource TextConverter}}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="0,0,1,0" />
</Grid>

<Grid Grid.Column="6">
<TextBlock
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding CompleteDate}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="0,0,1,0" />
</Grid>

<Border
Grid.ColumnSpan="8"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1,0,1,1" />

</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<!--#endregion-->
<Grid Background="#D7D7D7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.1*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid Background="#23282E">
<StackPanel Orientation="Vertical" VerticalAlignment="Top">
<RadioButton IsChecked="True" Click="RadioButton_Click" Style="{StaticResource toggle}" GroupName="or" Width="180" Height="60" FontSize="30" Content="本地菜谱" Foreground="White"/>
<RadioButton IsChecked="False" Click="RadioButton_Click" Style="{StaticResource toggle}" GroupName="or" Width="180" Height="60" FontSize="30" Content="云端菜谱" Foreground="White"/>
</StackPanel>
</Grid>
<!--#endregion-->

<!--#region 等待取餐的订单列表-->
<Grid Grid.Row="1">
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition />
<RowDefinition/>
<RowDefinition Height="120"/>
</Grid.RowDefinitions>


<!--#region 表格标题栏设置-->

<Grid Background="#dd2AB2E7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.5*" />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="取餐号" />

<Grid Grid.Column="1">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="商品名" />
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="开始时间" />

<Grid Grid.Column="3">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="结束时间" />
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="1,0,1,0" />
</Grid>

<Grid Grid.Column="5">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="制作状态" />
<Border BorderBrush="{StaticResource TitleBorderColor}" BorderThickness="0,0,1,0" />
</Grid>

<TextBlock
Grid.Column="6"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="完成时间" />

</Grid>

<!--#endregion-->

<!--#region 表格数据显示-->

<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding WaitTakeMeal}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0" />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.5*" />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="0"
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding OrderPush.SortNum}" />

<Grid Grid.Column="1">
<TextBlock
Margin="5,0,0,0"
HorizontalAlignment="Left"
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding OrderPush.GoodsName}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>


<TextBlock
Grid.Column="2"
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding StartDate}" />

<Grid Grid.Column="3">
<TextBlock
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding EndDate}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
<Grid x:Name="localRecipe" Margin="20">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding FoodMenus}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" Width="1600"/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Height="220" Width="320" >
<RadioButton Content="{Binding GoodName}" Foreground="Black" Background="White" x:Name="checkOrder" Command="{Binding ElementName=orderstatusView,Path=EditOrder}" GroupName="hh" FontSize="40" FontWeight="Black" CommandParameter="{Binding ElementName=checkOrder,Path=Content}" Margin="5" Style="{DynamicResource togrecipebtn}"/>
<Grid Height="80" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="20,0">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<Image Height="20" Width="20" Source="C:\Users\刘耀文\Desktop\煮面机测试\BPASmartClient.CustomResource\Image\面条_1.png"/>
<StackPanel Margin="10,0,0,0" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" >
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBlock Text="面条位置:" Foreground="#F08454" FontSize="16" FontWeight="Black"/>
<TextBlock Margin="20,0,0,0" Text="{Binding NoodleLoc}" FontSize="14" Foreground="#F08454" FontWeight="Black"/>
</StackPanel>
<StackPanel Margin="0,5,0,0" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBlock Text="面碗位置:" Foreground="#F08454" FontSize="16" FontWeight="Black"/>
<TextBlock Margin="20,0,0,0" Text="{Binding BowLoc}" Foreground="#F08454" FontSize="14" FontWeight="Black"/>
</StackPanel>
</StackPanel>
</StackPanel>
</Grid>
<Grid HorizontalAlignment="Right" Height="60" Margin="0,0,20,0" VerticalAlignment="Top">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<Image Height="20" Width="20" Source="/BPASmartClient.CustomResource;component/Image/时间.png"/>
<TextBlock Text="炒制时间:" Foreground="#ECBB52" FontSize="16" FontWeight="Black"/>
<TextBlock Margin="10,0,0,0" Text="{Binding Frytime}" Foreground="#ECBB52" FontSize="14" FontWeight="Black"/>
<TextBlock Text="min" Foreground="#ECBB52" FontSize="16" FontWeight="Black"/>
</StackPanel>
</Grid>
</Grid>


<Grid Grid.Column="5">
<TextBlock
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding OrderStatus, Converter={StaticResource TextConverter}}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="0,0,1,0" />
</Grid>

<Grid Grid.Column="6">
<TextBlock
Foreground="{Binding OrderStatus, Converter={StaticResource ColorConverter}}"
Style="{StaticResource TextBlockStyle}"
Text="{Binding CompleteDate}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="0,0,1,0" />
</Grid>

<Border
Grid.ColumnSpan="8"
BorderBrush="{StaticResource BorderSolid}"
BorderThickness="1,0,1,1" />

</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>

<!--#endregion-->

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
<Border Grid.Row="1" Background="White" BorderThickness="0">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
<ColumnDefinition Width="270"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<Image Source="/BPASmartClient.CustomResource;component/Image/菜品_1.png" Margin="40,30,10,30"/>
<TextBlock Margin="0,0,20,0" Text="菜品名称:" Foreground="Black" FontSize="35" FontWeight="Black"/>
<TextBlock Text="{Binding LocalOrder.Name}" FontSize="30" FontWeight="Black"/>
<Image Margin="40,30,10,30" Source="/BPASmartClient.CustomResource;component/Image/面条.png"/>
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" >
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBlock Text="面条位置:" Foreground="Black" FontSize="30" FontWeight="Black"/>
<TextBlock Margin="20,0,0,0" Text="{Binding LocalOrder.NoodleLoc}" FontSize="30" FontWeight="Black"/>
</StackPanel>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal" HorizontalAlignment="Left" VerticalAlignment="Center">
<TextBlock Text="面碗位置:" Foreground="Black" FontSize="30" FontWeight="Black"/>
<TextBlock Margin="20,0,0,0" Text="{Binding LocalOrder.Bowloc}" FontSize="30" FontWeight="Black"/>
</StackPanel>
</StackPanel>
</StackPanel>
<Grid HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Margin="0,0,20,0" Text="下单次数:" Foreground="Black" FontSize="35" FontWeight="Black"/>
<Button Width="60" Height="60" Tag="增加" Click="Button_Click" Style="{StaticResource adbtn}" >
<Button.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/加.png"/>
</Button.Background>
</Button>
<TextBox Margin="20,0,0,0" x:Name="amount" Text="{Binding OrderAmount,UpdateSourceTrigger=PropertyChanged,Mode=TwoWay}" FontSize="30" Style="{DynamicResource InputTextboxStyle}" Height="60" Width="100" FontWeight="Black" />
<Button Width="60" Tag="减少" Click="Button_Click" Style="{StaticResource adbtn}" Height="60">
<Button.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/减.png"/>
</Button.Background>
</Button>
</StackPanel>
</Grid>
<Grid Grid.Column="2">
<Border>
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1" Opacity="0.9">
<GradientStop Offset="0.0" Color="#F4925C"/>
<GradientStop Offset="0.75" Color="#F66412"/>
</LinearGradientBrush>
</Border.Background>
</Border>
<Button Style="{StaticResource viewBtn_1}" Content="下单" Foreground="White" Command="{Binding StartOrder}" FontSize="40" FontWeight="Black">
<Button.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/购物车.png"/>
</Button.Background>
</Button>
</Grid>
</Grid>
</Border>
</Grid>
<!--#endregion-->

</Grid>




+ 42
- 0
BPASmartClient/Control/OrderStatusView.xaml.cs View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
@@ -24,5 +25,46 @@ namespace BPASmartClient.Control
{
InitializeComponent();
}

private void RadioButton_Click(object sender, RoutedEventArgs e)
{
if (sender is RadioButton rb)
{
if (!string.IsNullOrEmpty(rb.Content.ToString()))
{
if (rb.Content.ToString() == "本地菜谱")
{
localRecipe.Visibility = Visibility.Visible;
}
else
{
localRecipe.Visibility = Visibility.Collapsed;
}
}
}
}

private void Button_Click(object sender, RoutedEventArgs e)
{
if (sender is Button btn)
{
if (!string.IsNullOrEmpty(btn.Tag.ToString()))
{
if (btn.Tag.ToString() == "增加")
{
int am = Convert.ToInt32(amount.Text);
amount.Text = (am + 1).ToString();
}
else
{
int am = Convert.ToInt32(amount.Text);
if ((am-1)>= 0)
{
amount.Text = (am - 1).ToString();
}
}
}
}
}
}
}

BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


+ 177
- 0
BPASmartClient/LoginOrderView.xaml View File

@@ -0,0 +1,177 @@
<Window x:Class="BPASmartClient.LoginOrderView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:BPASmartClient"
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel"
mc:Ignorable="d" Background="{x:Null}" WindowStartupLocation="CenterScreen" WindowState="Maximized" WindowStyle="None"
Title="LoginOrderView" Height="450" Width="800">
<Window.DataContext>
<vm:LoginViewModel x:Name="Login"/>
</Window.DataContext>
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
<LinearGradientBrush x:Key="wordColor" StartPoint="0,0" EndPoint="1,1" Opacity="1">
<GradientStop Offset="0" Color="#2160E6"/>
<GradientStop Offset="1" Color="#6682CA"/>
</LinearGradientBrush>
<LinearGradientBrush x:Key="infoColor" StartPoint="0,0" EndPoint="1,1" Opacity="1">
<GradientStop Offset="0" Color="#0AB2F2"/>
<GradientStop Offset="1" Color="#48ADD8"/>
</LinearGradientBrush>
</ResourceDictionary>
</Window.Resources>
<Grid Background="Transparent">
<Grid x:Name="mainView" Visibility="Visible">
<Grid.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1" Opacity="0.9">
<GradientStop Offset="0" Color="#ADD5FE"/>
<GradientStop Offset="1" Color="#FFFFFF"/>
</LinearGradientBrush>
</Grid.Background>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="7*"/>
<RowDefinition Height="0.4*"/>
</Grid.RowDefinitions>
<Grid>
<TextBlock Foreground="{StaticResource wordColor}" VerticalAlignment="Bottom" Margin="50,0,0,10" FontFamily="STHupo" Text="煮面机程序" FontSize="40"/>
</Grid>
<Grid Grid.Row="1" Background="Black" Margin="50,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1.2*"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid>
<Image Source="../../Image/noodle_1.jpeg" Stretch="UniformToFill" />
<Border BorderBrush="White" BorderThickness="0.8" Margin="10"/>
</Grid>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="0.6*"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid>
<Border Margin="0,0,0,2" BorderThickness="0">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1" Opacity="0.9">
<GradientStop Offset="0.0" Color="#F9AD39" />
<GradientStop Offset="0.75" Color="#DE6A14" />
</LinearGradientBrush>
</Border.Background>
</Border>
<Button Content="开始点餐" Tag="OrderStatusView" Style="{DynamicResource viewBtn_1}" Click="btnClick" FontSize="50" Foreground="White">
<Button.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/点餐.png"/>
</Button.Background>
</Button>
</Grid>
<Grid Grid.Row="1">
<UniformGrid Columns="2">
<Border Margin="0,2,2,0" BorderThickness="0">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1" Opacity="0.8">
<GradientStop Offset="0.0" Color="#3782B8" />
<GradientStop Offset="0.75" Color="#38B0E6" />
</LinearGradientBrush>
</Border.Background>
<Button Content="编辑菜谱" Tag="EditRecipeView" Click="btnClick" Style="{DynamicResource viewBtn_2}" FontSize="50" Foreground="White">
<Button.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/菜谱.png"/>
</Button.Background>
</Button>
</Border>
<UniformGrid Rows="3">
<Grid>
<Border Margin="2,2,0,2" BorderThickness="0">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1" Opacity="0.9">
<GradientStop Offset="0.0" Color="#77D268" />
<GradientStop Offset="0.75" Color="#26D07F" />
</LinearGradientBrush>
</Border.Background>
</Border>
<Button Content="订单状态" Tag="FoodMenuView" Click="btnClick" Style="{DynamicResource viewBtn_1}" FontSize="50" Foreground="White">
<Button.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/状态.png"/>
</Button.Background>
</Button>
</Grid>
<Grid>
<Border Margin="2,2,0,2" BorderThickness="0">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1" Opacity="0.9">
<GradientStop Offset="0.0" Color="#6481CF" />
<GradientStop Offset="0.75" Color="#6A9FDD" />
</LinearGradientBrush>
</Border.Background>
</Border>
<Button Content="系统设置" Style="{DynamicResource viewBtn_1}" FontSize="50" Foreground="White">
<Button.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/Settings.png"/>
</Button.Background>
</Button>
</Grid>
<Grid>
<Border Margin="2,2,0,0" BorderThickness="0">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="1,1" Opacity="0.9">
<GradientStop Offset="0.0" Color="#AB52EE" />
<GradientStop Offset="0.75" Color="#AC78D6" />
</LinearGradientBrush>
</Border.Background>
</Border>
<Button Content="管理员" Click="admin" Style="{DynamicResource viewBtn_1}" FontSize="50" Foreground="White">
<Button.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/管理员-用户查询.png"/>
</Button.Background>
</Button>
</Grid>

</UniformGrid>
</UniformGrid>
</Grid>

</Grid>
</Grid>
</Grid>
<Grid x:Name="orderView" Visibility="Collapsed">
<Grid.RowDefinitions>
<RowDefinition Height=" 0.08*"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Border Background="#368CF2">
<Grid>
<Button Style="{StaticResource viewBtn_1}" Click="Button_Click" FontSize="30" Foreground="White" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="20,0">
<Button.Background>
<ImageBrush ImageSource="../../Image/主页.png"/>
</Button.Background>
</Button>
</Grid>
</Border>
<ContentControl Grid.Row="1" x:Name="orderContent"/>
</Grid>
<Grid HorizontalAlignment="Center" Margin="0,20" VerticalAlignment="Top" Background="Transparent">
<TextBlock Text="主页" x:Name="titleText" HorizontalAlignment="Center" Foreground="White" FontSize="40" VerticalAlignment="Center"/>
</Grid>
<Border Margin="40,0" HorizontalAlignment="Right" VerticalAlignment="Top" Height="60" Width="60" >
<Button Style="{StaticResource adbtn}" Height="40" Click="Close_Click" Width="40" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/退出_1.png"/>
</Button.Background>
</Button>
</Border>
<Grid Visibility="Collapsed" x:Name="infoGrid" Margin="0,120" HorizontalAlignment="Center" Height="60" Width="400" VerticalAlignment="Top" Background="Transparent">
<Border Background="{DynamicResource infoColor}" />
<Button Click="Info_Click" Style="{StaticResource adbtn}" Background="Transparent" Content="关闭" FontSize="12" Foreground="White" Margin="2" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<TextBlock Text="下单成功" x:Name="infoText" Foreground="White" HorizontalAlignment="Center" FontSize="16" FontFamily="黑体"/>
<Image Margin="0,0,20,0" Source="/BPASmartClient.CustomResource;component/Image/提示.png" HorizontalAlignment="Right" VerticalAlignment="Center" Height="30"/>
</Grid>
</Grid>
</Window>

+ 108
- 0
BPASmartClient/LoginOrderView.xaml.cs View File

@@ -0,0 +1,108 @@
using BPA.Helper;
using BPASmartClient.ViewModel;
using Control;
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace BPASmartClient
{
/// <summary>
/// LoginOrderView.xaml 的交互逻辑
/// </summary>
public partial class LoginOrderView : Window
{
public LoginOrderView()
{
InitializeComponent();
NoodOrderCtrl.GetInstance.Init();
NoodOrderCtrl.GetInstance.showInfo = o =>
{
infoGrid.Visibility = Visibility.Visible;
infoText.Text = o.ToString();

Thread thread = new Thread(infoView);
thread.Start();
};
}
public void infoView()
{
Thread.Sleep(2000);
App.Current.Dispatcher.Invoke(() => {
infoGrid.Visibility = Visibility.Collapsed;
});
}
public void btnClick(object sender, RoutedEventArgs e)
{
try
{
if (sender is Button btn)
{
Type type = Type.GetType($"BPASmartClient.Control.{(sender as Button).Tag?.ToString()}");
if (type!=null)
{
if(NoodOrderCtrl.GetInstance.allViews.ContainsKey(type.Name))
{
orderContent.Content = NoodOrderCtrl.GetInstance.allViews[type.Name];
titleText.Text = btn.Content.ToString();
}
else
{
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes);
FrameworkElement framework = (FrameworkElement)cti.Invoke(null);
NoodOrderCtrl.GetInstance.allViews.TryAdd(type.Name, framework);
orderContent.Content = framework;
titleText.Text = btn.Content.ToString();
}
orderView.Visibility = Visibility.Visible;
mainView.Visibility = Visibility.Hidden;
}
}
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient 中引发错误,MainWindow.xaml.cs 类MenuItem_Click(),描述:[{ex.Message}]");
}
}

private void Button_Click(object sender, RoutedEventArgs e)
{
orderView.Visibility = Visibility.Hidden;
mainView.Visibility = Visibility.Visible;
titleText.Text = "主页";
}

private void Close_Click(object sender, RoutedEventArgs e)
{
this.Close();
MainViewModel.GetInstance().window.Close();
}

private void Info_Click(object sender, RoutedEventArgs e)
{
infoGrid.Visibility = Visibility.Collapsed;
}

private void admin(object sender, RoutedEventArgs e)
{
MainViewModel.GetInstance().window.Visibility = Visibility.Visible;
MainViewModel.GetInstance().window.Show();
}
}


}

+ 3
- 8
BPASmartClient/MainWindow.xaml View File

@@ -140,8 +140,8 @@
<MenuItem
Click="MenuItem_Click"
FontSize="12"
Header="订单监视"
Tag="OrderStatusView" />
Header="当前订单"
Tag="FoodMenuView" />
<Separator />
<MenuItem
Click="MenuItem_Click"
@@ -296,12 +296,7 @@
Margin="5,0,5,0"
Content="验证设备"
IsChecked="{Binding IsVerty}" />
<Button
Margin="10,0"
Click="MenuItem_Click"
Content="本地菜单"
Cursor="Hand"
Tag="FoodMenuView" />
<Button Content="主页" Click="Button_Click_1"/>
<!--<Button
Name="init" Margin="5,0,5,0"
Grid.Row="0"


+ 63
- 16
BPASmartClient/MainWindow.xaml.cs View File

@@ -31,6 +31,8 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Collections.Concurrent;
using BPASmartClient.Model.煮面机;

namespace BPASmartClient
{
@@ -43,31 +45,49 @@ namespace BPASmartClient
public MainWindow()
{
InitializeComponent();
//InitOrder();
MainViewModel.GetInstance().window = this;
this.DataContext = MainViewModel.GetInstance();
ActionManage.GetInstance.Register(new Action(() =>
{
myMenu.Visibility = Visibility.Visible;
myPanel.Visibility = Visibility.Collapsed;
MenuItem_Click(new MenuItem() { Tag = "LogView", Header = "日志监视" }, null);
MenuItem_Click(new MenuItem() { Tag = "LogView", Header = "日志" }, null);
}), "LoginSuccess");
Initialize();
LoginOrderView login = new LoginOrderView();
App.Current.MainWindow = login;
login.Show();
MainViewModel.GetInstance().window.Visibility = Visibility.Hidden;
}

public void InitOrder()
{
Type type = Type.GetType("BPASmartClient.Control.OrderStatusView");
if (type!=null)
{
ConstructorInfo info = type.GetConstructor(System.Type.EmptyTypes);
FrameworkElement framework = (FrameworkElement)info.Invoke(null);
MainViewModel.GetInstance().MenuItems.TryAdd(type.Name, framework);
}
}
#region 私有
/// <summary>
/// 初始化
/// </summary>
private void Initialize()
{
Json<NoodOrder>.Read();
this.ButClose.Click += (o, e) =>
{
MessageBoxResult res = MessageBox.Show("确定关闭上位机软件?", "警告", MessageBoxButton.OKCancel);
if (res == MessageBoxResult.OK)
{
this.Close();
Application.Current.Shutdown();
}
MainViewModel.GetInstance().window.Visibility = Visibility.Hidden;
//MessageBoxResult res = MessageBox.Show("确定关闭上位机软件?", "警告", MessageBoxButton.OKCancel);
//if (res == MessageBoxResult.OK)
//{
// this.Close();
// Application.Current.Shutdown();
//}

};
this.br.MouseLeftButtonDown += (o, e) =>
@@ -81,7 +101,7 @@ namespace BPASmartClient
}
if (e.LeftButton == MouseButtonState.Pressed) this.DragMove();
};
MenuItem_Click(new MenuItem() { Tag = "LogView", Header = "日志监视" }, null);
MenuItem_Click(new MenuItem() { Tag = "LogView", Header = "日志" }, null);

TaskManage.GetInstance.Start(new Action(() =>
{
@@ -214,28 +234,48 @@ namespace BPASmartClient


}

/// <summary>
/// 菜单切换栏
/// </summary>
private void MenuItem_Click(object sender, RoutedEventArgs e)
public void MenuItem_Click(object sender, RoutedEventArgs e)
{
try
{
if (sender is MenuItem)
{
Type type = Type.GetType($"BPASmartClient.Control.{(sender as MenuItem).Tag?.ToString()}");
if (type == null) { MenuClick((sender as MenuItem).Tag?.ToString()); return; }
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes);
contentRegion.Content = (FrameworkElement)cti.Invoke(null);
Title.Text = (sender as MenuItem).Header?.ToString() + "界面";
if (MainViewModel.GetInstance().MenuItems.ContainsKey(type.Name))
{
contentRegion.Content = MainViewModel.GetInstance().MenuItems[type.Name];
Title.Text = (sender as MenuItem).Header?.ToString() + "界面";
}
else
{
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes);
FrameworkElement framework = (FrameworkElement)cti.Invoke(null);
MainViewModel.GetInstance().MenuItems.TryAdd(type.Name, framework);
contentRegion.Content = framework;
Title.Text = (sender as MenuItem).Header?.ToString() + "界面";
}
}
else if (sender is Button)
{
Type type = Type.GetType($"BPASmartClient.Control.{(sender as Button).Tag?.ToString()}");
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes);
contentRegion.Content = (FrameworkElement)cti.Invoke(null);
Title.Text = (sender as Button).Content?.ToString() + "界面";
if (MainViewModel.GetInstance().MenuItems.ContainsKey(type.Name))
{
contentRegion.Content = MainViewModel.GetInstance().MenuItems[type.Name];
Title.Text = (sender as Button).Content?.ToString() + "界面";
}
else
{
ConstructorInfo cti = type.GetConstructor(System.Type.EmptyTypes);
FrameworkElement framework = (FrameworkElement)cti.Invoke(null);
MainViewModel.GetInstance().MenuItems.TryAdd(type.Name, framework);
contentRegion.Content = framework;
Title.Text = (sender as Button).Content?.ToString() + "界面";
}
}
}
catch (Exception ex)
@@ -373,5 +413,12 @@ namespace BPASmartClient


}

private void Button_Click_1(object sender, RoutedEventArgs e)
{
MenuItem_Click(new Button() { Tag = "OrderStatusView", Content = "配方选择" }, null);
//contentRegion.Content = MainViewModel.GetInstance().MenuItems["FoodMenuView"];
//Title.Text = "当前订单界面";
}
}
}

Loading…
Cancel
Save