Browse Source

解决冲突

master
pengliangyang 2 years ago
parent
commit
1b9ce07cd7
100 changed files with 9225 additions and 2424 deletions
  1. +1
    -1
      BPASmart.ConfigurationSoftware/BPASmart.ConfigurationSoftware.csproj
  2. +1
    -1
      BPASmart.PageLoad/BPASmart.PageLoad.csproj
  3. +2
    -2
      BPASmart.Server/BPASmart.Server.csproj
  4. +12
    -3
      BPASmart.Server/CommunicationServer.cs
  5. +2
    -2
      BPASmart.VariableManager/BPASmart.VariableManager.csproj
  6. +5
    -1
      BPASmart.VariableManager/ViewModels/VariableConfigViewModel.cs
  7. +2
    -1
      BPASmartClient.Business/BPASmartClient.Business.csproj
  8. +57
    -0
      BPASmartClient.Business/LocalMqtt.cs
  9. +1
    -1
      BPASmartClient.Business/Plugin/DeviceMgr.cs
  10. +1
    -1
      BPASmartClient.Business/Plugin/MQTTMgr.cs
  11. +2
    -2
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  12. +1
    -1
      BPASmartClient.Device/BPASmartClient.Device.csproj
  13. +39
    -1
      BPASmartClient.Device/BaseDevice.cs
  14. +1
    -1
      BPASmartClient.DosingProject/BPASmartClient.DosingHKProject.csproj
  15. +10
    -0
      BPASmartClient.Helper/ThreadManage.cs
  16. +1
    -1
      BPASmartClient.JXJFoodBigStation/BPASmartClient.JXJFoodBigStation.csproj
  17. +1
    -1
      BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj
  18. +148
    -33
      BPASmartClient.MilkWithTea/View/RecipeConfige.xaml.cs
  19. +90
    -4
      BPASmartClient.Modbus/ModbusTcp.cs
  20. +1
    -1
      BPASmartClient.Model/BPASmartClient.Model.csproj
  21. +15
    -0
      BPASmartClient.Model/FoodMenuModel.cs
  22. +14
    -0
      BPASmartClient.Model/GlobalFoodMenu.cs
  23. +21
    -0
      BPASmartClient.Model/OrderStatistics.cs
  24. +25
    -0
      BPASmartClient.MorkBF/BPASmartClient.MorkBF.csproj
  25. +804
    -0
      BPASmartClient.MorkBF/Control_MorkBF.cs
  26. +338
    -0
      BPASmartClient.MorkBF/GVL_MorkBF.cs
  27. +65
    -0
      BPASmartClient.MorkBF/Model/BF_Food.cs
  28. +12
    -0
      BPASmartClient.MorkBF/OrderLocInfo.cs
  29. +107
    -0
      BPASmartClient.MorkBF/VIew/DebugView.xaml
  30. +28
    -0
      BPASmartClient.MorkBF/VIew/DebugView.xaml.cs
  31. +50
    -0
      BPASmartClient.MorkBF/VIew/FoodManagerView.xaml
  32. +27
    -0
      BPASmartClient.MorkBF/VIew/FoodManagerView.xaml.cs
  33. +242
    -0
      BPASmartClient.MorkBF/VIew/Monitor.xaml
  34. +28
    -0
      BPASmartClient.MorkBF/VIew/Monitor.xaml.cs
  35. +373
    -0
      BPASmartClient.MorkBF/ViewModel/DebugViewModel.cs
  36. +25
    -0
      BPASmartClient.MorkBF/ViewModel/MonitorViewModel.cs
  37. +4
    -2
      BPASmartClient.MorkF/BPASmartClient.MorkF.csproj
  38. +1169
    -2022
      BPASmartClient.MorkF/Control_MorkF.cs
  39. +100
    -268
      BPASmartClient.MorkF/GVL_MorkF.cs
  40. +14
    -0
      BPASmartClient.MorkF/Model/LocalPotStep.cs
  41. +14
    -0
      BPASmartClient.MorkF/Model/StirFryPushMessages.cs
  42. +4
    -2
      BPASmartClient.MorkF/OrderLocInfo.cs
  43. +92
    -34
      BPASmartClient.MorkF/View/DebugView.xaml
  44. +11
    -3
      BPASmartClient.MorkF/View/DebugView.xaml.cs
  45. +80
    -0
      BPASmartClient.MorkF/View/LocalMenu.xaml
  46. +338
    -0
      BPASmartClient.MorkF/View/LocalMenu.xaml.cs
  47. +128
    -33
      BPASmartClient.MorkF/ViewModel/DebugViewModel.cs
  48. +104
    -0
      BPASmartClient.MorkF/ViewModel/LocalMenuViewModel.cs
  49. +1
    -1
      BPASmartClient.MorkS/BPASmartClient.MorkS.csproj
  50. +2
    -0
      BPASmartClient.MorkS/Control_Morks.cs
  51. +45
    -0
      BPASmartClient.MorkS/DataServer.cs
  52. +1
    -1
      BPASmartClient.MorkT_HQ/BPASmartClient.MorkTHQ.csproj
  53. +9
    -0
      BPASmartClient.ScreenALL/App.config
  54. +8
    -0
      BPASmartClient.ScreenALL/App.xaml
  55. +27
    -0
      BPASmartClient.ScreenALL/App.xaml.cs
  56. +10
    -0
      BPASmartClient.ScreenALL/AssemblyInfo.cs
  57. +24
    -0
      BPASmartClient.ScreenALL/BPASmartClient.ScreenALL.csproj
  58. BIN
     
  59. +56
    -0
      BPASmartClient.ScreenLib/AppMain.cs
  60. +10
    -0
      BPASmartClient.ScreenLib/AssemblyInfo.cs
  61. +26
    -0
      BPASmartClient.ScreenLib/BPASmartClient.ScreenLib.csproj
  62. +238
    -0
      BPASmartClient.ScreenLib/Helper/FSystemHelper.cs
  63. +229
    -0
      BPASmartClient.ScreenLib/Helper/Main.cs
  64. +20
    -0
      BPASmartClient.ScreenLib/Model/DevRunStatus.cs
  65. +163
    -0
      BPASmartClient.ScreenLib/Model/OrderMakeModel.cs
  66. +187
    -0
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml
  67. +70
    -0
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml.cs
  68. +145
    -0
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1ViewModel.cs
  69. +219
    -0
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2.xaml
  70. +29
    -0
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2.xaml.cs
  71. +145
    -0
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2ViewModel.cs
  72. +219
    -0
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl3.xaml
  73. +30
    -0
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl3.xaml.cs
  74. +146
    -0
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl3ViewModel.cs
  75. +31
    -0
      BPASmartClient.ScreenLib/分餐机/WindowShow.xaml
  76. +41
    -0
      BPASmartClient.ScreenLib/分餐机/WindowShow.xaml.cs
  77. +333
    -0
      BPASmartClient.ScreenLib/总监视大屏/ScreenALLControl.xaml
  78. +29
    -0
      BPASmartClient.ScreenLib/总监视大屏/ScreenALLControl.xaml.cs
  79. +216
    -0
      BPASmartClient.ScreenLib/总监视大屏/ScreenALLControlViewModel.cs
  80. +320
    -0
      BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControl.xaml
  81. +29
    -0
      BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControl.xaml.cs
  82. +176
    -0
      BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControlViewModel.cs
  83. +302
    -0
      BPASmartClient.ScreenLib/炒锅/ScreenMinWokControl.xaml
  84. +29
    -0
      BPASmartClient.ScreenLib/炒锅/ScreenMinWokControl.xaml.cs
  85. +191
    -0
      BPASmartClient.ScreenLib/炒锅/ScreenMinWokControlViewModel.cs
  86. +363
    -0
      BPASmartClient.ScreenLib/煮面机/ScreenMorksControl.xaml
  87. +29
    -0
      BPASmartClient.ScreenLib/煮面机/ScreenMorksControl.xaml.cs
  88. +311
    -0
      BPASmartClient.ScreenLib/煮面机/ScreenMorksControlViewModel.cs
  89. +10
    -0
      BPASmartClient.ScreenMaxWok/App.config
  90. +8
    -0
      BPASmartClient.ScreenMaxWok/App.xaml
  91. +27
    -0
      BPASmartClient.ScreenMaxWok/App.xaml.cs
  92. +10
    -0
      BPASmartClient.ScreenMaxWok/AssemblyInfo.cs
  93. +23
    -0
      BPASmartClient.ScreenMaxWok/BPASmartClient.ScreenMaxWok.csproj
  94. BIN
     
  95. +9
    -0
      BPASmartClient.ScreenMinWok/App.config
  96. +8
    -0
      BPASmartClient.ScreenMinWok/App.xaml
  97. +27
    -0
      BPASmartClient.ScreenMinWok/App.xaml.cs
  98. +10
    -0
      BPASmartClient.ScreenMinWok/AssemblyInfo.cs
  99. +24
    -0
      BPASmartClient.ScreenMinWok/BPASmartClient.ScreenMinWok.csproj
  100. BIN
     

+ 1
- 1
BPASmart.ConfigurationSoftware/BPASmart.ConfigurationSoftware.csproj View File

@@ -20,7 +20,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.21" />
<PackageReference Include="BPA.Helper" Version="1.0.28" />
</ItemGroup>

<ItemGroup>


+ 1
- 1
BPASmart.PageLoad/BPASmart.PageLoad.csproj View File

@@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.21" />
<PackageReference Include="BPA.Helper" Version="1.0.28" />
</ItemGroup>

<ItemGroup>


+ 2
- 2
BPASmart.Server/BPASmart.Server.csproj View File

@@ -8,8 +8,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Communication" Version="1.0.19" />
<PackageReference Include="BPA.Helper" Version="1.0.21" />
<PackageReference Include="BPA.Communication" Version="1.0.36" />
<PackageReference Include="BPA.Helper" Version="1.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.9" />
</ItemGroup>



+ 12
- 3
BPASmart.Server/CommunicationServer.cs View File

@@ -18,7 +18,12 @@ namespace BPASmart.Server
{
BPASmartClient.Message.MessageLog.GetInstance.ShowDebugLog(s);
});
RedisHelper.GetInstance.ConnectAsync("124.222.238.75", 16000, "123456", 1);

RedisHelper.GetInstance.Connect(new ConfigurationOptions()
{
ServerAddress = $"124.222.238.75:16000",
Password = "123456",
});
MqttInit();
Json<CommunicationPar>.Data.CommunicationDevices.ToList()?.ForEach(item =>
{
@@ -75,7 +80,11 @@ namespace BPASmart.Server
var DeviceModel = item;
});
modbusTcpMaster.IsReconnect = true;
modbusTcpMaster.ModbusTcpConnect(_modbusTcp.IP, _modbusTcp.PortNum);
modbusTcpMaster.Connect(new ConfigurationOptions()
{
IpAddress = _modbusTcp.IP,
Port = _modbusTcp.PortNum
});
break;
case BPASmart.Model.Siemens _siemens:
break;
@@ -200,7 +209,7 @@ namespace BPASmart.Server
});
}
});
RedisHelper.GetInstance.SetValue($"{Devicename}", reeisDataModels);
RedisHelper.GetInstance.Write($"{Devicename}", reeisDataModels);
}
}
}


+ 2
- 2
BPASmart.VariableManager/BPASmart.VariableManager.csproj View File

@@ -29,8 +29,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Communication" Version="1.0.19" />
<PackageReference Include="BPA.Helper" Version="1.0.21" />
<PackageReference Include="BPA.Communication" Version="1.0.36" />
<PackageReference Include="BPA.Helper" Version="1.0.28" />
</ItemGroup>

<ItemGroup>


+ 5
- 1
BPASmart.VariableManager/ViewModels/VariableConfigViewModel.cs View File

@@ -229,7 +229,11 @@ namespace BPASmart.VariableManager.ViewModels
}), $"{DeviceType} 设备数据采集");
});
modbusTcpMaster.IsReconnect = true;
modbusTcpMaster.ModbusTcpConnect(_modbusTcp.IP, _modbusTcp.PortNum);
modbusTcpMaster.Connect(new ConfigurationOptions()
{
IpAddress = _modbusTcp.IP,
Port = _modbusTcp.PortNum
});
break;
case BPASmart.Model.Siemens _siemens:
break;


+ 2
- 1
BPASmartClient.Business/BPASmartClient.Business.csproj View File

@@ -8,7 +8,8 @@

<ItemGroup>
<PackageReference Include="BPA.ApolloClient" Version="1.0.12" />
<PackageReference Include="BPA.Message" Version="1.0.46" />
<PackageReference Include="BPA.Helper" Version="1.0.28" />
<PackageReference Include="BPA.Message" Version="1.0.74" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />


+ 57
- 0
BPASmartClient.Business/LocalMqtt.cs View File

@@ -0,0 +1,57 @@
using BPA.Message;
using BPASmartClient.MQTT;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Business
{
public class LocalMqtt
{
private volatile static LocalMqtt _Instance;
public static LocalMqtt GetInstance => _Instance ?? (_Instance = new LocalMqtt());
private LocalMqtt() { }

/// <summary>
///
/// </summary>
SendScreenDataModel MqttPushs = new SendScreenDataModel();

MQTTProxy mQTTProxy = new MQTTProxy();

ScreenDeviceType LocDeviceType;

public void Init(ScreenDeviceType DeviceType)
{
MqttPushs.Name = DeviceType;
LocDeviceType = DeviceType;
mQTTProxy.Connected = new Action(() =>
{
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(DeviceType)) ;
});
mQTTProxy.Connect("admin", "public", "10.2.1.254", 1883, $"{DeviceType}_设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}

public void Start()
{
}


/// <summary>
/// MQTT消息推送
/// </summary>
/// <param name="topic">主题</param>
/// <param name="message">消息体</param>
public void Publish(object message)
{
MqttPushs.Value = message;
mQTTProxy.Publish(ScreenTOPIC.GetInstance.GetTopic(LocDeviceType), JsonConvert.SerializeObject(MqttPushs));
}
}
}

+ 1
- 1
BPASmartClient.Business/Plugin/DeviceMgr.cs View File

@@ -95,7 +95,7 @@ namespace BPASmartClient.Business

#region 获取物料数据
string result = string.Empty;
for (int i = 0; i < 2; i++)
for (int i = 0; i < 3; i++)
{
try
{


+ 1
- 1
BPASmartClient.Business/Plugin/MQTTMgr.cs View File

@@ -64,7 +64,7 @@ namespace BPASmartClient.Business
string deviceId = deviceConfig[0].deviceModels[0].DeviceId;
clientId = Plugin.GetInstance().GetPlugin<ConfigMgr>().ClientId;
//MQTT 初始化
mqttProxy.Connect(MqttServerAccount.UserName, MqttServerAccount.Password, MqttServerConfig.Host, MqttServerConfig.Port, "ClientId:" + clientId + "DeviceId:" + deviceId + Guid.NewGuid().ToString());
mqttProxy.Connect(MqttServerAccount.UserName, MqttServerAccount.Password, MqttServerConfig.Host, MqttServerConfig.Port, "ClientId:" + clientId + "DeviceId:" + deviceId + Guid.NewGuid().ToString());

ThreadManage.GetInstance().Start(() =>
{


+ 2
- 2
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj View File

@@ -409,8 +409,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.21" />
<PackageReference Include="BPA.Message" Version="1.0.46" />
<PackageReference Include="BPA.Helper" Version="1.0.28" />
<PackageReference Include="BPA.Message" Version="1.0.74" />
<PackageReference Include="MahApps.Metro.IconPacks.FontAwesome" Version="4.11.0" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
</ItemGroup>


+ 1
- 1
BPASmartClient.Device/BPASmartClient.Device.csproj View File

@@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.46" />
<PackageReference Include="BPA.Message" Version="1.0.74" />
</ItemGroup>

<ItemGroup>


+ 39
- 1
BPASmartClient.Device/BaseDevice.cs View File

@@ -98,11 +98,18 @@ namespace BPASmartClient.Device
/// </summary>
protected ConcurrentDictionary<string, object> peripheralStatus = new ConcurrentDictionary<string, object>();

protected

/// <summary>
/// 外设设备集合
/// </summary>
private List<IPeripheral> peripherals;

/// <summary>
/// <炒锅>:<外设状态,硬件设备数据>的键值对
/// </summary>
protected Dictionary<int, ConcurrentDictionary<string, object>> dicPort2peripheralStatus = new Dictionary<int, ConcurrentDictionary<string, object>>();

public Action<int, object> AddErrorAction { get; set; }
public Action<int, object> DeleteErrorAction { get; set; }
public List<Alarm> alarms { get; set; } = new List<Alarm>();
@@ -127,6 +134,22 @@ namespace BPASmartClient.Device
}
}
}
/// <summary>
/// 多设备分开写控制
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
public void WriteControlExact(string address, object value,int i)
{
if (peripherals != null)
{
if (peripherals.Count > i)
{
peripherals.ElementAt(i).WriteData(address, value);
}
}
}


/// <summary>
/// 设备过程日志显示
@@ -158,19 +181,34 @@ namespace BPASmartClient.Device
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
int i = 0;
foreach (var peripheral in peripherals)
{
string TypeName = peripheral.GetType().FullName.Replace("BPASmartClient.", "");
Status.Update($"{TypeName}.IsConnected", peripheral.IsConnected);
Status.Update($"{TypeName}.IsWork", peripheral.IsWork);
//做为炒锅与状态字典的新数据
ConcurrentDictionary<string, object> newPeripheralStatus = new ConcurrentDictionary<string, object>();
foreach (var key in peripheral.GetAllStatus().Keys)
{
peripheralStatus[key] = peripheral.GetAllStatus()[key];
//新的硬件设备数据存储
newPeripheralStatus[key] = peripheral.GetAllStatus()[key];
if (TypeName != "PLC.PLCMachine")
{
Status.Update($"{TypeName}.{key}", peripheral.GetAllStatus()[key]);
}
}
if(dicPort2peripheralStatus.ContainsKey(i))
{
dicPort2peripheralStatus[i] = newPeripheralStatus;
}
else
{
//将存储的新硬件设备数据放入字典中,i是作为炒锅编号。
dicPort2peripheralStatus.Add(i, newPeripheralStatus);
}
i++;
}

if (AddErrorAction != null && DeleteErrorAction != null)
@@ -336,7 +374,7 @@ namespace BPASmartClient.Device
{
ReadData();
Thread.Sleep(10);
}), $"ReadData:{DeviceId}");
}), $"ReadData:{DeviceId}",true);
#endregion

#region 任务流程


+ 1
- 1
BPASmartClient.DosingProject/BPASmartClient.DosingHKProject.csproj View File

@@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.60" />
<PackageReference Include="BPA.Message" Version="1.0.66" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
</ItemGroup>



+ 10
- 0
BPASmartClient.Helper/ThreadManage.cs View File

@@ -190,6 +190,16 @@ namespace BPASmartClient.Helper
return false;
}

/// <summary>
/// 根据key获取取消状态,为start()开启的task在外部停止使用。
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public bool IsCanncel(string key)
{
if(CancellationTokenSources.ContainsKey(guid + key)) return CancellationTokenSources[guid + key].IsCancellationRequested;
return false;
}
}

}

+ 1
- 1
BPASmartClient.JXJFoodBigStation/BPASmartClient.JXJFoodBigStation.csproj View File

@@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Communication" Version="1.0.19" />
<PackageReference Include="BPA.Communication" Version="1.0.36" />
</ItemGroup>

<ItemGroup>


+ 1
- 1
BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj View File

@@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.58" />
<PackageReference Include="BPA.Message" Version="1.0.74" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>


+ 148
- 33
BPASmartClient.MilkWithTea/View/RecipeConfige.xaml.cs View File

@@ -26,6 +26,12 @@ namespace BPASmartClient.MilkWithTea.View
Border ultUE;
Popup mypopup;
ListBoxItem OldItem;
bool isDown = false;

/// <summary>
/// 当前拖拽子控件Item
/// </summary>
private ListBoxItem ChildListBoxItem;

public RecipeConfige()
{
@@ -37,6 +43,8 @@ namespace BPASmartClient.MilkWithTea.View
private void Button_Click(object sender, RoutedEventArgs e)
{
this.Close();
}

@@ -63,7 +71,7 @@ namespace BPASmartClient.MilkWithTea.View
private bool IsMouseOverTarget(Visual target, GetPositionDelegate getPosition)
{
Rect bounds = VisualTreeHelper.GetDescendantBounds(target);
Point mousePos = getPosition((IInputElement)target);
Point mousePos = getPosition((IInputElement)target);
return bounds.Contains(mousePos);
}

@@ -102,60 +110,141 @@ namespace BPASmartClient.MilkWithTea.View

private void listview1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
var pos = e.GetPosition(listview1);
HitTestResult result = VisualTreeHelper.HitTest(listview1, pos);
OldItem = Utils.FindVisualParent<ListBoxItem>(result.VisualHit);
if(OldItem != null)
try
{
if (e.Source is Border)
if (isDown)
{
ultUE = (Border)e.Source;
ultUE.CaptureMouse();
ultUE.Visibility = Visibility.Collapsed;
CloneVisual(ultUE, e);
isDown = false;
return;
}
var pos = e.GetPosition(listview1);
HitTestResult result = VisualTreeHelper.HitTest(listview1, pos);
if (result == null) return;
OldItem = Utils.FindVisualParent<ListBoxItem>(result.VisualHit);
if (OldItem != null)
{
if (e.Source is Border)
{
ultUE = (Border)e.Source;
ultUE.CaptureMouse();
ChildListBoxItem = Utils.FindVisualParent<ListBoxItem>(VisualTreeHelper.HitTest(ultUE, e.GetPosition(ultUE)).VisualHit);
CloneVisual(ultUE, e);
isDown = true;
}
}
}
catch (Exception)
{

throw;
}
}



private void listview1_MouseMove(object sender, MouseEventArgs e)
{
Point ptLeftUp = new Point(0, 0);
Point ptRightDown = new Point(this.ActualWidth, this.ActualHeight);
ptLeftUp = listview1.PointToScreen(ptLeftUp);
ptRightDown = listview1.PointToScreen(ptRightDown);
double y = e.GetPosition(listview1).Y;
double x = e.GetPosition(listview1).X;
if (mypopup != null)
{
mypopup.HorizontalOffset = ptLeftUp.X + x - ((FrameworkElement)ultUE).ActualWidth / 2;
mypopup.VerticalOffset = ptLeftUp.Y + y - ((FrameworkElement)ultUE).ActualHeight / 2;
}
if (isDown == false) return;
if (e.LeftButton != MouseButtonState.Pressed)
listview1_MouseLeftButtonUp(null,null);
Point ptLeftUp = new Point(0, 0);
Point ptRightDown = new Point(this.ActualWidth, this.ActualHeight);
ptLeftUp = listview1.PointToScreen(ptLeftUp);
ptRightDown = listview1.PointToScreen(ptRightDown);
double y = e.GetPosition(listview1).Y;
double x = e.GetPosition(listview1).X;
if (mypopup != null)
{
mypopup.HorizontalOffset = ptLeftUp.X + x - ((FrameworkElement)ultUE).ActualWidth / 2;
mypopup.VerticalOffset = ptLeftUp.Y + y - ((FrameworkElement)ultUE).ActualHeight / 2;
}
MoveListBoxStyle(e, true);
}

private void listview1_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
if(mypopup != null)
//鼠标未按下返回
if (!isDown) return;

isDown = false;
if (mypopup != null)
{
mypopup.IsOpen = false;
mypopup = null;
}
if (OldItem == null) return;
var pos = e.GetPosition(listview1);
HitTestResult result = VisualTreeHelper.HitTest(listview1, pos);
if(result == null) return;
var Newitem = Utils.FindVisualParent<ListBoxItem>(result.VisualHit);
if (Newitem == null) return;
if (OldItem == Newitem) return;
int iold = listview1.Items.IndexOf((LocalMaterail)OldItem.DataContext);
int inew = listview1.Items.IndexOf((LocalMaterail)Newitem.DataContext);
RecipeConfigeViewModel.Materails.Move(iold,inew);

MoveListBoxStyle(e, false);
//if (OldItem == null) return;
//var pos = e.GetPosition(listview1);
//HitTestResult result = VisualTreeHelper.HitTest(listview1, pos);
//if(result == null) return;
//var Newitem = Utils.FindVisualParent<ListBoxItem>(result.VisualHit);
//if (Newitem == null) return;
//if (OldItem == Newitem) return;
//int iold = listview1.Items.IndexOf((LocalMaterail)OldItem.DataContext);
//int inew = listview1.Items.IndexOf((LocalMaterail)Newitem.DataContext);
//RecipeConfigeViewModel.Materails.Move(iold,inew);
}

/// <summary>
/// 移动效果
/// </summary>
/// <param name="boxItem"></param>
private void MoveListBoxStyle(MouseEventArgs e, bool isBool)
{
try
{
if (isBool)//为真,根据鼠标位置设置行透明度和显示状态
{
//移动到某行减轻某行 暗黑
foreach (ListBoxItem item in Utils.FindVisualChildren<ListBoxItem>(listview1))
{
if (item != ChildListBoxItem)//这就是其他控件
{
double item_width = item.ActualWidth; //当前行宽
double item_height = item.ActualHeight; //当前行高
double item_x = e.GetPosition(item).X; //鼠标相对当前行X位移
double item_y = e.GetPosition(item).Y; //鼠标相对当前行Y位移

if (item_y <= item_height && item_y > 0 && item_x > 0 && item_x <= item_width)//鼠标进入哪一行,则将那一行变灰
{
item.Opacity = 0.5;
int lao_index = RecipeConfigeViewModel.Materails.IndexOf(item.Content as LocalMaterail);
int new_index = RecipeConfigeViewModel.Materails.IndexOf(ChildListBoxItem.Content as LocalMaterail);
RecipeConfigeViewModel.Materails.Move(lao_index, new_index);
}
else //鼠标没在哪一行,则保持原状
{
item.Opacity = 1;
}
}
else
{
item.Visibility = Visibility.Hidden;
}
}
}
else//为假 恢复所有行透明度和显示状态
{
//移动到某行减轻某行 暗黑
foreach (ListBoxItem item in Utils.FindVisualChildren<ListBoxItem>(listview1))
{
item.Opacity = 1;
item.Visibility = Visibility.Visible;
}
}
}
catch (Exception ex)
{
}
}
}



internal static class Utils
{
//根据子元素查找父元素
@@ -170,5 +259,31 @@ namespace BPASmartClient.MilkWithTea.View
}
return null;
}

/// <summary>
/// 查询子控件
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="obj"></param>
/// <returns></returns>
public static IEnumerable<T> FindVisualChildren<T>(DependencyObject depObj) where T : DependencyObject
{
if (depObj != null)
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++)
{
DependencyObject child = VisualTreeHelper.GetChild(depObj, i);
if (child != null && child is T)
{
yield return (T)child;
}

foreach (T childOfChild in FindVisualChildren<T>(child))
{
yield return childOfChild;
}
}
}
}
}
}

+ 90
- 4
BPASmartClient.Modbus/ModbusTcp.cs View File

@@ -1,4 +1,5 @@
using BPASmartClient.Helper;
using BPASmartClient.Message;
//using BPASmartClient.Message;
using NModbus;
using System;
@@ -55,7 +56,7 @@ namespace BPASmartClient.Modbus
IPAdress = ip;
Port = port;
modbusFactory = new ModbusFactory();
Connect();
Connect();
if (Connected)
{
master.Transport.ReadTimeout = 2000;//读取超时时间
@@ -117,7 +118,15 @@ namespace BPASmartClient.Modbus
if (address.Length > 0)
{
address = address.Trim();
if (address.ToUpper().Contains("M") && address.Length >= 4)
if (address.ToUpper().Contains("GM") && address.Length >= 3)
{
var res = address.Remove(0, 2);
if (res != null && res.Length > 0)
{
return int.Parse(res) + 4096;
}
}
else if (address.ToUpper().Contains("M") && address.Length >= 4)
{
var res = address.Substring(1).Split('.');
if (res != null && res.Length == 2)
@@ -131,7 +140,28 @@ namespace BPASmartClient.Modbus
}
}
}
else if (address.ToUpper().Contains("VW") && address.Length >= 3)
else if (address.ToUpper().Contains("GI") && address.Length >= 3)
{
var res = address.Remove(0, 2);
if (res != null && res.Length > 0)
{
return int.Parse(res);
}
}
else if(address.ToUpper().Contains("LB") && address.Length >= 3)
{
var res = address.Substring(2);
if (res != null && res.Length > 0)
{
if(int.TryParse(res, out int firstAddress))
{
return firstAddress;
}
}
}

else if ((address.ToUpper().Contains("VW") || address.ToUpper().Contains("VD")) && address.Length >= 3)
{
var res = address.Substring(2);
if (res != null && int.TryParse(res, out int tempAddress))
@@ -228,21 +258,48 @@ namespace BPASmartClient.Modbus
CommandType commandType = CommandType.Coils;
try
{
if (address.ToUpper().Contains("M"))
if (address.ToUpper().Contains("M") || address.ToUpper().Contains("GM"))
{
commandType = CommandType.Coils;
return master.ReadCoils(slaveAddress, startAddress, len);
}
else if (address.ToUpper().Contains("VD"))
{
commandType = CommandType.HoldingRegisters;
var var1 = master.ReadHoldingRegisters(slaveAddress, startAddress, len);
var var2 = master.ReadHoldingRegisters(slaveAddress, (ushort)(startAddress + 1), len);
int dest = 0;
dest |= (var2[0] & 0x0000ffff);
dest = (dest << 16) | (var1[0] & 0x0000ffff);
return dest;

}
else if (address.ToUpper().Contains("VW") || address.ToUpper().Contains("LW") || address.ToUpper().Contains("D"))
{
commandType = CommandType.HoldingRegisters;
return master.ReadHoldingRegisters(slaveAddress, startAddress, len);
}
else if (address.ToUpper().Contains("VD"))
{
commandType = CommandType.HoldingRegisters;
var var1 = master.ReadHoldingRegisters(slaveAddress, startAddress, len);
var var2 = master.ReadHoldingRegisters(slaveAddress, (ushort)(startAddress+2), len);
int dest = 0;
dest |= (var2[0] & 0x0000ffff);
dest = (dest << 16) | (var1[0] & 0x0000ffff);
return dest;

}
else if (address.ToUpper().Contains("I"))
{
commandType = CommandType.Inputs;
return master.ReadInputs(slaveAddress, startAddress, len);
}
else if (address.ToUpper().Contains("LB"))
{
commandType = CommandType.Coils;
return master.ReadCoils(slaveAddress, startAddress, len);
}

}
catch (Exception ex)
@@ -307,6 +364,35 @@ namespace BPASmartClient.Modbus
else if (value is bool[] boolsValue)
master.WriteMultipleCoils(slaveAddress, startAddress, boolsValue);
}
if (address.ToUpper().Contains("GM") && address.Length >= 3)
{
commandType = CommandType.Coils;
if (value is bool boolValue)
master.WriteSingleCoil(slaveAddress, startAddress, boolValue);
else if (value is bool[] boolsValue)
master.WriteMultipleCoils(slaveAddress, startAddress, boolsValue);
}
else if(address.ToUpper().Contains("LB"))
{
commandType = CommandType.Coils;
if (value is bool boolValue)
master.WriteSingleCoil(slaveAddress, startAddress, boolValue);
else if (value is bool[] boolsValue)
master.WriteMultipleCoils(slaveAddress, startAddress, boolsValue);
}
else if (address.ToUpper().Contains("VD"))
{
commandType = CommandType.HoldingRegisters;
if (value is int intValue)
{

var val1 = (UInt16)intValue;
var val2 = Convert.ToUInt16(intValue >> 16 & 0x0000ffff);
master.WriteSingleRegister(slaveAddress, startAddress, val1);
master.WriteSingleRegister(slaveAddress, (ushort)(startAddress + 1), val2);
}

}
else if (address.ToUpper().Contains("VW") || address.ToUpper().Contains("LW") || address.ToUpper().Contains("D"))
{
commandType = CommandType.HoldingRegisters;


+ 1
- 1
BPASmartClient.Model/BPASmartClient.Model.csproj View File

@@ -17,7 +17,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.46" />
<PackageReference Include="BPA.Message" Version="1.0.74" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
</ItemGroup>



+ 15
- 0
BPASmartClient.Model/FoodMenuModel.cs View File

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

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

+ 14
- 0
BPASmartClient.Model/GlobalFoodMenu.cs View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Model
{
public class GlobalFoodMenu
{
public static ObservableCollection<FoodMenuModel> LocalFoodMenus = new ObservableCollection<FoodMenuModel>();
}
}

+ 21
- 0
BPASmartClient.Model/OrderStatistics.cs View File

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

namespace BPASmartClient.Model
{
public class OrderStatistics
{
/// <summary>
/// 订单总量
/// </summary>
public int Count { get; set; }

/// <summary>
/// 统计时间
/// </summary>
public DateTime StatisticsTime { get; set; }
}
}

+ 25
- 0
BPASmartClient.MorkBF/BPASmartClient.MorkBF.csproj View File

@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" />
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" />
</ItemGroup>

<ItemGroup>
<Page Update="VIew\Monitor.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
</ItemGroup>

</Project>

+ 804
- 0
BPASmartClient.MorkBF/Control_MorkBF.cs View File

@@ -0,0 +1,804 @@
using BPA.Message;
using BPA.Message.Enum;
using BPASmartClient.Business;
using BPASmartClient.Device;
using BPASmartClient.EventBus;
using BPASmartClient.Helper;
using BPASmartClient.Model;
using BPASmartClient.MorkBF.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using static BPASmartClient.EventBus.EventBus;

namespace BPASmartClient.MorkBF
{
public class Control_MorkBF : BaseDevice
{
GVL_MorkBF morkBF = new GVL_MorkBF();

public override DeviceClientType DeviceType => DeviceClientType.MORKCS;

public override void DoMain()
{

MonitorViewModel.DeviceId = DeviceId;
CommandRegist();//调试
ServerInit();
DataParse();//数据解析
ScreenDataServer();//大屏数据上报
DeviceProcessLogShow("MORKF 设备初始化完成");
}

private void DataParse()
{
EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle)
{
if (@event == null) return;
if (@event is DoOrderEvent order)
{
if (order.MorkOrder.GoodBatchings == null) return;
OrderCount++;
DeviceProcessLogShow($"接收到{OrderCount}次订单");

}

});
}

private void ServerInit()
{
//物料信息
EventBus.EventBus.GetInstance().Subscribe<MaterialDeliveryEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
if (@event == null) return;
if (@event is MaterialDeliveryEvent material)
{
orderMaterialDelivery = material.orderMaterialDelivery;

}
});

//配方数据信息
EventBus.EventBus.GetInstance().Subscribe<RecipeBomEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
if (@event == null) return;
if (@event is RecipeBomEvent recipe)
{
recipeBoms = recipe.recipeBoms;
}
});
}
/// <summary>
/// 调试
/// </summary>
/// <exception cref="NotImplementedException"></exception>
private void CommandRegist()
{
#region 炒锅1
ActionManage.GetInstance.Register(FirePot1_SetFireGear, "FirePot1_SetFireGear");//炒锅1设定加热挡位
ActionManage.GetInstance.Register(FirePot1_StartFire, "FirePot1_StartFire");//炒锅1加热启动
ActionManage.GetInstance.Register(FirePot1_StartFire, "FirePot1_StopFire");//炒锅1关闭加热
ActionManage.GetInstance.Register(FirePot1_SetStirGear, "FirePot1_SetStirGear");//炒锅1设定搅拌挡位
ActionManage.GetInstance.Register(FirePot1_StartStir, "FirePot1_StartStir");//炒锅1搅拌启动
ActionManage.GetInstance.Register(FirePot1_StartStir, "FirePot1_StopStir");//炒锅1搅拌停止
ActionManage.GetInstance.Register(FirePot1_SetTurnSpeed, "FirePot1_SetTurnSpeed");//炒锅1翻转频率设定
#endregion
#region 炒锅2
ActionManage.GetInstance.Register(FirePot2_SetFireGear, "FirePot2_SetFireGear");//炒锅2设定加热挡位
ActionManage.GetInstance.Register(FirePot2_StartFire, "FirePot2_StartFire");//炒锅2加热启动
ActionManage.GetInstance.Register(FirePot2_StartFire, "FirePot2_StopFire");//炒锅2关闭加热
ActionManage.GetInstance.Register(FirePot2_SetStirGear, "FirePot2_SetStirGear");//炒锅2设定搅拌挡位
ActionManage.GetInstance.Register(FirePot2_StartStir, "FirePot2_StartStir");//炒锅2搅拌启动
ActionManage.GetInstance.Register(FirePot2_StartStir, "FirePot2_StopStir");//炒锅2搅拌停止
ActionManage.GetInstance.Register(FirePot2_SetTurnSpeed, "FirePot2_SetTurnSpeed");//炒锅2翻转频率设定
#endregion
#region 炒锅通用
ActionManage.GetInstance.Register(FirePot_Reset, "FirePot_Reset");//复位;
ActionManage.GetInstance.Register(FirePot_PotGotoOrigin, "FirePot_PotGotoOrigin");//炒锅回原点
ActionManage.GetInstance.Register(FirePot_PotGotoP1, "FirePot_PotGotoP1");//炒锅去位置1
ActionManage.GetInstance.Register(FirePot_PotGotoP2, "FirePot_PotGotoP2");//炒锅去位置2
ActionManage.GetInstance.Register(FirePot_PotGotoP3, "FirePot_PotGotoP3");//炒锅去位置3
ActionManage.GetInstance.Register(FirePot_PotGotoP4, "FirePot_PotGotoP4");//炒锅去位置4
ActionManage.GetInstance.Register(FirePot_PotGotoOutFoodPositiong, "FirePot_PotGotoOutFoodPositiong");//炒锅去出餐位置
ActionManage.GetInstance.Register(FirePot_PotGotoInFoodPosition, "FirePot_PotGotoInFoodPosition");//炒锅去投料位置
ActionManage.GetInstance.Register(FirePot_StartOutFood, "FirePot_StartOutFood");//出餐启动
ActionManage.GetInstance.Register(FirePot_Clean, "FirePot_Clean");//清洗
ActionManage.GetInstance.Register(FirePot_StartPumpWater, "FirePot_StartPumpWater");//抽水启动
ActionManage.GetInstance.Register(FirePot_StartPumpOil, "FirePot_StartPumpOil");//抽油启动
#endregion
#region 机器人
ActionManage.GetInstance.Register(RobotStart, "RobotStart");//机器人启动
ActionManage.GetInstance.Register(RobotStop, "RobotStop");//机器人停止
ActionManage.GetInstance.Register(RobotReset, "RobotReset");//复位
ActionManage.GetInstance.Register(RobotProgramStart, "RobotProgramStart");//程序启动
ActionManage.GetInstance.Register(Robot_Pot1AllowInMaterail, "Robot_Pot1AllowInMaterail");//1号炒锅允许机器人投料
ActionManage.GetInstance.Register(Robot_Pot1OutFoodInSlowDown, "Robot_Pot1OutFoodInSlowDown");//1号炒锅出餐倒料到减速位
ActionManage.GetInstance.Register(Robot_Pot1OutFood, "Robot_Pot1OutFoodInSlowDown");//1号炒锅出餐倒料完成
ActionManage.GetInstance.Register(Robot_Pot2AllowInMaterail, "Robot_Pot2AllowInMaterail");//2号炒锅允许机器人投料
ActionManage.GetInstance.Register(Robot_Pot2OutFoodInSlowDown, "Robot_Pot2OutFoodInSlowDown");//2号炒锅出餐倒料到减速位
ActionManage.GetInstance.Register(Robot_Pot2OutFood, "Robot_Pot2OutFood");//2号炒锅出餐倒料完成
ActionManage.GetInstance.Register(RobotActionStart, "Robot_Pot2OutFood");//2号炒锅出餐倒料完成


#endregion

}

public override void MainTask()
{
}

private void FirePot1_Process()
{
}

private void FirePot2_Process()
{
}

public override void ReadData()
{
GetStatus("M20.0",new Action<object>((o)=>
{
if (o == null) return;
if(o is bool[] values&&values.Length == 19)
{
morkBF.FirePot1_InitCompleted = values[0];
morkBF.FirePot1_IsAuto = values[1];
morkBF.FirePot1_Emergencystop = values[2];
morkBF.FirePot1_MealTubExist = values[3];
morkBF.FirePot1_VegetablesTub1Exist = values[4];
morkBF.FirePot1_VegetablesTub2Exist = values[5];
morkBF.FirePot1_Seasoning1Exist = values[6];
morkBF.FirePot1_Seasoning2Exist = values[7];
morkBF.FirePot1_Accessories1Exist = values[8];
morkBF.FirePot1_Accessories2Exist = values[9];
morkBF.FirePot1_OutFoodTubExist = values[10];
morkBF.FirePot1_OnOrigin = values[11];
morkBF.FirePot1_FirePosition1 = values[12];
morkBF.FirePot1_FirePosition2 = values[13];
morkBF.FirePot1_FirePosition3 = values[14];
morkBF.FirePot1_FirePosition4 = values[15];
morkBF.FirePot1_PotOnOutFoodPosition = values[16];
morkBF.FirePot1_PotOnIntoFoodPosition = values[17];
morkBF.FirePot1_PotOnCleanPosition = values[18];

}
}),0);

GetStatus("VW120", new Action<object>((o) =>
{
if (o == null) return;
if (o is int[] values&&values.Length == 2)
{
morkBF.FirePot1_Temperature = values[0];
morkBF.FirePot1_Pulse = values[1];

}
}), 0);

GetStatus("M25.0", new Action<object>((o) =>
{
if (o == null) return;
if (o is bool[] values&& values.Length == 19)
{
morkBF.FirePot2_InitCompleted = values[0];
morkBF.FirePot2_IsAuto = values[1];
morkBF.FirePot2_Emergencystop = values[2];
morkBF.FirePot2_MealTubExist = values[3];
morkBF.FirePot2_VegetablesTub1Exist = values[4];
morkBF.FirePot2_VegetablesTub2Exist = values[5];
morkBF.FirePot2_Seasoning1Exist = values[6];
morkBF.FirePot2_Seasoning2Exist = values[7];
morkBF.FirePot2_Accessories1Exist = values[8];
morkBF.FirePot2_Accessories2Exist = values[9];
morkBF.FirePot2_OutFoodTubExist = values[10];
morkBF.FirePot2_OnOrigin = values[11];
morkBF.FirePot2_FirePosition1 = values[12];
morkBF.FirePot2_FirePosition2 = values[13];
morkBF.FirePot2_FirePosition3 = values[14];
morkBF.FirePot2_FirePosition4 = values[15];
morkBF.FirePot2_PotOnOutFoodPosition = values[16];
morkBF.FirePot2_PotOnIntoFoodPosition = values[17];
morkBF.FirePot2_PotOnCleanPosition = values[18];

}
}), 0);

GetStatus("VW150", new Action<object>((o) =>
{
if (o == null) return;
if (o is int[] values&& values.Length == 2)
{
morkBF.FirePot2_Temperature = values[0];
morkBF.FirePot2_Pulse = values[1];

}
}), 0);
GetStatus("GM500", new Action<object>((o) =>
{
if (o == null) return;
if (o is bool[] values && values.Length == 7)
{
morkBF.Robot_FirePot1OutMeal = values[0];
morkBF.Robot_FirePot1OutVegetables1 = values[1];
morkBF.Robot_FirePot1OutVegetables2 = values[2];
morkBF.Robot_FirePot1OutSeasoning = values[3];
morkBF.Robot_FirePot1OutAccessories = values[4];
morkBF.Robot_ArriveFirePot1 = values[5];
morkBF.Robot_FirePot1OutFoodComplete = values[6];

}
}), 1);
GetStatus("GM510", new Action<object>((o) =>
{
if (o == null) return;
if (o is bool[] values && values.Length == 7)
{
morkBF.Robot_FirePot2OutMeal = values[0];
morkBF.Robot_FirePot2OutVegetables1 = values[1];
morkBF.Robot_FirePot2OutVegetables2 = values[2];
morkBF.Robot_FirePot2OutSeasoning = values[3];
morkBF.Robot_FirePot2OutAccessories = values[4];
morkBF.Robot_ArriveFirePot2 = values[5];
morkBF.Robot_FirePot2OutFoodComplete = values[6];

}
}), 1);
GetStatus("GI5", new Action<object>((o) =>
{
if (o == null) return;
if (o is int[] values && values.Length == 1)
{
morkBF.Robot_ActionCallback = values[0];
}
}), 1);

}

public override void ResetProgram()
{
morkBF = null;
morkBF = new GVL_MorkBF();
}

public override void SimOrder()
{
}

public override void Stop()
{
}

/// <summary>
/// 获取炒锅PLC的所有状态
/// </summary>
/// <param name="key"></param>
/// <param name="action"></param>
/// <param name="num">炒锅编号</param>
private void GetStatus(string key, Action<object> action, int num)
{
if (dicPort2peripheralStatus.ContainsKey(num))
{
if (dicPort2peripheralStatus[num].ContainsKey(key))
{
action((object)dicPort2peripheralStatus[num][key]);//获取PLC指定地址的状态值
}
}
}

#region 控制
private void FirePot_Write(string address, object value, int i = 0)
{
WriteControlExact(address, value, i);
}
private void Robot_Write(string address, object value, int i = 1)
{
WriteControlExact(address, value, i);
}
#region 炒锅1

/// <summary>
/// 炒锅1设定加热挡位
/// </summary>
/// <param name="o"></param>
private void FirePot1_SetFireGear(object o)
{
if (o == null) return;
if (o is int value)
{
FirePot_Write("VW100", value);
}

}
/// <summary>
/// 炒锅1加热启停
/// </summary>
/// <param name="b"></param>
private void FirePot1_StartFire(object o)
{
if (o == null) return;
if (o is bool value)
{
FirePot_Write("M10.0", value);
}
}
/// <summary>
/// 炒锅1设置搅拌挡位
/// </summary>
/// <param name="o"></param>
private void FirePot1_SetStirGear(object o)
{
if (o == null) return;
if (o is int value)
{
FirePot_Write("VW102", value);
}
}
/// <summary>
/// 炒锅1搅拌启停
/// </summary>
/// <param name="o"></param>
private void FirePot1_StartStir(object o)
{
if (o == null) return;
if (o is bool value)
{
FirePot_Write("M10.1", value);
}
}
/// <summary>
/// 设置炒锅1翻转速度
/// </summary>
/// <param name="o"></param>
private void FirePot1_SetTurnSpeed(object o)
{
if (o == null) return;
if (o is int value)
{
FirePot_Write("VW104", value);
}
}
#endregion

#region 炒锅2
/// <summary>
/// 炒锅2设定加热挡位
/// </summary>
/// <param name="o"></param>
private void FirePot2_SetFireGear(object o)
{
if (o == null) return;
if (o is int value)
{
FirePot_Write("VW130", value);
}

}
/// <summary>
/// 炒锅2加热启停
/// </summary>
/// <param name="b"></param>
private void FirePot2_StartFire(object o)
{
if (o == null) return;
if (o is bool value)
{
FirePot_Write("M15.0", value);
}
}
/// <summary>
/// 炒锅2设置搅拌挡位
/// </summary>
/// <param name="o"></param>
private void FirePot2_SetStirGear(object o)
{
if (o == null) return;
if (o is int value)
{
FirePot_Write("VW132", value);
}
}
/// <summary>
/// 炒锅2搅拌启停
/// </summary>
/// <param name="o"></param>
private void FirePot2_StartStir(object o)
{
if (o == null) return;
if (o is bool value)
{
FirePot_Write("M15.1", value);
}
}
/// <summary>
/// 设置炒锅2翻转速度
/// </summary>
/// <param name="o"></param>
private void FirePot2_SetTurnSpeed(object o)
{
if (o == null) return;
if (o is int value)
{
FirePot_Write("VW134", value);
}
}

#endregion

#region 炒锅通用
/// <summary>
/// 炒锅复位
/// </summary>
/// <param name="o"></param>
private void FirePot_Reset(object o)
{
if (o == null) return;
if (o is int i)
{
if (i == 1)
{

}
else if (i == 2)
{

}
}


}
/// <summary>
/// 炒锅回原点
/// </summary>
/// <param name="o"></param>
private void FirePot_PotGotoOrigin(object o)
{
if (o == null) return;
if (o is int i)
{
if (i == 1)
{
FirePot_Write("M10.5", true);
}
else if (i == 2)
{
FirePot_Write("M15.5", true);
}
}
}
/// <summary>
/// 炒锅去位置1
/// </summary>
/// <param name="o"></param>
private void FirePot_PotGotoP1(object o)
{
if (o == null) return;
if (o is int i)
{
if (i == 1)
{
FirePot_Write("M11.2", true);
}
else if (i == 2)
{
FirePot_Write("M16.2", true);
}
}
}
/// <summary>
/// 炒锅去位置2
/// </summary>
/// <param name="o"></param>
private void FirePot_PotGotoP2(object o)
{
if (o == null) return;
if (o is int i)
{
if (i == 1)
{
FirePot_Write("M11.3", true);
}
else if (i == 2)
{
FirePot_Write("M16.3", true);
}
}
}
/// <summary>
/// 炒锅去位置3
/// </summary>
/// <param name="o"></param>
private void FirePot_PotGotoP3(object o)
{
if (o == null) return;
if (o is int i)
{
if (i == 1)
{
FirePot_Write("M11.4", true);
}
else if (i == 2)
{
FirePot_Write("M16.4", true);
}
}
}
/// <summary>
/// 炒锅去位置4
/// </summary>
/// <param name="o"></param>
private void FirePot_PotGotoP4(object o)
{
if (o == null) return;
if (o is int i)
{
if (i == 1)
{
FirePot_Write("M11.5", true);
}
else if (i == 2)
{
FirePot_Write("M16.5", true);
}
}
}
/// <summary>
/// 炒锅去出餐位置
/// </summary>
/// <param name="o"></param>
private void FirePot_PotGotoOutFoodPositiong(object o)
{
if (o == null) return;
if (o is int i)
{
if (i == 1)
{
FirePot_Write("M11.6", true);
}
else if (i == 2)
{
FirePot_Write("M16.6", true);
}
}
}
/// <summary>
/// 炒锅去投料位置
/// </summary>
/// <param name="o"></param>
private void FirePot_PotGotoInFoodPosition(object o)
{
if (o == null) return;
if (o is int i)
{
if (i == 1)
{
FirePot_Write("M11.7", true);
}
else if (i == 2)
{
FirePot_Write("M16.7", true);
}
}
}
/// <summary>
/// 出餐启动
/// </summary>
/// <param name="o"></param>
private void FirePot_StartOutFood(object o)
{
if (o == null) return;
if (o is int i)
{
if (i == 1)
{
FirePot_Write("M10.6", true);
}
else if (i == 2)
{
FirePot_Write("M15.6", true);
}

}
}
/// <summary>
/// 清洗
/// </summary>
/// <param name="o"></param>
private void FirePot_Clean(object o)
{
if (o == null) return;
if (o is int i)
{
if (i == 1)
{
FirePot_Write("M10.7", true);
}
else if (i == 2)
{
FirePot_Write("M15.7", true);
}
}
}
/// <summary>
/// 抽水启动
/// </summary>
/// <param name="o"></param>
private void FirePot_StartPumpWater(object o)
{
if (o == null) return;
if (o is int i)
{
if (i == 1)
{
FirePot_Write("M11.0", true);
}
else if (i == 2)
{
FirePot_Write("M16.0", true);
}
}
}
/// <summary>
/// 抽油启动
/// </summary>
/// <param name="o"></param>
private void FirePot_StartPumpOil(object o)
{
if (o == null) return;
if (o is int i)
{
if (i == 1)
{
FirePot_Write("M16.0", true);
}
else if (i == 2)
{
FirePot_Write("M16.1", true);
}
}
}
#endregion

#region 机器人
/// <summary>
/// 机器人启动
/// </summary>
private void RobotStart()
{
Robot_Write("GM600",true);
}
/// <summary>
/// 机器人停止
/// </summary>
private void RobotStop()
{
Robot_Write("GM601", true);
}
/// <summary>
/// 机器人复位
/// </summary>
private void RobotReset()
{
Robot_Write("GM602", true);
}
/// <summary>
/// 机器人程序重启
/// </summary>
private void RobotProgramStart()
{
Robot_Write("GM603", true);
}
/// <summary>
/// 1号炒锅允许机器人投料(炒锅在投料位给出)
/// </summary>
private void Robot_Pot1AllowInMaterail()
{
Robot_Write("GM520", true);
}
/// <summary>
/// 1号炒锅出餐倒料到减速位
/// </summary>
private void Robot_Pot1OutFoodInSlowDown()
{
Robot_Write("GM621", true);
}
/// <summary>
/// 1号炒锅出餐倒料完成
/// </summary>
private void Robot_Pot1OutFood()
{
Robot_Write("GM522", true);
}
/// <summary>
/// 2号炒锅允许机器人投料(炒锅在投料位给出)
/// </summary>
private void Robot_Pot2AllowInMaterail()
{
Robot_Write("GM530", true);
}
/// <summary>
/// 2号炒锅出餐倒料到减速位。开始倒菜
/// </summary>
private void Robot_Pot2OutFoodInSlowDown()
{
Robot_Write("GM531", true);
}
/// <summary>
/// 2号炒锅出餐倒料完成
/// </summary>
private void Robot_Pot2OutFood()
{
Robot_Write("GM532", true);
}
/// <summary>
///
/// </summary>
private void RobotActionStart(object o)
{
if (o == null) return;
if(o is int value)
{
Robot_Write("GI0",value);
}
}
#endregion



#endregion


private void ScreenDataServer()
{
LocalMqtt.GetInstance.Init(ScreenDeviceType.大炒);
ThreadManage.GetInstance().StartLong(new Action(() =>
{
List<StatsModel> statsModels = new List<StatsModel>();
statsModels.Add(new StatsModel() { Name = "帝王蟹", Count = 666 });
ScreenModelMaxWok maxWok = new ScreenModelMaxWok
{
IsRun = new Random().Next(0, 2) == 0 ? IsRun.运行 : IsRun.停止,
WorkStatus_1 = (WorkStatus)new Random().Next(0, 3),
WorkStatus_2 = (WorkStatus)new Random().Next(0, 3),
RobotStatu = (WorkStatus)new Random().Next(0, 3),
Alarm = new List<AlarmModel>(),
FailuresCount = 0,
StatsCount = statsModels,
MaxWok_Dishes_1 = "满汉全席",
MaxWok_Dishes_2 = "海鲜大餐",
MaxWok_Task_1 = "炒制菜品",
MaxWok_Task_2 = "热油",
MaxWok_Process_1 = new List<ProcessModel>(),
MaxWok_HeatGear_1 = new Random().Next(0, 5).ToString(),
MaxWok_HeatGear_2 = new Random().Next(0, 5).ToString(),
MaxWok_StirGear_1 = new Random().Next(0, 5).ToString(),
MaxWok_StirGear_2 = new Random().Next(0, 5).ToString(),
MaxWok_FlipSpeed_1 = new Random().Next(250, 450).ToString(),
MaxWok_FlipSpeed_2 = new Random().Next(250, 450).ToString(),
MaxWok_Temp_1 = new Random().Next(250, 450).ToString(),
MaxWok_Temp_2 = new Random().Next(250, 450).ToString(),
MaxWok_OrderCount_1 = 2,
MaxWok_OrderCount_2 = 2,
MaxWok_ErrorOrderCount_1 = 0,
MaxWok_ErrorOrderCount_2 = 0,

};
LocalMqtt.GetInstance.Publish(maxWok);
Thread.Sleep(1000);

}), "大屏数据上报");
}
}
}

+ 338
- 0
BPASmartClient.MorkBF/GVL_MorkBF.cs View File

@@ -0,0 +1,338 @@
using BPASmartClient.Device;
using BPASmartClient.MorkBF.Model;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkBF
{
internal class GVL_MorkBF : IStatus
{
/// <summary>
/// 炒锅1订单队列
/// </summary>
public ConcurrentQueue<BF_Food> FirePan1_Order { get; set; } = new ConcurrentQueue<BF_Food>();
/// <summary>
/// 炒锅2订单队列
/// </summary>
public ConcurrentQueue<BF_Food> FirePan2_Order { get; set; } = new ConcurrentQueue<BF_Food>();
/// <summary>
/// 炒锅1忙碌
/// </summary>
public bool FirePan1_Busy = false;
/// <summary>
/// 炒锅2忙碌
/// </summary>
public bool FirePan2_Busy = false;

#region 炒锅1读取数据
/// <summary>
/// 炒锅1锅低温度
/// </summary>
[VariableMonitor("炒锅1锅低温度", "VW120","160")]
public int FirePot1_Temperature { get; set; }
/// <summary>
/// 炒锅1脉冲值
/// </summary>
[VariableMonitor("炒锅1脉冲值", "VW122", "161")]
public int FirePot1_Pulse { get; set; }
/// <summary>
/// 炒锅1初始化完成
/// </summary>
[VariableMonitor("炒锅1初始化完成", "M20.0", "480")]
public bool FirePot1_InitCompleted { get; set; } = false;

/// <summary>
/// 炒锅1手动自动模式
/// </summary>
[VariableMonitor("炒锅1手动自动模式", "M20.1", "481")]
public bool FirePot1_IsAuto { get; set; }
/// <summary>
/// 炒锅1急停
/// </summary>
[VariableMonitor("炒锅1急停", "M20.2", "482")]
public bool FirePot1_Emergencystop{ get; set; }
/// <summary>
/// 1#炒锅荤菜盆有无检测
/// </summary>
[VariableMonitor("1#炒锅1锅低温度", "M20.3", "483")]
public bool FirePot1_MealTubExist{ get; set; }
/// <summary>
/// 1#炒锅素菜盆1有无检测
/// </summary>
[VariableMonitor("炒锅素菜盆1有无检测", "M20.4", "484")]
public bool FirePot1_VegetablesTub1Exist{ get; set; }
/// <summary>
/// 1#炒锅素菜盆2有无检测
/// </summary>
[VariableMonitor("1#炒锅素菜盆2有无检测", "M20.5", "485")]
public bool FirePot1_VegetablesTub2Exist{ get; set; }
/// <summary>
/// 1#炒锅调料盆1有无检测
/// </summary>
[VariableMonitor("1#炒锅调料盆1有无检测", "M20.6", "486")]
public bool FirePot1_Seasoning1Exist{ get; set; }
/// <summary>
/// 1#炒锅调料盆2有无检测
/// </summary>
[VariableMonitor("1#炒锅调料盆2有无检测", "M20.7", "487")]
public bool FirePot1_Seasoning2Exist{ get; set; }
/// <summary>
/// 1#炒锅辅料盆1有无检测
/// </summary>
[VariableMonitor("1#炒锅辅料盆1有无检测", "M21.0", "488")]
public bool FirePot1_Accessories1Exist{ get; set; }
/// <summary>
/// 1#炒锅辅料盆2有无检测
/// </summary>
[VariableMonitor("1#炒锅辅料盆2有无检测", "M21.1", "489")]
public bool FirePot1_Accessories2Exist{ get; set; }
/// <summary>
/// 1#炒锅出餐空盆有无检测
/// </summary>
[VariableMonitor("1#炒锅出餐空盆有无检测", "M21.2", "490")]
public bool FirePot1_OutFoodTubExist{ get; set; }
/// <summary>
/// 1#炒锅在原点反馈
/// </summary>
[VariableMonitor("1#炒锅在原点反馈", "M21.3", "491")]
public bool FirePot1_OnOrigin{ get; set; }
/// <summary>
/// 1#炒制位置1反馈
/// </summary>
[VariableMonitor("1#炒制位置1反馈", "M21.4", "492")]
public bool FirePot1_FirePosition1{ get; set; }
/// <summary>
/// 1#炒制位置2反馈
/// </summary>
[VariableMonitor("1#炒制位置2反馈", "M21.5", "493")]
public bool FirePot1_FirePosition2{ get; set; }
/// <summary>
/// 1#炒制位置3反馈
/// </summary>
[VariableMonitor("1#炒制位置3反馈", "M21.6", "494")]
public bool FirePot1_FirePosition3{ get; set; }
/// <summary>
/// 1#炒制位置4反馈
/// </summary>
[VariableMonitor("1#炒制位置4反馈", "M21.7", "495")]
public bool FirePot1_FirePosition4{ get; set; }
/// <summary>
/// 1#炒锅在出餐倒料位置反馈
/// </summary>
[VariableMonitor("1#炒锅在出餐倒料位置反馈", "M22.0", "496")]
public bool FirePot1_PotOnOutFoodPosition{ get; set; }
/// <summary>
/// 1#炒锅在投料位置反馈、
/// </summary>
[VariableMonitor("1#炒锅在投料位置反馈", "M22.1", "497")]
public bool FirePot1_PotOnIntoFoodPosition{ get; set; }
/// <summary>
/// 1#炒锅在洗锅位置反馈
/// </summary>
[VariableMonitor("1#炒锅在洗锅位置反馈", "M22.2", "498")]
public bool FirePot1_PotOnCleanPosition{ get; set; }
#endregion

#region 炒锅2读取数据
/// <summary>
/// 炒锅2锅低温度
/// </summary>
[VariableMonitor("炒锅2锅低温度", "VW150", "175")]
public int FirePot2_Temperature{ get; set; }
/// <summary>
/// 炒锅2脉冲值
/// </summary>
[VariableMonitor("炒锅2脉冲值", "VW152", "176")]
public int FirePot2_Pulse{ get; set; }
/// <summary>
/// 炒锅2初始化完成
/// </summary>
[VariableMonitor("炒锅2初始化完成", "M25.0", "520")]
public bool FirePot2_InitCompleted { get; set; } = false;

/// <summary>
/// 炒锅2手动自动模式
/// </summary>
[VariableMonitor("炒锅2手动自动模式", "M25.1", "521")]
public bool FirePot2_IsAuto{ get; set; }
/// <summary>
/// 炒锅2急停
/// </summary>
[VariableMonitor("炒锅2急停", "M25.2", "522")]
public bool FirePot2_Emergencystop{ get; set; }
/// <summary>
/// 2#炒锅荤菜盆有无检测
/// </summary>
[VariableMonitor("2#炒锅荤菜盆有无检测", "M25.3", "523")]
public bool FirePot2_MealTubExist{ get; set; }
/// <summary>
/// 2#炒锅素菜盆1有无检测
/// </summary>
[VariableMonitor("2#炒锅素菜盆1有无检测", "M25.4", "524")]
public bool FirePot2_VegetablesTub1Exist{ get; set; }
/// <summary>
/// 2#炒锅素菜盆2有无检测
/// </summary>
[VariableMonitor("2#炒锅素菜盆2有无检测", "M25.5", "525")]
public bool FirePot2_VegetablesTub2Exist{ get; set; }
/// <summary>
/// 2#炒锅调料盆1有无检测
/// </summary>
[VariableMonitor("2#炒锅调料盆1有无检测", "M25.6", "526")]
public bool FirePot2_Seasoning1Exist{ get; set; }
/// <summary>
/// 2#炒锅调料盆2有无检测
/// </summary>
[VariableMonitor("2#炒锅调料盆2有无检测", "M25.7", "527")]
public bool FirePot2_Seasoning2Exist{ get; set; }
/// <summary>
/// 2#炒锅辅料盆1有无检测
/// </summary>
[VariableMonitor("2#炒锅1锅低温度", "M26.0", "528")]
public bool FirePot2_Accessories1Exist{ get; set; }
/// <summary>
/// 2#炒锅辅料盆2有无检测
/// </summary>
[VariableMonitor("2#炒锅辅料盆2有无检测", "M26.1", "529")]
public bool FirePot2_Accessories2Exist{ get; set; }
/// <summary>
/// 2#炒锅出餐空盆有无检测
/// </summary>
[VariableMonitor("2#炒锅出餐空盆有无检测", "M26.2", "530")]
public bool FirePot2_OutFoodTubExist{ get; set; }
/// <summary>
/// 2#炒锅在原点反馈
/// </summary>
[VariableMonitor("2#炒锅在原点反馈", "M26.3", "531")]
public bool FirePot2_OnOrigin{ get; set; }
/// <summary>
/// 2#炒制位置1反馈
/// </summary>
[VariableMonitor("2#炒制位置1反馈", "M26.4", "532")]
public bool FirePot2_FirePosition1{ get; set; }
/// <summary>
/// 2#炒制位置2反馈
/// </summary>
[VariableMonitor("2#炒制位置2反馈", "M26.5", "533")]
public bool FirePot2_FirePosition2{ get; set; }
/// <summary>
/// 2#炒制位置3反馈
/// </summary>
[VariableMonitor("2#炒制位置3反馈", "M26.6", "534")]
public bool FirePot2_FirePosition3{ get; set; }
/// <summary>
/// 2#炒制位置4反馈
/// </summary>
[VariableMonitor("2#炒制位置4反馈", "M26.7", "535")]
public bool FirePot2_FirePosition4{ get; set; }
/// <summary>
/// 2#炒锅在出餐倒料位置反馈
/// </summary>
[VariableMonitor("2#炒锅在出餐倒料位置反馈", "M27.0", "536")]
public bool FirePot2_PotOnOutFoodPosition{ get; set; }
/// <summary>
/// 2#炒锅在投料位置反馈、
/// </summary>
[VariableMonitor("2#炒锅在投料位置反馈", "M27.1", "537")]
public bool FirePot2_PotOnIntoFoodPosition{ get; set; }
/// <summary>
/// 2#炒锅在洗锅位置反馈
/// </summary>
[VariableMonitor("2#炒锅在洗锅位置反馈", "M27.2", "538")]
public bool FirePot2_PotOnCleanPosition{ get; set; }
#endregion

#region 机器人数据读取
/// <summary>
/// 1号锅倒荤菜完成
/// </summary>
[VariableMonitor("1号锅倒荤菜完成", "GM500", "4596")]
public bool Robot_FirePot1OutMeal{ get; set; }
/// <summary>
/// 1号炒锅倒素菜1完成
/// </summary>
[VariableMonitor("1号炒锅倒素菜1完成", "GM501", "4597")]
public bool Robot_FirePot1OutVegetables1{ get; set; }
/// <summary>
/// 1号炒锅倒素菜2完成
/// </summary>
[VariableMonitor("1号炒锅倒素菜2完成", "GM502", "4598")]
public bool Robot_FirePot1OutVegetables2{ get; set; }
/// <summary>
/// 1号炒锅倒调料完成
/// </summary>
[VariableMonitor("1号炒锅倒调料完成", "GM503", "4599")]
public bool Robot_FirePot1OutSeasoning{ get; set; }
/// <summary>
/// 1号炒锅倒辅料完成
/// </summary>
[VariableMonitor("1号炒锅倒辅料完成", "GM504", "4600")]
public bool Robot_FirePot1OutAccessories{ get; set; }
/// <summary>
/// 机器人到位,请求1#炒锅倒菜
/// </summary>
[VariableMonitor("机器人到位,请求1#炒锅倒菜", "GM505", "4601")]
public bool Robot_ArriveFirePot1{ get; set; }
/// <summary>
/// 1号炒锅出餐完成
/// </summary>
[VariableMonitor("1号炒锅出餐完成", "GM506", "4602")]
public bool Robot_FirePot1OutFoodComplete{ get; set; }





/// <summary>
/// 2号锅倒荤菜完成
/// </summary>
[VariableMonitor("2号锅倒荤菜完成", "GM510", "4606")]
public bool Robot_FirePot2OutMeal { get; set; }
/// <summary>
/// 2号炒锅倒素菜1完成
/// </summary>
[VariableMonitor("2号炒锅倒素菜1完成", "GM511", "4607")]
public bool Robot_FirePot2OutVegetables1{ get; set; }
/// <summary>
/// 2号炒锅倒素菜2完成
/// </summary>
[VariableMonitor("2号炒锅倒素菜2完成", "GM512", "4608")]
public bool Robot_FirePot2OutVegetables2{ get; set; }
/// <summary>
/// 2号炒锅倒调料完成
/// </summary>
[VariableMonitor("2号炒锅倒调料完成", "GM513", "4609")]
public bool Robot_FirePot2OutSeasoning{ get; set; }
/// <summary>
/// 2号炒锅倒辅料完成
/// </summary>
[VariableMonitor("2号炒锅倒辅料完成", "GM514", "4610")]
public bool Robot_FirePot2OutAccessories{ get; set; }
/// <summary>
/// 机器人到位,请求1#炒锅倒菜
/// </summary>
[VariableMonitor("机器人到位,请求1#炒锅倒菜", "GM515", "4611")]
public bool Robot_ArriveFirePot2{ get; set; }
/// <summary>
/// 2号炒锅出餐完成
/// </summary>
[VariableMonitor("2号炒锅出餐完成", "GM516", "4612")]
public bool Robot_FirePot2OutFoodComplete{ get; set; }
/// <summary>
/// 机器人动作反馈
/// </summary>
[VariableMonitor("机器人动作反馈", "GI5", "5")]
public int Robot_ActionCallback{ get; set; }

#endregion



public DateTime FirePan1_Date;
public DateTime FirePan2_Date;
}
}

+ 65
- 0
BPASmartClient.MorkBF/Model/BF_Food.cs View File

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

namespace BPASmartClient.MorkBF.Model
{
public class BF_Food
{
/// <summary>
/// 菜品名称
/// </summary>
public string FoodName { get; set; }
/// <summary>
/// 菜品ID
/// </summary>
public string FoodID { get; set; }

}

public class BF_PotAction
{
/// <summary>
/// 步骤
/// </summary>
public int FryTime
{
get;
set;
}
/// <summary>
/// 时间
/// </summary>
public int During
{
get;
set;
}
/// <summary>
/// 动作
/// </summary>
public string Actions
{
get;
set;
}
/// <summary>
/// 调料
/// </summary>
public List<int> SeasoningLists
{
get;
set;
}
/// <summary>
/// 菜品
/// </summary>
public List<int> MaterialLists
{
get;
set;
}
}
}

+ 12
- 0
BPASmartClient.MorkBF/OrderLocInfo.cs View File

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

namespace BPASmartClient.MorkBF
{
internal class OrderLocInfo
{
}
}

+ 107
- 0
BPASmartClient.MorkBF/VIew/DebugView.xaml View File

@@ -0,0 +1,107 @@
<UserControl x:Class="BPASmartClient.MorkBF.VIew.DebugView"
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:local="clr-namespace:BPASmartClient.MorkBF.VIew"
xmlns:vm="clr-namespace:BPASmartClient.MorkBF.ViewModel"
mc:Ignorable="d"
Name="调试界面"
d:DesignHeight="900" d:DesignWidth="1600">
<UserControl.DataContext>
<vm:DebugViewModel/>
</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>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<GroupBox Header="炒锅1" FontSize="22">


<WrapPanel Grid.Row="1" Orientation="Horizontal">
<Button Content="复位" Width="110" Margin="10,5" Command="{Binding FirePot_ResetCommand}" CommandParameter="1"/>
<TextBlock Text="加热挡位" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding FireGear}" Margin="10,5" SelectedItem="{Binding FirePot1_FireGear}"/>
<Button Content="加热档位设定" Width="110" Margin="10,5" Command="{Binding FirePot1_SetFireGearCommand}"/>
<Button Content="加热启动" Width="80" Margin="10,5" Command="{Binding FirePot1_StartFireCommand}"/>
<Button Content="加热停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot1_StopFireCommand}"/>
<TextBlock Text="搅拌挡位" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding StirGear}" SelectedItem="{Binding FirePot1_StirGear}" Margin="10,5"/>
<Button Content="搅拌档位设定" Width="110" Margin="10,5" Command="{Binding FirePot1_SetStirGearCommand}"/>
<Button Content="搅拌启动" Width="80" Margin="10,5" Command="{Binding FirePot1_StartStirCommand}"/>
<Button Content="搅拌停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot1_StopStirCommand}"/>
<TextBlock Text="翻转频率" Margin="10,5"/>
<TextBox Width="80" Text="{Binding FirePot1_TurnSpeed}" Margin="10,5"/>
<Button Content="翻转频率设定" Width="110" Margin="10,5" Command="{Binding FirePot1_SetTurnSpeedCommand}"/>
<Button Content="炒锅回原点" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoOriginCommand}" CommandParameter="1"/>
<Button Content="出餐启动" Width="110" Margin="10,5" Command="{Binding FirePot_StartOutFoodCommand}" CommandParameter="1"/>
<Button Content="单独清洗" Width="110" Margin="10,5" Command="{Binding FirePot_CleanCommand}" CommandParameter="1"/>
<Button Content="抽水启动" Width="110" Margin="10,5" Command="{Binding FirePot_StartPumpWaterCommand}" CommandParameter="1"/>
<Button Content="抽油启动" Width="110" Margin="10,5" Command="{Binding FirePot_StartPumpOilCommand}" CommandParameter="1"/>
<Button Content="炒锅去炒制位置1" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoP1Command}" CommandParameter="1"/>
<Button Content="炒锅去炒制位置2" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoP2Command}" CommandParameter="1"/>
<Button Content="炒锅去炒制位置3" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoP3Command}" CommandParameter="1"/>
<Button Content="炒锅去炒制位置4" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoP4Command}" CommandParameter="1"/>
<Button Content="炒锅去出餐倒料位置" Width="140" Margin="10,5" Command="{Binding FirePot_PotGotoOutFoodPositiongCommand}" CommandParameter="1"/>
<Button Content="炒锅去投料位置" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoInFoodPositionCommand}" CommandParameter="1"/>
</WrapPanel>

</GroupBox>
<GroupBox Grid.Row="1" Header="炒锅2" FontSize="22">
<WrapPanel Grid.Row="1" Orientation="Horizontal">
<Button Content="复位" Width="110" Margin="10,5" Command="{Binding FirePot_ResetCommand}" CommandParameter="1"/>
<TextBlock Text="加热挡位" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding FireGear}" Margin="10,5" SelectedItem="{Binding FirePot2_FireGear}"/>
<Button Content="加热档位设定" Width="110" Margin="10,5" Command="{Binding FirePot2_SetFireGearCommand}"/>
<Button Content="加热启动" Width="80" Margin="10,5" Command="{Binding FirePot2_StartFireCommand}"/>
<Button Content="加热停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot2_StopFireCommand}"/>
<TextBlock Text="搅拌挡位" Margin="10,5"/>
<ComboBox Width="80" ItemsSource="{Binding StirGear}" SelectedItem="{Binding FirePot2_StirGear}" Margin="10,5"/>
<Button Content="搅拌档位设定" Width="110" Margin="10,5" Command="{Binding FirePot2_SetStirGearCommand}"/>
<Button Content="搅拌启动" Width="80" Margin="10,5" Command="{Binding FirePot2_StartStirCommand}"/>
<Button Content="搅拌停止" Width="80" Margin="10,5,30,5" Command="{Binding FirePot2_StopStirCommand}"/>
<TextBlock Text="翻转频率" Margin="10,5"/>
<TextBox Width="80" Text="{Binding FirePot2_TurnSpeed}" Margin="10,5"/>
<Button Content="翻转频率设定" Width="110" Margin="10,5" Command="{Binding FirePot2_SetTurnSpeedCommand}"/>
<Button Content="炒锅回原点" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoOriginCommand}" CommandParameter="2"/>
<Button Content="出餐启动" Width="110" Margin="10,5" Command="{Binding FirePot_StartOutFoodCommand}" CommandParameter="2"/>
<Button Content="单独清洗" Width="110" Margin="10,5" Command="{Binding FirePot_CleanCommand}" CommandParameter="2"/>
<Button Content="抽水启动" Width="110" Margin="10,5" Command="{Binding FirePot_StartPumpWaterCommand}" CommandParameter="2"/>
<Button Content="抽油启动" Width="110" Margin="10,5" Command="{Binding FirePot_StartPumpOilCommand}" CommandParameter="2"/>
<Button Content="炒锅去炒制位置1" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoP1Command}" CommandParameter="2"/>
<Button Content="炒锅去炒制位置2" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoP2Command}" CommandParameter="2"/>
<Button Content="炒锅去炒制位置3" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoP3Command}" CommandParameter="2"/>
<Button Content="炒锅去炒制位置4" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoP4Command}" CommandParameter="2"/>
<Button Content="炒锅去出餐倒料位置" Width="140" Margin="10,5" Command="{Binding FirePot_PotGotoOutFoodPositiongCommand}" CommandParameter="2"/>
<Button Content="炒锅去投料位置" Width="110" Margin="10,5" Command="{Binding FirePot_PotGotoInFoodPositionCommand}" CommandParameter="2"/>
</WrapPanel>
</GroupBox>
<GroupBox Grid.Row="3" Header="机器人" FontSize="22">
<WrapPanel Orientation="Horizontal">
<Button Content="机器人启动" Width="110" Margin="10,5" Command="{Binding RobotStartCommand}"/>
<Button Content="复位" Width="110" Margin="10,5" Command="{Binding RobotResetCommand}"/>
<Button Content="程序启动" Width="110" Margin="10,5" Command="{Binding RobotProgramStartCommand}"/>
<Button Content="机器人停止" Width="110" Margin="10,5" Command="{Binding RobotStopCommand}"/>
<Button Content="1号炒锅允许机器人投料" Width="160" Margin="10,5" Command="{Binding Robot_Pot1AllowInMaterailCommand}"/>
<Button Content="1号炒锅出餐倒料到减速位" Width="160" Margin="10,5" Command="{Binding Robot_Pot1OutFoodInSlowDownCommand}"/>
<Button Content="1号炒锅出餐倒料完成" Width="160" Margin="10,5" Command="{Binding Robot_Pot1OutFoodCommand}"/>
<Button Content="2号炒锅允许机器人投料" Width="160" Margin="10,5" Command="{Binding Robot_Pot2AllowInMaterailCommand}"/>
<Button Content="2号炒锅出餐倒料到减速位" Width="160" Margin="10,5" Command="{Binding Robot_Pot2OutFoodInSlowDownCommand}"/>
<Button Content="2号炒锅出餐倒料完成" Width="160" Margin="10,5" Command="{Binding Robot_Pot2OutFoodCommand}"/>
<TextBlock Text="机器人取菜出餐动作" Margin="10,5"/>
<ComboBox ItemsSource="{Binding RobotActions}" DisplayMemberPath="Value" SelectedValuePath="Key" SelectedValue="{Binding RobotAction}" Height="30" Width="200" Margin="10,0"/>
<Button Content="动作启动" Width="100" Margin="10,5" Command="{Binding RobotActionStartCommand}"/>
</WrapPanel>
</GroupBox>
</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.MorkBF/VIew/DebugView.xaml.cs View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.Navigation;
using System.Windows.Shapes;

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

+ 50
- 0
BPASmartClient.MorkBF/VIew/FoodManagerView.xaml View File

@@ -0,0 +1,50 @@
<Window x:Class="BPASmartClient.MorkBF.VIew.FoodManagerView"
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.MorkBF.VIew"
mc:Ignorable="d"
Title="FoodManagerView" Height="450" Width="800" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" WindowStyle="None" AllowsTransparency="True" Background="Transparent">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Height="45">
<TextBlock Text="菜品名称:" Margin="10,0"/>
<TextBox Text="{Binding FoodName}" Width="160" Margin="10,0" FontSize="16"/>
<Button Content="添加新步骤" Margin="10,0" Style="{StaticResource ButtonStyle}" Height="36" />
<Button Content="保存" Margin="10,0" Style="{StaticResource ButtonStyle}" Height="36" Width="80"/>
<Button Content="退出" Margin="10,0" Style="{StaticResource ButtonStyle}" Height="36" Width="80"/>
</StackPanel>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ListBox >
<ListBox.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ComboBox />
<Button Content="删除"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Grid>
</Window>

+ 27
- 0
BPASmartClient.MorkBF/VIew/FoodManagerView.xaml.cs View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.MorkBF.VIew
{
/// <summary>
/// FoodManagerView.xaml 的交互逻辑
/// </summary>
public partial class FoodManagerView : Window
{
public FoodManagerView()
{
InitializeComponent();
}
}
}

+ 242
- 0
BPASmartClient.MorkBF/VIew/Monitor.xaml View File

@@ -0,0 +1,242 @@
<UserControl
x:Class="BPASmartClient.MorkBF.View.Monitor"
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:local="clr-namespace:BPASmartClient.MorkBF.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.MorkBF.ViewModel"
Name="监控画面"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:MonitorViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<!--<convert:TextDisplayConvert x:Key="textDisplayConvert" />
<convert:IsEnableConvert x:Key="isEnableConvert" />
<convert:AnalogAlarmConvert x:Key="analogAlarmConvert" />
<convert:DiscreteAlarmConvert x:Key="discreteAlarmConvert" />
<convert:AlarmTypeTextConvert x:Key="alarmTypeTextConvert" />-->
<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" />

<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>

<Style x:Key="TextBoxStyle" TargetType="TextBox">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="22" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" />
<Setter Property="BorderBrush" Value="#FF23CACA" />
<Setter Property="CaretBrush" Value="Aqua" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>

<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>

<!--#region 表格标题栏设置-->
<Grid Background="#dd2AB2E7">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*" />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="0.7*" />
<ColumnDefinition Width="0.7*" />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="ID" />

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

<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="PLC 地址" />


<Grid Grid.Column="3">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="注释" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,0,0"
Cursor="SizeWE" />
</Grid>



<Grid Grid.Column="4">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="Modbus TCP 地址" />
<Border
BorderBrush="{StaticResource TitleBorderColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<TextBlock
Grid.Column="5"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="{StaticResource TitleFontColor}"
Text="当前值" />

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

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

<TextBlock
Grid.Column="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"
Text="{Binding Id}" />

<Grid Grid.Column="1">
<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"
Text="{Binding VarName}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>


<TextBlock
Grid.Column="2"
Margin="5,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"
Text="{Binding PLCAddress}" />

<Grid Grid.Column="3">
<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"
Text="{Binding Notes}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,0,0" />
</Grid>

<Grid Grid.Column="4">
<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"
Text="{Binding ModbusTcpAddress}" />
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" />
</Grid>

<TextBlock
Grid.Column="5"
Margin="5,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
FontSize="14"
Foreground="{StaticResource FontColor}"
Text="{Binding CurrentValue}" />

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

</Grid>

<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<!--#endregion-->


</Grid>

</UserControl>

+ 28
- 0
BPASmartClient.MorkBF/VIew/Monitor.xaml.cs View File

@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.Navigation;
using System.Windows.Shapes;

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

+ 373
- 0
BPASmartClient.MorkBF/ViewModel/DebugViewModel.cs View File

@@ -0,0 +1,373 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmartClient.Helper;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;

namespace BPASmartClient.MorkBF.ViewModel
{
[INotifyPropertyChanged]
partial class DebugViewModel
{
/// <summary>
/// 加热挡位
/// </summary>
public ObservableCollection<int> FireGear { get; set; } = new ObservableCollection<int>() { 1, 2, 3, 4, 5 };
/// <summary>
/// 搅拌挡位
/// </summary>
public ObservableCollection<int> StirGear { get; set; } = new ObservableCollection<int>() { 1, 2, 3, 4, 5 };

[ObservableProperty]
private int _firePot1_FireGear = 0;
[ObservableProperty]
private int _firePot2_FireGear = 0;
[ObservableProperty]
private int _firePot1_StirGear = 0;
[ObservableProperty]
private int _firePot2_StirGear = 0;
[ObservableProperty]
private int _firePot1_TurnSpeed;
[ObservableProperty]
private int _firePot2_TurnSpeed;
#region 炒锅1

/// <summary>
/// 设定加热挡位
/// </summary>
[RelayCommand]
private void FirePot1_SetFireGear()
{
ActionManage.GetInstance.Send("FirePot1_SetFireGear",new List<int> { FirePot1_FireGear});
}
/// <summary>
/// 加热启动
/// </summary>
[RelayCommand]
private void FirePot1_StartFire()
{
ActionManage.GetInstance.Send("FirePot1_StartFire",true);
}
/// <summary>
/// 关闭加热
/// </summary>
[RelayCommand]
private void FirePot1_StopFire()
{
ActionManage.GetInstance.Send("FirePot1_StopFire",false);
}
/// <summary>
/// 设定搅拌挡位
/// </summary>
[RelayCommand]
private void FirePot1_SetStirGear()
{
ActionManage.GetInstance.Send("FirePot1_SetStirGear",new List<int> { FirePot1_StirGear});
}
/// <summary>
/// 搅拌启动
/// </summary>
[RelayCommand]
private void FirePot1_StartStir()
{
ActionManage.GetInstance.Send("FirePot1_StartStir",true);
}
/// <summary>
/// 搅拌停止
/// </summary>
[RelayCommand]
private void FirePot1_StopStir()
{
ActionManage.GetInstance.Send("FirePot1_StopStir",false);
}
/// <summary>
/// 翻转频率设定
/// </summary>
[RelayCommand]
private void FirePot1_SetTurnSpeed()
{
if (FirePot1_TurnSpeed > 800) FirePot1_TurnSpeed = 800;
ActionManage.GetInstance.Send("FirePot1_SetTurnSpeed",new List<int> { FirePot1_TurnSpeed});
}
#endregion

#region 炒锅2
/// <summary>
/// 设定加热挡位
/// </summary>
[RelayCommand]
private void FirePot2_SetFireGear()
{
ActionManage.GetInstance.Send("FirePot2_SetFireGear", new List<int> { FirePot2_FireGear });
}
/// <summary>
/// 加热启动
/// </summary>
[RelayCommand]
private void FirePot2_StartFire()
{
ActionManage.GetInstance.Send("FirePot2_StartFire", true);
}
/// <summary>
/// 关闭加热
/// </summary>
[RelayCommand]
private void FirePot2_StopFire()
{
ActionManage.GetInstance.Send("FirePot2_StopFire", false);
}
/// <summary>
/// 设定搅拌挡位
/// </summary>
[RelayCommand]
private void FirePot2_SetStirGear()
{
ActionManage.GetInstance.Send("FirePot2_SetStirGear", new List<int> { FirePot2_StirGear });
}
/// <summary>
/// 搅拌启动
/// </summary>
[RelayCommand]
private void FirePot2_StartStir()
{
ActionManage.GetInstance.Send("FirePot2_StartStir", true);
}
/// <summary>
/// 搅拌停止
/// </summary>
[RelayCommand]
private void FirePot2_StopStir()
{
ActionManage.GetInstance.Send("FirePot1_StopStir", false);
}
/// <summary>
/// 翻转频率设定
/// </summary>
[RelayCommand]
private void FirePot2_SetTurnSpeed()
{
if (FirePot1_TurnSpeed > 800) FirePot1_TurnSpeed = 800;
ActionManage.GetInstance.Send("FirePot2_SetTurnSpeed", new List<int> { FirePot2_TurnSpeed });
}
#endregion

#region 炒锅通用
/// <summary>
/// 复位
/// </summary>
[RelayCommand]
private void FirePot_Reset(object o)
{
ActionManage.GetInstance.Send("FirePot1_Reset", o);
}
/// <summary>
/// 炒锅回原点
/// </summary>
[RelayCommand]
private void FirePot_PotGotoOrigin(object o)
{
ActionManage.GetInstance.Send("FirePot_PotGotoOrigin", o);
}
/// <summary>
/// 炒锅去位置1
/// </summary>
[RelayCommand]
private void FirePot_PotGotoP1(object o)
{
ActionManage.GetInstance.Send("FirePot_PotGotoP1", o);
}
/// <summary>
///炒锅去位置2
/// </summary>
[RelayCommand]
private void FirePot_PotGotoP2(object o)
{
ActionManage.GetInstance.Send("FirePot_PotGotoP2", o);
}
/// <summary>
/// 炒锅去位置3
/// </summary>
[RelayCommand]
private void FirePot_PotGotoP3(object o)
{
ActionManage.GetInstance.Send("FirePot_PotGotoP3", o);
}
/// <summary>
/// 炒锅去位置4
/// </summary>
[RelayCommand]
private void FirePot_PotGotoP4(object o)
{
ActionManage.GetInstance.Send("FirePot_PotGotoP4", o);
}
/// <summary>
/// 炒锅去出餐位置
/// </summary>
[RelayCommand]
private void FirePot_PotGotoOutFoodPositiong(object o)
{
ActionManage.GetInstance.Send("FirePot_PotGotoOutFoodPositiong", o);
}
/// <summary>
/// 炒锅去投料位置
/// </summary>
[RelayCommand]
private void FirePot_PotGotoInFoodPosition(object o)
{
ActionManage.GetInstance.Send("FirePot_PotGotoInFoodPosition", o);
}
/// <summary>
/// 出餐启动
/// </summary>
[RelayCommand]
private void FirePot_StartOutFood(object o)
{
ActionManage.GetInstance.Send("FirePot_StartOutFood", o);
}
/// <summary>
/// 清洗
/// </summary>
[RelayCommand]
private void FirePot_Clean(object o)
{
ActionManage.GetInstance.Send("FirePot_Clean",o);
}
/// <summary>
/// 抽水启动
/// </summary>
[RelayCommand]
private void FirePot_StartPumpWater(object o)
{
ActionManage.GetInstance.Send("FirePot_StartPumpWater", o);
}
/// <summary>
/// 抽油启动
/// </summary>
[RelayCommand]
private void FirePot_StartPumpOil(object o)
{
ActionManage.GetInstance.Send("FirePot_StartPumpOil", o);
}


#endregion


#region 机器人
public Dictionary<int,string> RobotActions { get; set; } = new Dictionary<int, string>()
{
{0, "无任务"},
{1, "取1号炒锅荤菜盆倒1号炒锅"},
{2, "取1号炒锅素菜盆1倒1号炒锅"},
{3, "取1号炒锅素菜盆2倒1号炒锅"},
{4, "取1号炒锅调料盆倒入1号炒锅"},
{5, "取1号炒锅辅料盆1倒入1号炒锅"},
{6, "取1号空盆出餐"},
{20, "取2号炒锅荤菜盆1倒1号炒锅"},
{21, "取2号炒锅素菜盆1倒1号炒锅"},
{22, "取2号炒锅素菜盆2倒1号炒锅"},
{23, "取2号炒锅调料盆倒入1号炒锅"},
{24, "取2号炒锅辅料盆1倒入1号炒锅"},
{25, "取2号空盆出餐"},
};

[ObservableProperty]
private int _robotAction;
/// <summary>
/// 机器人启动
/// </summary>
[RelayCommand]
private void RobotStart()
{
ActionManage.GetInstance.Send("RobotStart");
}
/// <summary>
/// 机器人停止
/// </summary>
[RelayCommand]
private void RobotStop()
{
ActionManage.GetInstance.Send("RobotStop");
}
/// <summary>
/// 复位
/// </summary>
[RelayCommand]
private void RobotReset()
{
ActionManage.GetInstance.Send("RobotReset");
}
/// <summary>
/// 程序启动
/// </summary>
[RelayCommand]
private void RobotProgramStart()
{
ActionManage.GetInstance.Send("RobotProgramStart");
}
/// <summary>
/// 1号炒锅允许机器人投料
/// </summary>
[RelayCommand]
private void Robot_Pot1AllowInMaterail()
{
ActionManage.GetInstance.Send("Robot_Pot1AllowInMaterail");
}
/// <summary>
/// 1号炒锅出餐倒料到减速位
/// </summary>
[RelayCommand]
private void Robot_Pot1OutFoodInSlowDown()
{
ActionManage.GetInstance.Send("Robot_Pot1OutFoodInSlowDown");
}
/// <summary>
/// 1号炒锅出餐倒料完成
/// </summary>
[RelayCommand]
private void Robot_Pot1OutFood()
{
ActionManage.GetInstance.Send("Robot_Pot1OutFood");
}
/// <summary>
/// 2号炒锅允许机器人投料
/// </summary>
[RelayCommand]
private void Robot_Pot2AllowInMaterail()
{
ActionManage.GetInstance.Send("Robot_Pot2AllowInMaterail");
}
/// <summary>
/// 2号炒锅出餐倒料到减速位
/// </summary>
[RelayCommand]
private void Robot_Pot2OutFoodInSlowDown()
{
ActionManage.GetInstance.Send("Robot_Pot2OutFoodInSlowDown");
}
/// <summary>
/// 2号炒锅出餐倒料完成
/// </summary>
[RelayCommand]
private void Robot_Pot2OutFood()
{
ActionManage.GetInstance.Send("Robot_Pot2OutFood");
}

/// <summary>
/// 机器人动作启动
/// </summary>
[RelayCommand]
private void RobotActionStart()
{
ActionManage.GetInstance.Send("RobotProgramStart",RobotAction );
}

#endregion
}
}

+ 25
- 0
BPASmartClient.MorkBF/ViewModel/MonitorViewModel.cs View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmartClient.Business;
using BPASmartClient.Device;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;

namespace BPASmartClient.MorkBF.ViewModel
{
public class MonitorViewModel : ObservableObject
{
public MonitorViewModel()
{

}

public static int DeviceId { get; set; }

public ObservableCollection<VariableMonitor> variableMonitors { get; set; } = Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices()?.FirstOrDefault(p => p.DeviceId == DeviceId)?.variableMonitors;

}
}

+ 4
- 2
BPASmartClient.MorkF/BPASmartClient.MorkF.csproj View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
@@ -10,11 +10,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Models" Version="1.0.13" />
<PackageReference Include="BPA.Message" Version="1.0.74" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" />
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" />
<ProjectReference Include="..\BPASmartClient.Modbus\BPASmartClient.Modbus.csproj" />
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" />
</ItemGroup>



+ 1169
- 2022
BPASmartClient.MorkF/Control_MorkF.cs
File diff suppressed because it is too large
View File


+ 100
- 268
BPASmartClient.MorkF/GVL_MorkF.cs View File

@@ -10,100 +10,105 @@ namespace BPASmartClient.MorkF
{
internal class GVL_MorkF
{
/// <summary>
/// 初始化完成状态
/// </summary>
public bool InitialComplete { get; set; }
/// <summary>
/// 供盘 模组状态 忙碌1 空闲0
/// </summary>
public bool ProvidePlateModule { get; set; }
/// <summary>
/// 供盘完成状态
/// </summary>
public bool ProvidePlateComplete { get; set; }
/// <summary>
/// 清洗模组1状态 忙碌1 空闲0
/// 小炒队列
/// </summary>
public bool CleanModule { get; set; }
public ConcurrentQueue<OrderLocInfo> StirFryGoodsQuenes = new ConcurrentQueue<OrderLocInfo>();

/// <summary>
/// 清洗模组2状态 忙碌1 空闲0
/// </summary>
public bool SecondCleanModule { get; set; }
/// <summary>
/// 清洗模组1完成状态
/// </summary>
public bool CleanComplete { get; set; }

// <summary>
/// 清洗模组2完成状态
/// </summary>
public bool SecondCleanComplete { get; set; }
/// <summary>
/// 锅灶1状态 忙碌1 空闲0
/// </summary>
public bool KitchenOneStatus { get; set; }
public bool IsAuto = true;

#region 炒锅1
/// <summary>
/// 锅灶1状态 忙碌1 空闲0
/// 炒锅是否在工作状态中
/// </summary>
public bool KitchenSecondStatus { get; set; }
public bool FryWorking { get; set; }
/// <summary>
/// 锅灶1注油完成状态
/// 炒锅自动模式
/// </summary>
public bool FallOilComplete { get; set; }
public bool AutoMode { get; set; }
/// <summary>
/// 锅灶2注油完成状态
/// 炒锅1初始化完成
/// </summary>
public bool SecondOilComplete { get; set; }
public bool FryPot1_InitialComplete { get; set; }
/// <summary>
/// 锅灶1翻转机上升完成状态
/// 炒锅1允许HBOT放盒
/// </summary>
public bool TurnMachineUpComplete { get; set; }
public bool FryPot1_HOBTPut { get; set; }
/// <summary>
/// 锅灶2翻转机上升完成状态
/// 炒锅1允许HBOT取盒
/// </summary>
public bool SecondTurnMachineUpComplete { get; set; }
public bool FryPot1_HOBTGet { get; set; }
/// <summary>
/// 锅灶1翻转机下降完成状态
/// 往炒锅倒菜完成
/// </summary>
public bool TurnMachineDownComplete { get; set; }

/// <summary>
/// 锅灶2翻转机下降完成状态
/// </summary>
public bool SecondTurnMachineDownComplete { get; set; }
public bool FryPot1_MaterialIntoPot { get; set; }
/// <summary>
/// 料仓旋转到位状态
/// 出餐完成
/// </summary>
public bool MaterialArriveComplete { get; set; }
public bool OutFoodCompelete { get; set; }
/// <summary>
/// 机器人空闲状态 1:忙碌 0:空闲
/// 允许出餐倒菜
/// </summary>
public bool RoobotIdle { get; set; }
public bool CanOutFood { get; set; }
/// <summary>
/// 放锅至灶台1完成状态
/// 窗口取餐完成
/// </summary>
public bool PutPotToKitchenComlete { get; set; }

public bool GetFoodCompelete { set; get; }
/// <summary>
/// 放锅至灶台2完成状态
/// 允许倒洗锅水
/// </summary>
public bool PutPotToSecondKitchenComlete { get; set; }
public bool CanOutPotWashingWater { get; set; }
/// <summary>
/// 机器人取料完成状态
/// 搅拌臂在原点位
/// </summary>
public bool TakeMaterialComplete { get; set; }
public bool ArmOnOrigin { get; set; }
/// <summary>
/// 机器人放锅至清洗台1完成状态
/// 搅拌臂在工作位
/// </summary>
public bool PlaceRinseTableComplete { get; set; }
public bool ArmOnWorking { get; set; }
/// <summary>
/// 机器人放锅至清洗台2完成状态
/// 锅在原点位
/// </summary>
public bool PlaceRinseSecondTableComplete { get; set; }
public bool PotOnOrigin { get; set; }

#endregion

#region 调料通道
public bool PassWay1_1Compelete { get; set; }
public bool PassWay1_2Compelete { get; set; }
public bool PassWay1_3Compelete { get; set; }
public bool PassWay1_4Compelete { get; set; }
public bool PassWay1_5Compelete { get; set; }
public bool PassWay1_6Compelete { get; set; }
public bool PassWay1_7Compelete { get; set; }
public bool PassWay1_8Compelete { get; set; }
public bool PassWay1_9Compelete { get; set; }
public bool PassWay1_10Compelete { get; set; }
public bool PassWay1_11Compelete { get; set; }
public bool PassWay1_12Compelete { get; set; }
public bool PassWay1_13Compelete { get; set; }
public bool PassWay1_14Compelete { get; set; }
public Dictionary<int, bool> PassWay1_Compelete = new Dictionary<int, bool>();
#endregion

public GVL_MorkF()
{
PassWay1_Compelete.Add(1,PassWay1_1Compelete);
PassWay1_Compelete.Add(2,PassWay1_2Compelete);
PassWay1_Compelete.Add(3,PassWay1_3Compelete);
PassWay1_Compelete.Add(4,PassWay1_4Compelete);
PassWay1_Compelete.Add(5,PassWay1_5Compelete);
PassWay1_Compelete.Add(6,PassWay1_6Compelete);
PassWay1_Compelete.Add(7,PassWay1_7Compelete);
PassWay1_Compelete.Add(8,PassWay1_8Compelete);
PassWay1_Compelete.Add(9,PassWay1_9Compelete);
PassWay1_Compelete.Add(10,PassWay1_10Compelete);
PassWay1_Compelete.Add(11,PassWay1_11Compelete);
PassWay1_Compelete.Add(12,PassWay1_12Compelete);
PassWay1_Compelete.Add(13,PassWay1_13Compelete);
PassWay1_Compelete.Add(14,PassWay1_14Compelete);
}

/// <summary>
/// 订单取配料队列
/// </summary>
@@ -112,185 +117,12 @@ namespace BPASmartClient.MorkF
/// 订单供盘队列
/// </summary>
public ConcurrentQueue<OrderLocInfo> TakePlateQueue = new ConcurrentQueue<OrderLocInfo>();
/// <summary>
/// 存放主流程当前订单唯一ID
/// </summary>
public string MainCurrentOrderId { get; set; }
/// <summary>
/// 存放辅流程当前订单唯一ID
/// </summary>
public string MinorCurrentOrderId { get; set; }
/// <summary>
/// PLC上升沿初始化触发信号
/// </summary>
public bool DevicDataInite { set; get; }
/// <summary>
/// 取素菜A料完成
/// </summary>
public bool TakeVegBurdenAComplete { get; set; }
/// <summary>
/// 取荤菜A料完成
/// </summary>
public bool TakeMeatBurdenAComplete { get; set; }

/// <summary>
/// 所有A料下锅完成
/// </summary>
public bool TakeAllBurdenAComplete { get; set; }
/// <summary>
/// 取素菜B料完成
/// </summary>
public bool TakeVegBurdenBComplete { get; set; }
/// <summary>
/// 所有B料下锅完成
/// </summary>
public bool TakeAllBurdenBComplete { get; set; }
/// <summary>
/// 取C料完成
/// </summary>
public bool TakeBurdenCComplete { get; set; }
/// <summary>
/// 除C料外,所有配料下锅标志
/// </summary>
public bool TakeAllBurdenComplete { get; set; }
/// <summary>
/// 锅1到位 true:到位 false:未到位
/// </summary>
public bool PotInPlace { get; set; }
/// <summary>
/// 锅2到位 true:到位 false:未到位
/// </summary>
public bool SecondPotInPlace { get; set; }
/// <summary>
/// true:烹饪完成
/// </summary>
public bool CookingComplete { get; set; }
/// <summary>
/// 注油完成
/// </summary>
public bool AddOilComplete { get; set; }
/// <summary>
/// 1号锅倒料完成
/// </summary>
public bool FallMaterialComplete { get; set; }
/// <summary>
/// 2号锅倒料完成
/// </summary>
public bool SecondFallMaterialComplete { get; set; }
/// <summary>
/// 供盘互锁
/// </summary>
public bool TakePlateLock { get; set; }
/// <summary>
/// 取锅互锁
/// </summary>
public bool TakePotLock { get; set; }
/// <summary>
/// 取素菜A料互锁
/// </summary>
public bool TakeVegALock { get; set; }
/// <summary>
/// 取荤菜A料互锁
/// </summary>
public bool TakeMeatALock { get; set; }
/// <summary>
/// 取素菜B料互锁
/// </summary>
public bool TakeVegBLock { get; set; }
/// <summary>
/// 取C料互锁
/// </summary>
public bool TakeBurdenCLcok { get; set; }
/// <summary>
/// 烹饪任务互锁
/// </summary>
public bool CookingLock { get; set; }
/// <summary>
/// 转台互锁
/// </summary>
public bool TurnTableLock { get; set; }
/// <summary>
/// 主流程自锁
/// </summary>
public bool MainProcessExcuteLock { get; set; }
/// <summary>
/// 辅流程自锁
/// </summary>
public bool MinorProcessExcuteLock { get; set; }
/// <summary>
/// 开始取料标志
/// </summary>
public bool AllowTakeMaterial { get; set; }
/// <summary>
/// 主流程订单完成标志
/// </summary>
public bool MainOutMealComplete { get; set; }
/// <summary>
/// 辅流程订单完成标志
/// </summary>
public bool MinorOutMealComplete { get; set; }
/// <summary>
/// 主流程订单取料结束
/// </summary>
public bool MainOrderMaterialCom { get; set; }
/// <summary>
/// 主流程是否取料判断
/// </summary>
public bool MainHasTakeMaterial { get; set; }
/// <summary>
/// 主流程等待
/// </summary>
public bool MainProcessWait { get; set; }
/// <summary>
/// 辅流程等待
/// </summary>
public bool MinorProcessWait { get; set; }
/// <summary>
/// 辅流程订单取料结束
/// </summary>
public bool MinorOrderMaterialCom { get; set; }
/// <summary>
/// 辅流程是否取料判断
/// </summary>
public bool MinorHasTakeMaterial { get; set; }
/// <summary>
/// 存储订单对应流程对象
/// </summary>
public List<StirFryBom> listStirBom=new List<StirFryBom>();




/// <summary>
/// 下配料次数
/// </summary>
public int MaterialCount { get; set; }
/// <summary>
/// 允许执行辅流程标识
/// </summary>
public bool MinorProcessFlag { get; set; }
/// <summary>
/// 辅流程执行状态
/// </summary>
public bool MinorProessStatus { get; set; }
/// <summary>
/// 允许执行主流程标识
/// </summary>
public bool MainProcessFlag { get; set; } = true;
/// <summary>
/// 主流程执行状态
/// </summary>
public bool MainProcessStatus { get; set; } = true;
/// <summary>
/// 当前放锅位置 1:1号锅 2: 2号锅
/// </summary>
public int CurrentPutPotLoc { get; set; }
/// <summary>
/// 主流程所执行的锅位置
/// </summary>
public int MainProcessPotLoc { get; set; }
/// <summary>
/// 辅流程所执行的锅位置
/// </summary>
public int MinorProcessPotLoc { get; set; }


#region 单口锅逻辑变量
@@ -303,39 +135,39 @@ namespace BPASmartClient.MorkF

public Dictionary<int,string> StartPassWay { get; set; } = new Dictionary<int, string>()
{
{1,"M3.0" },
{2,"M3.1" },
{3,"M3.2" },
{4,"M3.3" },
{5,"M3.4" },
{6,"M3.5" },
{7,"M3.6" },
{8,"M3.7" },
{9,"M4.0" },
{10,"M4.1" },
{11,"M4.2" },
{12,"M4.3" },
{13,"M4.4" },
{13,"M4.5" },
{1,"LB24" },
{2,"LB25" },
{3,"LB26" },
{4,"LB27" },
{5,"LB28" },
{6,"LB29" },
{7,"LB30" },
{8,"LB31" },
{9,"LB32" },
{10,"LB33" },
{11,"LB34" },
{12,"LB35" },
{13,"LB36" },
{14,"LB37" },

};

public Dictionary<int, string> PassWayValue { get; set; } = new Dictionary<int, string>()
{
{1,"VW200" },
{2,"VW202" },
{3,"VW204" },
{4,"VW206" },
{5,"VW208" },
{6,"VW210" },
{7,"VW212" },
{8,"VW214" },
{9,"VW216" },
{10,"VW218" },
{11,"VW220" },
{12,"VW222" },
{13,"VW224" },
{13,"VW226" },
{1,"LW0" },
{2,"LW1" },
{3,"LW2" },
{4,"LW3" },
{5,"LW4" },
{6,"LW5" },
{7,"LW6" },
{8,"LW7" },
{9,"LW8" },
{10,"LW9" },
{11,"LW10" },
{12,"LW11" },
{13,"LW12" },
{14,"LW13" },
};
}
}


+ 14
- 0
BPASmartClient.MorkF/Model/LocalPotStep.cs View File

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

namespace BPASmartClient.MorkF.Model
{
public class LocalPotStep
{
public StirFryGoods LocalstirFryGoods { get; set; } = new StirFryGoods();
}
}

+ 14
- 0
BPASmartClient.MorkF/Model/StirFryPushMessages.cs View File

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

namespace BPASmartClient.MorkF.Model
{
public class StirFryPushMessages
{
public StirFryPushMessage pushMessage = new StirFryPushMessage();
}
}

+ 4
- 2
BPASmartClient.MorkF/OrderLocInfo.cs View File

@@ -1,4 +1,5 @@
using System;
using BPA.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -9,8 +10,9 @@ namespace BPASmartClient.MorkF
internal class OrderLocInfo
{
public string SuborderId { get; set; }
public List<int> MaterialLoc { get; set; } = new List<int>();//物料A位置
public List<PotActions> StirPotActions = new List<PotActions>();
public ushort RecipeNumber { get; set; }
public int BatchingId { get; set; }
public string GoodName { get; set; }
}
}

+ 92
- 34
BPASmartClient.MorkF/View/DebugView.xaml View File

@@ -4,8 +4,12 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkF.View"
xmlns:vm="clr-namespace:BPASmartClient.MorkF.ViewModel"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="1300">
d:DesignHeight="900" d:DesignWidth="1300">
<UserControl.DataContext>
<vm:DebugViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
@@ -16,38 +20,92 @@
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="120" ></RowDefinition>
<RowDefinition Height="100"></RowDefinition>
<RowDefinition Height="81" ></RowDefinition>
<RowDefinition Height="81" ></RowDefinition>
<RowDefinition Height="285"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<GroupBox Header="设备控制" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" Height="120">
<WrapPanel Orientation="Horizontal" VerticalAlignment="Top" Margin="0,5,0,0">
<Button Content="初始化" Command="{Binding PlcInite}" Margin="10,0,10,0" Cursor="Hand"></Button>
<Button Content="模拟订单" Command="{Binding SimulateOrder}" Margin="10,0,10,0" Cursor="Hand"></Button>
<Button Content="自动模式" Command="{ Binding AutoModel}" Margin="10,0,10,0" Cursor="Hand"></Button>
<Button Content="手动模式" Command="{Binding ManualModel}" Margin="10,0,10,0"></Button>
<Button Content="打开抽风" Command="{Binding OpenExhaust}" Margin="10,0,10,0"></Button>
<Button Content="关闭抽风" Command="{Binding CloaseExhaust}" Margin="10,0,10,0"></Button>
<Button Content="料仓1" Command="{Binding MaterialOne}" Margin="10,0,10,0"></Button>
<Button Content="料仓2" Command="{Binding MaterialTwo}" Margin="10,0,10,0"></Button>
<Button Content="料仓3" Command="{Binding MaterialThree}" Margin="10,0,10,0"></Button>
<Button Content="料仓4" Command="{Binding MaterialFour}" Margin="10,0,10,0"></Button>
<Button Content="料仓5" Command="{Binding MaterialFive}" Margin="10,0,10,0"></Button>
<Button Content="供盘" Command="{Binding OutPlate}" Margin="10,0,10,0"></Button>
<Button Content="清洗模组1启动" Command="{Binding StartQXOne}" Margin="10,0,10,0"></Button>
<Button Content="清洗模组2启动" Command="{Binding StartQXTwo}" Margin="10,0,10,0" Cursor="Hand"></Button>
<CheckBox Name="checkValue" Content="运行模拟订单程序" Margin="10,10,10,0" IsChecked="{Binding SimOrderEnable}"></CheckBox>
</WrapPanel>
<GroupBox Header="设备控制" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" >
<Grid Height="50">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<WrapPanel Orientation="Horizontal">
<TextBlock Text="炒锅选择:" Margin="10,0"/>
<ComboBox ItemsSource="{Binding lstFry}" Width="80" Margin="10,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center"
SelectedValue="{Binding FryGear}" SelectedIndex="0"/>
<Button Content="设定" Margin="0,0,30,0" Command="{Binding SetFry}"/>
<Button Content="炒锅初始化" Command="{Binding PlcInite}" Cursor="Hand" Margin="10,0"/>
<Button Content="炒锅复位" Command="{Binding Plc1Reset}" Cursor="Hand" Margin="10,0"/>
</WrapPanel>
</Grid>

</GroupBox>
<GroupBox Header="菜品选择" FontSize="15" Foreground="Aqua" Grid.Row="1" Margin="0,0,0,40" VerticalAlignment="Top" Height="100">
<WrapPanel Orientation="Horizontal" Height="52" VerticalAlignment="Center" >
<Button Content="手撕包菜" Command="{Binding ShreddCabbage}" Margin="10,0,10,0"></Button>
<Button Content="盐煎肉" Command="{Binding FryPork}" Margin="10,0,10,0"></Button>
<Button Content="酱烧杏鲍菇" Command="{Binding XingBaoGu}" Margin="10,0,10,0"></Button>
</WrapPanel>
<GroupBox Grid.Row="1" Header="自动炒菜" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" >
<Grid Height="50">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<WrapPanel Grid.Row="1" Orientation="Horizontal">

<TextBlock Text="菜单编号:" Margin="10,0"/>
<TextBox Text="{Binding FoodMenuID}" Width="100"/>
<Button Content="下单" Margin="10,0" Command="{Binding StartOrder}" Cursor="Hand"/>
<Button Content="本地模拟流程配置" Click="Button_Click"/>
<Button Content="本地模拟流程下单" Margin="10,0" Command="{Binding StartLocalOrder}" Cursor="Hand"/>
<Button Content="停止炒菜" Margin="10,0" Command="{Binding StopLocalOrder}" Cursor="Hand"/>
</WrapPanel>
</Grid>

</GroupBox>
<StackPanel Orientation="Vertical" Grid.Row="2">
<GroupBox Header="配料仓控制" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" Height="95">
<GroupBox Header="菜品选择" FontSize="15" Foreground="Aqua" Grid.Row="2" VerticalAlignment="Center" Height="190" >
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WrapPanel Orientation="Horizontal" >
<TextBlock Text="取料手臂实时位置" Margin="0,0,10,0"/>
<TextBlock Text="X:" Margin="5,0"/>
<TextBox Text="{Binding RealX}" Width="70" Margin="5,0" VerticalAlignment="Top" IsReadOnly="True"/>
<TextBlock Text="Y:" Margin="5,0"/>
<TextBox Text="{Binding RealY}" Width="70" Margin="5,0" VerticalAlignment="Top" IsReadOnly="True"/>
<TextBlock Text="{Binding PawPosition}" Margin="10,0,5,0"/>
<Button Content="菜品库初始化" Margin="10,0,5,0" Command="{Binding FoodLibInit}"/>
<Button Content="电磁阀启动" Margin="10,0,5,0" Command="{Binding StartElectromagnetism}"/>
<Button Content="电磁阀停止" Margin="10,0,5,0" Command="{Binding StopElectromagnetism}"/>
</WrapPanel>
<WrapPanel Grid.Row="1" Orientation="Horizontal" >
<TextBlock Text="取料手臂设定位置" Margin="0,0,10,0"/>
<TextBlock Text="X:" Margin="5,0"/>
<TextBox Text="{Binding SettingX}" Width="70" Margin="5,0" VerticalAlignment="Center" />
<TextBlock Text="Y:" Margin="5,0"/>
<TextBox Text="{Binding SettingY}" Width="70" Margin="5,0" VerticalAlignment="Center" />
<Button Content="移动" Command="{Binding SetArmPosition}" Margin="5,0,10,0" Cursor="Hand"/>
<TextBlock Text="移动速度:" Margin="5,0"/>
<TextBox Text="{Binding MoveSpeed}" Width="70" Margin="5,0" VerticalAlignment="Center" />
<Button Content="设定" Command="{Binding SetSpeed}" Cursor="Hand" Margin="5,0,10,0" />
<Button Content="感应器1测距" Margin="5,0" Command="{Binding GetDistance_1}"/>
<TextBox Text="{Binding SensingDistance_1}" Margin="5,0" Width="60" IsReadOnly="True"/>
<Button Content="感应器2测距" Margin="5,0" Command="{Binding GetDistance_2}"/>
<TextBox Text="{Binding SensingDistance_2}" Margin="5,0" Width="60" IsReadOnly="True"/>
<Button Content="感应器3测距" Margin="5,0" Command="{Binding GetDistance_3}"/>
<TextBox Text="{Binding SensingDistance_3}" Margin="5,0" Width="60" IsReadOnly="True"/>
</WrapPanel>
<WrapPanel Grid.Row="2" Orientation="Horizontal" >
<Button Content="夹爪正转" Command="{Binding PawTurnFront}" Margin="5,0" Cursor="Hand"/>
<Button Content="夹爪反转" Command="{Binding PawTurnBack}" Margin="5,0" Cursor="Hand"/>
<RadioButton Content="位置2" Margin="5,0" IsEnabled="False" IsChecked="{Binding PawPositon1}" GroupName="a"/>
<RadioButton Content="位置1" Margin="5,0" IsEnabled="False" IsChecked="{Binding PawPositon2}" GroupName="b"/>
<RadioButton Content="位置3" Margin="5,0 " IsEnabled="False" IsChecked="{Binding PawPositon3}" GroupName="c"/>
</WrapPanel>
</Grid>

</GroupBox>
<StackPanel Orientation="Vertical" Grid.Row="3">
<GroupBox Header="配料仓控制" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" Height="65">
<WrapPanel Orientation="Horizontal" Grid.RowSpan="2" VerticalAlignment="Top" Margin="0,5,0,0" >
<TextBlock Text="通道号" Margin="5,0"/>
<ComboBox ItemsSource="{Binding PassageWays}" Width="120" Margin="5,0"
@@ -59,7 +117,7 @@
</WrapPanel>
</GroupBox>

<GroupBox Header="炒锅1" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" Height="140">
<GroupBox Header="炒锅" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" Height="140">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
@@ -77,7 +135,7 @@
<Button Content="HBOT放盒子到位" Command="{Binding HBOTGoWork}" Margin="10,0,10,0"></Button>
<Button Content="出餐启动" Command="{Binding OutMeal}" Margin="10,0,10,0"></Button>
</WrapPanel>
<WrapPanel Grid.Row="2">
<TextBlock Text="加热挡位:" Margin="10,0,0,0" />
<ComboBox ItemsSource="{Binding lstFire}" Width="80" Margin="10,0,10,0" HorizontalAlignment="Center" VerticalAlignment="Center"
@@ -89,9 +147,9 @@
<Button Content="设定" Margin="0,0,30,0" Command="{Binding SetStir}"/>
</WrapPanel>
</Grid>
</GroupBox>
<GroupBox Header="炒锅2" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" Height="140">
<GroupBox Header="炒锅" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" Height="140">
<WrapPanel VerticalAlignment="Top" Margin="0,5,0,0">
<Button Content="注油" Command="{Binding SecAddOil}" Margin="10,0,10,0"></Button>
<Button Content="加热关闭" Command="{Binding SecTempTurnOff}" Margin="10,0,10,0"></Button>
@@ -106,7 +164,7 @@
<Button Content="翻炒机3挡" Command="{Binding SecOverThreeBlock}" Margin="10,0,10,0"></Button>

</WrapPanel>
</GroupBox>

</StackPanel>


+ 11
- 3
BPASmartClient.MorkF/View/DebugView.xaml.cs View File

@@ -1,4 +1,6 @@
using BPASmartClient.MorkF.ViewModel;
using BPASmartClient.Helper;
using BPASmartClient.MorkF.Model;
using BPASmartClient.MorkF.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -24,8 +26,14 @@ namespace BPASmartClient.MorkF.View
public DebugView()
{
InitializeComponent();
this.DataContext = new DebugViewModel();
Json<LocalPotStep>.Read();

}

private void Button_Click(object sender, RoutedEventArgs e)
{
LocalMenu localMenu = new LocalMenu();
localMenu.ShowDialog();
}
}
}

+ 80
- 0
BPASmartClient.MorkF/View/LocalMenu.xaml View File

@@ -0,0 +1,80 @@
<Window x:Class="BPASmartClient.MorkF.View.LocalMenu"
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.MorkF.View"
xmlns:vm="clr-namespace:BPASmartClient.MorkF.ViewModel"
mc:Ignorable="d"
Title="LocalMenu" Height="800" Width="800" WindowStartupLocation="CenterScreen" WindowStyle="None" AllowsTransparency="True" MouseLeftButtonDown="Window_MouseLeftButtonDown">
<Window.DataContext>
<vm:LocalMenuViewModel/>
</Window.DataContext>
<Window.Resources>
<Style TargetType="ListBoxItem" >
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border BorderBrush="Black" BorderThickness="0" Background="White">
<Grid Width="600" HorizontalAlignment="Center" VerticalAlignment="Center" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBox Grid.Column="0" Text="{Binding FryTime}" HorizontalAlignment="Center" VerticalAlignment="Center" />
<TextBox Grid.Column="1" Text="{Binding During}" Margin="10,0"/>
<ComboBox Grid.Column="2" Width="120" ItemsSource="{Binding DataContext.strPotActions , RelativeSource={RelativeSource AncestorType=Window,Mode=FindAncestor}}"
SelectedValue="{Binding Actions}" Margin="10,0"/>
<TextBox Grid.Column="3" Text="{Binding SeasoningLists[0].Loc}" Margin="10,0"/>
<TextBox Grid.Column="4" Text="{Binding SeasoningLists[0].Qty}" Margin="10,0"/>
<Button Grid.Column="5" Content="删除" Margin="10,0" HorizontalAlignment="Center"
Command="{Binding DataContext.Delete, RelativeSource={RelativeSource AncestorType=Window,Mode=FindAncestor}}"
CommandParameter="{Binding DataContext, RelativeSource={RelativeSource AncestorType=ListBoxItem,Mode=FindAncestor}}"/>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="50"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<Button Content="增加步骤" Command="{Binding AddFryTime}" Width="120" Height="40" Margin="10,0"/>
<Button Content="保存" Command="{Binding Save}" Width="120" Height="40" Margin="10,0"/>
<Button Content="退出" Click="Button_Click" Width="120" Height="40" Margin="10,0"/>
</StackPanel>
<Grid Grid.Row="1" Width="600" HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Text="步骤" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="1" Text="时间" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="2" Text="动作" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="3" Text="调料位置" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="4" Text="调料重量" HorizontalAlignment="Center"/>
<TextBlock Grid.Column="5" Text="删除" HorizontalAlignment="Center"/>
</Grid>
<ListBox x:Name="listview1" Grid.Row="2" BorderBrush="Black" BorderThickness="0" HorizontalAlignment="Center" AllowDrop="True"
ScrollViewer.HorizontalScrollBarVisibility="Disabled" ItemsSource="{Binding PotActionStep}" Margin=" 10" Background="Transparent"
>
</ListBox>
</Grid>
</Window>

+ 338
- 0
BPASmartClient.MorkF/View/LocalMenu.xaml.cs View File

@@ -0,0 +1,338 @@
using BPA.Models;
using BPASmartClient.Helper;
using BPASmartClient.MorkF.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
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.MorkF.View
{
/// <summary>
/// LocalMenu.xaml 的交互逻辑
/// </summary>
public partial class LocalMenu : Window
{

double X, Y;
Border ultUE;
Popup mypopup;
ListBoxItem OldItem;
ListBoxItem new_Item;
bool isDown = false;

int lao_index;
int new_index;


/// <summary>
/// 当前拖拽子控件Item
/// </summary>
private ListBoxItem ChildListBoxItem;

public LocalMenu()
{
InitializeComponent();
ActionManage.GetInstance.CancelRegister ("LocalMenuClose");
ActionManage.GetInstance.Register(new Action(() =>
{
this.Close();
}), "LocalMenuClose");
}

private void Button_Click(object sender, RoutedEventArgs e)
{
this.Close();
}

private int GetCurrentIndex(GetPositionDelegate getPosition)
{
int index = -1;
for (int i = 0; i < listview1.Items.Count; ++i)
{
ListBoxItem item = GetListViewItem(i);
if (item != null && this.IsMouseOverTarget(item, getPosition))
{
index = i;
break;
}
}
return index;
}

private bool IsMouseOverTarget(Visual target, GetPositionDelegate getPosition)
{
Rect bounds = VisualTreeHelper.GetDescendantBounds(target);
Point mousePos = getPosition((IInputElement)target);
return bounds.Contains(mousePos);
}


delegate Point GetPositionDelegate(IInputElement element);

ListBoxItem GetListViewItem(int index)
{
if (listview1.ItemContainerGenerator.Status != GeneratorStatus.ContainersGenerated)
return null;
return listview1.ItemContainerGenerator.ContainerFromIndex(index) as ListBoxItem;
}

private void CloneVisual(Border border, MouseButtonEventArgs e)
{
ListBoxItem listBoxItem = new ListBoxItem();
Point ptLeftUp = new Point(0, 0);
ptLeftUp = listview1.PointToScreen(ptLeftUp);
mypopup = new Popup();
double y = e.GetPosition(listview1).Y;
double x = e.GetPosition(listview1).X;

VisualBrush brush = new VisualBrush(border);
Rectangle rect = new Rectangle();
rect.Width = border.ActualWidth;
rect.Height = border.ActualHeight;
rect.Fill = brush;
rect.Opacity = border.Opacity;
border.Opacity = 0.8;
mypopup.Child = rect;
mypopup.AllowsTransparency = true;
mypopup.HorizontalOffset = ptLeftUp.X + x - ((FrameworkElement)ultUE).ActualWidth / 2;
mypopup.VerticalOffset = ptLeftUp.Y + y - ((FrameworkElement)ultUE).ActualHeight / 2;
mypopup.IsOpen = true;
}

private void listview1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
try
{
if (isDown)
{
isDown = false;
return;
}
var pos = e.GetPosition(listview1);
HitTestResult result = VisualTreeHelper.HitTest(listview1, pos);
if (result == null) return;
OldItem = Utils.FindVisualParent<ListBoxItem>(result.VisualHit);
if (OldItem != null)
{
if (e.Source is Border)
{
ultUE = (Border)e.Source;
ultUE.CaptureMouse();
ChildListBoxItem = Utils.FindVisualParent<ListBoxItem>(VisualTreeHelper.HitTest(ultUE, e.GetPosition(ultUE)).VisualHit);
CloneVisual(ultUE, e);
isDown = true;
}
}
}
catch (Exception)
{

throw;
}
}



private void listview1_MouseMove(object sender, MouseEventArgs e)
{
if (sender is ListBox listview&& e.LeftButton == MouseButtonState.Pressed&& listview.SelectedItem != null)
{
var pos = e.GetPosition(listview1);
HitTestResult result = VisualTreeHelper.HitTest(listview1, pos);
if (result == null)
{
return;
}
var listBoxItem = Utils.FindVisualParent<ListBoxItem>(result.VisualHit);
if (listBoxItem == null || listBoxItem.Content != listview1.SelectedItem)
{
return;
}
DataObject dataObj = new DataObject(listBoxItem.Content as PotActions);
DragDrop.DoDragDrop(listview1, dataObj, DragDropEffects.Move);
ActionManage.GetInstance.Send("SortFryTime");
}


}

private void listview1_Drop(object sender, DragEventArgs e)
{
var pos = e.GetPosition(listview1);
var result = VisualTreeHelper.HitTest(listview1, pos);
if (result == null)
{
return;
}
//查找元数据
var sourcePerson = e.Data.GetData(typeof(PotActions)) as PotActions;
if (sourcePerson == null)
{
return;
}
//查找目标数据
var listBoxItem = Utils.FindVisualParent<ListBoxItem>(result.VisualHit);
if (listBoxItem == null)
{
return;
}
var targetPerson = listBoxItem.Content as PotActions;
if (ReferenceEquals(targetPerson, sourcePerson))
{
return;
}
int i = listview1.Items.IndexOf(sourcePerson);
int j = listview1.Items.IndexOf(targetPerson);
ActionManage.GetInstance.Send("PotActionStep", new int[] { i, j });
//LocalMenuViewModel.PotActionStep.RemoveAt(listview1.Items.IndexOf(sourcePerson));
//LocalMenuViewModel.PotActionStep.Insert(listview1.Items.IndexOf(targetPerson)+1, sourcePerson);
//targetPerson.FryTime = listview1.Items.IndexOf(targetPerson) -1;
//LocalMenuViewModel.PotActionStep.Move(listview1.Items.IndexOf(sourcePerson), listview1.Items.IndexOf(targetPerson));


}

private void listview1_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
////鼠标未按下返回
//if (!isDown) return;

//isDown = false;

//var pos = e.GetPosition(listview1);
//HitTestResult result = VisualTreeHelper.HitTest(listview1, pos);
//if (result == null) return;
//new_Item = Utils.FindVisualParent<ListBoxItem>(result.VisualHit);
//if (mypopup != null)
//{
// mypopup.IsOpen = false;
// mypopup = null;
//}

//MoveListBoxStyle(e, false);


}

private void Window_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
this.DragMove();
}


/// <summary>
/// 移动效果
/// </summary>
/// <param name="boxItem"></param>
private void MoveListBoxStyle(MouseEventArgs e, bool isBool)
{
try
{
if (isBool)//为真,根据鼠标位置设置行透明度和显示状态
{
//移动到某行减轻某行 暗黑
//foreach (ListBoxItem item in Utils.FindVisualChildren<ListBoxItem>(listview1))
//{
// if (item != ChildListBoxItem)//这就是其他控件
// {
// double item_width = item.ActualWidth; //当前行宽
// double item_height = item.ActualHeight; //当前行高
// double item_x = e.GetPosition(item).X; //鼠标相对当前行X位移
// double item_y = e.GetPosition(item).Y; //鼠标相对当前行Y位移

// if (item_y <= item_height && item_y > 0 && item_x > 0 && item_x <= item_width)//鼠标进入哪一行,则将那一行变灰
// {
// item.Opacity = 0.5;
// item.Background = Brushes.AliceBlue;
// lao_index = LocalMenuViewModel.PotActionStep.IndexOf(item.Content as PotActions);
// new_index = LocalMenuViewModel.PotActionStep.IndexOf(ChildListBoxItem.Content as PotActions);
// //LocalMenuViewModel.PotActionStep.Move(lao_index, new_index);
// }
// else //鼠标没在哪一行,则保持原状
// {
// item.Opacity = 1;
// }
// }
// else
// {
// item.Visibility = Visibility.Hidden;
// }
//}
}
else//为假 恢复所有行透明度和显示状态
{
//LocalMenuViewModel.PotActionStep.Move(lao_index, new_index);
//移动到某行减轻某行 暗黑
foreach (ListBoxItem item in Utils.FindVisualChildren<ListBoxItem>(listview1))
{
item.Background = Brushes.Transparent;
item.Opacity = 1;
item.Visibility = Visibility.Visible;
}
}
}
catch (Exception ex)
{
}
}
}


internal static class Utils
{
//根据子元素查找父元素
public static T FindVisualParent<T>(DependencyObject obj) where T : class
{
while (obj != null)
{
if (obj is T)
return obj as T;

obj = VisualTreeHelper.GetParent(obj);
}
return null;
}

/// <summary>
/// 查询子控件
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="obj"></param>
/// <returns></returns>
public static IEnumerable<T> FindVisualChildren<T>(DependencyObject depObj) where T : DependencyObject
{
if (depObj != null)
{
for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++)
{
DependencyObject child = VisualTreeHelper.GetChild(depObj, i);
if (child != null && child is T)
{
yield return (T)child;
}

foreach (T childOfChild in FindVisualChildren<T>(child))
{
yield return childOfChild;
}
}
}
}
}
}

+ 128
- 33
BPASmartClient.MorkF/ViewModel/DebugViewModel.cs View File

@@ -1,9 +1,12 @@
using BPASmartClient.Helper;
using BPASmartClient.Business;
using BPASmartClient.Device;
using BPASmartClient.Helper;
using BPASmartClient.MorkF.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -13,30 +16,72 @@ namespace BPASmartClient.MorkF.ViewModel
internal class DebugViewModel : ObservableObject
{
public bool SimOrderEnable { get { return General_Config.SimOrderAllow; } set { General_Config.SimOrderAllow = value; OnPropertyChanged(); } }
/// <summary>
/// 设备数据
/// </summary>
public ObservableCollection<VariableMonitor> variableMonitors { get; set; }

/// <summary>
/// 设备ID
/// </summary>
public int DeviceId { get; set; }

#region 设备控制
public int FoodMenuID { get { return _foodMenuID; } set { _foodMenuID = value; OnPropertyChanged(); } }
private int _foodMenuID;
public RelayCommand PlcInite { get; set; }
public RelayCommand SimulateOrder { get; set; }
public RelayCommand MaterialOne { get; set; }
public RelayCommand MaterialTwo { get; set; }
public RelayCommand MaterialThree { get; set; }
public RelayCommand MaterialFour { get; set; }
public RelayCommand MaterialFive { get; set; }
public RelayCommand OpenExhaust { get;set; }
public RelayCommand CloaseExhaust { get; set; }
public RelayCommand StartQXOne { get; set; }
public RelayCommand StartQXTwo { get; set; }
public RelayCommand FoodPlcInite { get; set; }
public RelayCommand Plc1Reset { get; set; }
public RelayCommand StartOrder { get; set; }
public RelayCommand StartLocalOrder { get; set; }
public RelayCommand StopLocalOrder { get; set; }


#endregion

#region 菜品控制
public string RealX { get { return _realX; } set { _realX = value; OnPropertyChanged(); } }
private string _realX;
public string RealY { get { return _realY; } set { _realY = value; OnPropertyChanged(); } }
private string _realY;

public RelayCommand ShreddCabbage { get; set; }
public RelayCommand FryPork { get; set; }
public RelayCommand XingBaoGu { get; set; }
#endregion
public int SettingX { get { return _settingX; } set { _settingX = value; OnPropertyChanged(); } }
private int _settingX = 0;
public int SettingY { get { return _settingY; } set { _settingY = value; OnPropertyChanged(); } }
private int _settingY = 0;

public int MoveSpeed { get { return _moveSpeed; } set { _moveSpeed = value; OnPropertyChanged(); } }
private int _moveSpeed;
public string SensingDistance_1 { get { return _sensingDistance_1; } set { _sensingDistance_1 = value; OnPropertyChanged(); } }
private string _sensingDistance_1 ;
public string SensingDistance_2 { get { return _sensingDistance_2; } set { _sensingDistance_2 = value; OnPropertyChanged(); } }
private string _sensingDistance_2 ;
public string SensingDistance_3 { get { return _sensingDistance_3; } set { _sensingDistance_3 = value; OnPropertyChanged(); } }
private string _sensingDistance_3;
public bool PawPositon1 { get { return _pawPositon1; } set { _pawPositon1 = value; OnPropertyChanged(); } }
private bool _pawPositon1;
public bool PawPositon2 { get { return _pawPositon2; } set { _pawPositon2 = value; OnPropertyChanged(); } }
private bool _pawPositon2;
public bool PawPositon3 { get { return _pawPositon3; } set { _pawPositon3 = value; OnPropertyChanged(); } }
private bool _pawPositon3;


public RelayCommand FoodLibInit { get; set; }//初始化
public RelayCommand StartElectromagnetism { get; set; }//电磁阀启动
public RelayCommand StopElectromagnetism { get; set; }
public RelayCommand SetSpeed { get; set; }//速度设定
public RelayCommand GetDistance_1 { get; set; }//感应测距1
public RelayCommand GetDistance_2 { get; set; }//感应测距2
public RelayCommand GetDistance_3 { get; set; }//感应测距3
public RelayCommand PawTurnFront { get; set; }//夹爪正转
public RelayCommand PawTurnBack { get; set; }//夹爪反转
public RelayCommand SetArmPosition { get; set; }//机器臂位置设定

#endregion

#region 配料仓控制
public List<string> PassageWays = new List<string>()
public List<string> PassageWays { get; set; } = new List<string>()
{
"通道1",
"通道2",
@@ -61,6 +106,7 @@ namespace BPASmartClient.MorkF.ViewModel
#endregion

#region 炒锅1
public RelayCommand Pot1SimOrder { get; set; }
public RelayCommand AddOil { get; set; }
public RelayCommand StartFire { get; set; }
public RelayCommand StopFire { get; set; }
@@ -72,13 +118,39 @@ namespace BPASmartClient.MorkF.ViewModel
public RelayCommand HBOTGoWork { get; set; }
public RelayCommand OutMeal { get; set; }
public RelayCommand SetFire { get; set; }
public RelayCommand SetFry { get; set; }
public RelayCommand SetStir { get; set; }
public List<int> lstFire { get; set; } = new List<int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
public List<int> lstFry { get; set; } = new List<int>() { 1, 2 };
public List<int> lstStir { get; set; } = new List<int>() { 1, 2, 3 };
public int FireGear { get { return _fireGear; } set { _fireGear = value; OnPropertyChanged(); } }
private int _fireGear;
public int FryGear { get { return _fryeGear; } set { _fryeGear = value; OnPropertyChanged(); } }
private int _fryeGear;
public int StirGear { get { return _stirGear; } set { _stirGear = value; OnPropertyChanged(); } }
private int _stirGear;
#region 模拟
public int OilTime { get { return _oilTime; } set { _oilTime = value; OnPropertyChanged(); } }
private int _oilTime = 10;
public int OilFirGear { get { return _oilFirGear; } set { _oilFirGear = value; OnPropertyChanged(); } }
private int _oilFirGear = 3;
public int OilStrGear { get { return _oilStrGear; } set { _oilStrGear = value; OnPropertyChanged(); } }
private int _oilStrGear = 1;

public int Food1Time { get { return _food1Time; } set { _food1Time = value; OnPropertyChanged(); } }
private int _food1Time = 30;
public int Food1FirGear { get { return _food1FirGear; } set { _food1FirGear = value; OnPropertyChanged(); } }
private int _food1FirGear = 6;
public int Food1StrGear { get { return _food1StrGear; } set { _food1StrGear = value; OnPropertyChanged(); } }
private int _food1StrGear = 2;

public int Food2Time { get { return _food2Time; } set { _food2Time = value; OnPropertyChanged(); } }
private int _food2Time = 30;
public int Food2FirGear { get { return _food2FirGear; } set { _food2FirGear = value; OnPropertyChanged(); } }
private int _food2FirGear = 6;
public int Food2StrGear { get { return _food2StrGear; } set { _food2StrGear = value; OnPropertyChanged(); } }
private int _food2StrGear = 2;
#endregion
#endregion


@@ -102,28 +174,35 @@ namespace BPASmartClient.MorkF.ViewModel
{
#region 设备控制
PlcInite = new RelayCommand(() => { ActionManage.GetInstance.Send("InitCommand"); });
SimulateOrder = new RelayCommand(() => { ActionManage.GetInstance.Send("SimultaorOrder"); });
MaterialOne = new RelayCommand(() => { ActionManage.GetInstance.Send("MaterialOne"); });
MaterialTwo = new RelayCommand(() => { ActionManage.GetInstance.Send("MaterialTwo"); });
MaterialThree = new RelayCommand(() => { ActionManage.GetInstance.Send("MaterialThree"); });
MaterialFour = new RelayCommand(() => { ActionManage.GetInstance.Send("MaterialFour"); });
MaterialFive = new RelayCommand(() => { ActionManage.GetInstance.Send("MaterialFive"); });
OpenExhaust = new RelayCommand(() => { ActionManage.GetInstance.Send("OpenExhaust"); });
CloaseExhaust = new RelayCommand(() => { ActionManage.GetInstance.Send("CloseExhaust"); });
StartQXOne = new RelayCommand(() => { ActionManage.GetInstance.Send("StartQXOne", 1); });
StartQXTwo = new RelayCommand(() => { ActionManage.GetInstance.Send("StartQXTwo", 2); });
Plc1Reset = new RelayCommand(() => { ActionManage.GetInstance.Send("Plc1Reset"); });
StartOrder = new RelayCommand(() => { ActionManage.GetInstance.Send("StartOrder", FoodMenuID); });
StartLocalOrder = new RelayCommand(() => { ActionManage.GetInstance.Send("StartLocalOrder"); });
StopLocalOrder = new RelayCommand(() => { ActionManage.GetInstance.Send("StopLocalOrder"); });
#endregion
ShreddCabbage = new RelayCommand(() => { ActionManage.GetInstance.Send("ShreddCabbage"); });
FryPork = new RelayCommand(() => { ActionManage.GetInstance.Send("FryPork"); });
XingBaoGu = new RelayCommand(() => { ActionManage.GetInstance.Send("XingBaoGu"); });

#region 菜品控制

#region 配料仓控制
OutMaterials = new RelayCommand(() => { ActionManage.GetInstance.Send("OutMaterials" ,new List<int> { PassagePosition,Weight } ); });
FoodLibInit = new RelayCommand(() => { ActionManage.GetInstance.Send("FoodLibInit"); });//菜品库初始化
StartElectromagnetism = new RelayCommand(() => { ActionManage.GetInstance.Send("Electromagnetism", new List<bool> { true }); });//电磁阀启动
StopElectromagnetism = new RelayCommand(() => { ActionManage.GetInstance.Send("Electromagnetism", new List<bool> { false });});//电磁阀关闭
SetSpeed = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("SetSpeed", new List<int> { MoveSpeed });
});//设定速度
GetDistance_1 = new RelayCommand(() => { ActionManage.GetInstance.Send("GetDistance_1"); });//感应距离1
GetDistance_2 = new RelayCommand(() => { ActionManage.GetInstance.Send("GetDistance_2"); });//感应距离2
GetDistance_3 = new RelayCommand(() => { ActionManage.GetInstance.Send("GetDistance_3"); });//感应距离3
PawTurnFront = new RelayCommand(() => { ActionManage.GetInstance.Send("PawTurnFront"); });//夹爪正转
PawTurnBack = new RelayCommand(() => { ActionManage.GetInstance.Send("PawTurnBack"); });//夹爪反转
SetArmPosition = new RelayCommand(() => { ActionManage.GetInstance.Send("SetArmPosition", new List<int> { SettingX, SettingY }); });//设定机械臂位置
#endregion

#region 配料仓控制
OutMaterials = new RelayCommand(() => { ActionManage.GetInstance.Send("OutMaterials" ,new List<int> { PassagePosition + 1,Weight } ); });
#endregion

#region 炒锅1
Pot1SimOrder = new RelayCommand(() => { ActionManage.GetInstance.Send("模拟小炒锅1订单",new List<int> { OilTime,OilFirGear,OilStrGear,Food1Time,Food1FirGear,Food1StrGear,Food2Time,Food2FirGear,Food2StrGear }); });//模拟订单
AddOil = new RelayCommand(() => { ActionManage.GetInstance.Send("AddOil", 1); });//加油
StartFire = new RelayCommand(() => { ActionManage.GetInstance.Send("StartFire"); });//加热启动
StopFire = new RelayCommand(() => { ActionManage.GetInstance.Send("StopFire"); });//加热停止
@@ -136,10 +215,9 @@ namespace BPASmartClient.MorkF.ViewModel
OutMeal = new RelayCommand(() => { ActionManage.GetInstance.Send("OutMeal"); });//出餐启动
SetFire = new RelayCommand(() => { ActionManage.GetInstance.Send("SetFire", new List<int> { FireGear }); });//加热挡位设定
SetStir = new RelayCommand(() => { ActionManage.GetInstance.Send("SetStir", new List<int> { StirGear }); });//搅拌挡位设定
SetFry = new RelayCommand(() => { ActionManage.GetInstance.Send("SetFry", new List<int> { FryGear }); });//炒锅选择
#endregion



#region 炒锅2
SecAddOil = new RelayCommand(() => { ActionManage.GetInstance.Send("AddOil", 2); });
SecTempTurnOff = new RelayCommand(() => { ActionManage.GetInstance.Send("TakeOff", 2); });
@@ -155,6 +233,23 @@ namespace BPASmartClient.MorkF.ViewModel
SecAutoModel = new RelayCommand(() => { ActionManage.GetInstance.Send("AutoModel", 2); });
SecManualModel = new RelayCommand(() => { ActionManage.GetInstance.Send("ManualModel", 2); });
#endregion

Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices().ForEach(device =>
{
if (device.Name == "MorkT") DeviceId = device.DeviceId
;
});

ThreadManage.GetInstance().StartLong(new Action(() =>
{
//variableMonitors = Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices()?.FirstOrDefault(p => p.DeviceId == DeviceId)?.variableMonitors;

if(variableMonitors != null)
{
RealX = variableMonitors.FirstOrDefault(p => p.Notes == "机械手臂X").CurrentValue;
RealY = variableMonitors.FirstOrDefault(p => p.Notes == "机械手臂Y").CurrentValue;
}
}), "获取小炒数据");
}

}


+ 104
- 0
BPASmartClient.MorkF/ViewModel/LocalMenuViewModel.cs View File

@@ -0,0 +1,104 @@
using BPA.Models;
using BPASmartClient.Helper;
using BPASmartClient.MorkF.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkF.ViewModel
{
partial class LocalMenuViewModel:ObservableObject
{
public ObservableCollection<PotActions> PotActionStep { get; set; } = new ObservableCollection<PotActions>();

public ObservableCollection<string> strPotActions { get; set; } = new ObservableCollection<string>();


public RelayCommand<object> Delete { get; set; }
public RelayCommand AddFryTime { get; set; }
public RelayCommand Save { get; set; }

private void Deleted(object o)
{
if (o == null) return;
if(o is PotActions p)
{
PotActionStep.Remove(p);
}
for (int i = 0; i < PotActionStep.Count; i++)
{
PotActionStep[i].FryTime = i + 1;
}
}


public LocalMenuViewModel()
{
if(Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions.Count > 0)
{
PotActionStep.Clear();
PotActionStep = new ObservableCollection<PotActions>(Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions);
}
Delete = new RelayCommand<object>(Deleted);
AddFryTime = new RelayCommand(() =>
{
List<SeasoningList> seasoningLists = new List<SeasoningList>();
seasoningLists.Add(new SeasoningList { Loc = 0,Qty = 0});
PotActionStep.Add(new BPA.Models.PotActions
{
FryTime = PotActionStep.Count +1,
During =0,
SeasoningLists = seasoningLists,
});
});

Save = new RelayCommand(new Action(() =>
{
Json<LocalPotStep>.Data.LocalstirFryGoods.GoodsKey = 11;
Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions = new List<PotActions>(PotActionStep);
Json<LocalPotStep>.Save();
ActionManage.GetInstance.Send("LocalMenuClose");
}));

foreach(var pot in Enum.GetNames(typeof(StirFryPotActionEnum)))
{
strPotActions.Add(pot);
}

ActionManage.GetInstance.Register(new Action(()=>
{
for (int i = 0; i < Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions.Count; i++)
{
Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions[i].FryTime = i + 1;
}
}), "SortFryTime");
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o == null) return ;
if(o is int[] ints)
{
Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions[ints[0]].FryTime = ints[1]+1;
Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions[ints[1]].FryTime = ints[0]+1;
var res = Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions[ints[0]];

Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions.Remove(res);
Json<LocalPotStep>.Data.LocalstirFryGoods.StirPotActions.Insert(ints[1],res);

}

}), "PotActionStep");


}
}
}

+ 1
- 1
BPASmartClient.MorkS/BPASmartClient.MorkS.csproj View File

@@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Models" Version="1.0.13" />
<PackageReference Include="BPA.Models" Version="1.0.34" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="System.Speech" Version="6.0.0" />
</ItemGroup>


+ 2
- 0
BPASmartClient.MorkS/Control_Morks.cs View File

@@ -273,6 +273,8 @@ namespace BPASmartClient.MorkS
if (order.MorkOrder.GoodBatchings == null) return;
if (mORKS.HistorySuborderId.Contains(order.MorkOrder.SuborderId)) return;
OrderCount++;
Json<OrderStatistics>.Data.StatisticsTime=DateTime.Now;
Json<OrderStatistics>.Data.Count++;
OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT);
DeviceProcessLogShow($"接收到{OrderCount}次订单,订单ID:{order.MorkOrder.SuborderId}");
mORKS.HistorySuborderId.Add(order.MorkOrder.SuborderId);


+ 45
- 0
BPASmartClient.MorkS/DataServer.cs View File

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

namespace BPASmartClient.MorkS
{
public class DataServer
{

private volatile static DataServer _Instance;
public static DataServer GetInstance => _Instance ?? (_Instance = new DataServer());
private DataServer() { }

public void Init()
{
MQTTProxy mQTTProxy = new MQTTProxy();
mQTTProxy.Connected = new Action(() =>
{
mQTTProxy.Subscrib("");
ThreadManage.GetInstance().StartLong(new Action(() =>
{
mQTTProxy.Publish("", "");
Thread.Sleep(100);
}), "海科食堂大屏监听");
});
mQTTProxy.Connect("UserName", "Password", "Host", 1883, $"MORKS 设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}


//订单信息(正在制作,等待制作,制作完成)
//煮面炉上下状态(6个煮面炉上或下)
//温度状态(煮面炉温度是否到达)
//料仓位置(当前料仓在几号位置)
//料仓上下物料检测
//落碗机构缺碗检测
//机器人状态
//当日订单总量
//报警信息
}
}

+ 1
- 1
BPASmartClient.MorkT_HQ/BPASmartClient.MorkTHQ.csproj View File

@@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Models" Version="1.0.13" />
<PackageReference Include="BPA.Models" Version="1.0.34" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
</ItemGroup>



+ 9
- 0
BPASmartClient.ScreenALL/App.config View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!--Redis配置-->
<add key="RedisConnection" value="10.2.1.254,6379,BapAdmin123456.,1"/>
<add key="DeviceMC" value="1"/>
<add key="GgAdder" value="https://stream7.iqilu.com/10339/upload_transcode/202002/18/20200218114723HDu3hhxqIT.mp4"/>
</appSettings>
</configuration>

+ 8
- 0
BPASmartClient.ScreenALL/App.xaml View File

@@ -0,0 +1,8 @@
<Application x:Class="BPASmartClient.ScreenALL.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BPASmartClient.ScreenALL">
<Application.Resources>
</Application.Resources>
</Application>

+ 27
- 0
BPASmartClient.ScreenALL/App.xaml.cs View File

@@ -0,0 +1,27 @@
using BPASmartClient.ScreenLib;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmartClient.ScreenALL
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
AppMain appMain = new AppMain(MainWindow, this.GetType());
}
protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
}
}
}

+ 10
- 0
BPASmartClient.ScreenALL/AssemblyInfo.cs View File

@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

+ 24
- 0
BPASmartClient.ScreenALL/BPASmartClient.ScreenALL.csproj View File

@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<AssemblyName>总监控大屏</AssemblyName>
<ApplicationIcon>hbl.ico</ApplicationIcon>

</PropertyGroup>

<ItemGroup>
<Content Include="hbl.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BPASmartClient.ScreenLib\BPASmartClient.ScreenLib.csproj" />
</ItemGroup>
<ItemGroup>
<Resource Include="App.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
</ItemGroup>
</Project>

BIN
View File


+ 56
- 0
BPASmartClient.ScreenLib/AppMain.cs View File

@@ -0,0 +1,56 @@
using BPA.CustomResource.UserControls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Forms;

namespace BPASmartClient.ScreenLib
{
public partial class AppMain
{
public AppMain(Window window, Type type)
{
//启动Redis数据读取
Main.GetInstance.Start();
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
FSystemHelper.GetInstance.CreateDesktopShortcut();
WindowLargeScreen windowLarge = new WindowLargeScreen();
#region 设置显示页面与标题
string TitleName = $"{type.Assembly.ManifestModule.Name.Replace(".dll", "")}";
string name= type.FullName.Split('.')[2];
string sbmc=string.Empty;
switch (type.FullName)
{
case "BPASmartClient.ScreenALL.App":
windowLarge.Init(TitleName, new ScreenALLControl()); windowLarge.Show();
break;
case "BPASmartClient.ScreenMaxWok.App":
windowLarge.Init(TitleName, new ScreenMaxWokControl()); windowLarge.Show();
break;
case "BPASmartClient.ScreenMinWok.App":
windowLarge.Init(TitleName, new ScreenMinWokControl()); windowLarge.Show();
break;
case "BPASmartClient.ScreenMorks.App":
windowLarge.Init(TitleName, new ScreenMorksControl()); windowLarge.Show();
break;
case "BPASmartClient.ScreenSplitMeals.App":
ScreenSplitMealsControl1 ScreenSplit=new ScreenSplitMealsControl1();
windowLarge.Init("一号" + TitleName, ScreenSplit);
windowLarge.Show();
ScreenSplit.Start(TitleName);
break;
}
#endregion
window = windowLarge;
}

private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
{

}

}
}

+ 10
- 0
BPASmartClient.ScreenLib/AssemblyInfo.cs View File

@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

+ 26
- 0
BPASmartClient.ScreenLib/BPASmartClient.ScreenLib.csproj View File

@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
</PropertyGroup>
<ItemGroup>
<COMReference Include="IWshRuntimeLibrary">
<WrapperTool>tlbimp</WrapperTool>
<VersionMinor>0</VersionMinor>
<VersionMajor>1</VersionMajor>
<Guid>f935dc20-1cf0-11d0-adb9-00c04fd58a0b</Guid>
<Lcid>0</Lcid>
<Isolated>false</Isolated>
<EmbedInteropTypes>true</EmbedInteropTypes>
<UseWindowsForms>true</UseWindowsForms>
</COMReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="BPA.CustomResource" Version="1.0.5" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1418.22" />
</ItemGroup>

</Project>

+ 238
- 0
BPASmartClient.ScreenLib/Helper/FSystemHelper.cs View File

@@ -0,0 +1,238 @@
using BPA.Helper;
using IWshRuntimeLibrary;
using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.ScreenLib
{
/// <summary>
/// 系统操作类
/// </summary>
public class FSystemHelper
{
private volatile static FSystemHelper _Instance;
public static FSystemHelper GetInstance => _Instance ?? (_Instance = new FSystemHelper());
private FSystemHelper() { }

/// <summary>
/// 获取当前应用程序名称,包括后缀名
/// </summary>
public string GetApplicationName => $"{AppDomain.CurrentDomain.FriendlyName}.exe";

/// <summary>
/// 获取当前应用程序完整路径
/// </summary>
public string GetApplicationPath => $"{AppDomain.CurrentDomain.BaseDirectory}{GetApplicationName}";

/// <summary>
/// 创建桌面快捷方式
/// </summary>
/// <returns>成功或失败</returns>
public bool CreateDesktopShortcut()
{
//1、在COM对象中找到 Windows Script Host Object Model
//2、添加引用 using IWshRuntimeLibrary;
string deskTop = string.Empty;
try
{
deskTop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\";
if (System.IO.File.Exists(deskTop + GetApplicationName + ".lnk")) //
{
return true;
//System.IO.File.Delete(deskTop + FileName + ".lnk");//删除原来的桌面快捷键方式
}
WshShell shell = new WshShell();
//快捷键方式创建的位置、名称
IWshShortcut shortcut = shell.CreateShortcut(deskTop + GetApplicationName + ".lnk") as IWshShortcut;
shortcut.TargetPath = GetApplicationPath; //目标文件
//该属性指定应用程序的工作目录,当用户没有指定一个具体的目录时,快捷方式的目标应用程序将使用该属性所指定的目录来装载或保存文件。
shortcut.WorkingDirectory = System.Environment.CurrentDirectory;
shortcut.WindowStyle = 1; //目标应用程序的窗口状态分为普通、最大化、最小化【1,3,7】
shortcut.Description = GetApplicationName; //描述
//shortcut.IconLocation = exePath + "\\logo.ico"; //快捷方式图标
shortcut.Arguments = "";
//shortcut.Hotkey = "CTRL+ALT+F11"; // 快捷键
shortcut.Save(); //必须调用保存快捷才成创建成功
return true;
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx(ex.ToString());
return false;
}
}

/// <summary>
/// 设置开机自启动
/// </summary>
/// <param name="isAuto">true:开机启动,false:不开机自启</param>
public void AutoStart(bool isAuto = true)
{
if (isAuto == true)
{
RegistryKey R_local = Registry.CurrentUser;
RegistryKey R_run = R_local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
R_run.SetValue(GetApplicationName, GetApplicationPath);
R_run.Close();
R_local.Close();
}
else
{
RegistryKey R_local = Registry.CurrentUser;
RegistryKey R_run = R_local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
R_run.DeleteValue(GetApplicationName, false);
R_run.Close();
R_local.Close();
}
}

/// <summary>
/// 判断是否是自动启动
/// </summary>
/// <returns></returns>
public bool IsAutoStart()
{
RegistryKey R_local = Registry.CurrentUser;
RegistryKey R_run = R_local.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
bool res = R_run.GetValueNames().Contains(GetApplicationName);
R_run.Close();
R_local.Close();
return res;
}

#region U盘,串口插拔信息
private const int WM_DEVICECHANGE = 0x219; //设备改变
private const int DBT_DEVICEARRIVAL = 0x8000; //检测到新设备
private const int DBT_DEVICEREMOVECOMPLETE = 0x8004; //移除设备
public const int DBT_DEVTYP_PORT = 0x00000003;
public const int DBT_DEVTYP_VOLUME = 0x00000002;

public IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
if (msg == WM_DEVICECHANGE)
{
//插入
if (wParam.ToInt32() == DBT_DEVICEARRIVAL)
{
var volume = (DEV_BROADCAST_HDR)Marshal.PtrToStructure(lParam, typeof(DEV_BROADCAST_HDR));

switch (volume.dbch_devicetype)
{
case DBT_DEVTYP_PORT://串口设备
string portName = Marshal.PtrToStringUni(lParam + Marshal.SizeOf(typeof(DEV_BROADCAST_PORT)));
MessageLog.GetInstance.Show($"插入串口:[{portName}]");
break;
case DBT_DEVTYP_VOLUME:
var drive = GetDrive(lParam);
MessageLog.GetInstance.Show($"usb插入:[{drive}]");
break;
default:
break;
}
}

//拔出
if (wParam.ToInt32() == DBT_DEVICEREMOVECOMPLETE)
{
var volume = (DEV_BROADCAST_HDR)Marshal.PtrToStructure(lParam, typeof(DEV_BROADCAST_HDR));
switch (volume.dbch_devicetype)
{
case DBT_DEVTYP_PORT://串口设备
string portName = Marshal.PtrToStringUni(lParam + Marshal.SizeOf(typeof(DEV_BROADCAST_PORT)));
MessageLog.GetInstance.Show($"拔出串口:[{portName}]");
break;
case DBT_DEVTYP_VOLUME:
var drive = GetDrive(lParam);
MessageLog.GetInstance.Show($"usb拔出:[{drive}]");
break;
default:
break;
}
}
}
return IntPtr.Zero;
}

private static string GetDrive(IntPtr lParam)
{
var volume = (DEV_BROADCAST_VOLUME)Marshal.PtrToStructure(lParam, typeof(DEV_BROADCAST_VOLUME));
var letter = GetLetter(volume.dbcv_unitmask);
return string.Format("{0}:\\", letter);
}

/// <summary>
/// 获得盘符
/// </summary>
/// <param name="dbcvUnitmask">
/// 1 = A
/// 2 = B
/// 4 = C...
/// </param>
/// <returns>结果是A~Z的任意一个字符或者为'?'</returns>
private static char GetLetter(uint dbcvUnitmask)
{
const char nona = '?';
const string drives = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if (dbcvUnitmask == 0) return nona;
var i = 0;
var pom = dbcvUnitmask >> 1;
while (pom != 0)
{
pom = pom >> 1;
i++;
}
if (i < drives.Length)
return drives[i];
return nona;
}


#endregion
}

[StructLayout(LayoutKind.Sequential)]
struct DEV_BROADCAST_HDR
{
public UInt32 dbch_size;
public UInt32 dbch_devicetype;
public UInt32 dbch_reserved;
}

[StructLayout(LayoutKind.Sequential)]
struct DEV_BROADCAST_PORT
{
public uint dbcp_size;
public uint dbcp_devicetype;
public uint dbcp_reserved;
}

[StructLayout(LayoutKind.Sequential)]
struct DEV_BROADCAST_PORT_A
{
public uint dbcp_size;
public uint dbcp_devicetype;
public uint dbcp_reserved;
//public string dbcp_name;
}

[StructLayout(LayoutKind.Sequential)]
struct DEV_BROADCAST_VOLUME
{
/// DWORD->unsigned int
public uint dbcv_size;
/// DWORD->unsigned int
public uint dbcv_devicetype;
/// DWORD->unsigned int
public uint dbcv_reserved;
/// DWORD->unsigned int
public uint dbcv_unitmask;
/// WORD->unsigned short
public ushort dbcv_flags;
}
}

+ 229
- 0
BPASmartClient.ScreenLib/Helper/Main.cs View File

@@ -0,0 +1,229 @@
using BPA.Communication;
using BPA.Helper;
using BPA.Message;
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace BPASmartClient.ScreenLib
{
/// <summary>
/// 主函数
/// </summary>
public class Main
{
#region 接口继承变量
/// <summary>
/// MQTT连接信息
/// </summary>
public string MQTTConnection { get; set; }
/// <summary>
/// 业务名称
/// </summary>
private string _Name = string.Empty;
public string Name
{
get { return _Name; }
set
{
_Name = value;
ThreadServer();
}
}
/// <summary>
/// 是否自动重启(出现健康检查未通过时)
/// </summary>
public bool AutoRestart { get; set; }
#endregion

#region 自建变量
/// <summary>
/// 是否运行
/// </summary>
public bool IsRunning { get; set; }
/// <summary>
/// Mqtt是否运行
/// </summary>
public bool IsRunningMqtt = false;
/// <summary>
/// Mqtt
/// </summary>
public MqttHelper mqttHelper = new MqttHelper();
/// <summary>
/// 主函数
/// </summary>
private static volatile Main _Instance;
public static Main GetInstance => _Instance ?? (_Instance = new Main());
public Main()
{
ReadPZ();
if (PZdic.ContainsKey("MQTTConnection"))
MQTTConnection = PZdic["MQTTConnection"];
if (PZdic.ContainsKey("DeviceMC"))
Name = PZdic["DeviceMC"];
}
/// <summary>
/// 设备数据
/// </summary>
public Dictionary<string, Dictionary<string, string>> mqttDatasDic = new Dictionary<string, Dictionary<string, string>>();
/// <summary>
/// 配置数据
/// </summary>
public Dictionary<string,string> PZdic=new Dictionary<string,string>();
/// <summary>
/// Mqtt消息队列
/// </summary>
public ConcurrentQueue<string> msg = new ConcurrentQueue<string>();
#endregion

#region 线程处理函数
/// <summary>
/// 线程服务
/// </summary>
public void ThreadServer()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
try
{
if (IsRunning && IsRunningMqtt)
{
if (msg.Count > 0 && msg.TryDequeue(out string s))
{
SendScreenDataModel read= JsonConvert.DeserializeObject<SendScreenDataModel>(s);
if (read != null)
{
read?.mqttAicDatasDic?.ToList().ForEach(data => {
mqttDatasDic[data.Key]= data.Value;
});
}
}
}
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"{Name}:线程服务异常,原因:{ex.Message}");
}
Thread.Sleep(100);
}), $"{Name},线程服务");
}
#endregion

#region 启动、停止、健康检查
/// <summary>
/// 开始服务
/// </summary>
public void Start()
{
try
{
//连接MQTT、Redis
Connection();
IsRunning = true;
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"{Name}:MQTT或者Redis启动时,连接失败,原因:{ex.Message}");
}
}
/// <summary>
/// 停止服务
/// </summary>
public void Stop()
{
try
{
//0.设置运行标志
IsRunning = false;
mqttHelper.CloseConnect();
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"{Name}:MQTT或者Redis停止时异常,原因:{ex.Message}");
}
}
/// <summary>
/// 健康检查
/// </summary>
/// <param name="msg"></param>
/// <returns></returns>
public bool Check(out string msg)
{
string msgage = string.Empty;
bool IsTrue = false;
if (IsRunningMqtt && IsRunning)
IsTrue = true;
else
{
if (!IsRunningMqtt)
msgage += "Redis断开连接.";
IsTrue = false;
msgage = $"{Name}:健康检查失败,原因:{msgage}";
}
msg = msgage;
return IsTrue;
}
#endregion

#region 调用事件
/// <summary>
/// 读取配置
/// </summary>
public void ReadPZ()
{
System.Configuration.ConfigurationManager.AppSettings.AllKeys?.ToList().ForEach(key => {
PZdic[key]= System.Configuration.ConfigurationManager.AppSettings[key].ToString();
});
}
/// <summary>
/// 初始化连接Redis MQTT
/// </summary>
public void Connection()
{
try
{
//2.Mqtt连接
if (!string.IsNullOrEmpty(this.MQTTConnection) && this.MQTTConnection.Contains(','))
{
string[] mqttcom = this.MQTTConnection.Split(',');
if (mqttcom != null && mqttcom.Count() == 4)
{
mqttHelper.Connect(mqttcom[2], mqttcom[3], mqttcom[0], int.Parse(mqttcom[1]), $"{Name}:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}
}
mqttHelper.Disconnect = new Action(() =>
{
IsRunningMqtt = false;
MessageLog.GetInstance.ShowEx($"{Name}:MQTT异常断开....");
});
mqttHelper.ConnectOk = new Action(() =>
{
IsRunningMqtt = true;//连接成功
if (Name.Contains(","))
{
Name.Split(',')?.ToList().ForEach(x =>
{
mqttHelper.Subscrib(x);
});
}
else
{
mqttHelper.Subscrib(Name);
}
});
mqttHelper.MessageRecive = new Action<string>((s) => { msg.Enqueue(s); });
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"{Name}:初始化连接Redis MQTT,原因:{ex.Message}");
}

}
#endregion
}
}

+ 20
- 0
BPASmartClient.ScreenLib/Model/DevRunStatus.cs View File

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

namespace BPASmartClient.ScreenLib
{
public enum DevRunStatus
{
正常,
异常
}

public enum DevIsRun
{
运行,
停止
}
}

+ 163
- 0
BPASmartClient.ScreenLib/Model/OrderMakeModel.cs View File

@@ -0,0 +1,163 @@
using BPA.Helper;
using BPA.Message.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;

namespace BPASmartClient.ScreenLib
{
/// <summary>
/// 订单制作Model
/// </summary>
public class OrderMakeModel : NotifyBase
{
/// <summary>
/// 状态
/// </summary>
private ORDER_STATUS _Status;
public ORDER_STATUS Status
{
get { return _Status; }
set {
_Status = value;
foreground = new SolidColorBrush(Color.FromArgb(255, 0, 204, 255));
switch ((ORDER_STATUS)value)
{
case ORDER_STATUS.WAIT:
MakeStatus = "等待制作";

foreground = new SolidColorBrush(Color.FromArgb(255, 0, 204, 255));
break;
case ORDER_STATUS.COOKING:
MakeStatus = "制作中";
foreground = new SolidColorBrush(Color.FromArgb(255, 0, 255, 127));
break;
case ORDER_STATUS.COMPLETED_COOK:
MakeStatus = "制作完成";
foreground = new SolidColorBrush(Color.FromArgb(255, 255, 215, 00));
break;
case ORDER_STATUS.COMPLETED_TAKE:
MakeStatus = "取餐完成";
foreground = new SolidColorBrush(Color.FromArgb(255, 102, 204, 153));
break;
case ORDER_STATUS.ERR_NOT_REPLY_WHEN_COOKING:
MakeStatus = "取餐完成";
foreground = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0));
break;
default:
MakeStatus = "异常订单";
break;
}
OnPropertyChanged();
}
}
/// <summary>
/// 制作状态
/// </summary>
private string _MakeStatus;
public string MakeStatus
{
get { return _MakeStatus; }
set
{
_MakeStatus = value;
OnPropertyChanged();
}
}
/// <summary>
/// 商品名称
/// </summary>
public string GoodName { get; set; }

/// <summary>
/// 订单排序号
/// </summary>
public string SortNum { get; set; }

/// <summary>
/// 开始时间
/// </summary>
public string StartTime { get; set; }

/// <summary>
/// 结束时间
/// </summary>
public string StopTime { get; set; }

private Brush _foreground;
public Brush foreground
{
get
{
return _foreground;
}
set
{
if (_foreground == value)
return;
_foreground = value;
OnPropertyChanged("foreground");
}
}
}

/// <summary>
/// 告警数据
/// </summary>
public class AlarmMsModel : NotifyBase
{
private string _AlarmTime;
public string AlarmTime
{
get { return _AlarmTime; }
set
{
_AlarmTime = value;
OnPropertyChanged();
}
}


private string _AlarmMs;
public string AlarmMs
{
get { return _AlarmMs; }
set
{
_AlarmMs = value;
OnPropertyChanged();
}
}
}

/// <summary>
/// 菜品类型
/// </summary>
public class CookType : NotifyBase
{
private string _Name;
public string Name
{
get { return _Name; }
set
{
_Name = value;
OnPropertyChanged();
}
}

private string _Name1;
public string Name1
{
get { return _Name1; }
set
{
_Name1 = value;
OnPropertyChanged();
}
}
}
}

+ 187
- 0
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml View File

@@ -0,0 +1,187 @@
<UserControl x:Class="BPASmartClient.ScreenLib.ScreenSplitMealsControl1"
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:local="clr-namespace:BPASmartClient.ScreenLib"
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
xmlns:con="clr-namespace:BPA.CustomResource.UserControls;assembly=BPA.CustomResource"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPA.CustomResource;component/Themes/ProlineStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

<StackPanel Margin="0,10,0,0">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="2 号档口" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="设备运行情况" Margin="20,10,0,0"/>
<Grid Height="160" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备是否运行</TextBlock>
</StackPanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding DdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="当前操作信息" Margin="20,10,0,0"/>
<Grid Height="160">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="张三"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">前一位刷卡人</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="李四"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">当前刷卡人</TextBlock>
</StackPanel>
</Grid>
</StackPanel>

</GroupBox>
<GroupBox Margin="0,20,10,0" Height="480" Width="450" Header="今日菜品列表" Style="{DynamicResource from}" Tag="Start">
<ListBox ItemsSource="{Binding CookTypeListLeft,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel>
<Button Width="370" Height="100" Margin="20,20,0,0" FontSize="60" Content="{Binding Name}"/>
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</GroupBox>
</StackPanel>

<StackPanel Grid.Column="1" >
<GroupBox Height="600" Width="950" Margin="0,10,0,20" Header="广告区域" HorizontalAlignment="Center" VerticalAlignment="Top" Style="{DynamicResource from}" Tag="Start">
<Grid>
<wv2:WebView2 Name="webView" Source="{Binding GgAdder,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
</GroupBox>

<StackPanel Orientation="Horizontal">

<GroupBox Margin="5,0,0,0" Height="340" Width="950" Header="设备告警详情" Style="{DynamicResource from}">
<DataGrid Margin="0,10,0,0" ItemsSource="{Binding AlarmList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="160">
<DataGridTemplateColumn.Header>
<TextBlock Text="告警时间" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmTime}" Foreground="#FFD86E03" FontSize="14" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="300">
<DataGridTemplateColumn.Header>
<TextBlock Text="告警描述" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmMs}" Foreground="#FFD86E03" FontSize="14" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</GroupBox>
</StackPanel>
</StackPanel>

<StackPanel Grid.Column="2" Margin="0,10,0,0">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="1 号档口" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="设备运行情况" Margin="20,10,0,0"/>
<Grid Height="160" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备是否运行</TextBlock>
</StackPanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding DdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="当前操作信息" Margin="20,10,0,0"/>
<Grid Height="160">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="张三"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">前一位刷卡人</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="李四"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">当前刷卡人</TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</GroupBox>
<GroupBox Margin="0,20,10,0" Height="480" Width="450" Header="今日菜品列表" Style="{DynamicResource from}" Tag="Start">
<ListBox ItemsSource="{Binding CookTypeListReit,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel>
<Button Width="370" Height="100" Margin="20,20,0,0" FontSize="60" Content="{Binding Name}"/>
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</GroupBox>
</StackPanel>
</Grid>

</UserControl>

+ 70
- 0
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml.cs View File

@@ -0,0 +1,70 @@
using BPA.CustomResource.UserControls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.ScreenLib
{
/// <summary>
/// ScreenSplitMealsControl1.xaml 的交互逻辑
/// </summary>
public partial class ScreenSplitMealsControl1 : UserControl
{
public ScreenSplitMealsControl1()
{
InitializeComponent();
this.DataContext = new ScreenSplitMealsControl1ViewModel();
}

public void Start(string name)
{
WindowShow windowLarge2 = new WindowShow();
windowLarge2.Init("二号" + name, new ScreenSplitMealsControl2());
WindowShow windowLarge3 = new WindowShow();
windowLarge3.Init("三号"+ name, new ScreenSplitMealsControl3());
int i = 0;
foreach (System.Windows.Forms.Screen scr in System.Windows.Forms.Screen.AllScreens)
{
if (!scr.Primary)
{
if (i == 1)
{
windowLarge2.WindowStartupLocation = WindowStartupLocation.Manual;

windowLarge2.Left = scr.WorkingArea.Left;
windowLarge2.Top = scr.WorkingArea.Top;
windowLarge2.Width = scr.Bounds.Width;
windowLarge2.Height = scr.Bounds.Height;
windowLarge2.WindowState = WindowState.Maximized;
windowLarge2.ResizeMode = ResizeMode.NoResize;
windowLarge2.WindowStyle = WindowStyle.None;
windowLarge2.WindowState = WindowState.Normal;
windowLarge2.ShowInTaskbar = false;
}
else if (i == 2)
{
windowLarge3.WindowStartupLocation = WindowStartupLocation.Manual;

windowLarge3.Left = scr.WorkingArea.Left;
windowLarge3.Top = scr.WorkingArea.Top;
windowLarge3.Width = scr.Bounds.Width;
windowLarge3.Height = scr.Bounds.Height;
}
i++;
}
}
windowLarge2.Show(); windowLarge3.Show();
}
}
}

+ 145
- 0
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1ViewModel.cs View File

@@ -0,0 +1,145 @@
using BPA.Helper;
using BPA.Message.Enum;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace BPASmartClient.ScreenLib
{
public class ScreenSplitMealsControl1ViewModel : NotifyBase
{
#region 变量
/// <summary>
/// 柱状图显示集合
/// </summary>
public IEnumerable<KeyValuePair<string, double>> Histogram { get { return _Histogram; } set { _Histogram = value; OnPropertyChanged(); } }
private IEnumerable<KeyValuePair<string, double>> _Histogram = new List<KeyValuePair<string, double>>();

/// <summary>
/// 设备是否运行
/// </summary>
public DevIsRun DevIsRun { get { return _DevIsRun; } set { _DevIsRun = value; OnPropertyChanged(); } }
private DevIsRun _DevIsRun = DevIsRun.停止;

/// <summary>
/// 设备状态
/// </summary>
public DevRunStatus RunStatus { get { return _RunStatus; } set { _RunStatus = value; OnPropertyChanged(); } }
private DevRunStatus _RunStatus = DevRunStatus.正常;

/// <summary>
/// 订单数
/// </summary>
public int DdCount { get { return _DdCount; } set { _DdCount = value; OnPropertyChanged(); } }
private int _DdCount = 0;

/// <summary>
/// 异常订单数
/// </summary>
public int YCDdCount { get { return _YCDdCount; } set { _YCDdCount = value; OnPropertyChanged(); } }
private int _YCDdCount = 0;

/// <summary>
/// 广告地址
/// </summary>
public Uri GgAdder { get { return _GgAdder; } set { _GgAdder = value; OnPropertyChanged(); } }
private Uri _GgAdder = new Uri(System.Configuration.ConfigurationManager.AppSettings["GgAdder"].ToString());

/// <summary>
/// 告警数据
/// </summary>
public ObservableCollection<AlarmMsModel> AlarmList
{
get { return _AlarmList; }
set
{
_AlarmList = value;
OnPropertyChanged();
}
}
private ObservableCollection<AlarmMsModel> _AlarmList = new ObservableCollection<AlarmMsModel>();

/// <summary>
/// 菜品类型-左
/// </summary>
public ObservableCollection<CookType> CookTypeListLeft
{
get { return _CookTypeListLeft; }
set
{
_CookTypeListLeft = value;
OnPropertyChanged();
}
}
private ObservableCollection<CookType> _CookTypeListLeft = new ObservableCollection<CookType>();

/// <summary>
/// 菜品类型-右边
/// </summary>
public ObservableCollection<CookType> CookTypeListReit
{
get { return _CookTypeListReit; }
set
{
_CookTypeListReit = value;
OnPropertyChanged();
}
}
private ObservableCollection<CookType> _CookTypeListReit = new ObservableCollection<CookType>();
#endregion
public ScreenSplitMealsControl1ViewModel()
{
Init();
}

/// <summary>
/// 初始化
/// </summary>
public void Init()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
{
RunStatus = RunStatus == DevRunStatus.正常 ? DevRunStatus.异常 : DevRunStatus.正常;
DevIsRun = DevIsRun == DevIsRun.运行 ? DevIsRun.停止 : DevIsRun.运行;
DdCount = new Random().Next(0, 400);
YCDdCount = new Random().Next(0, 400);

List<ORDER_STATUS> oRDER_s = new List<ORDER_STATUS>() { ORDER_STATUS.WAIT, ORDER_STATUS.COOKING };
List<ORDER_STATUS> oRDER_s1 = new List<ORDER_STATUS>() { ORDER_STATUS.COMPLETED_COOK, ORDER_STATUS.COMPLETED_TAKE };

List<string> name_s = new List<string>() { "担担面", "鸡蛋面", "火鸡面", "扬州炒饭", "回锅肉盖饭", "炒茄子" };
CookTypeListReit = new ObservableCollection<CookType>();
CookTypeListReit.Add(new CookType { Name = name_s[0],Name1= name_s[1] });
CookTypeListReit.Add(new CookType { Name = name_s[2], Name1 = name_s[3] });
CookTypeListReit.Add(new CookType { Name = name_s[4], Name1 = name_s[5] });

CookTypeListLeft = new ObservableCollection<CookType>();
CookTypeListLeft.Add(new CookType { Name = name_s[0], Name1 = name_s[1] });
CookTypeListLeft.Add(new CookType { Name = name_s[2], Name1 = name_s[3] });
CookTypeListLeft.Add(new CookType { Name = name_s[4], Name1 = name_s[5] });

AlarmList = new ObservableCollection<AlarmMsModel>();
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
Histogram = new[] {
new KeyValuePair<string, double>(name_s[0], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[1], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[2], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[3], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[4], new Random().Next(0,400))};
}));
Thread.Sleep(5000);
}), $"{DateTime.Now}_1,线程服务");
}
}
}

+ 219
- 0
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2.xaml View File

@@ -0,0 +1,219 @@
<UserControl x:Class="BPASmartClient.ScreenLib.ScreenSplitMealsControl2"
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:local="clr-namespace:BPASmartClient.ScreenLib"
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
xmlns:con="clr-namespace:BPA.CustomResource.UserControls;assembly=BPA.CustomResource"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPA.CustomResource;component/Themes/ProlineStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

<StackPanel Margin="0,10,0,0">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="4 号档口" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="设备运行情况" Margin="20,10,0,0"/>
<Grid Height="160" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备是否运行</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="异常">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备当前状态</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="刷卡信息统计" Margin="20,10,0,0"/>
<Grid Height="160">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding DdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="#FFEC3107" FontSize="52" Text="{Binding YCDdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">异常刷卡数</TextBlock>
</StackPanel>
</Grid>

</StackPanel>

</GroupBox>
<GroupBox Margin="0,20,10,0" Height="480" Width="450" Header="今日菜品列表" Style="{DynamicResource from}" Tag="Start">
<ListBox ItemsSource="{Binding CookTypeListLeft,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel>
<Button Width="170" Height="100" Margin="20,20,0,0" Content="{Binding Name}"/>
<Button Width="170" Height="100" Margin="20,20,0,0" Content="{Binding Name1}"/>
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</GroupBox>
</StackPanel>

<StackPanel Grid.Column="1" >
<GroupBox Height="600" Width="950" Margin="0,10,0,20" Header="广告区域" HorizontalAlignment="Center" VerticalAlignment="Top" Style="{DynamicResource from}" Tag="Start">
<Grid>
<wv2:WebView2 Name="webView" Source="{Binding GgAdder,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
</GroupBox>

<StackPanel Orientation="Horizontal">
<GroupBox Margin="5,0,0,0" Height="340" Width="470" Header="今日菜品刷卡统计图" Style="{DynamicResource from}">
<StackPanel>
<con:BasicBarChart Margin="30,40,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" SeriesArray="{Binding Histogram,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="410" Height="200" ShowSize="50"></con:BasicBarChart>
</StackPanel>
</GroupBox>

<GroupBox Margin="10,0,0,0" Height="340" Width="470" Header="设备告警详情" Style="{DynamicResource from}">
<DataGrid Margin="0,10,0,0" ItemsSource="{Binding AlarmList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="160">
<DataGridTemplateColumn.Header>
<TextBlock Text="告警时间" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmTime}" Foreground="#FFD86E03" FontSize="14" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="300">
<DataGridTemplateColumn.Header>
<TextBlock Text="告警描述" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmMs}" Foreground="#FFD86E03" FontSize="14" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</GroupBox>
</StackPanel>
</StackPanel>

<StackPanel Grid.Column="2" Margin="0,10,0,0">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="3 号档口" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="设备运行情况" Margin="20,10,0,0"/>
<Grid Height="160" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备是否运行</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="异常">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备当前状态</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="刷卡信息统计" Margin="20,10,0,0"/>
<Grid Height="160">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding DdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="#FFEC3107" FontSize="52" Text="{Binding YCDdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">异常刷卡数</TextBlock>
</StackPanel>
</Grid>

</StackPanel>

</GroupBox>
<GroupBox Margin="0,20,10,0" Height="480" Width="450" Header="今日菜品列表" Style="{DynamicResource from}" Tag="Start">
<ListBox ItemsSource="{Binding CookTypeListReit,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel>
<Button Width="170" Height="100" Margin="20,20,0,0" Content="{Binding Name}"/>
<Button Width="170" Height="100" Margin="20,20,0,0" Content="{Binding Name1}"/>
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</GroupBox>
</StackPanel>
</Grid>

</UserControl>

+ 29
- 0
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2.xaml.cs View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.ScreenLib
{
/// <summary>
/// ScreenSplitMealsControl2.xaml 的交互逻辑
/// </summary>
public partial class ScreenSplitMealsControl2 : UserControl
{
public ScreenSplitMealsControl2()
{
InitializeComponent();
this.DataContext = new ScreenSplitMealsControl2ViewModel();
}
}
}

+ 145
- 0
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2ViewModel.cs View File

@@ -0,0 +1,145 @@
using BPA.Helper;
using BPA.Message.Enum;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace BPASmartClient.ScreenLib
{
public class ScreenSplitMealsControl2ViewModel : NotifyBase
{
#region 变量
/// <summary>
/// 柱状图显示集合
/// </summary>
public IEnumerable<KeyValuePair<string, double>> Histogram { get { return _Histogram; } set { _Histogram = value; OnPropertyChanged(); } }
private IEnumerable<KeyValuePair<string, double>> _Histogram = new List<KeyValuePair<string, double>>();

/// <summary>
/// 设备是否运行
/// </summary>
public DevIsRun DevIsRun { get { return _DevIsRun; } set { _DevIsRun = value; OnPropertyChanged(); } }
private DevIsRun _DevIsRun = DevIsRun.停止;

/// <summary>
/// 设备状态
/// </summary>
public DevRunStatus RunStatus { get { return _RunStatus; } set { _RunStatus = value; OnPropertyChanged(); } }
private DevRunStatus _RunStatus = DevRunStatus.正常;

/// <summary>
/// 订单数
/// </summary>
public int DdCount { get { return _DdCount; } set { _DdCount = value; OnPropertyChanged(); } }
private int _DdCount = 0;

/// <summary>
/// 异常订单数
/// </summary>
public int YCDdCount { get { return _YCDdCount; } set { _YCDdCount = value; OnPropertyChanged(); } }
private int _YCDdCount = 0;

/// <summary>
/// 广告地址
/// </summary>
public Uri GgAdder { get { return _GgAdder; } set { _GgAdder = value; OnPropertyChanged(); } }
private Uri _GgAdder = new Uri(System.Configuration.ConfigurationManager.AppSettings["GgAdder"].ToString());

/// <summary>
/// 告警数据
/// </summary>
public ObservableCollection<AlarmMsModel> AlarmList
{
get { return _AlarmList; }
set
{
_AlarmList = value;
OnPropertyChanged();
}
}
private ObservableCollection<AlarmMsModel> _AlarmList = new ObservableCollection<AlarmMsModel>();

/// <summary>
/// 菜品类型-左
/// </summary>
public ObservableCollection<CookType> CookTypeListLeft
{
get { return _CookTypeListLeft; }
set
{
_CookTypeListLeft = value;
OnPropertyChanged();
}
}
private ObservableCollection<CookType> _CookTypeListLeft = new ObservableCollection<CookType>();

/// <summary>
/// 菜品类型-右边
/// </summary>
public ObservableCollection<CookType> CookTypeListReit
{
get { return _CookTypeListReit; }
set
{
_CookTypeListReit = value;
OnPropertyChanged();
}
}
private ObservableCollection<CookType> _CookTypeListReit = new ObservableCollection<CookType>();
#endregion
public ScreenSplitMealsControl2ViewModel()
{
Init();
}

/// <summary>
/// 初始化
/// </summary>
public void Init()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
{
RunStatus = RunStatus == DevRunStatus.正常 ? DevRunStatus.异常 : DevRunStatus.正常;
DevIsRun = DevIsRun == DevIsRun.运行 ? DevIsRun.停止 : DevIsRun.运行;
DdCount = new Random().Next(0, 400);
YCDdCount = new Random().Next(0, 400);

List<ORDER_STATUS> oRDER_s = new List<ORDER_STATUS>() { ORDER_STATUS.WAIT, ORDER_STATUS.COOKING };
List<ORDER_STATUS> oRDER_s1 = new List<ORDER_STATUS>() { ORDER_STATUS.COMPLETED_COOK, ORDER_STATUS.COMPLETED_TAKE };

List<string> name_s = new List<string>() { "担担面", "鸡蛋面", "火鸡面", "扬州炒饭", "回锅肉盖饭", "炒茄子" };
CookTypeListReit = new ObservableCollection<CookType>();
CookTypeListReit.Add(new CookType { Name = name_s[0], Name1 = name_s[1] });
CookTypeListReit.Add(new CookType { Name = name_s[2], Name1 = name_s[3] });
CookTypeListReit.Add(new CookType { Name = name_s[4], Name1 = name_s[5] });

CookTypeListLeft = new ObservableCollection<CookType>();
CookTypeListLeft.Add(new CookType { Name = name_s[0], Name1 = name_s[1] });
CookTypeListLeft.Add(new CookType { Name = name_s[2], Name1 = name_s[3] });
CookTypeListLeft.Add(new CookType { Name = name_s[4], Name1 = name_s[5] });

AlarmList = new ObservableCollection<AlarmMsModel>();
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
Histogram = new[] {
new KeyValuePair<string, double>(name_s[0], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[1], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[2], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[3], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[4], new Random().Next(0,400))};
}));
Thread.Sleep(5000);
}), $"{DateTime.Now}_2,线程服务");
}
}
}

+ 219
- 0
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl3.xaml View File

@@ -0,0 +1,219 @@
<UserControl x:Class="BPASmartClient.ScreenLib.ScreenSplitMealsControl3"
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:local="clr-namespace:BPASmartClient.ScreenLib"
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
xmlns:con="clr-namespace:BPA.CustomResource.UserControls;assembly=BPA.CustomResource"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPA.CustomResource;component/Themes/ProlineStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

<StackPanel Margin="0,10,0,0">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="6 号档口" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="设备运行情况" Margin="20,10,0,0"/>
<Grid Height="160" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备是否运行</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="异常">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备当前状态</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="刷卡信息统计" Margin="20,10,0,0"/>
<Grid Height="160">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding DdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="#FFEC3107" FontSize="52" Text="{Binding YCDdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">异常刷卡数</TextBlock>
</StackPanel>
</Grid>

</StackPanel>

</GroupBox>
<GroupBox Margin="0,20,10,0" Height="480" Width="450" Header="今日菜品列表" Style="{DynamicResource from}" Tag="Start">
<ListBox ItemsSource="{Binding CookTypeListLeft,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel>
<Button Width="170" Height="100" Margin="20,20,0,0" Content="{Binding Name}"/>
<Button Width="170" Height="100" Margin="20,20,0,0" Content="{Binding Name1}"/>
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</GroupBox>
</StackPanel>

<StackPanel Grid.Column="1" >
<GroupBox Height="600" Width="950" Margin="0,10,0,20" Header="广告区域" HorizontalAlignment="Center" VerticalAlignment="Top" Style="{DynamicResource from}" Tag="Start">
<Grid>
<wv2:WebView2 Name="webView" Source="{Binding GgAdder,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
</GroupBox>

<StackPanel Orientation="Horizontal">
<GroupBox Margin="5,0,0,0" Height="340" Width="470" Header="今日菜品刷卡统计图" Style="{DynamicResource from}">
<StackPanel>
<con:BasicBarChart Margin="30,40,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" SeriesArray="{Binding Histogram,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="410" Height="200" ShowSize="50"></con:BasicBarChart>
</StackPanel>
</GroupBox>

<GroupBox Margin="10,0,0,0" Height="340" Width="470" Header="设备告警详情" Style="{DynamicResource from}">
<DataGrid Margin="0,10,0,0" ItemsSource="{Binding AlarmList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="160">
<DataGridTemplateColumn.Header>
<TextBlock Text="告警时间" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmTime}" Foreground="#FFD86E03" FontSize="14" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="300">
<DataGridTemplateColumn.Header>
<TextBlock Text="告警描述" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmMs}" Foreground="#FFD86E03" FontSize="14" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</GroupBox>
</StackPanel>
</StackPanel>

<StackPanel Grid.Column="2" Margin="0,10,0,0">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="5 号档口" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="设备运行情况" Margin="20,10,0,0"/>
<Grid Height="160" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备是否运行</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="异常">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备当前状态</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="刷卡信息统计" Margin="20,10,0,0"/>
<Grid Height="160">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding DdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="#FFEC3107" FontSize="52" Text="{Binding YCDdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">异常刷卡数</TextBlock>
</StackPanel>
</Grid>

</StackPanel>

</GroupBox>
<GroupBox Margin="0,20,10,0" Height="480" Width="450" Header="今日菜品列表" Style="{DynamicResource from}" Tag="Start">
<ListBox ItemsSource="{Binding CookTypeListReit,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel>
<Button Width="170" Height="100" Margin="20,20,0,0" Content="{Binding Name}"/>
<Button Width="170" Height="100" Margin="20,20,0,0" Content="{Binding Name1}"/>
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</GroupBox>
</StackPanel>
</Grid>

</UserControl>

+ 30
- 0
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl3.xaml.cs View File

@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.ScreenLib
{
/// <summary>
/// ScreenSplitMealsControl3.xaml 的交互逻辑
/// </summary>
public partial class ScreenSplitMealsControl3 : UserControl
{
public ScreenSplitMealsControl3()
{
InitializeComponent();
this.DataContext = new ScreenSplitMealsControl3ViewModel();

}
}
}

+ 146
- 0
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl3ViewModel.cs View File

@@ -0,0 +1,146 @@
using BPA.Helper;
using BPA.Message.Enum;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;


namespace BPASmartClient.ScreenLib
{
public class ScreenSplitMealsControl3ViewModel : NotifyBase
{
#region 变量
/// <summary>
/// 柱状图显示集合
/// </summary>
public IEnumerable<KeyValuePair<string, double>> Histogram { get { return _Histogram; } set { _Histogram = value; OnPropertyChanged(); } }
private IEnumerable<KeyValuePair<string, double>> _Histogram = new List<KeyValuePair<string, double>>();

/// <summary>
/// 设备是否运行
/// </summary>
public DevIsRun DevIsRun { get { return _DevIsRun; } set { _DevIsRun = value; OnPropertyChanged(); } }
private DevIsRun _DevIsRun = DevIsRun.停止;

/// <summary>
/// 设备状态
/// </summary>
public DevRunStatus RunStatus { get { return _RunStatus; } set { _RunStatus = value; OnPropertyChanged(); } }
private DevRunStatus _RunStatus = DevRunStatus.正常;

/// <summary>
/// 订单数
/// </summary>
public int DdCount { get { return _DdCount; } set { _DdCount = value; OnPropertyChanged(); } }
private int _DdCount = 0;

/// <summary>
/// 异常订单数
/// </summary>
public int YCDdCount { get { return _YCDdCount; } set { _YCDdCount = value; OnPropertyChanged(); } }
private int _YCDdCount = 0;

/// <summary>
/// 广告地址
/// </summary>
public Uri GgAdder { get { return _GgAdder; } set { _GgAdder = value; OnPropertyChanged(); } }
private Uri _GgAdder = new Uri(System.Configuration.ConfigurationManager.AppSettings["GgAdder"].ToString());

/// <summary>
/// 告警数据
/// </summary>
public ObservableCollection<AlarmMsModel> AlarmList
{
get { return _AlarmList; }
set
{
_AlarmList = value;
OnPropertyChanged();
}
}
private ObservableCollection<AlarmMsModel> _AlarmList = new ObservableCollection<AlarmMsModel>();

/// <summary>
/// 菜品类型-左
/// </summary>
public ObservableCollection<CookType> CookTypeListLeft
{
get { return _CookTypeListLeft; }
set
{
_CookTypeListLeft = value;
OnPropertyChanged();
}
}
private ObservableCollection<CookType> _CookTypeListLeft = new ObservableCollection<CookType>();

/// <summary>
/// 菜品类型-右边
/// </summary>
public ObservableCollection<CookType> CookTypeListReit
{
get { return _CookTypeListReit; }
set
{
_CookTypeListReit = value;
OnPropertyChanged();
}
}
private ObservableCollection<CookType> _CookTypeListReit = new ObservableCollection<CookType>();
#endregion
public ScreenSplitMealsControl3ViewModel()
{
Init();
}

/// <summary>
/// 初始化
/// </summary>
public void Init()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
{
RunStatus = RunStatus == DevRunStatus.正常 ? DevRunStatus.异常 : DevRunStatus.正常;
DevIsRun = DevIsRun == DevIsRun.运行 ? DevIsRun.停止 : DevIsRun.运行;
DdCount = new Random().Next(0, 400);
YCDdCount = new Random().Next(0, 400);

List<ORDER_STATUS> oRDER_s = new List<ORDER_STATUS>() { ORDER_STATUS.WAIT, ORDER_STATUS.COOKING };
List<ORDER_STATUS> oRDER_s1 = new List<ORDER_STATUS>() { ORDER_STATUS.COMPLETED_COOK, ORDER_STATUS.COMPLETED_TAKE };

List<string> name_s = new List<string>() { "担担面", "鸡蛋面", "火鸡面", "扬州炒饭", "回锅肉盖饭", "炒茄子" };
CookTypeListReit = new ObservableCollection<CookType>();
CookTypeListReit.Add(new CookType { Name = name_s[0], Name1 = name_s[1] });
CookTypeListReit.Add(new CookType { Name = name_s[2], Name1 = name_s[3] });
CookTypeListReit.Add(new CookType { Name = name_s[4], Name1 = name_s[5] });

CookTypeListLeft = new ObservableCollection<CookType>();
CookTypeListLeft.Add(new CookType { Name = name_s[0], Name1 = name_s[1] });
CookTypeListLeft.Add(new CookType { Name = name_s[2], Name1 = name_s[3] });
CookTypeListLeft.Add(new CookType { Name = name_s[4], Name1 = name_s[5] });

AlarmList = new ObservableCollection<AlarmMsModel>();
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
Histogram = new[] {
new KeyValuePair<string, double>(name_s[0], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[1], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[2], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[3], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[4], new Random().Next(0,400))};
}));
Thread.Sleep(5000);
}), $"{DateTime.Now}_3,线程服务");
}
}
}

+ 31
- 0
BPASmartClient.ScreenLib/分餐机/WindowShow.xaml View File

@@ -0,0 +1,31 @@
<Window x:Class="BPASmartClient.ScreenLib.WindowShow"
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.ScreenLib"
mc:Ignorable="d"
WindowStartupLocation="Manual"
WindowState="Maximized"
WindowStyle="None"
Title="监控大屏" Height="1080" Width="1920">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPA.CustomResource;component/Themes/ProlineStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Grid Background="{DynamicResource image大屏}">
<Grid.RowDefinitions>
<RowDefinition Height="100"/>
<RowDefinition/>
</Grid.RowDefinitions>
<GroupBox x:Name="titlename" Header="攀华产线数据可视化大屏" Style="{DynamicResource TopStyle}" Tag="Start">

</GroupBox>
<Border x:Name="main" Grid.Row="1">

</Border>
</Grid>
</Window>

+ 41
- 0
BPASmartClient.ScreenLib/分餐机/WindowShow.xaml.cs View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.ScreenLib
{
/// <summary>
/// WindowShow.xaml 的交互逻辑
/// </summary>
public partial class WindowShow : Window
{
public WindowShow()
{
InitializeComponent();
this.KeyDown += new KeyEventHandler((o, k) =>
{
if (k.Key == Key.Escape)
{
if (MessageBox.Show("确认是否退出大屏!", "退出提示", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
this.Close();
}
});
}

public void Init(string title, UserControl user)
{
titlename.Header = title;
main.Child = user;
}
}
}

+ 333
- 0
BPASmartClient.ScreenLib/总监视大屏/ScreenALLControl.xaml View File

@@ -0,0 +1,333 @@
<UserControl x:Class="BPASmartClient.ScreenLib.ScreenALLControl"
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:local="clr-namespace:BPASmartClient.ScreenLib"
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
xmlns:con="clr-namespace:BPA.CustomResource.UserControls;assembly=BPA.CustomResource"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPA.CustomResource;component/Themes/ProlineStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Margin="0,10,0,0">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="310" Width="450" Header="大炒设备" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="1 号炒锅" Margin="20,0,0,0"/>
<Grid Height="80" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="60" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19">设备是否运行</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="42" Foreground="#FFD2C106" Text="{Binding DdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19">今日刷卡数</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="2 号炒锅" Margin="20,0,0,0"/>
<Grid Height="80">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="60" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19">设备是否运行</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="42" Foreground="#FFD2C106" Text="{Binding DdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19">今日刷卡数</TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</GroupBox>
<GroupBox Grid.Row="0" Margin="10,10,10,0" Height="320" Width="450" Header="小炒设备" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="1 号炒锅" Margin="20,0,0,0"/>
<Grid Height="80" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="60" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19">设备是否运行</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="42" Foreground="#FFD2C106" Text="{Binding DdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19">今日刷卡数</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="2 号炒锅" Margin="20,0,0,0"/>
<Grid Height="80">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="60" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19">设备是否运行</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="42" Foreground="#FFD2C106" Text="{Binding DdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19">今日刷卡数</TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</GroupBox>
<GroupBox Grid.Row="0" Margin="10,10,10,0" Height="310" Width="450" Header="煮面设备 MorkS" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="设备运行情况" Margin="20,0,0,0"/>
<Grid Height="80" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="60" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19" >设备是否运行</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="异常">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19">设备当前状态</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="订单信息统计" Margin="20,0,0,0"/>
<Grid Height="80">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="60" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="42" Foreground="#FFD2C106" Text="{Binding DdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19">今日订单数</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="#FFEC3107" FontSize="42" Text="{Binding YCDdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19">异常订单数</TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</GroupBox>
</StackPanel>
<Grid Grid.Column="1" >
<Grid> <Grid VerticalAlignment="Top" Margin="0,-30,0,0"> <Image Style="{DynamicResource imagezhu}"></Image> <Image Style="{DynamicResource image中1}" Margin="0,400,0,0"></Image> <GroupBox Margin="600,100,0,500" Header="10000" Style="{DynamicResource GroupStyle圆形}" Tag="累计收入" Content="万元" Width="100"/> <GroupBox Margin="600,400,0,0" Header="988" Style="{DynamicResource GroupStyle圆形}" Tag="累计刷卡" Content="次" Width="160"/> <GroupBox Margin="-500,100,0,0" Header="0" Style="{DynamicResource GroupStyle圆形}" Tag="累计故障" Content="次" Width="160"/> </Grid> <GroupBox Margin="10,10,10,10" Height="260" Width="940" HorizontalAlignment="Center" VerticalAlignment="Bottom" Style="{DynamicResource fromNoTitle}"> <Grid Margin="0,10,0,0"> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <Grid> <GroupBox Header="商品分布图" Margin="20,0,0,0"/>
<con:RadarChart x:Name="生存图示例" Margin="0,10,0,0" Width="120" Height="150" RadarArray="{Binding RadarModelList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ></con:RadarChart> </Grid> <Grid Grid.Column="1"> <GroupBox Header="商品统计图" Margin="20,0,0,0"/>
<con:BasicBarChart Margin="30,20,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" SeriesArray="{Binding Histogram,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="370" Height="150" ShowSize="50"></con:BasicBarChart>
</Grid> </Grid> </GroupBox> </Grid>
</Grid>
<StackPanel Grid.Column="2" Margin="0,10,0,0">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="420" Width="450" Header="分餐机设备" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="1 号分餐机" Margin="20,0,0,0"/>
<Grid Height="80" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="60" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19">设备是否运行</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="42" Foreground="#FFD2C106" Text="{Binding DdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19">今日刷卡数</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="2 号分餐机" Margin="20,0,0,0"/>
<Grid Height="80" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="60" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19">设备是否运行</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="42" Foreground="#FFD2C106" Text="{Binding DdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19">今日刷卡数</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="3 号分餐机" Margin="20,0,0,0"/>
<Grid Height="80" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="60" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19">设备是否运行</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="42" Foreground="#FFD2C106" Text="{Binding DdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19">今日刷卡数</TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</GroupBox>
<GroupBox Margin="10,10,10,0" Height="260" Width="450" Header="今日商品统计图" Style="{DynamicResource from}">
<StackPanel>
<con:BasicBarChart Margin="30,20,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" SeriesArray="{Binding Histogram,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="410" Height="160" ShowSize="50"></con:BasicBarChart>
</StackPanel>
</GroupBox>
<GroupBox Margin="10,10,10,0" Height="260" Width="450" Header="设备告警详情" Style="{DynamicResource from}">
<DataGrid Margin="0,10,0,0" ItemsSource="{Binding AlarmList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="160">
<DataGridTemplateColumn.Header>
<TextBlock Text="告警时间" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmTime}" Foreground="#FFD86E03" FontSize="14" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="300">
<DataGridTemplateColumn.Header>
<TextBlock Text="告警描述" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmMs}" Foreground="#FFD86E03" FontSize="14" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</GroupBox>
</StackPanel>
</Grid>
</UserControl>

+ 29
- 0
BPASmartClient.ScreenLib/总监视大屏/ScreenALLControl.xaml.cs View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.ScreenLib
{
/// <summary>
/// ScreenALLControl.xaml 的交互逻辑
/// </summary>
public partial class ScreenALLControl : UserControl
{
public ScreenALLControl()
{
InitializeComponent();
this.DataContext = new ScreenALLControlViewModel();
}
}
}

+ 216
- 0
BPASmartClient.ScreenLib/总监视大屏/ScreenALLControlViewModel.cs View File

@@ -0,0 +1,216 @@
using BPA.CustomResource.UserControls;
using BPA.Helper;
using BPA.Message.Enum;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace BPASmartClient.ScreenLib
{
public class ScreenALLControlViewModel : NotifyBase
{
#region 变量
/// <summary>
/// 柱状图显示集合
/// </summary>
public IEnumerable<KeyValuePair<string, double>> Histogram { get { return _Histogram; } set { _Histogram = value; OnPropertyChanged(); } }
private IEnumerable<KeyValuePair<string, double>> _Histogram = new List<KeyValuePair<string, double>>();


/// <summary>
/// 分布统计图
/// </summary>
public ObservableCollection<RadarModel> RadarModelList
{
get { return _RadarModelList; }
set
{
_RadarModelList = value;
OnPropertyChanged();
}
}
private ObservableCollection<RadarModel> _RadarModelList = new ObservableCollection<RadarModel>();

/// <summary>
/// 设备是否运行
/// </summary>
public DevIsRun DevIsRun { get { return _DevIsRun; } set { _DevIsRun = value; OnPropertyChanged(); } }
private DevIsRun _DevIsRun = DevIsRun.停止;

/// <summary>
/// 设备状态
/// </summary>
public DevRunStatus RunStatus { get { return _RunStatus; } set { _RunStatus = value; OnPropertyChanged(); } }
private DevRunStatus _RunStatus = DevRunStatus.正常;

/// <summary>
/// 订单数
/// </summary>
public int DdCount { get { return _DdCount; } set { _DdCount = value; OnPropertyChanged(); } }
private int _DdCount = 0;

/// <summary>
/// 异常订单数
/// </summary>
public int YCDdCount { get { return _YCDdCount; } set { _YCDdCount = value; OnPropertyChanged(); } }
private int _YCDdCount = 0;

/// <summary>
/// 广告地址
/// </summary>
public Uri GgAdder { get { return _GgAdder; } set { _GgAdder = value; OnPropertyChanged(); } }
private Uri _GgAdder = new Uri(System.Configuration.ConfigurationManager.AppSettings["GgAdder"].ToString());

/// <summary>
/// 正在制作订单数据
/// </summary>
public ObservableCollection<OrderMakeModel> OrderMakeList
{
get { return _OrderMakeList; }
set
{
_OrderMakeList = value;
OnPropertyChanged();
}
}
private ObservableCollection<OrderMakeModel> _OrderMakeList = new ObservableCollection<OrderMakeModel>();

/// <summary>
/// 制作完成订单数据
/// </summary>
public ObservableCollection<OrderMakeModel> OrderMakeListOver
{
get { return _OrderMakeListOver; }
set
{
_OrderMakeListOver = value;
OnPropertyChanged();
}
}
private ObservableCollection<OrderMakeModel> _OrderMakeListOver = new ObservableCollection<OrderMakeModel>();

/// <summary>
/// 告警数据
/// </summary>
public ObservableCollection<AlarmMsModel> AlarmList
{
get { return _AlarmList; }
set
{
_AlarmList = value;
OnPropertyChanged();
}
}
private ObservableCollection<AlarmMsModel> _AlarmList = new ObservableCollection<AlarmMsModel>();


#endregion
public ScreenALLControlViewModel()
{
Init();
}

/// <summary>
/// 初始化
/// </summary>
public void Init()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
{
RunStatus = RunStatus == DevRunStatus.正常 ? DevRunStatus.异常 : DevRunStatus.正常;
DevIsRun = DevIsRun == DevIsRun.运行 ? DevIsRun.停止 : DevIsRun.运行;
DdCount = new Random().Next(0, 400);
YCDdCount = new Random().Next(0, 400);

List<ORDER_STATUS> oRDER_s = new List<ORDER_STATUS>() { ORDER_STATUS.WAIT, ORDER_STATUS.COOKING };
List<ORDER_STATUS> oRDER_s1 = new List<ORDER_STATUS>() { ORDER_STATUS.COMPLETED_COOK, ORDER_STATUS.COMPLETED_TAKE };

List<string> name_s = new List<string>() { "担担面", "鸡蛋面", "火鸡面", "扬州炒饭", "回锅肉盖饭" };
OrderMakeList = new ObservableCollection<OrderMakeModel>();
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "011", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "012", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "013", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "014", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });

OrderMakeListOver = new ObservableCollection<OrderMakeModel>();
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "001", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "002", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "003", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "005", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "006", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "008", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "009", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "010", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });


AlarmList = new ObservableCollection<AlarmMsModel>();
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
Histogram = new[] {
new KeyValuePair<string, double>(name_s[0], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[1], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[2], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[3], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[4], new Random().Next(0,400))};

RadarModelList = new ObservableCollection<RadarModel>();
RadarModelList.Add(new RadarModel { Text = name_s[0], ValueMax = new Random().Next(0, 100) });
RadarModelList.Add(new RadarModel { Text = name_s[1], ValueMax = new Random().Next(0, 100) });
RadarModelList.Add(new RadarModel { Text = name_s[2], ValueMax = new Random().Next(0, 100) });
RadarModelList.Add(new RadarModel { Text = name_s[3], ValueMax = new Random().Next(0, 100) });
RadarModelList.Add(new RadarModel { Text = name_s[4], ValueMax = new Random().Next(0, 100) });

}));
Thread.Sleep(5000);
}), $"{DateTime.Now},线程服务");
}
}
}

+ 320
- 0
BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControl.xaml View File

@@ -0,0 +1,320 @@
<UserControl x:Class="BPASmartClient.ScreenLib.ScreenMaxWokControl"
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:local="clr-namespace:BPASmartClient.ScreenLib"
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
xmlns:con="clr-namespace:BPA.CustomResource.UserControls;assembly=BPA.CustomResource"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPA.CustomResource;component/Themes/ProlineStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Margin="0,10,0,0">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="370" Width="450" Header="2 号炒锅" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="设备运行情况" Margin="20,10,0,0"/>
<Grid Height="100" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备是否运行</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="异常">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备当前状态</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="正在炒制菜品" Margin="20,10,0,0"/>
<Grid Height="100">
<TextBlock FontSize="60" Foreground="#FFD2C106">炒制作中</TextBlock>
</Grid>
</StackPanel>
</GroupBox>
<GroupBox Margin="10,20,10,0" Height="275" Width="450" Header="设备当前流程" Style="{DynamicResource from}" Tag="Start">

</GroupBox>
<GroupBox Margin="10,20,10,0" Height="275" Width="450" Header="设备当前状态" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<Grid Height="100" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">炒锅加热挡位</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="异常">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">炒锅搅拌挡位</TextBlock>
</StackPanel>
</Grid>
<Grid Height="100" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">炒锅翻转速度</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="异常">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">当前锅底温度</TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</GroupBox>
</StackPanel>

<StackPanel Grid.Column="1" >
<GroupBox Height="600" Width="950" Margin="0,10,0,20" Header="广告区域" HorizontalAlignment="Center" VerticalAlignment="Top" Style="{DynamicResource from}" Tag="Start">
<Grid>
<wv2:WebView2 Name="webView" Source="{Binding GgAdder,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
</GroupBox>

<GroupBox Margin="0,0,0,0" Height="340" Width="950" Header="告警信息展示区域" Style="{DynamicResource from}">
<DataGrid Margin="0,10,0,0" ItemsSource="{Binding AlarmList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="160">
<DataGridTemplateColumn.Header>
<TextBlock Text="告警时间" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmTime}" Foreground="#FFD86E03" FontSize="14" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="*">
<DataGridTemplateColumn.Header>
<TextBlock Text="告警描述" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmMs}" Foreground="#FFD86E03" FontSize="14" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</GroupBox>
</StackPanel>
<StackPanel Grid.Column="2" Margin="0,10,0,0">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="370" Width="450" Header="1 号炒锅" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="设备运行状态" Margin="20,10,0,0"/>
<Grid Height="100" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备是否运行</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="异常">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备当前状态</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="炒锅运行情况" Margin="20,10,0,0"/>
<Grid Height="100">
<TextBlock FontSize="60" Foreground="#FFD2C106">炒制作中</TextBlock>
</Grid>
</StackPanel>
</GroupBox>
<GroupBox Margin="10,20,10,0" Height="275" Width="450" Header="设备当前流程" Style="{DynamicResource from}" Tag="Start">
</GroupBox>
<GroupBox Margin="10,20,10,0" Height="275" Width="450" Header="设备当前状态" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<Grid Height="100" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">炒锅加热挡位</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="异常">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">炒锅搅拌挡位</TextBlock>
</StackPanel>
</Grid>
<Grid Height="100" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">炒锅翻转速度</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="异常">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">当前锅底温度</TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</GroupBox>
</StackPanel>
</Grid>
</UserControl>

+ 29
- 0
BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControl.xaml.cs View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.ScreenLib
{
/// <summary>
/// ScreenMaxWokControl.xaml 的交互逻辑
/// </summary>
public partial class ScreenMaxWokControl : UserControl
{
public ScreenMaxWokControl()
{
InitializeComponent();
this.DataContext = new ScreenMaxWokControlViewModel();
}
}
}

+ 176
- 0
BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControlViewModel.cs View File

@@ -0,0 +1,176 @@
using BPA.Helper;
using BPA.Message.Enum;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace BPASmartClient.ScreenLib
{
public class ScreenMaxWokControlViewModel : NotifyBase
{
#region 变量
/// <summary>
/// 广告地址
/// </summary>
public Uri GgAdder { get { return _GgAdder; } set { _GgAdder = value; OnPropertyChanged(); } }
private Uri _GgAdder = new Uri(System.Configuration.ConfigurationManager.AppSettings["GgAdder"].ToString());

/// <summary>
/// 设备是否运行
/// </summary>
public DevIsRun DevIsRun { get { return _DevIsRun; } set { _DevIsRun = value; OnPropertyChanged(); } }
private DevIsRun _DevIsRun = DevIsRun.停止;

/// <summary>
/// 设备状态
/// </summary>
public DevRunStatus RunStatus { get { return _RunStatus; } set { _RunStatus = value; OnPropertyChanged(); } }
private DevRunStatus _RunStatus = DevRunStatus.正常;

/// <summary>
/// 订单数
/// </summary>
public int DdCount { get { return _DdCount; } set { _DdCount = value; OnPropertyChanged(); } }
private int _DdCount = 0;

/// <summary>
/// 异常订单数
/// </summary>
public int YCDdCount { get { return _YCDdCount; } set { _YCDdCount = value; OnPropertyChanged(); } }
private int _YCDdCount = 0;

/// <summary>
/// 正在制作订单数据
/// </summary>
public ObservableCollection<OrderMakeModel> OrderMakeList { get { return _OrderMakeList; } set {
_OrderMakeList = value;
OnPropertyChanged();
} }
private ObservableCollection<OrderMakeModel> _OrderMakeList = new ObservableCollection<OrderMakeModel>();

/// <summary>
/// 制作完成订单数据
/// </summary>
public ObservableCollection<OrderMakeModel> OrderMakeListOver
{
get { return _OrderMakeListOver; }
set
{
_OrderMakeListOver = value;
OnPropertyChanged();
}
}
private ObservableCollection<OrderMakeModel> _OrderMakeListOver = new ObservableCollection<OrderMakeModel>();

/// <summary>
/// 告警数据
/// </summary>
public ObservableCollection<AlarmMsModel> AlarmList
{
get { return _AlarmList; }
set
{
_AlarmList = value;
OnPropertyChanged();
}
}
private ObservableCollection<AlarmMsModel> _AlarmList = new ObservableCollection<AlarmMsModel>();


#endregion
public ScreenMaxWokControlViewModel()
{
Init();
}

/// <summary>
/// 初始化
/// </summary>
public void Init()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
{
RunStatus = RunStatus == DevRunStatus.正常 ? DevRunStatus.异常 : DevRunStatus.正常;
DevIsRun = DevIsRun == DevIsRun.运行 ? DevIsRun.停止 : DevIsRun.运行;
DdCount = new Random().Next(0, 400);
YCDdCount = new Random().Next(0, 400);

List<ORDER_STATUS> oRDER_s = new List<ORDER_STATUS>() { ORDER_STATUS.WAIT, ORDER_STATUS.COOKING };
List<ORDER_STATUS> oRDER_s1 = new List<ORDER_STATUS>() { ORDER_STATUS.COMPLETED_COOK, ORDER_STATUS.COMPLETED_TAKE };

List<string> name_s = new List<string>() { "担担面", "鸡蛋面", "火鸡面", "扬州炒饭", "回锅肉盖饭" };
OrderMakeList = new ObservableCollection<OrderMakeModel>();
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "011", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "012", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "013", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "014", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });

OrderMakeListOver = new ObservableCollection<OrderMakeModel>();
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "001", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "002", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "003", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "005", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "006", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "008", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "009", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "010", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });


AlarmList = new ObservableCollection<AlarmMsModel>();
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
}));
Thread.Sleep(5000);
}), $"{DateTime.Now},线程服务");
}
}
}

+ 302
- 0
BPASmartClient.ScreenLib/炒锅/ScreenMinWokControl.xaml View File

@@ -0,0 +1,302 @@
<UserControl x:Class="BPASmartClient.ScreenLib.ScreenMinWokControl"
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:local="clr-namespace:BPASmartClient.ScreenLib"
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
xmlns:con="clr-namespace:BPA.CustomResource.UserControls;assembly=BPA.CustomResource"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPA.CustomResource;component/Themes/ProlineStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

<StackPanel Margin="0,10,0,0">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="370" Width="450" Header="2 号炒锅" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="设备运行状态" Margin="20,10,0,0"/>
<Grid Height="100" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="异常">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备当前状态</TextBlock>
</StackPanel>

<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding DdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日订单数</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="炒锅运行情况" Margin="20,10,0,0"/>
<Grid Height="100">
<TextBlock FontSize="60" Foreground="#FFD2C106">炒制作中</TextBlock>
</Grid>
</StackPanel>
</GroupBox>
<GroupBox Margin="10,20,10,0" Height="275" Width="450" Header="设备当前流程" Style="{DynamicResource from}" Tag="Start">

</GroupBox>
<GroupBox Margin="10,20,10,0" Height="275" Width="450" Header="设备当前状态" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<Grid Height="100" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">炒锅加热挡位</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="异常">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">炒锅搅拌挡位</TextBlock>
</StackPanel>
</Grid>
<Grid Height="100" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">炒锅翻转速度</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="异常">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">当前锅底温度</TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</GroupBox>
</StackPanel>

<StackPanel Grid.Column="1" >
<GroupBox Height="600" Width="950" Margin="0,10,0,20" Header="广告区域" HorizontalAlignment="Center" VerticalAlignment="Top" Style="{DynamicResource from}" Tag="Start">
<Grid>
<wv2:WebView2 Name="webView" Source="{Binding GgAdder,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
</GroupBox>

<StackPanel Orientation="Horizontal">
<GroupBox Margin="0,0,0,0" Height="340" Width="950" Header="告警信息展示区域" Style="{DynamicResource from}">
<DataGrid Margin="0,10,0,0" ItemsSource="{Binding AlarmList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="160">
<DataGridTemplateColumn.Header>
<TextBlock Text="告警时间" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmTime}" Foreground="#FFD86E03" FontSize="14" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="*">
<DataGridTemplateColumn.Header>
<TextBlock Text="告警描述" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmMs}" Foreground="#FFD86E03" FontSize="14" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</GroupBox>
</StackPanel>
</StackPanel>

<StackPanel Grid.Column="2" Margin="0,10,0,0">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="370" Width="450" Header="1 号炒锅" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="设备运行状态" Margin="20,10,0,0"/>
<Grid Height="100" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="异常">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备当前状态</TextBlock>
</StackPanel>

<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding DdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日订单数</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="炒锅运行情况" Margin="20,10,0,0"/>
<Grid Height="100">
<TextBlock FontSize="60" Foreground="#FFD2C106">炒制作中</TextBlock>
</Grid>
</StackPanel>
</GroupBox>
<GroupBox Margin="10,20,10,0" Height="275" Width="450" Header="设备当前流程" Style="{DynamicResource from}" Tag="Start">

</GroupBox>
<GroupBox Margin="10,20,10,0" Height="275" Width="450" Header="设备当前状态" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<Grid Height="100" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">炒锅加热挡位</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="异常">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">炒锅搅拌挡位</TextBlock>
</StackPanel>
</Grid>
<Grid Height="100" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">炒锅翻转速度</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="异常">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">当前锅底温度</TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</GroupBox>
</StackPanel>
</Grid>
</UserControl>

+ 29
- 0
BPASmartClient.ScreenLib/炒锅/ScreenMinWokControl.xaml.cs View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.ScreenLib
{
/// <summary>
/// ScreenMinWokControl.xaml 的交互逻辑
/// </summary>
public partial class ScreenMinWokControl : UserControl
{
public ScreenMinWokControl()
{
InitializeComponent();
this.DataContext = new ScreenMinWokControlViewModel();
}
}
}

+ 191
- 0
BPASmartClient.ScreenLib/炒锅/ScreenMinWokControlViewModel.cs View File

@@ -0,0 +1,191 @@
using BPA.Helper;
using BPA.Message.Enum;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace BPASmartClient.ScreenLib
{
public class ScreenMinWokControlViewModel : NotifyBase
{
#region 变量
/// <summary>
/// 柱状图显示集合
/// </summary>
public IEnumerable<KeyValuePair<string, double>> Histogram { get { return _Histogram; } set { _Histogram = value; OnPropertyChanged(); } }
private IEnumerable<KeyValuePair<string, double>> _Histogram = new List<KeyValuePair<string, double>>();

/// <summary>
/// 设备是否运行
/// </summary>
public DevIsRun DevIsRun { get { return _DevIsRun; } set { _DevIsRun = value; OnPropertyChanged(); } }
private DevIsRun _DevIsRun = DevIsRun.停止;

/// <summary>
/// 设备状态
/// </summary>
public DevRunStatus RunStatus { get { return _RunStatus; } set { _RunStatus = value; OnPropertyChanged(); } }
private DevRunStatus _RunStatus = DevRunStatus.正常;

/// <summary>
/// 订单数
/// </summary>
public int DdCount { get { return _DdCount; } set { _DdCount = value; OnPropertyChanged(); } }
private int _DdCount = 0;

/// <summary>
/// 异常订单数
/// </summary>
public int YCDdCount { get { return _YCDdCount; } set { _YCDdCount = value; OnPropertyChanged(); } }
private int _YCDdCount = 0;

/// <summary>
/// 广告地址
/// </summary>
public Uri GgAdder { get { return _GgAdder; } set { _GgAdder = value; OnPropertyChanged(); } }
private Uri _GgAdder = new Uri(System.Configuration.ConfigurationManager.AppSettings["GgAdder"].ToString());

/// <summary>
/// 正在制作订单数据
/// </summary>
public ObservableCollection<OrderMakeModel> OrderMakeList
{
get { return _OrderMakeList; }
set
{
_OrderMakeList = value;
OnPropertyChanged();
}
}
private ObservableCollection<OrderMakeModel> _OrderMakeList = new ObservableCollection<OrderMakeModel>();

/// <summary>
/// 制作完成订单数据
/// </summary>
public ObservableCollection<OrderMakeModel> OrderMakeListOver
{
get { return _OrderMakeListOver; }
set
{
_OrderMakeListOver = value;
OnPropertyChanged();
}
}
private ObservableCollection<OrderMakeModel> _OrderMakeListOver = new ObservableCollection<OrderMakeModel>();

/// <summary>
/// 告警数据
/// </summary>
public ObservableCollection<AlarmMsModel> AlarmList
{
get { return _AlarmList; }
set
{
_AlarmList = value;
OnPropertyChanged();
}
}
private ObservableCollection<AlarmMsModel> _AlarmList = new ObservableCollection<AlarmMsModel>();

#endregion
public ScreenMinWokControlViewModel()
{
Init();
}

/// <summary>
/// 初始化
/// </summary>
public void Init()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
{
RunStatus = RunStatus == DevRunStatus.正常 ? DevRunStatus.异常 : DevRunStatus.正常;
DevIsRun = DevIsRun == DevIsRun.运行 ? DevIsRun.停止 : DevIsRun.运行;
DdCount = new Random().Next(0, 400);
YCDdCount = new Random().Next(0, 400);

List<ORDER_STATUS> oRDER_s = new List<ORDER_STATUS>() { ORDER_STATUS.WAIT, ORDER_STATUS.COOKING };
List<ORDER_STATUS> oRDER_s1 = new List<ORDER_STATUS>() { ORDER_STATUS.COMPLETED_COOK, ORDER_STATUS.COMPLETED_TAKE };

List<string> name_s = new List<string>() { "担担面", "鸡蛋面", "火鸡面", "扬州炒饭", "回锅肉盖饭" };
OrderMakeList = new ObservableCollection<OrderMakeModel>();
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "011", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "012", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "013", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "014", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });

OrderMakeListOver = new ObservableCollection<OrderMakeModel>();
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "001", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "002", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "003", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "005", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "006", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "008", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "009", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "010", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });


AlarmList = new ObservableCollection<AlarmMsModel>();
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
Histogram = new[] {
new KeyValuePair<string, double>(name_s[0], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[1], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[2], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[3], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[4], new Random().Next(0,400))};
}));
Thread.Sleep(5000);
}), $"{DateTime.Now},线程服务");
}
}
}

+ 363
- 0
BPASmartClient.ScreenLib/煮面机/ScreenMorksControl.xaml View File

@@ -0,0 +1,363 @@
<UserControl x:Class="BPASmartClient.ScreenLib.ScreenMorksControl"
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:local="clr-namespace:BPASmartClient.ScreenLib"
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
xmlns:con="clr-namespace:BPA.CustomResource.UserControls;assembly=BPA.CustomResource"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPA.CustomResource;component/Themes/ProlineStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

<StackPanel Margin="0,10,0,0">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="160" Width="450" Style="{DynamicResource fromNoTitle}" Tag="Start">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备是否运行</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="异常">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备当前状态</TextBlock>
</StackPanel>
</Grid>
</GroupBox>
<GroupBox Margin="0,20,10,0" Height="780" Width="450" Header="待制作订单列表" Style="{DynamicResource from}" Tag="Start">
<DataGrid Margin="0,10,0,0" ItemsSource="{Binding OrderMakeList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="60">
<DataGridTemplateColumn.Header>
<TextBlock Text="订单号" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding SortNum,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Foreground="{Binding foreground,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="14" VerticalAlignment="Bottom" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="120">
<DataGridTemplateColumn.Header>
<TextBlock Text="商品名称" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding GoodName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Foreground="{Binding foreground,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="160">
<DataGridTemplateColumn.Header>
<TextBlock Text="开始时间" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding StartTime,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Foreground="{Binding foreground,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="80">
<DataGridTemplateColumn.Header>
<TextBlock Text="状态" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding MakeStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Foreground="{Binding foreground,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" FontSize="14" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</GroupBox>
</StackPanel>

<StackPanel Grid.Column="1" >
<GroupBox Height="600" Width="950" Margin="0,10,0,20" Header="广告区域" HorizontalAlignment="Center" VerticalAlignment="Top" Style="{DynamicResource from}" Tag="Start">
<Grid>
<wv2:WebView2 Name="webView" Source="{Binding GgAdder,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
</GroupBox>

<StackPanel Orientation="Horizontal">

<GroupBox Margin="5,0,0,0" Height="340" Width="950" Header="告警信息展示区域" Style="{DynamicResource from}">
<DataGrid Margin="0,10,0,0" ItemsSource="{Binding AlarmList,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="160">
<DataGridTemplateColumn.Header>
<TextBlock Text="告警时间" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmTime}" Foreground="#FFD86E03" FontSize="14" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="*">
<DataGridTemplateColumn.Header>
<TextBlock Text="告警描述" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmMs}" Foreground="#FFD86E03" FontSize="14" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</GroupBox>
</StackPanel>
</StackPanel>

<StackPanel Grid.Column="2" Margin="0,10,0,0">
<GroupBox Grid.Column="2" Margin="0,0,10,0" Height="160" HorizontalAlignment="Right" Width="450" Style="{DynamicResource fromNoTitle}" Tag="Start">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding DdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日订单数</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="#FFEC3107" FontSize="52" Text="{Binding YCDdCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">机器人当前状态</TextBlock>
</StackPanel>
</Grid>
</GroupBox>
<GroupBox Margin="10,20,0,0" Height="780" Width="450" Header="设备当前状态" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<Grid Height="100" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="下降">
<Setter Property="Foreground" Value="#FFD2C106"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">煮面炉1号</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="下降">
<Setter Property="Foreground" Value="#FFD2C106"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">煮面炉2号</TextBlock>
</StackPanel>
</Grid>
<Grid Height="100" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="下降">
<Setter Property="Foreground" Value="#FFD2C106"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">煮面炉1号</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="下降">
<Setter Property="Foreground" Value="#FFD2C106"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">煮面炉2号</TextBlock>
</StackPanel>
</Grid>
<Grid Height="100" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="下降">
<Setter Property="Foreground" Value="#FFD2C106"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">煮面炉5号</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="下降">
<Setter Property="Foreground" Value="#FFD2C106"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">煮面炉6号</TextBlock>
</StackPanel>
</Grid>

<Grid Height="100" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="下降">
<Setter Property="Foreground" Value="#FFD2C106"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">温度状态</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="下降">
<Setter Property="Foreground" Value="#FFD2C106"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">料仓位置</TextBlock>
</StackPanel>
</Grid>

<Grid Height="100" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding DevIsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="下降">
<Setter Property="Foreground" Value="#FFD2C106"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">料仓上下物料检测</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding RunStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="下降">
<Setter Property="Foreground" Value="#FFD2C106"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">落碗机构缺碗检测</TextBlock>
</StackPanel>
</Grid>

</StackPanel>
</GroupBox>
</StackPanel>
</Grid>
</UserControl>

+ 29
- 0
BPASmartClient.ScreenLib/煮面机/ScreenMorksControl.xaml.cs View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.ScreenLib
{
/// <summary>
/// ScreenMorksControl.xaml 的交互逻辑
/// </summary>
public partial class ScreenMorksControl : UserControl
{
public ScreenMorksControl()
{
InitializeComponent();
this.DataContext = new ScreenMorksControlViewModel();
}
}
}

+ 311
- 0
BPASmartClient.ScreenLib/煮面机/ScreenMorksControlViewModel.cs View File

@@ -0,0 +1,311 @@
using BPA.Helper;
using BPA.Message.Enum;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;

namespace BPASmartClient.ScreenLib
{
public class ScreenMorksControlViewModel : NotifyBase
{
#region 变量
/// <summary>
/// 广告地址
/// </summary>
public Uri GgAdder { get { return _GgAdder; } set { _GgAdder = value; OnPropertyChanged(); } }
private Uri _GgAdder = new Uri(System.Configuration.ConfigurationManager.AppSettings["GgAdder"].ToString());

/// <summary>
/// 柱状图显示集合
/// </summary>
public IEnumerable<KeyValuePair<string, double>> Histogram { get { return _Histogram; } set { _Histogram = value; OnPropertyChanged(); } }
private IEnumerable<KeyValuePair<string, double>> _Histogram = new List<KeyValuePair<string, double>>();

/// <summary>
/// 设备是否运行
/// </summary>
public DevIsRun DevIsRun { get { return _DevIsRun; } set { _DevIsRun = value; OnPropertyChanged(); } }
private DevIsRun _DevIsRun = DevIsRun.停止;

/// <summary>
/// 设备状态
/// </summary>
public DevRunStatus RunStatus { get { return _RunStatus; } set { _RunStatus = value; OnPropertyChanged(); } }
private DevRunStatus _RunStatus = DevRunStatus.正常;

/// <summary>
/// 订单数
/// </summary>
public int DdCount { get { return _DdCount; } set { _DdCount = value; OnPropertyChanged(); } }
private int _DdCount = 0;

/// <summary>
/// 异常订单数
/// </summary>
public int YCDdCount { get { return _YCDdCount; } set { _YCDdCount = value; OnPropertyChanged(); } }
private int _YCDdCount = 0;

/// <summary>
/// 正在制作订单数据
/// </summary>
public ObservableCollection<OrderMakeModel> OrderMakeList
{
get { return _OrderMakeList; }
set
{
_OrderMakeList = value;
OnPropertyChanged();
}
}
private ObservableCollection<OrderMakeModel> _OrderMakeList = new ObservableCollection<OrderMakeModel>();

/// <summary>
/// 制作完成订单数据
/// </summary>
public ObservableCollection<OrderMakeModel> OrderMakeListOver
{
get { return _OrderMakeListOver; }
set
{
_OrderMakeListOver = value;
OnPropertyChanged();
}
}
private ObservableCollection<OrderMakeModel> _OrderMakeListOver = new ObservableCollection<OrderMakeModel>();

/// <summary>
/// 告警数据
/// </summary>
public ObservableCollection<AlarmMsModel> AlarmList
{
get { return _AlarmList; }
set
{
_AlarmList = value;
OnPropertyChanged();
}
}
private ObservableCollection<AlarmMsModel> _AlarmList = new ObservableCollection<AlarmMsModel>();

#endregion
public ScreenMorksControlViewModel()
{
Init();
}

/// <summary>
/// 初始化
/// </summary>
public void Init()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
{
RunStatus = RunStatus == DevRunStatus.正常 ? DevRunStatus.异常 : DevRunStatus.正常;
DevIsRun = DevIsRun == DevIsRun.运行 ? DevIsRun.停止 : DevIsRun.运行;
DdCount = new Random().Next(0, 400);
YCDdCount = new Random().Next(0, 400);

List<ORDER_STATUS> oRDER_s = new List<ORDER_STATUS>() { ORDER_STATUS.WAIT, ORDER_STATUS.COOKING };
List<ORDER_STATUS> oRDER_s1 = new List<ORDER_STATUS>() { ORDER_STATUS.COMPLETED_COOK, ORDER_STATUS.COMPLETED_TAKE };

List<string> name_s = new List<string>() { "担担面", "鸡蛋面", "火鸡面", "扬州炒饭", "回锅肉盖饭" };
OrderMakeList = new ObservableCollection<OrderMakeModel>();
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "011", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "012", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "013", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "014", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeList.Add(new OrderMakeModel { Status = oRDER_s[new Random().Next(0, 2)], SortNum = "015", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });

OrderMakeListOver = new ObservableCollection<OrderMakeModel>();
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "001", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "002", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "003", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "005", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "006", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "008", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "009", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "010", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });
OrderMakeListOver.Add(new OrderMakeModel { Status = oRDER_s1[new Random().Next(0, 2)], SortNum = "007", GoodName = name_s[new Random().Next(0, 5)], StartTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), StopTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") });


AlarmList = new ObservableCollection<AlarmMsModel>();
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
AlarmList.Add(new AlarmMsModel { AlarmTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), AlarmMs = "XXXX机构出现故障!!!!" });
Histogram = new[] {
new KeyValuePair<string, double>(name_s[0], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[1], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[2], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[3], new Random().Next(0,400)),
new KeyValuePair<string, double>(name_s[4], new Random().Next(0,400))};
}));
Thread.Sleep(5000);
}), $"{DateTime.Now},线程服务");
}

/// <summary>
/// 数据运行器
/// </summary>
public void DataRun()
{
string Dev = "MorkS";//当前设备名称
string name = Main.GetInstance.PZdic.ContainsKey($"{Dev}_Name") ? Main.GetInstance.PZdic[$"{Dev}_Name"].ToString(): DateTime.Now.ToString();
//ThreadManage.GetInstance().StartLong(new Action(() =>
//{
// System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() =>
// {
// if (!string.IsNullOrEmpty(name) && Main.GetInstance.redisDatasDic != null && Main.GetInstance.redisDatasDic.ContainsKey(name) && Main.GetInstance.redisDatasDic[name]!=null)
// {
// List<string> list=new List<string> { "IsRun", "RunStatus", "OrderCount", "ErrorOrderCount", "OrderMakeList", "OrderMakeListOver", "AlarmList" };
// list?.ForEach(x => {
// if (Main.GetInstance.PZdic.ContainsKey($"{Dev}_{x}"))
// {
// if (Main.GetInstance.redisDatasDic[name].ContainsKey(Main.GetInstance.PZdic[$"{Dev}_{x}"]))
// {
// string _value = Main.GetInstance.redisDatasDic[name][Main.GetInstance.PZdic[$"{Dev}_{x}"]].VarVaule;
// #region 执行更新界面数据
// switch (x)
// {
// case "IsRun"://是否运行
// DevIsRun = _value == "0" ? DevIsRun.停止 : DevIsRun.运行;
// break;
// case "RunStatus"://运行状态
// DevIsRun = _value == "0" ? DevIsRun.停止 : DevIsRun.运行;
// break;
// case "OrderCount"://是否运行
// try
// {
// DdCount = int.Parse(_value);
// }
// catch (Exception ex)
// {
// DdCount = 0;
// }
// break;
// case "ErrorOrderCount":
// try
// {
// YCDdCount = int.Parse(_value);
// }
// catch (Exception ex)
// {
// YCDdCount = 0;
// }
// break;
// case "OrderMakeList":
// try
// {
// OrderMakeList = new ObservableCollection<OrderMakeModel>();
// JsonConvert.DeserializeObject<List<OrderMakeModel>>(_value)?.OrderBy(l => l.SortNum)?.ToList().ForEach(par => {
// OrderMakeList.Add(par);
// });
// }
// catch (Exception ex)
// {
// OrderMakeList = new ObservableCollection<OrderMakeModel>();
// }
// break;
// case "OrderMakeListOver":
// try
// {
// OrderMakeListOver = new ObservableCollection<OrderMakeModel>();
// JsonConvert.DeserializeObject<List<OrderMakeModel>>(_value)?.OrderBy(l => l.SortNum)?.ToList().ForEach(par => {
// OrderMakeListOver.Add(par);
// });
// //OrderMakeListOver?.ToList().FindAll(m => m.GoodName).di
// }
// catch (Exception ex)
// {
// OrderMakeListOver = new ObservableCollection<OrderMakeModel>();
// }
// break;
// case "AlarmList":
// try
// {
// AlarmList = new ObservableCollection<AlarmMsModel>();
// JsonConvert.DeserializeObject<List<AlarmMsModel>>(_value)?.OrderBy(l => l.AlarmTime)?.ToList().ForEach(par => {
// AlarmList.Add(par);
// });


// //Histogram=new
// //if (AlarmList.Count > 0)
// //{

// //}
// }
// catch (Exception ex)
// {
// OrderMakeListOver = new ObservableCollection<OrderMakeModel>();
// }
// break;
// default:
// break;
// }
// #endregion

// }
// }

// });
// }
// //Histogram = new[] {
// // new KeyValuePair<string, double>(name_s[0], new Random().Next(0,400)),
// // new KeyValuePair<string, double>(name_s[1], new Random().Next(0,400)),
// // new KeyValuePair<string, double>(name_s[2], new Random().Next(0,400)),
// // new KeyValuePair<string, double>(name_s[3], new Random().Next(0,400)),
// // new KeyValuePair<string, double>(name_s[4], new Random().Next(0,400))};
// }));
// Thread.Sleep(500);
//}), $"{name},线程服务");
}
}
}

+ 10
- 0
BPASmartClient.ScreenMaxWok/App.config View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!--MQTT配置-->
<add key="MQTTConnection" value="10.2.1.254,1883,admin,public"/>
<!--订阅主题设置:大炒,小炒,分餐机,煮面机-->
<add key="DeviceMC" value="大炒,小炒,分餐机,煮面机"/>
<add key="GgAdder" value="https://stream7.iqilu.com/10339/upload_transcode/202002/18/20200218114723HDu3hhxqIT.mp4"/>
</appSettings>
</configuration>

+ 8
- 0
BPASmartClient.ScreenMaxWok/App.xaml View File

@@ -0,0 +1,8 @@
<Application x:Class="BPASmartClient.ScreenMaxWok.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BPASmartClient.ScreenMaxWok">
<Application.Resources>
</Application.Resources>
</Application>

+ 27
- 0
BPASmartClient.ScreenMaxWok/App.xaml.cs View File

@@ -0,0 +1,27 @@
using BPASmartClient.ScreenLib;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmartClient.ScreenMaxWok
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
AppMain appMain = new AppMain(MainWindow, this.GetType());
}
protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
}
}
}

+ 10
- 0
BPASmartClient.ScreenMaxWok/AssemblyInfo.cs View File

@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

+ 23
- 0
BPASmartClient.ScreenMaxWok/BPASmartClient.ScreenMaxWok.csproj View File

@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<AssemblyName>大炒大屏</AssemblyName>
<ApplicationIcon>hbl.ico</ApplicationIcon>

</PropertyGroup>
<ItemGroup>
<Content Include="hbl.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BPASmartClient.ScreenLib\BPASmartClient.ScreenLib.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="App.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

BIN
View File


+ 9
- 0
BPASmartClient.ScreenMinWok/App.config View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<!--Redis配置-->
<add key="RedisConnection" value="10.2.1.254,6379,BapAdmin123456.,1"/>
<add key="DeviceMC" value="1"/>
<add key="GgAdder" value="https://stream7.iqilu.com/10339/upload_transcode/202002/18/20200218114723HDu3hhxqIT.mp4"/>
</appSettings>
</configuration>

+ 8
- 0
BPASmartClient.ScreenMinWok/App.xaml View File

@@ -0,0 +1,8 @@
<Application x:Class="BPASmartClient.ScreenMinWok.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:BPASmartClient.ScreenMinWok">
<Application.Resources>
</Application.Resources>
</Application>

+ 27
- 0
BPASmartClient.ScreenMinWok/App.xaml.cs View File

@@ -0,0 +1,27 @@
using BPASmartClient.ScreenLib;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace BPASmartClient.ScreenMinWok
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
AppMain appMain = new AppMain(MainWindow, this.GetType());
}
protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
}
}
}

+ 10
- 0
BPASmartClient.ScreenMinWok/AssemblyInfo.cs View File

@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]

+ 24
- 0
BPASmartClient.ScreenMinWok/BPASmartClient.ScreenMinWok.csproj View File

@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<AssemblyName>小炒大屏</AssemblyName>
<ApplicationIcon>hbl.ico</ApplicationIcon>

</PropertyGroup>

<ItemGroup>
<Content Include="hbl.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\BPASmartClient.ScreenLib\BPASmartClient.ScreenLib.csproj" />
</ItemGroup>
<ItemGroup>
<Resource Include="App.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Resource>
</ItemGroup>
</Project>

BIN
View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save