Sfoglia il codice sorgente

morkBF

样式分支
NXX 2 anni fa
parent
commit
752f21c619
100 ha cambiato i file con 5306 aggiunte e 4568 eliminazioni
  1. +31
    -0
      BPASmartClient.CustomResource/Converters/RecipeStatusConvert.cs
  2. +0
    -1
      BPASmartClient.JXJFoodBigStation/App.xaml.cs
  3. +6
    -1
      BPASmartClient.JXJFoodBigStation/Model/DeviceCurrentStatus.cs
  4. +13
    -19
      BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs
  5. +17
    -0
      BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Read.cs
  6. +0
    -41
      BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DataComm.cs
  7. +1
    -1
      BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs
  8. +160
    -48
      BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
  9. +0
    -2
      BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs
  10. +44
    -19
      BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_DataColl_DB.cs
  11. +20
    -3
      BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Start_DB.cs
  12. +12
    -9
      BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Status_DB.cs
  13. +1
    -374
      BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensCommAddress.cs
  14. +55
    -5
      BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs
  15. +20
    -90
      BPASmartClient.JXJFoodBigStation/Model/TestData.cs
  16. +0
    -8
      BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml
  17. +76
    -369
      BPASmartClient.JXJFoodBigStation/View/SiemensRecipeSendDownView.xaml
  18. +0
    -25
      BPASmartClient.JXJFoodBigStation/View/SiemensRecipeSendDownView.xaml.cs
  19. +1
    -1
      BPASmartClient.JXJFoodBigStation/ViewModel/DeviceManageViewModel.cs
  20. +6
    -11
      BPASmartClient.JXJFoodBigStation/ViewModel/HardwareStatusViewModel.cs
  21. +13
    -2
      BPASmartClient.JXJFoodBigStation/ViewModel/RecipeSendDownViewModel.cs
  22. +18
    -14
      BPASmartClient.JXJFoodBigStation/ViewModel/SiemensRecipeSendDownViewModel.cs
  23. +2
    -0
      BPASmartClient.JXJFoodSmallStation/App.xaml.cs
  24. +6
    -2
      BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs
  25. +172
    -52
      BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
  26. +59
    -15
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/SiemensDeviceStatus.cs
  27. +3
    -3
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Finish_DB.cs
  28. +2
    -2
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Start_DB.cs
  29. +1
    -1
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Status_DB.cs
  30. +3
    -1
      BPASmartClient.MORKSM.BK.PLC/PLCMachine.cs
  31. +1
    -1
      BPASmartClient.Model/柔性味魔方/RawMaterialModel.cs
  32. +1276
    -714
      BPASmartClient.MorkF/Control_MorkF.cs
  33. +16
    -1
      BPASmartClient.MorkF/GVL_MorkF.cs
  34. +127
    -0
      BPASmartClient.MorkF/ML_MorkF.cs
  35. +27
    -0
      BPASmartClient.MorkF/MaterialOperation.cs
  36. +23
    -5
      BPASmartClient.MorkF/View/DebugView.xaml
  37. +56
    -3
      BPASmartClient.MorkF/ViewModel/DebugViewModel.cs
  38. +1
    -0
      BPASmartClient.MorkS/BPASmartClient.MorkS.csproj
  39. +60
    -6
      BPASmartClient.MorkS/Control_Morks.cs
  40. +11
    -4
      BPASmartClient.MorkS/DataServer.cs
  41. +23
    -5
      BPASmartClient.MorkTSingle/Control_MORKJC.cs
  42. +4
    -0
      BPASmartClient.MorkTSingle/GVL_MORKJC.cs
  43. +25
    -4
      BPASmartClient.S7Net/EntityClassResolution.cs
  44. +36
    -6
      BPASmartClient.S7Net/SiemensHelper.cs
  45. +4
    -3
      BPASmartClient.ScreenALL/App.config
  46. +1
    -1
      BPASmartClient.ScreenALL/BPASmartClient.ScreenALL.csproj
  47. +58
    -5
      BPASmartClient.ScreenLib/AppMain.cs
  48. +1
    -1
      BPASmartClient.ScreenLib/BPASmartClient.ScreenLib.csproj
  49. +50
    -8
      BPASmartClient.ScreenLib/Helper/Main.cs
  50. +0
    -20
      BPASmartClient.ScreenLib/Model/DevRunStatus.cs
  51. +1
    -57
      BPASmartClient.ScreenLib/Model/OrderMakeModel.cs
  52. +188
    -186
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml
  53. +0
    -40
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml.cs
  54. +17
    -102
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1ViewModel.cs
  55. +52
    -83
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2.xaml
  56. +17
    -102
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2ViewModel.cs
  57. +53
    -84
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl3.xaml
  58. +17
    -102
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl3ViewModel.cs
  59. +0
    -31
      BPASmartClient.ScreenLib/分餐机/WindowShow.xaml
  60. +0
    -41
      BPASmartClient.ScreenLib/分餐机/WindowShow.xaml.cs
  61. +291
    -114
      BPASmartClient.ScreenLib/总监视大屏/ScreenALLControl.xaml
  62. +159
    -129
      BPASmartClient.ScreenLib/总监视大屏/ScreenALLControlViewModel.cs
  63. +404
    -319
      BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControl.xaml
  64. +54
    -123
      BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControlViewModel.cs
  65. +403
    -301
      BPASmartClient.ScreenLib/炒锅/ScreenMinWokControl.xaml
  66. +36
    -134
      BPASmartClient.ScreenLib/炒锅/ScreenMinWokControlViewModel.cs
  67. +392
    -362
      BPASmartClient.ScreenLib/煮面机/ScreenMorksControl.xaml
  68. +29
    -249
      BPASmartClient.ScreenLib/煮面机/ScreenMorksControlViewModel.cs
  69. +4
    -3
      BPASmartClient.ScreenMinWok/App.config
  70. +5
    -4
      BPASmartClient.ScreenMorks/App.config
  71. +8
    -3
      BPASmartClient.ScreenSplitMeals/App.config
  72. +6
    -0
      DosingSystem/App.config
  73. +1
    -0
      DosingSystem/App.xaml
  74. +5
    -7
      DosingSystem/App.xaml.cs
  75. +5
    -0
      DosingSystem/BPASmartClient.DosingSystem.csproj
  76. +7
    -4
      DosingSystem/Model/DeviceInquire.cs
  77. +5
    -0
      DosingSystem/Model/RecipeModel.cs
  78. +4
    -0
      DosingSystem/Model/StockStatusModel.cs
  79. +1
    -1
      DosingSystem/Model/par/BasePar.cs
  80. +0
    -1
      DosingSystem/Model/par/DevicePar.cs
  81. +10
    -9
      DosingSystem/Service/SiemensDevice.cs
  82. +4
    -4
      DosingSystem/View/ChangeDeviceNameView.xaml.cs
  83. +1
    -1
      DosingSystem/View/NewRecipeView.xaml.cs
  84. +2
    -2
      DosingSystem/View/RecipeControlView.xaml
  85. +0
    -10
      DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs
  86. +0
    -1
      DosingSystem/ViewModel/ConveyerBeltManualViewModel.cs
  87. +3
    -4
      DosingSystem/ViewModel/NewRecipeViewModel.cs
  88. +257
    -38
      DosingSystem/ViewModel/RecipeControlViewModel.cs
  89. +3
    -10
      DosingSystem/ViewModel/RecipeSettingsViewModel.cs
  90. +0
    -1
      DosingSystem/ViewModel/StockControViewModel.cs
  91. +13
    -0
      DosingSystem/tsconfig1.json
  92. +46
    -0
      SmartClient.sln
  93. +9
    -0
      WpfApp1/App.xaml
  94. +17
    -0
      WpfApp1/App.xaml.cs
  95. +10
    -0
      WpfApp1/AssemblyInfo.cs
  96. +12
    -0
      WpfApp1/MainWindow.xaml
  97. +90
    -0
      WpfApp1/MainWindow.xaml.cs
  98. +14
    -0
      WpfApp1/WpfApp1.csproj
  99. +100
    -0
      WpfApp1/XL_Start_DB.cs
  100. +9
    -0
      WpfTest/App.xaml

+ 31
- 0
BPASmartClient.CustomResource/Converters/RecipeStatusConvert.cs Vedi File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media;

namespace BPASmartClient.CustomResource.Converters
{
public class RecipeStatusConvert : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null)
{
if (value.ToString() == "等待制作")
return Brushes.Yellow;
else if (value.ToString() == "制作完成")
return Brushes.Green;
}
return default;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

+ 0
- 1
BPASmartClient.JXJFoodBigStation/App.xaml.cs Vedi File

@@ -29,7 +29,6 @@ namespace BPASmartClient.JXJFoodBigStation
DataInit();
ProcessControl.GetInstance.Init();
MainView mv = new MainView();
//mv.Show();
LoginView lv = new LoginView();
var res = lv.ShowDialog();
if (res != null && res == true)


+ 6
- 1
BPASmartClient.JXJFoodBigStation/Model/DeviceCurrentStatus.cs Vedi File

@@ -13,7 +13,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model
public double Weight { get { return _mWeight; } set { _mWeight = value; OnPropertyChanged(); } }
private double _mWeight;


/// <summary>
/// 运行状态
/// </summary>
public bool RunStatus { get { return _mRunStatus; } set { _mRunStatus = value; OnPropertyChanged(); } }
private bool _mRunStatus;

@@ -21,6 +23,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model
public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } }
private string _mDeviceName;

/// <summary>
/// 设备编号
/// </summary>
public int DeviceNum { get { return _mDeviceNum; } set { _mDeviceNum = value; OnPropertyChanged(); } }
private int _mDeviceNum;



+ 13
- 19
BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs Vedi File

@@ -16,37 +16,31 @@ namespace BPASmartClient.JXJFoodBigStation.Model
/// </summary>
public static bool HeartBeatFromPlc { get; set; }
/// <summary>
/// 往输送带下发配方完成
/// </summary>
public bool IssueRecipeFinish { get; set; } = false;
/// <summary>
/// 当前料仓的位置
/// </summary>
public int StockInIsWork { get; set; } = 0;
/// <summary>
/// 单个配方执行完成标志
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方
/// </summary>
public bool RecipeFinish { get; set; } = false;
public static int Recipe1DosingStatus { get; set; }
/// <summary>
/// 记录AGV进站送货的指令顺序
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方
/// </summary>
public int AgvDeliveryPosition { get; set; }
public static int Recipe2DosingStatus { get; set; }
/// <summary>
/// 记录AGV进站取货的指令顺序
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方
/// </summary>
public int AgvPickUpPosition { get; set; }

public static int Recipe3DosingStatus { get; set; }
/// <summary>
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方
/// </summary>
public static int Recipe1DosingStatus { get; set; }
public static int Recipe2DosingStatus { get; set; }
public static int Recipe3DosingStatus { get; set; }
public static int Recipe4DosingStatus { get; set; }

/// <summary>
/// 是否处于手动下发配方
/// </summary>
public static bool IsUseLocalRecipe { get; set; } = false;
/// <summary>
/// 订单请求
/// </summary>
public static bool Order_Request { get; set; } = false;
public static int SiemensSendRecipeStatus { get; set; } = 0;

public const int Max_DosingSotckBinNum = 14;
}
}

+ 17
- 0
BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Read.cs Vedi File

@@ -8,20 +8,37 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
{
public class DB_Read
{
/// <summary>
/// plc心跳上报
/// </summary>
public bool HeartBeat { get; set; }
/// <summary>
/// 配方1允许下发配方
/// </summary>
public bool IsAllowIssueRecipe1 { get; set; }
public bool IsAllowIssueRecipe2 { get; set; }
public bool IsAllowIssueRecipe3 { get; set; }
public bool IsAllowIssueRecipe4 { get; set; }

/// <summary>
/// 配方1 接收配方完成
/// </summary>
public bool ReceiveFinishRecipe1 { get; set; }
public bool ReceiveFinishRecipe2 { get; set; }
public bool ReceiveFinishRecipe3 { get; set; }
public bool ReceiveFinishRecipe4 { get; set; }

/// <summary>
/// 配方1 配料完成
/// </summary>
public bool Recipe1DosingFinish { get; set; }
public bool Recipe2DosingFinish { get; set; }
public bool Recipe3DosingFinish { get; set; }
public bool Recipe4DosingFinish { get; set; }

/// <summary>
/// 配方1 托盘编号
/// </summary>
public short Recipe1TrayCode { get; set; }
public short Recipe2TrayCode { get; set; }
public short Recipe3TrayCode { get; set; }


+ 0
- 41
BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DataComm.cs Vedi File

@@ -1,41 +0,0 @@
using BPASmartClient.Helper;
using BPASmartClient.Modbus;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
{
public class DataComm
{
public volatile static DataComm Instance;
public static DataComm GetInstance => Instance ?? (new DataComm());
public DataComm() { }
/// <summary>
/// 是否允许配料
/// </summary>
public bool IsAllowDosing { get { return _mIsAllowDosing; } set { _mIsAllowDosing = value; } }
private bool _mIsAllowDosing;

public bool DosingFinishToPLC { get { return _mDosingFinishToPLC; } set { _mDosingFinishToPLC = value; } }
private bool _mDosingFinishToPLC;

private int _mStockBinLocationToPLC;
public int StockBinLocationToPLC { get { return _mStockBinLocationToPLC; } set { _mStockBinLocationToPLC = value; } }

public bool StatusSignToBPA { get { return _mStatusSignToBPA; } set { _mStatusSignToBPA = value; } }
private bool _mStatusSignToBPA;

private int _mStockBinLocationToBPA;
public int StockBinLocationToBPA { get { return _mStockBinLocationToBPA; } set { _mStockBinLocationToBPA = value; } }

private int _mBarrelNumToPLC;
public int BarrelNumToPLC { get { return _mBarrelNumToPLC; } set { _mBarrelNumToPLC = value; } }
/*public ConcurrentDictionary<int, StockBinLocations> DeviceLists = new ConcurrentDictionary<int, StockBinLocations>();*/
}
}

+ 1
- 1
BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs Vedi File

@@ -52,7 +52,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
PlcWrite.TrayCode = Convert.ToInt16(recipe.TrayCode);
for (int barrel = 1; barrel < 6; barrel++)
{
if (barrel != 3)
if (barrel != 3)//桶的编号不为3 只为1,2,4,5号桶
{
for (int loc = 1; loc < 15; loc++)
{


+ 160
- 48
BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs Vedi File

@@ -20,12 +20,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model
private volatile static ProcessControl _Instance;
public static ProcessControl GetInstance => _Instance ?? (_Instance = new ProcessControl());
private ProcessControl() { }

public SiemensDeviceStatus SiemensDevice = new SiemensDeviceStatus();
public HKDeviceStatus HKDevice = new HKDeviceStatus();
DL_Finish_DB FinishData = new DL_Finish_DB();

/// <summary>
/// 配方数据
/// </summary>
@@ -45,12 +42,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model
public ConcurrentQueue<string> RecipeQueue2 = new ConcurrentQueue<string>();
public ConcurrentQueue<string> RecipeQueue3 = new ConcurrentQueue<string>();
public ConcurrentQueue<string> RecipeQueue4 = new ConcurrentQueue<string>();
/// <summary>
/// 接收原料数据
/// </summary>
public RecipeRawMaterial RawMaterial;
public void Init()
{
testData();
ActionManage.GetInstance.CancelRegister("SiemensSendRecipe");
ActionManage.GetInstance.Register(new Action<object>((res) =>
{
@@ -60,9 +54,9 @@ namespace BPASmartClient.JXJFoodBigStation.Model
if (res != null && res is DL_Start_DB recipe)
{
RawMaterials.Clear();
for (int i = 0; i < 15; i++)
for (int i = 0; i < GVL_BigStation.Max_DosingSotckBinNum; i++)
{
if (RawMaterialsNamePos.ContainsKey(recipe.RecipeName))
if (RawMaterialsNamePos.ContainsKey(recipe.Material[i].Material_Name))
{
RawMaterials.Add(new RawMaterial()
{
@@ -77,12 +71,15 @@ namespace BPASmartClient.JXJFoodBigStation.Model
//报警,配方的原料名称下发和设备不一致
}
}
Json<RemoteRecipe>.Data.Recipes.Add(new RecipeData()
App.Current.Dispatcher.Invoke(() =>
{
RecipeName = recipe.RecipeName,
RecipeCode = recipe.RecipeCode,
RawMaterial = RawMaterials,
//TrayCode = recipe.Order_No,
Json<RemoteRecipe>.Data.Recipes.Add(new RecipeData()
{
RecipeName = recipe.RecipeName,
RecipeCode = recipe.RecipeCode,
RawMaterial = RawMaterials,
TrayCode = recipe.Job_No,
});
});
}
}
@@ -92,13 +89,13 @@ namespace BPASmartClient.JXJFoodBigStation.Model
try
{
//HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71500, HK_PLC_IP);
//SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP);
SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP);
if (HKDevice.IsConnected)
{
HKDevice.Init();
MessageNotify.GetInstance.ShowRunLog("海科plc连接成功");
}
if (SiemensDevice.IsConnected)
if (SiemensDevice.IsConnected || true)
{
SiemensDevice.Init();
MessageNotify.GetInstance.ShowRunLog("西门子plc连接成功");
@@ -108,24 +105,10 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{

}
ActionManage.GetInstance.CancelRegister("ManualSendRecipe");
ActionManage.GetInstance.Register(new Action<Object>((o) =>
{
if (o != null && o is RecipeData a)
{
Json<LocalRecipe>.Data.Recipes.Add(a);
for (int i = 0; i < Json<LocalRecipe>.Data.Recipes.Count; i++)
{
foreach (var item in Json<LocalRecipe>.Data.Recipes.ElementAt(i).RawMaterial)
{
item.RawMaterialLocation = Convert.ToInt32(item.RawMaterialName);
}
}
MessageNotify.GetInstance.ShowAlarmLog("手动下发配方完成");
}
}), "ManualSendRecipe", true);
RecipeQueue1.Clear();
RecipeQueue2.Clear();
RecipeQueue3.Clear();
RecipeQueue4.Clear();
ThreadManage.GetInstance().StartLong(new Action(() =>
{
SystemStatus();
@@ -152,25 +135,134 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
foreach (var data in Recipes)
{
if (RecipeQueue1.Count == 0)
if (RecipeQueue1.Count == 0 && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode))
{
if (!(RecipeQueue1.Contains(data.RecipeCode)))
RecipeQueue1.Enqueue(data.RecipeCode);
{
if (SiemensDevice.DL_Status is DL_Status_DB status)
{
if (GVL_BigStation.SiemensSendRecipeStatus == 3)
{
GVL_BigStation.SiemensSendRecipeStatus = 4;
SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10);
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true);
}
if (GVL_BigStation.SiemensSendRecipeStatus == 4)
{
if (SiemensDevice.DL_Status.Dosing_Start_ACK)
{
GVL_BigStation.SiemensSendRecipeStatus = 5;
SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10);
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", false);
}
}
if (GVL_BigStation.SiemensSendRecipeStatus == 5)
{
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
{
GVL_BigStation.SiemensSendRecipeStatus = 6;
RecipeQueue1.Enqueue(data.RecipeCode);
}
}
}

}
}
else if (RecipeQueue2.Count == 0)
else if (RecipeQueue2.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode))
{
if (!(RecipeQueue2.Contains(data.RecipeCode)))
RecipeQueue2.Enqueue(data.RecipeCode);
{
if (SiemensDevice.DL_Status is DL_Status_DB status)
{
if (GVL_BigStation.SiemensSendRecipeStatus == 3)
{
GVL_BigStation.SiemensSendRecipeStatus = 4;
SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10);
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true);
}
if (GVL_BigStation.SiemensSendRecipeStatus == 4)
{
if (SiemensDevice.DL_Status.Dosing_Start_ACK)
{
GVL_BigStation.SiemensSendRecipeStatus = 5;
SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10);
SiemensDevice.Siemens_PLC_S7.Write("DB3231.DBX28.0", false);
}
}
if (GVL_BigStation.SiemensSendRecipeStatus == 5)
{
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
{
GVL_BigStation.SiemensSendRecipeStatus = 6;
RecipeQueue2.Enqueue(data.RecipeCode);
}
}
}
}
}
else if (RecipeQueue3.Count == 0)
else if (RecipeQueue3.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue4.Contains(data.RecipeCode))
{
if (!(RecipeQueue3.Contains(data.RecipeCode)))
RecipeQueue3.Enqueue(data.RecipeCode);
if (!(RecipeQueue3.Contains(data.RecipeCode)))
{
if (SiemensDevice.DL_Status is DL_Status_DB status)
{
if (GVL_BigStation.SiemensSendRecipeStatus == 3)
{
GVL_BigStation.SiemensSendRecipeStatus = 4;
SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10);
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true);
}
if (GVL_BigStation.SiemensSendRecipeStatus == 4)
{
if (SiemensDevice.DL_Status.Dosing_Start_ACK)
{
GVL_BigStation.SiemensSendRecipeStatus = 5;
SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10);
SiemensDevice.Siemens_PLC_S7.Write("DB3231.DBX28.0", false);
}
}
if (GVL_BigStation.SiemensSendRecipeStatus == 5)
{
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
{
GVL_BigStation.SiemensSendRecipeStatus = 6;
RecipeQueue3.Enqueue(data.RecipeCode);
}
}
}
}
}
else if (RecipeQueue4.Count == 0)
else if (RecipeQueue4.Count == 0 && !RecipeQueue1.Contains(data.RecipeCode) && !RecipeQueue2.Contains(data.RecipeCode) && !RecipeQueue3.Contains(data.RecipeCode))
{
if (!(RecipeQueue4.Contains(data.RecipeCode)))
RecipeQueue4.Enqueue(data.RecipeCode);
if (!(RecipeQueue4.Contains(data.RecipeCode)))
{
if (SiemensDevice.DL_Status is DL_Status_DB status)
{
if (GVL_BigStation.SiemensSendRecipeStatus == 3)
{
GVL_BigStation.SiemensSendRecipeStatus = 4;
SiemensDevice.Siemens_PLC_S7.WriteString(2331, data.RecipeCode, 10);
SiemensDevice.Siemens_PLC_S7.Write("DB2331.DBX28.0", true);
}
if (GVL_BigStation.SiemensSendRecipeStatus == 4)
{
if (SiemensDevice.DL_Status.Dosing_Start_ACK)
{
GVL_BigStation.SiemensSendRecipeStatus = 5;
SiemensDevice.Siemens_PLC_S7.WriteString(2331, "", 10);
SiemensDevice.Siemens_PLC_S7.Write("DB3231.DBX28.0", false);
}
}
if (GVL_BigStation.SiemensSendRecipeStatus == 5)
{
if (SiemensDevice.DL_Status.Dosing_Start_ACK == false)
{
GVL_BigStation.SiemensSendRecipeStatus = 6;
RecipeQueue4.Enqueue(data.RecipeCode);
}
}
}
}
}
}
}
@@ -286,17 +378,23 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (SiemensDevice.IsConnected)
{
FinishData.Ask_For_Finish = true;
GVL_BigStation.SiemensSendRecipeStatus = 7;
SiemensDevice.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(FinishData, 2361);
}
RecipeQueue1.TryDequeue(out code);
IssuedComplete.Add(Recipes.ElementAt(index));//将配方添加到完成列表
if (!GVL_BigStation.IsUseLocalRecipe)
{
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
App.Current.Dispatcher.Invoke(() => {
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
});
}
else
{
Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
App.Current.Dispatcher.Invoke(() => {
Json<LocalRecipe>.Data.Recipes.RemoveAt(index);//制作完成,移除当前配方
});
}
GVL_BigStation.Recipe1DosingStatus = 0;
}
@@ -529,7 +627,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
GVL_BigStation.Recipe3DosingStatus = 0;
}
}
}
if (RecipeQueue4.Count > 0)
@@ -653,7 +750,6 @@ namespace BPASmartClient.JXJFoodBigStation.Model
/// </summary>
private void StockBinParReset()
{

HKDevice.PlcWrite.RecipeCode = 0;
HKDevice.PlcWrite.TrayCode = 0;

@@ -723,6 +819,22 @@ namespace BPASmartClient.JXJFoodBigStation.Model
RawMaterialsNamePos.Clear();
if (!HKDevice.IsConnected)
{
RawMaterialsNamePos.Add("A10", 1);
RawMaterialsNamePos.Add("A20", 2);
RawMaterialsNamePos.Add("A30", 3);
RawMaterialsNamePos.Add("A40", 4);
RawMaterialsNamePos.Add("A50", 5);
RawMaterialsNamePos.Add("A60", 6);
RawMaterialsNamePos.Add("A70", 7);
RawMaterialsNamePos.Add("A80", 8);
RawMaterialsNamePos.Add("A90", 9);
RawMaterialsNamePos.Add("A100", 10);
RawMaterialsNamePos.Add("A110", 11);
RawMaterialsNamePos.Add("A120", 12);
RawMaterialsNamePos.Add("A130", 13);
RawMaterialsNamePos.Add("A140", 14);
}
/*
HKDevice.StockBinName.RawMaterialName1 = "1";
HKDevice.StockBinName.RawMaterialName2 = "2";
HKDevice.StockBinName.RawMaterialName3 = "3";
@@ -793,7 +905,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
if (!RawMaterialsNamePos.ContainsKey(HKDevice.StockBinName.RawMaterialName14))
{
RawMaterialsNamePos.Add(HKDevice.StockBinName.RawMaterialName14, 14);
}
}*/
}
}
}

+ 0
- 2
BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs Vedi File

@@ -32,7 +32,5 @@ namespace BPASmartClient.JXJFoodBigStation.Model
/// 原料数据
/// </summary>
public ObservableCollection<RawMaterial> RawMaterial { get; set; } = new ObservableCollection<RawMaterial>();


}
}

+ 44
- 19
BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_DataColl_DB.cs Vedi File

@@ -13,25 +13,50 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
public string RecipeCode { get; set; }
[Siemens(16)]
public string RecipeName { get; set; }
public bool var1 { get; set; }
public bool var2 { get; set; }

public bool var3 { get; set; }

public bool var4 { get; set; }

public bool var5 { get; set; }

public bool var6 { get; set; }

public bool var7 { get; set; }

public bool var8 { get; set; }

public bool var9 { get; set; }
public short Mode { get; set; }

public bool[] Alarm { get; set; } = new bool[24];
/// <summary>
/// 缺料本机
/// </summary>
public bool DeviceInComplete { get; set; }
/// <summary>
/// 上游缺料
/// </summary>
public bool TopInComple { get; set; }
/// <summary>
/// 下游堵料
/// </summary>
public bool DownWindrow { get; set; }
/// <summary>
/// 设备启动
/// </summary>
public bool DeviceStart { get; set; }
/// <summary>
/// 设备停止
/// </summary>
public bool DeviceStop { get; set; }
/// <summary>
/// 设备急停
/// </summary>
public bool DeviceEStop { get; set; }
/// <summary>
/// 设备暂停
/// </summary>
public bool DevicePause { get; set; }
/// <summary>
/// 设备故障
/// </summary>
public bool DeviceAlarm { get; set; }
/// <summary>
/// 上位机给plc的心跳
/// </summary>
public bool HeartBeat { get; set; }
/// <summary>
/// 设备模式
/// </summary>
public short DeviceMode { get; set; }
/// <summary>
/// 设备报警
/// </summary>
public bool[] AlarmInfo { get; set; } = new bool[24];
public int Reserved1 { get; set; }
public int Reserved2 { get; set; }



+ 20
- 3
BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Start_DB.cs Vedi File

@@ -19,20 +19,37 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
/// 配发名称
/// </summary>
public string RecipeName { get; set; }
public short Order_No { get; set; }
/// <summary>
/// 工位号
/// </summary>
public short Job_No { get; set; }
/// <summary>
/// 托盘号
/// </summary>
public short Pallet_No { get; set; }
/// <summary>
/// 物料信息
/// </summary>
public UDT[] Material { get; set; } = new UDT[20];
/// <summary>
/// 订单类型(0.其他、 1.洗锅)
/// </summary>
public bool Order_Type { get; set; }
/// <summary>
/// 订单请求确认
/// </summary>
public bool Order_Request_Ack { get; set; }

/// <summary>
/// 备用
/// </summary>
public short[] Standby { get; set; } = new short[4];
/// <summary>
/// 配方发送请求
/// </summary>
public bool Ask_For_Send_Bit { get; set; }
public bool Order_Request { get; set; }
/// <summary>
/// 备用
/// </summary>
public short[] Standby1 { get; set; } = new short[4];
}
public class UDT


+ 12
- 9
BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Status_DB.cs Vedi File

@@ -7,12 +7,12 @@ using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
{
internal class DL_Status_DB
public class DL_Status_DB
{
/// <summary>
/// 配料开始
/// 配料开始确认
/// </summary>
public bool Dosing_Start { get; set; }
public bool Dosing_Start_ACK { get; set; }
/// <summary>
/// 配料开始确认
/// </summary>
@@ -29,18 +29,21 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
/// 生产工单
/// </summary>
public string RecipeCode { get; set; }
public bool Dosing_Cancel4 { get; set; }
/// <summary>
/// 配料开始
/// </summary>
public bool Dosing_Start { get; set; }

public bool Dosing_Cancel5 { get; set; }
public bool Allow_Agv_Put { get; set; }

public bool Dosing_Cancel6 { get; set; }
public bool Allow_Agv_Get { get; set; }

public bool Dosing_Cancel7 { get; set; }
public bool Allow_Agv_Get_Empty { get; set; }

public short Dosing_Cancel8 { get; set; }
public short Pallet_Position_Occ { get; set; }

public short Dosing_Cancel9 { get; set; }

public short[] Standby2 { get; set; } = new short[4];
public short[] Standby2 { get; set; } = new short[3];
}
}

+ 1
- 374
BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensCommAddress.cs Vedi File

@@ -8,380 +8,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
{
public class SiemensCommAddress
{
#region 配方地址
/// <summary>
/// 配方状态
/// </summary>
public static string RecipeState { get; set; } = "";
/// <summary>
/// 配方名称
/// </summary>
public static string RecipeName { get; set; } = "";
/// <summary>
/// 配方ID
/// </summary>
public static string RecipeID { get; set; } = "";
/// <summary>
/// 原料信息
/// </summary>
public static string RawMaterial { get; set; } = "";
#endregion
#region AGV到位(与西门子PLC交互)西门子PLC ==> 上位机
/// <summary>
/// 托盘的位置编号
/// </summary>
public static string TrayLocationNum { get; set; } = "";
/// <summary>
/// 配方ID
/// </summary>
public static string TrayRecipeID { get; set; } = "";
/// <summary>
/// 状态信号
/// </summary>
public static string StateSign { get; set; } = "";
#endregion
#region Tray配料完成(与西门子PLC交互)上位机 ==> 西门子PLC
public static string TrayLocationNumToSiemens { get; set; } = "";
public static string TrayRecipeIDToSiemens { get; set; } = "";
public static string TrayStateToSiemens { get; set; } = "";
#endregion
/*#region AGV小车进出工站1
/// <summary>
/// Agv送货 进站申请 从西门子读取
/// </summary>
public static string DeliveryAGVApply1 { get; set; } = "";
/// <summary>
/// Agv送货 进站申请 写给西门子
/// </summary>
public static string DeliveryAGVIsApply1 { get; set; } = "";
/// <summary>
/// Agv送货 进站顶升申请 从西门子读取
/// </summary>
public static string DeliveryAGVApplyJack1 { get; set; } = "";
/// <summary>
/// Agv送货 进站顶升申请 写给西门子
/// </summary>
public static string DeliveryAGVIsApplyJack1 { get; set; } = "";
/// <summary>
/// Agv送货 送货完成 从西门子读取
/// </summary>
public static string DeliveryAGVFinsih1{ get; set; } = "";
/// <summary>
/// Agv送货 工位上有货架 写给西门子
/// </summary>
public static string StationHaveCargo1 { get; set; } = "";
/// <summary>
/// Agv送货 进站申请 从西门子读取
/// </summary>
public static string PickAGVApply1 { get; set; } = "";
/// <summary>
/// Agv送货 进站申请 写给西门子
/// </summary>
public static string PickAGVIsApply1 { get; set; } = "";
/// <summary>
/// Agv送货 取货架完成 从西门子读取
/// </summary>
public static string PickCargoAGVFinish1 { get; set; } = "";
/// <summary>
/// Agv送货 取料完成 写给西门子
/// </summary>
public static string PickAGVFinish1 { get; set; } = "";
/// <summary>
/// 工位上是否有小车
/// </summary>
public static string StationIsExistCar1 { get; set; } = "";
#endregion
#region AGV小车进出工站2
/// <summary>
/// Agv送货 进站申请 从西门子读取
/// </summary>
public static string DeliveryAGVApply2 { get; set; } = "";
/// <summary>
/// Agv送货 进站申请 写给西门子
/// </summary>
public static string DeliveryAGVIsApply2 { get; set; } = "";
/// <summary>
/// Agv送货 进站顶升申请 从西门子读取
/// </summary>
public static string DeliveryAGVApplyJack2 { get; set; } = "";
/// <summary>
/// Agv送货 进站顶升申请 写给西门子
/// </summary>
public static string DeliveryAGVIsApplyJack2 { get; set; } = "";
/// <summary>
/// Agv送货 送货完成 从西门子读取
/// </summary>
public static string DeliveryAGVFinsih2 { get; set; } = "";
/// <summary>
/// Agv送货 工位上有货架 写给西门子
/// </summary>
public static string StationHaveCargo2 { get; set; } = "";
/// <summary>
/// Agv送货 进站申请 从西门子读取
/// </summary>
public static string PickAGVApply2 { get; set; } = "";
/// <summary>
/// Agv送货 进站申请 写给西门子
/// </summary>
public static string PickAGVIsApply2 { get; set; } = "";
/// <summary>
/// Agv送货 取货架完成 从西门子读取
/// </summary>
public static string PickCargoAGVFinish2 { get; set; } = "";
/// <summary>
/// Agv送货 取料完成 写给西门子
/// </summary>
public static string PickAGVFinish2 { get; set; } = "";
/// <summary>
/// 工位上是否有小车
/// </summary>
public static string StationIsExistCar2 { get; set; } = "";
#endregion
#region AGV小车进出工站3
/// <summary>
/// Agv送货 进站申请 从西门子读取
/// </summary>
public static string DeliveryAGVApply3 { get; set; } = "";
/// <summary>
/// Agv送货 进站申请 写给西门子
/// </summary>
public static string DeliveryAGVIsApply3 { get; set; } = "";
/// <summary>
/// Agv送货 进站顶升申请 从西门子读取
/// </summary>
public static string DeliveryAGVApplyJack3 { get; set; } = "";
/// <summary>
/// Agv送货 进站顶升申请 写给西门子
/// </summary>
public static string DeliveryAGVIsApplyJack3 { get; set; } = "";
/// <summary>
/// Agv送货 送货完成 从西门子读取
/// </summary>
public static string DeliveryAGVFinsih3 { get; set; } = "";
/// <summary>
/// Agv送货 工位上有货架 写给西门子
/// </summary>
public static string StationHaveCargo3 { get; set; } = "";
/// <summary>
/// Agv送货 进站申请 从西门子读取
/// </summary>
public static string PickAGVApply3 { get; set; } = "";
/// <summary>
/// Agv送货 进站申请 写给西门子
/// </summary>
public static string PickAGVIsApply3 { get; set; } = "";
/// <summary>
/// Agv送货 取货架完成 从西门子读取
/// </summary>
public static string PickCargoAGVFinish3 { get; set; } = "";
/// <summary>
/// Agv送货 取料完成 写给西门子
/// </summary>
public static string PickAGVFinish3 { get; set; } = "";
/// <summary>
/// 工位上是否有小车
/// </summary>
public static string StationIsExistCar3 { get; set; } = "";
#endregion
#region AGV小车进出工站4
/// <summary>
/// Agv送货 进站申请 从西门子读取
/// </summary>
public static string DeliveryAGVApply4 { get; set; } = "";
/// <summary>
/// Agv送货 进站申请 写给西门子
/// </summary>
public static string DeliveryAGVIsApply4 { get; set; } = "";
/// <summary>
/// Agv送货 进站顶升申请 从西门子读取
/// </summary>
public static string DeliveryAGVApplyJack4 { get; set; } = "";
/// <summary>
/// Agv送货 进站顶升申请 写给西门子
/// </summary>
public static string DeliveryAGVIsApplyJack4 { get; set; } = "";
/// <summary>
/// Agv送货 送货完成 从西门子读取
/// </summary>
public static string DeliveryAGVFinsih4 { get; set; } = "";
/// <summary>
/// Agv送货 工位上有货架 写给西门子
/// </summary>
public static string StationHaveCargo4 { get; set; } = "";
/// <summary>
/// Agv送货 进站申请 从西门子读取
/// </summary>
public static string PickAGVApply4 { get; set; } = "";
/// <summary>
/// Agv送货 进站申请 写给西门子
/// </summary>
public static string PickAGVIsApply4 { get; set; } = "";
/// <summary>
/// Agv送货 取货架完成 从西门子读取
/// </summary>
public static string PickCargoAGVFinish4 { get; set; } = "";
/// <summary>
/// Agv送货 取料完成 写给西门子
/// </summary>
public static string PickAGVFinish4 { get; set; } = "";
/// <summary>
/// 工位上是否有小车
/// </summary>
public static string StationIsExistCar4 { get; set; } = "";
#endregion
#region AGV小车进出工站5
/// <summary>
/// Agv送货 进站申请 从西门子读取
/// </summary>
public static string DeliveryAGVApply5 { get; set; } = "";
/// <summary>
/// Agv送货 进站申请 写给西门子
/// </summary>
public static string DeliveryAGVIsApply5 { get; set; } = "";
/// <summary>
/// Agv送货 进站顶升申请 从西门子读取
/// </summary>
public static string DeliveryAGVApplyJack5 { get; set; } = "";
/// <summary>
/// Agv送货 进站顶升申请 写给西门子
/// </summary>
public static string DeliveryAGVIsApplyJack5 { get; set; } = "";
/// <summary>
/// Agv送货 送货完成 从西门子读取
/// </summary>
public static string DeliveryAGVFinsih5 { get; set; } = "";
/// <summary>
/// Agv送货 工位上有货架 写给西门子
/// </summary>
public static string StationHaveCargo5 { get; set; } = "";
/// <summary>
/// Agv送货 进站申请 从西门子读取
/// </summary>
public static string PickAGVApply5 { get; set; } = "";
/// <summary>
/// Agv送货 进站申请 写给西门子
/// </summary>
public static string PickAGVIsApply5 { get; set; } = "";
/// <summary>
/// Agv送货 取货架完成 从西门子读取
/// </summary>
public static string PickCargoAGVFinish5 { get; set; } = "";
/// <summary>
/// Agv送货 取料完成 写给西门子
/// </summary>
public static string PickAGVFinish5 { get; set; } = "";
/// <summary>
/// 工位上是否有小车
/// </summary>
public static string StationIsExistCar5 { get; set; } = "";
#endregion
#region AGV小车进出工站6
/// <summary>
/// Agv送货 进站申请 从西门子读取
/// </summary>
public static string DeliveryAGVApply6 { get; set; } = "";
/// <summary>
/// Agv送货 进站申请 写给西门子
/// </summary>
public static string DeliveryAGVIsApply6 { get; set; } = "";
/// <summary>
/// Agv送货 进站顶升申请 从西门子读取
/// </summary>
public static string DeliveryAGVApplyJack6 { get; set; } = "";
/// <summary>
/// Agv送货 进站顶升申请 写给西门子
/// </summary>
public static string DeliveryAGVIsApplyJack6 { get; set; } = "";
/// <summary>
/// Agv送货 送货完成 从西门子读取
/// </summary>
public static string DeliveryAGVFinsih6 { get; set; } = "";
/// <summary>
/// Agv送货 工位上有货架 写给西门子
/// </summary>
public static string StationHaveCargo6 { get; set; } = "";
/// <summary>
/// Agv送货 进站申请 从西门子读取
/// </summary>
public static string PickAGVApply6 { get; set; } = "";
/// <summary>
/// Agv送货 进站申请 写给西门子
/// </summary>
public static string PickAGVIsApply6 { get; set; } = "";
/// <summary>
/// Agv送货 取货架完成 从西门子读取
/// </summary>
public static string PickCargoAGVFinish6 { get; set; } = "";
/// <summary>
/// Agv送货 取料完成 写给西门子
/// </summary>
public static string PickAGVFinish6 { get; set; } = "";
/// <summary>
/// 工位上是否有小车
/// </summary>
public static string StationIsExistCar6 { get; set; } = "";
#endregion*/
#region AGV进出站
/// <summary>
/// Agv送货 进站申请
/// </summary>
public static string DeliveryAGVApply { get; set; } = "M4002";
/// <summary>
/// Agv送货 进站申请
/// </summary>
public static string DeliveryAGVIsApply { get; set; } = "M5002";
/// <summary>
/// Agv送货 进站顶升申请
/// </summary>
public static string DeliveryAGVApplyJack { get; set; } = "M4004";
/// <summary>
/// Agv送货 进站顶升申请
/// </summary>
public static string DeliveryAGVIsApplyJack { get; set; } = "M5004";
/// <summary>
/// Agv送货 送货完成
/// </summary>
public static string DeliveryAGVFinsih { get; set; } = "M4005";
/// <summary>
/// Agv送货 工位上有货架
/// </summary>
public static string StationHaveCargo { get; set; } = "M5005";
/// <summary>
/// Agv送货 进站申请
/// </summary>
public static string PickAGVApply { get; set; } = "M4003";
/// <summary>
/// Agv送货 进站申请
/// </summary>
public static string PickAGVIsApply { get; set; } = "M5003";
/// <summary>
/// Agv送货 取货架完成
/// </summary>
public static string PickCargoAGVFinish { get; set; } = "M4006";
/// <summary>
/// Agv送货 取料完成
/// </summary>
public static string PickAGVFinish { get; set; } = "M5006";
/// <summary>
/// 工位上是否有小车
/// </summary>
public static string StationIsExistCar { get; set; } = "M4007";
#endregion
}
public class RecipeRawMaterial
{
/// <summary>
/// 原料对应的桶号
/// </summary>
public int[] RawMaterialBarrelNum = new int[15];
/// <summary>
/// 需要原料重量
/// </summary>
public double[] RawMaterialWeight = new double[15];
/// <summary>
/// 原料对应料仓的位置
/// </summary>
public int[] RawMaterialLocation = new int[15];

}

}

+ 55
- 5
BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs Vedi File

@@ -15,9 +15,11 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
public SiemensHelper Siemens_PLC_S7 = new SiemensHelper();
public bool IsConnected => Siemens_PLC_S7.IsConnected;

public DL_Status_DB DL_Status = new DL_Status_DB();
bool a = false;
public void Init()
{
if (IsConnected)
if (IsConnected)
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
@@ -25,11 +27,59 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
var res1 = this.Siemens_PLC_S7.ReadClass<DL_Status_DB>(2331);
var res2 = this.Siemens_PLC_S7.ReadClass<DL_Finish_DB>(2361);
var res3 = this.Siemens_PLC_S7.ReadClass<DL_DataColl_DB>(2391);
if (res2 != null && res2.Ask_For_Finish_PLC)
if (res != null && res is DL_Start_DB start)
{
ActionManage.GetInstance.Send("配料完成信号确认完成");
res2.Ask_For_Finish_PLC = false;
this.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(res2, 3);
if (a)
{
start.RecipeName = "配方1";
start.RecipeCode = "1201";
start.Order_Request_Ack = true;

for (int i = 0; i < GVL_BigStation.Max_DosingSotckBinNum ; i++)
{
start.Material[i] = new UDT();
start.Material[i].Material_Name = "" + (i +1);
start.Material[i].Material_Weight = 100 + (i + 1);
start.Material[i].Material_BarrelNum = (short)(i + 1);
}
}
if (RTrig.GetInstance("Order_Request").Start(GVL_BigStation.Order_Request) && GVL_BigStation.SiemensSendRecipeStatus == 0)
{
GVL_BigStation.SiemensSendRecipeStatus = 1;
this.Siemens_PLC_S7.Write("DB2301.DBX330.0", true);
}
if (RTrig.GetInstance("Order_Request_Ack").Start(start.Order_Request_Ack) && GVL_BigStation.SiemensSendRecipeStatus == 1)
{
GVL_BigStation.SiemensSendRecipeStatus = 2;
ActionManage.GetInstance.Send("SiemensSendRecipe", start);
this.Siemens_PLC_S7.Write("DB2301.DBX330.0", false);
}
if (TTrig.GetInstance("Order_Request_Ack").Start(start.Order_Request_Ack) && GVL_BigStation.SiemensSendRecipeStatus == 2)
{
GVL_BigStation.SiemensSendRecipeStatus = 3;
GVL_BigStation.Order_Request = false;
}
}
if (res1 != null && res1 is DL_Status_DB status)
{
DL_Status = status;
}
if (res2 != null && res2 is DL_Finish_DB finish)
{
if (RTrig.GetInstance("Ask_For_Finish_PLC").Start(finish.Ask_For_Finish_PLC) && GVL_BigStation.SiemensSendRecipeStatus == 7)
{
finish.Order_No = "";
finish.Product_Code = "";
finish.job_No = 0;
for (int i = 0; i < 20; i++)
{
finish.Material[i] = new UDT1();
}
GVL_BigStation.SiemensSendRecipeStatus = 0;
finish.Ask_For_Finish = false;
finish.ProcessTime = 0;
this.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(finish, 2261);
}
}
Thread.Sleep(10);
}), "监听服务数据");


+ 20
- 90
BPASmartClient.JXJFoodBigStation/Model/TestData.cs Vedi File

@@ -17,96 +17,26 @@ namespace BPASmartClient.JXJFoodBigStation.Model
public ObservableCollection<RawMaterial> RawMaterials { get; set; } = new ObservableCollection<RawMaterial>();
public TestData()
{
string recipeName = "配方1";
string recipeCode = "10001";
int Traycode = 1;

float RawmaterialWeight = 10;
short RawMaterialbarrelNum = 1;
int RawMaterialLocation = 5;

float RawmaterialWeight1 = 20;
short RawMaterialbarrelNum1 = 2;
int RawMaterialLocation1 = 7;

float RawmaterialWeight2 = 30;
short RawMaterialbarrelNum2 = 3;
int RawMaterialLocation2 = 9;
RawMaterials.Add(new RawMaterial()
{
DeviceIp = RawMaterials.Count + 1,
RawMaterialWeight = RawmaterialWeight,
RawMaterialBarrelNum = RawMaterialbarrelNum,
RawMaterialLocation = RawMaterialLocation
});
RawMaterials.Add(new RawMaterial()
{
DeviceIp = RawMaterials.Count + 1,
RawMaterialWeight = RawmaterialWeight1,
RawMaterialBarrelNum = RawMaterialbarrelNum1,
RawMaterialLocation = RawMaterialLocation1
});
RawMaterials.Add(new RawMaterial()
{
DeviceIp = RawMaterials.Count + 1,
RawMaterialWeight = RawmaterialWeight2,
RawMaterialBarrelNum = RawMaterialbarrelNum2,
RawMaterialLocation = RawMaterialLocation2
});

Recipes.Add(new Model.RecipeData()
{
RecipeName = recipeName,
RecipeCode = recipeCode,
TrayCode = Traycode,
RawMaterial = RawMaterials
});

RawMaterials.Clear();
string recipeName_2 = "配方2";
string recipeCode_2 = "20001";
int Traycode_2 = 3;

float RawmaterialWeight_2 = 10;
short RawMaterialbarrelNum_2 = 1;
int RawMaterialLocation_2 = 5;

float RawmaterialWeight1_2 = 20;
short RawMaterialbarrelNum1_2 = 2;
int RawMaterialLocation1_2 = 7;

float RawmaterialWeight2_2 = 30;
short RawMaterialbarrelNum2_2 = 3;
int RawMaterialLocation2_2 = 9;
RawMaterials.Add(new RawMaterial()
{
DeviceIp = RawMaterials.Count + 1,
RawMaterialWeight = RawmaterialWeight_2,
RawMaterialBarrelNum = RawMaterialbarrelNum_2,
RawMaterialLocation = RawMaterialLocation_2
});
RawMaterials.Add(new RawMaterial()
{
DeviceIp = RawMaterials.Count + 1,
RawMaterialWeight = RawmaterialWeight1_2,
RawMaterialBarrelNum = RawMaterialbarrelNum1_2,
RawMaterialLocation = RawMaterialLocation1_2
});
RawMaterials.Add(new RawMaterial()
{
DeviceIp = RawMaterials.Count + 1,
RawMaterialWeight = RawmaterialWeight2_2,
RawMaterialBarrelNum = RawMaterialbarrelNum2_2,
RawMaterialLocation = RawMaterialLocation2_2
});

Recipes.Add(new Model.RecipeData()
{
RecipeName = recipeName_2,
RecipeCode = recipeCode_2,
TrayCode = Traycode_2,
RawMaterial = RawMaterials
});
for (int i = 0; i < 5; i++)
{
for (int j = 0; j < 10; i++)
{
RawMaterials.Add(new RawMaterial()
{
DeviceIp = RawMaterials.Count + 1,
RawMaterialWeight = new Random().Next(),
RawMaterialBarrelNum = j,
RawMaterialLocation = j
});
}
Recipes.Add(new Model.RecipeData()
{
RecipeName = "配方" + i,
RecipeCode = new Random().Next(1000,9999) + "",
TrayCode = new Random().Next(1,3),
RawMaterial = RawMaterials
});
}
}
}
}

+ 0
- 8
BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml Vedi File

@@ -423,9 +423,7 @@
</Grid.ColumnDefinitions>

<Grid Name="ggr" Margin="10">

<pry:ImageBorder Width="{Binding ElementName=ggr, Path=ActualWidth}" Height="{Binding ElementName=ggr, Path=ActualHeight}" />

<ListBox
Margin="5"
VerticalAlignment="Top"
@@ -444,7 +442,6 @@

<ListBox.ItemTemplate>
<DataTemplate>

<Grid
Name="tt"
Height="220"
@@ -456,7 +453,6 @@
<RowDefinition Height="2" />
<RowDefinition Height="40" />
</Grid.RowDefinitions>

<Image
Grid.RowSpan="5"
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png"
@@ -785,10 +781,7 @@
Content="已完成"
GroupName="state"
Style="{DynamicResource RadioState}" />

</Grid>


<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Hidden"
@@ -873,6 +866,5 @@
</Border>
</ScrollViewer>
</Grid>

</Grid>
</UserControl>

+ 76
- 369
BPASmartClient.JXJFoodBigStation/View/SiemensRecipeSendDownView.xaml Vedi File

@@ -22,7 +22,7 @@
<SolidColorBrush
x:Key="{x:Static SystemColors.HighlightBrushKey}"
Opacity=".4"
Color="White" />
Color="White" />
<!-- SelectedItem without focus -->
<SolidColorBrush
x:Key="{x:Static SystemColors.ControlBrushKey}"
@@ -337,18 +337,6 @@
</Grid>

<ControlTemplate.Triggers>
<!--<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" Value="#FFd2e7f4" />
</Trigger>
<Trigger Property="IsChecked" Value="true">
<Setter TargetName="border2" Property="Background" Value="#191E36" />
</Trigger>
<Trigger Property="IsChecked" Value="false">
<Setter TargetName="border2" Property="Background" Value="#191E36" />
</Trigger>-->
<!--<Trigger Property="IsEnabled" Value="false">
<Setter Property="Foreground" Value="White" />
</Trigger>-->
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="border2" Property="Background" Value="#191E36" />
</Trigger>
@@ -419,7 +407,7 @@

<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="0.25*" />
<!--<ColumnDefinition Width="0.25*" />-->
</Grid.ColumnDefinitions>

<Grid Name="ggr" Margin="10">
@@ -444,40 +432,97 @@

<ListBox.ItemTemplate>
<DataTemplate>

<Grid
Name="tt"
Height="220"
Height="300"
Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="80" />
<RowDefinition Height="20" />
<RowDefinition Height="128" />
<RowDefinition Height="198" />
<RowDefinition Height="2" />
<RowDefinition Height="40" />
</Grid.RowDefinitions>

<Image
Grid.RowSpan="5"
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png"
Stretch="Fill" />

<TextBlock
Grid.Row="0"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="18"
Foreground="#FF2AB2E7"
Text="{Binding RecipeName}" />
<Grid Grid.Row="0">

<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>

<TextBlock
Grid.Row="0"
Grid.Column="0"
Margin="7,5,0,0"
HorizontalAlignment="left"
VerticalAlignment="Center"
FontSize="16"
Foreground="#FF2AB2E7"
Text="配方名称:"></TextBlock>
<TextBlock
Grid.Row="0"
Grid.Column="1"
Margin="7,5,0,0"
HorizontalAlignment="left"
VerticalAlignment="Center"
FontSize="16"
Foreground="#FF2AB2E7"
Text="{Binding RecipeName}" />
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="7,5,0,0"
HorizontalAlignment="left"
VerticalAlignment="Center"
FontSize="16"
Foreground="#FF2AB2E7"
Text="配方编号:"></TextBlock>
<TextBlock
Grid.Row="1"
Grid.Column="1"
Margin="7,5,0,0"
HorizontalAlignment="left"
VerticalAlignment="Center"
FontSize="16"
Foreground="#FF2AB2E7"
Text="{Binding RecipeCode}" />
<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="7,5,0,0"
HorizontalAlignment="left"
VerticalAlignment="Center"
FontSize="16"
Foreground="#FF2AB2E7"
Text="托盘编号:"></TextBlock>
<TextBlock
Grid.Row="2"
Grid.Column="1"
Margin="7,5,0,0"
HorizontalAlignment="left"
VerticalAlignment="Center"
FontSize="16"
Foreground="#FF2AB2E7"
Text="{Binding TrayCode}" />
</Grid>

<TextBlock
Grid.Row="1"
FontSize="16"
Margin="5,0,0,0"
Margin="7,2,0,0"
VerticalAlignment="Top"
Foreground="#FF2AB2E7"
Text="配方信息:" />
Text="原料信息:" />

<ScrollViewer
Grid.Row="2"
@@ -510,7 +555,7 @@
<Expander.Content>
<StackPanel Margin="36,0,0,0">
<StackPanel Orientation="Horizontal">
<TextBlock Text="托盘编号:" Foreground="#FF2AB2E7"/>
<TextBlock Text="原料桶号:" Foreground="#FF2AB2E7"/>
<TextBlock Text="{Binding RawMaterialBarrelNum}" Foreground="#FF2AB2E7"/>
</StackPanel>
<StackPanel Orientation="Horizontal">
@@ -518,17 +563,12 @@
<TextBlock Text="{Binding RawMaterialWeight}" Foreground="#FF2AB2E7"/>
</StackPanel>
</StackPanel>

</Expander.Content>
</Expander>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>


</ScrollViewer>

<Image
Grid.Row="3"
Width="{Binding ElementName=tt, Path=ActualWidth}"
@@ -536,343 +576,10 @@
VerticalAlignment="Bottom"
Source="/BPASmartClient.CustomResource;component/Image/直线.png"
Stretch="Fill" />

<Grid
Name="gr"
Grid.Row="4"
Height="30"
Margin="0,0,0,10"
VerticalAlignment="Bottom"
Background="Transparent">
<!--<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>-->

<!--<Image
Height="2"
Grid.ColumnSpan="2"
Width="{Binding ElementName=gr, Path=ActualWidth}"
VerticalAlignment="Top"
Source="/BPASmartClient.CustomResource;component/Image/直线.png" />-->

<!--<pry:IcoButton
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
Margin="4,4,4,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#222bd06f"
BorderThickness="0"
Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
CommandParameter="{Binding RecipeName}"
Content="配方下发"
EnterBackground="#332bd06f"
FontStyle="Normal"
Foreground="#ff2bd06f"
IcoText="&#xe6cf;"
IsEnabled="{Binding IsEnable}"
Style="{StaticResource IcoButtonStyle}" />-->

<!--<pry:IcoButton
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
Margin="4,4,3,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#11F53F62"
BorderThickness="0"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
CommandParameter="{Binding RecipCode}"
Content="删除"
EnterBackground="#22F53F62"
FontStyle="Normal"
Foreground="#FFF53F62"
IcoText="&#xe68e;"
Style="{StaticResource IcoButtonStyle}" />

<pry:IcoButton
Grid.Column="1"
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
Margin="3,4,4,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#112AB2E7"
BorderThickness="0"
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
CommandParameter="{Binding RecipCode}"
Content="编辑"
EnterBackground="#222AB2E7"
Foreground="#FF2AB2E7"
IcoText="&#xe636;"
Style="{StaticResource IcoButtonStyle}" />-->

</Grid>
<!--</StackPanel>-->
</Grid>

<!--<Grid Name="tt" Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition Height="auto" />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<Image
Grid.RowSpan="4"
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png"
Stretch="Fill" />

<TextBlock
Grid.Row="0"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="18"
Foreground="#FF2AB2E7"
Text="{Binding RecipeName}" />


<TextBlock
Grid.Row="1"
Margin="5,0,0,5"
Foreground="#ffc000"
Text="配方信息:" />

<ScrollViewer
Grid.Row="2"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<ItemsControl ItemsSource="{Binding RawMaterials}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<TextBlock
Grid.Row="1"
Margin="5,0,0,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Foreground="#aaffc000"
Text="{Binding RawMaterialName}" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

<ItemsControl Grid.Column="1" ItemsSource="{Binding RawMaterials}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">

<TextBlock
Margin="5,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#aaffc000"
Text=":" />

<TextBlock
Margin="5,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#aaffc000"
Text="{Binding RawMaterialWeight}" />

<TextBlock
Margin="5,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#aaffc000"
Text="g" />

</StackPanel>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>

</Grid>

</ScrollViewer>



<Grid
Name="grb"
Grid.Row="3"
Height="30"
Margin="0,0,0,10"
VerticalAlignment="Bottom"
Background="Transparent">

<Image
Width="{Binding ElementName=grb, Path=ActualWidth}"
VerticalAlignment="Top"
StretchDirection="Both"
Source="/BPASmartClient.CustomResource;component/Image/直线.png" />

<pry:IcoButton
Width="{Binding ElementName=grb, Path=ActualWidth}"
Height="{Binding ElementName=grb, Path=ActualHeight}"
Margin="4,4,4,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#222bd06f"
BorderThickness="0"
Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
CommandParameter="{Binding RecipeName}"
Content="配方下发"
EnterBackground="#332bd06f"
FontStyle="Normal"
Foreground="#ff2bd06f"
IcoText="&#xe6cf;"
IsEnabled="{Binding IsEnable}"
Style="{StaticResource IcoButtonStyle}" />


</Grid>

</Grid>-->
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>

</Grid>

<Grid
Name="gr"
Grid.Column="1"
Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition />
</Grid.RowDefinitions>

<pry:ImageBorder
Grid.RowSpan="2"
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}" />

<Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<RadioButton
Click="RadioButtonWait_Click"
Command="{Binding ChangeRecipeStateCommand}"
Content="等待中"
GroupName="state"
IsChecked="True"
Style="{DynamicResource RadioState}" />
<RadioButton
Grid.Column="1"
Click="RadioButtonMaking_Click"
Content="执行中"
GroupName="state"
Style="{DynamicResource RadioState}" />
<RadioButton
Grid.Column="2"
Click="RadioButtonCompelete_Click"
Content="已完成"
GroupName="state"
Style="{DynamicResource RadioState}" />

</Grid>


<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<Border>
<Grid Grid.Row="1">
<Grid x:Name="repiceListMaking" Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>
<TextBlock
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="18"
Foreground="#FF2AB2E7"
Text="{Binding CurrentRecipeName}" />
<ItemsControl
Grid.Row="1"
Margin="50,0"
ItemsSource="{Binding recipeProcesses}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="16" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Margin="10,0,5,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="15"
Foreground="#AA2AB2E7"
Text="{Binding RawMaterialName}"
ToolTip="{Binding RawMaterialSource, Converter={StaticResource IntToSourceConvert}}" />
<TextBlock
Grid.Column="1"
Margin="0,0,5,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="15"
Foreground="#AA2AB2E7"
Text=":" />
<Button
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Command="{Binding DataContext.ChangeRecipeStateCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialId}"
Content="{Binding RecipeStatus, Converter={StaticResource RunStatusConvert}}"
IsEnabled="{Binding RawMaterialSource, Converter={StaticResource EnbleConvert}}"
Style="{StaticResource materialMakingButton}" />
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>

</ItemsControl>

</Grid>
<!--<TreeView x:Name="repiceListMaking" ItemsSource="{Binding RecipeProcesse}"
ScrollViewer.VerticalScrollBarVisibility="Disabled" HorizontalAlignment="Stretch" Background="Wheat" ItemContainerStyle="{StaticResource recipeTreeItem}">
</TreeView>-->

<!-- 等待和已完成 -->

<TreeView
x:Name="repiceList"
HorizontalAlignment="Stretch"
Background="Transparent"
BorderThickness="0"
ItemContainerStyle="{StaticResource recipeTreeItem}"
ItemsSource="{Binding UserTreeWait}"
ScrollViewer.VerticalScrollBarVisibility="Visible" />




</Grid>
</Border>
</ScrollViewer>
</Grid>

</Grid>
</UserControl>

+ 0
- 25
BPASmartClient.JXJFoodBigStation/View/SiemensRecipeSendDownView.xaml.cs Vedi File

@@ -25,30 +25,5 @@ namespace BPASmartClient.JXJFoodBigStation.View
{
InitializeComponent();
}

private void RadioButtonCompelete_Click(object sender, RoutedEventArgs e)
{
repiceList.ItemsSource = RecipeSendDownViewModel.UserTreeCompelete;
repiceList.Visibility = Visibility.Visible;
repiceListMaking.Visibility = Visibility.Hidden;


}

private void RadioButtonWait_Click(object sender, RoutedEventArgs e)
{
repiceList.ItemsSource = RecipeSendDownViewModel.UserTreeWait;
repiceList.Visibility = Visibility.Visible;
repiceListMaking.Visibility = Visibility.Hidden;
}

private void RadioButtonMaking_Click(object sender, RoutedEventArgs e)
{
repiceListMaking.Visibility = Visibility.Visible;
repiceList.Visibility = Visibility.Hidden;

}
}

}

+ 1
- 1
BPASmartClient.JXJFoodBigStation/ViewModel/DeviceManageViewModel.cs Vedi File

@@ -16,7 +16,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
internal class DeviceManageViewModel:ObservableObject
{

public ObservableCollection<DeviceInfo> Devices { get; set; }=new ObservableCollection<DeviceInfo>() { new DeviceInfo {DeviceName="123",IpAddress="123.213.123.213." } };
public ObservableCollection<DeviceInfo> Devices { get; set; } = new ObservableCollection<DeviceInfo>() { new DeviceInfo { DeviceName = "123", IpAddress = "123.213.123.213." } };

public RelayCommand<object> ChangeNameCommand { get; set; }



+ 6
- 11
BPASmartClient.JXJFoodBigStation/ViewModel/HardwareStatusViewModel.cs Vedi File

@@ -25,7 +25,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus()
{
DeviceName = i.ToString(),
DeviceNum=i,
DeviceNum = i,
RunStatus = true,
Weight = new Random().Next(0, 100)
});
@@ -40,13 +40,11 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
Weight = new Random().Next(0, 100)
});
}
StartCommand = new RelayCommand<string>((deviceName) => {
//PLC控制

//动画
StartCommand = new RelayCommand<string>((deviceName) =>
{
if (deviceName != null)
{
var top= TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName);
var top = TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName);
if (top != null)
{
ActionManage.GetInstance.Send("StartTopDevice", deviceName);
@@ -58,10 +56,8 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
}
}
});
StopCommand = new RelayCommand<string>((deviceName) => {
//PLC控制

//动画
StopCommand = new RelayCommand<string>((deviceName) =>
{
if (deviceName != null)
{
var top = TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName);
@@ -120,7 +116,6 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
view.ShowDialog();
});
}
public ObservableCollection<DeviceCurrentStatus> AllDeviceCurrentStatuses;
public ObservableCollection<DeviceCurrentStatus> TopDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>();
public ObservableCollection<DeviceCurrentStatus> BottomDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>();
public RelayCommand<string> UpdateRawMaterName { get; set; }


+ 13
- 2
BPASmartClient.JXJFoodBigStation/ViewModel/RecipeSendDownViewModel.cs Vedi File

@@ -1,4 +1,5 @@
using BPASmartClient.Helper;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using BPASmartClient.JXJFoodBigStation.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
@@ -37,7 +38,17 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
//配方下发逻辑
var res = Recipes.FirstOrDefault(p => p.RecipeName == recipeName);
if (res != null)
ActionManage.GetInstance.Send("ManualSendRecipe", res);
{
Json<LocalRecipe>.Data.Recipes.Add(res);
for (int i = 0; i < Json<LocalRecipe>.Data.Recipes.Count; i++)
{
foreach (var item in Json<LocalRecipe>.Data.Recipes.ElementAt(i).RawMaterial)
{
item.RawMaterialLocation = Convert.ToInt32(item.RawMaterialName);
}
}
MessageNotify.GetInstance.ShowAlarmLog("手动下发配方完成");
}
}
});
}


+ 18
- 14
BPASmartClient.JXJFoodBigStation/ViewModel/SiemensRecipeSendDownViewModel.cs Vedi File

@@ -14,22 +14,26 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
{
internal class SiemensRecipeSendDownViewModel : ObservableObject
{
public ObservableCollection<RecipeData> Recipes { get; set; } = Json<RemoteRecipe>.Data.Recipes;
/// <summary>
/// 当前正在制作的配方
/// </summary>
public static ObservableCollection<RawMaterial> recipeProcesses { get; set; } = new ObservableCollection<RawMaterial>();
/// <summary>
/// 等待制作的配方
/// </summary>
public static ObservableCollection<RecipeData> UserTreeWait { get; set; } = new ObservableCollection<RecipeData>();
/// <summary>
/// 已完成的配方
/// </summary>
public static ObservableCollection<RecipeData> UserTreeCompelete { get; set; } = new ObservableCollection<RecipeData>();
//Json<RemoteRecipe>.Data.Recipes
public static ObservableCollection<RawMaterial> a = new ObservableCollection<RawMaterial>()
{
new RawMaterial() { RawMaterialName= "1",RawMaterialWeight=101, RawMaterialBarrelNum=1 },
new RawMaterial() { RawMaterialName= "2",RawMaterialWeight=102, RawMaterialBarrelNum=1 },
new RawMaterial() { RawMaterialName= "3",RawMaterialWeight=103, RawMaterialBarrelNum=1 },
new RawMaterial() { RawMaterialName= "4",RawMaterialWeight=104, RawMaterialBarrelNum=1 },
new RawMaterial() { RawMaterialName= "5",RawMaterialWeight=105, RawMaterialBarrelNum=1 },
new RawMaterial() { RawMaterialName= "6",RawMaterialWeight=106, RawMaterialBarrelNum=1 },
new RawMaterial() { RawMaterialName= "7",RawMaterialWeight=107, RawMaterialBarrelNum=1 },
new RawMaterial() { RawMaterialName= "8",RawMaterialWeight=108, RawMaterialBarrelNum=1 },
new RawMaterial() { RawMaterialName= "9",RawMaterialWeight=109, RawMaterialBarrelNum=1 },
new RawMaterial() { RawMaterialName= "10",RawMaterialWeight=110, RawMaterialBarrelNum=1 },
new RawMaterial() { RawMaterialName= "11",RawMaterialWeight=111, RawMaterialBarrelNum=1 },
new RawMaterial() { RawMaterialName= "12",RawMaterialWeight=112, RawMaterialBarrelNum=1 }
};
public ObservableCollection<RecipeData> Recipes { get; set; } = Json<RemoteRecipe>.Data.Recipes;
public SiemensRecipeSendDownViewModel()
{
}
}
}

+ 2
- 0
BPASmartClient.JXJFoodSmallStation/App.xaml.cs Vedi File

@@ -48,6 +48,7 @@ namespace BPASmartClient.JXJFoodSmallStation
base.OnExit(e);
Json<LocaPar>.Save();
Json<LocalRecipeDataColl>.Save();
Json<RemoteRecipeDataColl>.Save();
MessageNotify.GetInstance.LogSave();
ThreadManage.GetInstance().Dispose();
}
@@ -268,6 +269,7 @@ namespace BPASmartClient.JXJFoodSmallStation
Json<DevicePar>.Read();
Json<WindSendDevicePar>.Read();
Json<LocalRecipeDataColl>.Read();
Json<RemoteRecipeDataColl>.Read();
}

}


+ 6
- 2
BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs Vedi File

@@ -23,14 +23,17 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// <summary>
/// 风送料仓数目
/// </summary>
public const int Max_PowderSotckBinNum = 15;
public const int Max_PowderSotckBinNum = 5;
public bool HeartBeatToPlc { get; set; } = false;
public bool HeartBeatFromPlc { get; set; } = false;
/// <summary>
/// 是否允许西门子下发配方
/// </summary>
public static bool IsAllowSiemensSendRecipe { get; set; } = false;

/// <summary>
/// 西门子下发配方状态 0:等待下发配方 1:请求下发配方 2:上位机接收配方 3:配方接收完成 4:请求配料 5:西门子开始配料确认 6:配方配料完成 7:配料完成确认
/// </summary>
public static int SiemensSendRecipeStatus { get; set; } = 0;
/// <summary>
/// 往输送带下发配方完成
/// </summary>
@@ -114,6 +117,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// 是否使用本地模拟订单+风送配方
/// </summary>
public bool IsUseWindSendDosing { get; set; }
public static int test1 = 1;
#endregion
}
}

+ 172
- 52
BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs Vedi File

@@ -50,6 +50,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
public RecipeRawMaterial RawMaterial;
public void Init()
{
testData();
for (int i = 0; i < 16; i++)
{
if (DeviceInquire.GetInstance.GetDevice(i).DeviceName != null)
@@ -69,57 +70,91 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
if (res != null && res is XL_Start_DB recipe)
{
RawMaterials.Clear();
for (int i = 0; i < GVL_SmallStation.Max_DosingSotckBinNum; i++)
{
if (!string.IsNullOrEmpty(recipe.Material[i].Material_Name))
if (!string.IsNullOrEmpty(recipe.RecipeCode)) {
RawMaterials.Clear();
for (int i = 0; i < GVL_SmallStation.Max_DosingSotckBinNum; i++)
{
if (RawMaterialsNamePos.ContainsKey(recipe.Material[i].Material_Name))
if (!string.IsNullOrEmpty(recipe.Material[i].Material_Name))
{
RawMaterials.Add(new RemoteRecipeRawMaterial()
if (RawMaterialsNamePos.ContainsKey(recipe.Material[i].Material_Name))
{
RawMaterialName = recipe.Material[i].Material_Name,
RawMaterialBarrelNum = recipe.Material[i].Material_BarrelNum,
RawMaterialWeight = recipe.Material[i].Material_Weight,
RawMaterialLocation = (int)RawMaterialsNamePos[recipe.Material[i].Material_Name]
});
RawMaterials.Add(new RemoteRecipeRawMaterial()
{
RawMaterialName = recipe.Material[i].Material_Name,
RawMaterialBarrelNum = recipe.Material[i].Material_BarrelNum,
RawMaterialWeight = recipe.Material[i].Material_Weight,
RawMaterialLocation = (int)RawMaterialsNamePos[recipe.Material[i].Material_Name]
});
}
else
{
//MessageNotify.GetInstance.AlarmLog("配方名称与本地不符合");
}
}
else
{
//MessageNotify.GetInstance.AlarmLog("配方名称与本地不符合");
break;
}
}
else
for (int i = 0; i < GVL_SmallStation.Max_PowderSotckBinNum; i++)
{
break;
if (!string.IsNullOrEmpty(recipe.Powder[i].Powder_Name))
{
WindSendData.Add(new WindSendRawMaterial()
{
RawMaterialName = recipe.Powder[i].Powder_Name,
RawMaterialWeight = recipe.Powder[i].Powder_Weight
});
}
else
{
break;
}
}
}
for (int i = 0; i < GVL_SmallStation.Max_PowderSotckBinNum; i++)
{
if (!string.IsNullOrEmpty(recipe.Powder[i].Powder_Name))
{
WindSendData.Add(new WindSendRawMaterial()
App.Current.Dispatcher.Invoke(() => {
Json<RemoteRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData()
{
RawMaterialName = recipe.Powder[i].Powder_Name,
RawMaterialWeight = recipe.Powder[i].Powder_Weight
RecipeName = recipe.RecipeName,
RecipeCode = recipe.RecipeCode,
RawMaterial = RawMaterials,
TrayCode = recipe.StockCode,
WindSend = WindSendData
});
}
else
{
break;
}
});
}
Json<RemoteRecipeDataColl>.Data.Recipes.Add(new RemoteRecipeData()
{
RecipeName = recipe.RecipeName,
RecipeCode = recipe.RecipeCode,
RawMaterial = RawMaterials,
TrayCode = recipe.TrayCode,
WindSend = WindSendData
});
}
}
}), "SiemensRecipeRecive", true);
ActionManage.GetInstance.CancelRegister("SiemensRecipeFinish");
ActionManage.GetInstance.Register(new Action<object>((res) =>
{
if (SiemensDevice.IsConnected)
{
if (res != null && res is RemoteRecipeData recipe)
{
RecipeFinishInfo.Order_No = recipe.RecipeCode;
RecipeFinishInfo.Product_Code = recipe.RecipeName;
RecipeFinishInfo.Job_No = (short)recipe.TrayCode;
for (int i = 0; i < recipe.RawMaterial.Count; i++)
{
RecipeFinishInfo.Material[i] = new UDT1();
RecipeFinishInfo.Material[i].Material_Name = recipe.RawMaterial.ElementAt(i).RawMaterialName;
RecipeFinishInfo.Material[i].Material_BarrelNum = recipe.RawMaterial.ElementAt(i).RawMaterialBarrelNum;
RecipeFinishInfo.Material[i].Material_Laying_Off_Weight = recipe.RawMaterial.ElementAt(i).Laying_Off_Weight;
}
for (int i = 0; i < recipe.WindSend.Count; i++)
{
RecipeFinishInfo.Powder[i] = new UDT2();
}
if (GVL_SmallStation.SiemensSendRecipeStatus == 6)
{
GVL_SmallStation.SiemensSendRecipeStatus = 7;
RecipeFinishInfo.Ask_For_Finish = true;
SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo, 2261);
}
}
}
}), "SiemensRecipeFinish", true);
ActionManage.GetInstance.CancelRegister("WindSendDosingFinish");
ActionManage.GetInstance.Register(new Action(() =>
{
@@ -139,7 +174,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
try
{
//HKDevice.HK_PLC_S7.Connect(S7.Net.CpuType.S71200, HK_PLC_IP);
//SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP);
SiemensDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71500, Siemens_PLC_IP);
//WindSendDevice.Siemens_PLC_S7.Connect(S7.Net.CpuType.S71200,WindSend_PLC_IP);
if (HKDevice.IsConnected)
{
@@ -644,7 +679,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
GVL_SmallStation.GetInstance.HeartBeatToPlc = !GVL_SmallStation.GetInstance.HeartBeatToPlc;
HKDevice.HK_PLC_S7.Write("DB4.DBX0.0", GVL_SmallStation.GetInstance.HeartBeatToPlc);
GVL_SmallStation.GetInstance.HeartBeatFromPlc = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX0.0");

}
}
/// <summary>
@@ -661,14 +695,66 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
if (!(RecipeQueue.Contains(data.RecipeCode)))
{
RecipeQueue.Enqueue(data.RecipeCode);
if (SiemensDevice.XL_Status is XL_Status_DB status)
{
if (GVL_SmallStation.SiemensSendRecipeStatus == 3)
{
GVL_SmallStation.SiemensSendRecipeStatus = 4;
SiemensDevice.Siemens_PLC_S7.WriteString(2231, data.RecipeCode,10);
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0",true);
}
if (GVL_SmallStation.SiemensSendRecipeStatus == 4)
{
if (SiemensDevice.XL_Status.Dosing_Confirm)
{
GVL_SmallStation.SiemensSendRecipeStatus = 5;
SiemensDevice.Siemens_PLC_S7.WriteString(2231, "", 10);
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", false);
}
}
if (GVL_SmallStation.SiemensSendRecipeStatus == 5)
{
if (SiemensDevice.XL_Status.Dosing_Confirm == false)
{
GVL_SmallStation.SiemensSendRecipeStatus = 6;
RecipeQueue.Enqueue(data.RecipeCode);
}

}

}
}
}
else if(data.TrayCode == 2)
else if (data.TrayCode == 2)
{
if (!(RecipeQueueTray2.Contains(data.RecipeCode)))
{
RecipeQueueTray2.Enqueue(data.RecipeCode);
if (SiemensDevice.XL_Status is XL_Status_DB status)
{
if (GVL_SmallStation.SiemensSendRecipeStatus == 3)
{
GVL_SmallStation.SiemensSendRecipeStatus = 4;
SiemensDevice.Siemens_PLC_S7.WriteString(2231, data.RecipeCode, 10);
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", true);
}
if (GVL_SmallStation.SiemensSendRecipeStatus == 4)
{
if (SiemensDevice.XL_Status.Dosing_Confirm)
{
GVL_SmallStation.SiemensSendRecipeStatus = 5;
SiemensDevice.Siemens_PLC_S7.WriteString(2231, "", 10);
SiemensDevice.Siemens_PLC_S7.Write("DB2231.DBX28.0", false);
}
}
if (GVL_SmallStation.SiemensSendRecipeStatus == 5)
{
if (SiemensDevice.XL_Status.Dosing_Confirm == false)
{
GVL_SmallStation.SiemensSendRecipeStatus = 0;
RecipeQueueTray2.Enqueue(data.RecipeCode);
}
}
}
}
}
}
@@ -851,23 +937,39 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
}
if (RTrig.GetInstance("配方配料完成").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.1")) && (GVL_SmallStation.GetInstance.WindSendDosingFinish || !GVL_SmallStation.GetInstance.IsUseWindSend))
if ((RTrig.GetInstance("配方配料完成").Start(HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.1")) && (GVL_SmallStation.GetInstance.WindSendDosingFinish || !GVL_SmallStation.GetInstance.IsUseWindSend)) || GVL_SmallStation.GetInstance.RecipeStatusID == 5)
{
var res = Json<RemoteRecipeDataColl>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == code);
MessageNotify.GetInstance.ShowRunLog($"托盘1,配方{res.RecipeName},配料完成");
RecipeFinishInfo.Order_No = RemoteRecipes.ElementAt(index).RecipeCode;
RecipeFinishInfo.Product_Code = RemoteRecipes.ElementAt(index).RecipeName;
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++)
{
RecipeFinishInfo.Material[i] = new UDT1();
RecipeFinishInfo.Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
RecipeFinishInfo.Material[i].Material_BarrelNum = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
RecipeFinishInfo.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight;
}
if (SiemensDevice.IsConnected)
{
RecipeFinishInfo.Ask_For_Finish = true;
SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo, 2261);
RecipeFinishInfo.Order_No = RemoteRecipes.ElementAt(index).RecipeCode;
RecipeFinishInfo.Product_Code = RemoteRecipes.ElementAt(index).RecipeName;
RecipeFinishInfo.Job_No = (short)trayCode;
for (int i = 0; i < 20; i++)
{
RecipeFinishInfo.Material[i] = new UDT1();
}
for (int i = 0; i < 10; i++)
{
RecipeFinishInfo.Powder[i] = new UDT2();
}
for (int i = 0; i < RemoteRecipes.ElementAt(index).RawMaterial.Count; i++)
{
RecipeFinishInfo.Material[i].Material_Name = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialName;
RecipeFinishInfo.Material[i].Material_BarrelNum = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).RawMaterialBarrelNum;
RecipeFinishInfo.Material[i].Material_Laying_Off_Weight = RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(i).Laying_Off_Weight;
}
for (int i = 0; i < RemoteRecipes.ElementAt(index).WindSend.Count; i++)
{
}
if (GVL_SmallStation.SiemensSendRecipeStatus == 6)
{
GVL_SmallStation.SiemensSendRecipeStatus = 7;
RecipeFinishInfo.Ask_For_Finish = true;
SiemensDevice.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(RecipeFinishInfo, 2261);
}
}
App.Current.Dispatcher.Invoke(() =>
{
@@ -1079,5 +1181,23 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
}
}
private void testData()
{
RawMaterialsNamePos.Add("A10", 1);
RawMaterialsNamePos.Add("A20", 2);
RawMaterialsNamePos.Add("A30", 3);
RawMaterialsNamePos.Add("A40", 4);
RawMaterialsNamePos.Add("A50", 5);
RawMaterialsNamePos.Add("A60", 6);
RawMaterialsNamePos.Add("A70", 7);
RawMaterialsNamePos.Add("A80", 8);
RawMaterialsNamePos.Add("A90", 9);
RawMaterialsNamePos.Add("A100", 10);
RawMaterialsNamePos.Add("A110", 11);
RawMaterialsNamePos.Add("A120", 12);
RawMaterialsNamePos.Add("A130", 13);
RawMaterialsNamePos.Add("A140", 14);
RawMaterialsNamePos.Add("A150", 15);
}
}
}

+ 59
- 15
BPASmartClient.JXJFoodSmallStation/Model/Siemens/SiemensDeviceStatus.cs Vedi File

@@ -14,34 +14,79 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
{
public SiemensHelper Siemens_PLC_S7 = new SiemensHelper();
public bool IsConnected => Siemens_PLC_S7.IsConnected;

public XL_Status_DB XL_Status = new XL_Status_DB();
bool test;
public void Init()
{
if (IsConnected)
{
ThreadManage.GetInstance().StartLong(new Action(() =>
ThreadManage.GetInstance().StartLong(new Action(() =>
{
var Start = this.Siemens_PLC_S7.ReadClass<XL_Start_DB>(2201);
var Status = this.Siemens_PLC_S7.ReadClass<XL_Status_DB>(2231);
var Finish = this.Siemens_PLC_S7.ReadClass<XL_Finish_DB>(2261);
var DataColl = this.Siemens_PLC_S7.ReadClass<XL_DataColl_DB>(2291);
if (Start != null && Start.Order_Request == false && GVL_SmallStation.IsAllowSiemensSendRecipe)
if (test)
{
Start.Order_Request = true;
this.Siemens_PLC_S7.WriteClass<XL_Start_DB>(Start, 1);
for (int i = 0; i < XL_Status.Powder.Length; i++) {

XL_Status.Powder.ElementAt(i).Powder_Name = ""+i;
}
Siemens_PLC_S7.WriteClass<XL_Status_DB>(XL_Status, 2231);
}
if (Start != null && RTrig.GetInstance("RecipeTrig").Start(Start.Order_Request_ACK))
if (Start != null && Start is XL_Start_DB st)
{
ActionManage.GetInstance.Send("SiemensRecipeRecive", Start);
Start.Order_Request_ACK = false;
this.Siemens_PLC_S7.WriteClass<XL_Start_DB>(Start, 1);
if (RTrig.GetInstance("DB2201.DBX450.0").Start(GVL_SmallStation.IsAllowSiemensSendRecipe) && GVL_SmallStation.SiemensSendRecipeStatus == 0)
{
GVL_SmallStation.SiemensSendRecipeStatus = 1;
this.Siemens_PLC_S7.Write("DB2201.DBX450.0", true);
}
if (RTrig.GetInstance("Order_Request_ACK").Start(Start.Order_Request_ACK) && GVL_SmallStation.SiemensSendRecipeStatus == 1)
{
if (!string.IsNullOrEmpty(st.RecipeCode))
{
GVL_SmallStation.SiemensSendRecipeStatus = 2;
ActionManage.GetInstance.Send("SiemensRecipeRecive", st);
this.Siemens_PLC_S7.Write("DB2201.DBX450.0", false);
}
}
if (TTrig.GetInstance("Order_Request_ACK_").Start(Start.Order_Request_ACK) && GVL_SmallStation.SiemensSendRecipeStatus == 2)
{
GVL_SmallStation.IsAllowSiemensSendRecipe = false;
GVL_SmallStation.SiemensSendRecipeStatus = 3;
//需要等待请求信号复位才能认为接收配方完成
}
}
if (Status != null && RTrig.GetInstance("Allow_AGV_Put[0]").Start(Status.AgvRequestPut))
if (Finish != null && Finish is XL_Finish_DB FinishData)
{
ActionManage.GetInstance.Send("AGV放货架到位",Status);
Status.AgvRequestPut = false;
this.Siemens_PLC_S7.WriteClass<XL_Status_DB>(Status, 2);
if (RTrig.GetInstance("Ask_For_Finish_PLC").Start(FinishData.Ask_For_Finish_PLC) && GVL_SmallStation.SiemensSendRecipeStatus == 7)
{
FinishData.Order_No = "";
FinishData.Product_Code = "";
FinishData.Job_No = 0;
for (int i = 0; i < 20; i++)
{
FinishData.Material[i] = new UDT1();
}
for (int i = 0; i < 10; i++)
{
FinishData.Powder[i] = new UDT2();
}
GVL_SmallStation.SiemensSendRecipeStatus = 0;
FinishData.Ask_For_Finish = false;
FinishData.DosingTime = 0;
this.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(FinishData, 2261);
}
}
if (Status != null && Status is XL_Status_DB state)
{
XL_Status = state;
if (RTrig.GetInstance("Allow_AGV_Put[0]").Start(Status.AgvRequestPut))
{
ActionManage.GetInstance.Send("AGV放货架到位", Status);
Status.AgvRequestPut = false;
this.Siemens_PLC_S7.WriteClass<XL_Status_DB>(Status, 2);
}
}
if (Status != null && RTrig.GetInstance("Allow_AGV_Put[1]").Start(Status.AgvRequestGet))
{
@@ -49,7 +94,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
Status.AgvRequestGet = false;
this.Siemens_PLC_S7.WriteClass<XL_Status_DB>(Status, 2);
}
Thread.Sleep(10);
}),"监听服务数据");
}


+ 3
- 3
BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Finish_DB.cs Vedi File

@@ -7,7 +7,7 @@ using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
{
internal class XL_Finish_DB
public class XL_Finish_DB
{
/// <summary>
/// 配料完成信号确认
@@ -52,7 +52,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
/// 原料名称
/// </summary>
[Siemens(6)]
public string Material_Name { get; set; }
public string Material_Name { get; set; } = "";
/// <summary>
/// 原料下料重量
/// </summary>
@@ -68,7 +68,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
/// 粉料仓名称
/// </summary>
[Siemens(6)]
public string Powder_Name { get; set; }
public string Powder_Name { get; set; } = "";
/// <summary>
/// 粉料仓重量
/// </summary>


+ 2
- 2
BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Start_DB.cs Vedi File

@@ -51,7 +51,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
/// <summary>
/// 原料名称
/// </summary>
public string Material_Name { get; set; }
public string Material_Name { get; set; } = "";
/// <summary>
/// 原料重量
/// </summary>
@@ -69,7 +69,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
/// 粉料仓名称
/// </summary>
[Siemens(6)]
public string Powder_Name { get; set; }
public string Powder_Name { get; set; } = "";
/// <summary>
/// 粉料仓重量
/// </summary>


+ 1
- 1
BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Status_DB.cs Vedi File

@@ -78,7 +78,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
/// 粉料名称
/// </summary>
[Siemens(6)]
public string Powder_Name { get; set; }
public string Powder_Name { get; set; } = "";
/// <summary>
/// 粉料仓剩余重量
/// </summary>


+ 3
- 1
BPASmartClient.MORKSM.BK.PLC/PLCMachine.cs Vedi File

@@ -16,6 +16,8 @@ namespace BPASmartClient.PLC
{
Task.Run(new Action(() => { modbusTcp.ModbusTcpConnect(communicationPar.IPAddress, communicationPar.IPPort); })); //PLC 设备连接

Thread.Sleep(1000);

ThreadManage.GetInstance().StartLong(new Action(() =>
{
IsConnected = modbusTcp.Connected;
@@ -41,7 +43,7 @@ namespace BPASmartClient.PLC
Thread.Sleep(500);
}
Thread.Sleep(1000);
}), $"设备[{DeviceId}]PLC读取线程", true);
}), $"设备[{DeviceId}][{modbusTcp.IPAdress}]PLC读取线程", true);

//写入数据
EventBus.EventBus.GetInstance().Subscribe<WriteModel>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)


+ 1
- 1
BPASmartClient.Model/柔性味魔方/RawMaterialModel.cs Vedi File

@@ -114,7 +114,7 @@ namespace BPASmartClient.Model
set
{
_mRecipeStatus = value;
if (value == 1) Status = Status.等待配料;
if (value == 1 && Status != Status.配料完成) Status = Status.等待配料;
else if (value == 2) Status = Status.正在配料;
else if (value == 3) Status = Status.配料完成;
OnPropertyChanged();


+ 1276
- 714
BPASmartClient.MorkF/Control_MorkF.cs
File diff soppresso perché troppo grande
Vedi File


+ 16
- 1
BPASmartClient.MorkF/GVL_MorkF.cs Vedi File

@@ -1,4 +1,5 @@
using BPA.Models;
using BPASmartClient.Device;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -17,7 +18,15 @@ namespace BPASmartClient.MorkF

public bool IsAuto = true;

#region 炒锅1
#region 炒锅
/// <summary>
/// 炒锅上一次搅拌档位
/// </summary>
public int Stir { set; get; }
/// <summary>
/// 炒锅上一次火力
/// </summary>
public int Fire { get; set; }
/// <summary>
/// 炒锅是否在工作状态中
/// </summary>
@@ -25,6 +34,7 @@ namespace BPASmartClient.MorkF
/// <summary>
/// 炒锅自动模式
/// </summary>
[VariableMonitor("炒锅1锅低温度", "VW120", "160")]
public bool AutoMode { get; set; }
/// <summary>
/// 炒锅1初始化完成
@@ -71,6 +81,11 @@ namespace BPASmartClient.MorkF
/// </summary>
public bool PotOnOrigin { get; set; }

/// <summary>
/// 获取菜品是否完成
/// </summary>
public bool GetMaterialComplete { get; set; }

#endregion

#region 调料通道


+ 127
- 0
BPASmartClient.MorkF/ML_MorkF.cs Vedi File

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

namespace BPASmartClient.MorkF
{
internal class ML_MorkF
{
#region 菜品库的操作状态
/// <summary>
/// 激光距离
/// </summary>
public int LaserDistance { get; set; }

/// <summary>
/// 菜品库当前X轴坐标
/// </summary>
public int ArmPositionX { get; set; }

/// <summary>
/// 菜品库当前Y轴坐标
/// </summary>
public int ArmPositionY { get; set; }

/// <summary>
/// 菜品库是否在工作中
/// </summary>
public bool MaterailIsWorking { get; set; }

/// <summary>
/// 初始化是否完成
/// </summary>
public bool InitialComplete { get; set; }

private bool _ArriveComplete = false;
/// <summary>
/// 定位到达,上升沿捕获需要特殊处理
/// </summary>
public bool ArriveComplete
{
get
{
var ret = _ArriveComplete;
_ArriveComplete = false;
if(ret)
{
MessageLog.GetInstance.Show("到达上升沿为true");
}
else
{
MessageLog.GetInstance.Show("到达上升沿为false");
}
return ret;
}
set
{
_ArriveComplete = value;
}
}

/// <summary>
/// 爪子初始化完成
/// </summary>
public bool PawInitialComplete { get; set; }

private bool _PawArrivePortOne = false;
/// <summary>
/// 爪子到达一号位,上升沿捕获需要特殊处理
/// </summary>
public bool PawArrivePortOne
{
get
{
var ret = _PawArrivePortOne;
_PawArrivePortOne = false;
return ret;
}
set
{
_PawArrivePortOne = value;
}
}

private bool _PawArrivePortTwo = false;
/// <summary>
/// 爪子到达二号位,上升沿捕获需要特殊处理
/// </summary>
public bool PawArrivePortTwo
{
get
{
var ret = _PawArrivePortTwo;
_PawArrivePortTwo = false;
return ret;
}
set
{
_PawArrivePortTwo = value;
}
}

private bool _PawArrivePortThree = false;
/// <summary>
/// 爪子到达三号位
/// </summary>
public bool PawArrivePortThree
{
get
{
var ret = _PawArrivePortThree;
_PawArrivePortThree = false;
return ret;
}
set
{
_PawArrivePortThree = value;
}
}
#endregion

#region
#endregion
}
}

+ 27
- 0
BPASmartClient.MorkF/MaterialOperation.cs Vedi File

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

namespace BPASmartClient.MorkF
{
/// <summary>
/// 菜品库操作类
/// </summary>
internal class MaterialOperation
{
/// <summary>
/// x轴坐标
/// </summary>
public int x;
/// <summary>
/// y轴坐标
/// </summary>
public int y;
/// <summary>
/// 炒锅编号
/// </summary>
public int fryNum;
}
}

+ 23
- 5
BPASmartClient.MorkF/View/DebugView.xaml Vedi File

@@ -22,7 +22,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="81" ></RowDefinition>
<RowDefinition Height="81" ></RowDefinition>
<RowDefinition Height="285"></RowDefinition>
<RowDefinition Height="325"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<GroupBox Header="设备控制" FontSize="15" Foreground="Aqua" VerticalAlignment="Center" >
@@ -65,6 +65,8 @@
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<WrapPanel Orientation="Horizontal" >
<TextBlock Text="取料手臂实时位置" Margin="0,0,10,0"/>
@@ -94,12 +96,28 @@
<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" >
<WrapPanel Grid.Row="2" Orientation="Horizontal" >
<TextBlock Text="设定手臂当前位置" Margin="0,0,10,0"/>
<TextBlock Text="X:" Margin="5,0"/>
<TextBox Text="{Binding SettingNowX}" Width="70" Margin="5,0" VerticalAlignment="Center" />
<TextBlock Text="Y:" Margin="5,0"/>
<TextBox Text="{Binding SettingNowY}" Width="70" Margin="5,0" VerticalAlignment="Center" />
<Button Content="设置" Margin="10,0,5,0" Command="{Binding SetNowPosition}"/>
</WrapPanel>
<WrapPanel Grid.Row="3" 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"/>
<RadioButton Content="位置1" Margin="5,0" IsEnabled="True" IsChecked="{Binding PawPositon1}" Command="{Binding GetDistance_1}" GroupName="PawTurn"/>
<RadioButton Content="位置2" Margin="5,0" IsEnabled="True" IsChecked="{Binding PawPositon2}" Command="{Binding GetDistance_2}" GroupName="PawTurn"/>
<RadioButton Content="位置3" Margin="5,0 " IsEnabled="True" IsChecked="{Binding PawPositon3}" Command="{Binding GetDistance_3}" GroupName="PawTurn"/>
</WrapPanel>
<WrapPanel Grid.Row="4" Orientation="Horizontal" >
<RadioButton Content="上" Margin="5,0" IsEnabled="{Binding ArmRunEnable}" IsChecked="{Binding ArmRunUp}" Command="{Binding GetDistance_1}" GroupName="ArmRun"/>
<RadioButton Content="下" Margin="5,0" IsEnabled="{Binding ArmRunEnable}" IsChecked="{Binding ArmRunDown}" Command="{Binding GetDistance_2}" GroupName="ArmRun"/>
<RadioButton Content="左" Margin="5,0 " IsEnabled="{Binding ArmRunEnable}" IsChecked="{Binding ArmRunLeft}" Command="{Binding GetDistance_3}" GroupName="ArmRun"/>
<RadioButton Content="右" Margin="5,0 " IsEnabled="{Binding ArmRunEnable}" IsChecked="{Binding ArmRunRight}" Command="{Binding GetDistance_3}" GroupName="ArmRun"/>
<Button Content="{Binding ArmButtonName}" Command="{Binding ArmRun}" Margin="5,0" Cursor="Hand">
</Button>
</WrapPanel>
</Grid>



+ 56
- 3
BPASmartClient.MorkF/ViewModel/DebugViewModel.cs Vedi File

@@ -50,6 +50,11 @@ namespace BPASmartClient.MorkF.ViewModel
public int SettingY { get { return _settingY; } set { _settingY = value; OnPropertyChanged(); } }
private int _settingY = 0;

public int SettingNowX { get { return _settingNowX; } set { _settingNowX = value; OnPropertyChanged(); } }
private int _settingNowX = 0;
public int SettingNowY { get { return _settingNowY; } set { _settingNowY = value; OnPropertyChanged(); } }
private int _settingNowY = 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(); } }
@@ -65,7 +70,21 @@ namespace BPASmartClient.MorkF.ViewModel
public bool PawPositon3 { get { return _pawPositon3; } set { _pawPositon3 = value; OnPropertyChanged(); } }
private bool _pawPositon3;

public bool ArmRunUp { get { return _armRunUp; } set { _armRunUp = value; OnPropertyChanged(); } }
private bool _armRunUp;
public bool ArmRunDown { get { return _armRunDown; } set { _armRunDown = value; OnPropertyChanged(); } }
private bool _armRunDown;
public bool ArmRunLeft { get { return _armRunLeft; } set { _armRunLeft = value; OnPropertyChanged(); } }
private bool _armRunLeft;
public bool ArmRunRight { get { return _armRunRight; } set { _armRunRight = value; OnPropertyChanged(); } }
private bool _armRunRight;
public bool ArmRunEnable { get { return _ArmRunEnable; } set { _ArmRunEnable = value; OnPropertyChanged(); } }
private bool _ArmRunEnable = true;

public string ArmButtonName { get { return _ArmButtonName; } set { _ArmButtonName = value; OnPropertyChanged(); } }
private string _ArmButtonName = "启动";

public RelayCommand SetNowPosition { get; set; }//设置机械臂当前坐标
public RelayCommand FoodLibInit { get; set; }//初始化
public RelayCommand StartElectromagnetism { get; set; }//电磁阀启动
public RelayCommand StopElectromagnetism { get; set; }
@@ -76,9 +95,10 @@ namespace BPASmartClient.MorkF.ViewModel
public RelayCommand PawTurnFront { get; set; }//夹爪正转
public RelayCommand PawTurnBack { get; set; }//夹爪反转
public RelayCommand SetArmPosition { get; set; }//机器臂位置设定
public RelayCommand ArmRun { get; set; }//机械臂运动

#endregion

#region 配料仓控制
public List<string> PassageWays { get; set; } = new List<string>()
@@ -183,8 +203,8 @@ namespace BPASmartClient.MorkF.ViewModel
#region 菜品控制

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 });});//电磁阀关闭
StartElectromagnetism = new RelayCommand(() => { ActionManage.GetInstance.Send("Electromagnetism", new List<bool> { false }); });//电磁阀启动
StopElectromagnetism = new RelayCommand(() => { ActionManage.GetInstance.Send("Electromagnetism", new List<bool> { true });});//电磁阀关闭
SetSpeed = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("SetSpeed", new List<int> { MoveSpeed });
@@ -195,6 +215,39 @@ namespace BPASmartClient.MorkF.ViewModel
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 }); });//设定机械臂位置
SetNowPosition = new RelayCommand(() => { ActionManage.GetInstance.Send("SetNowPosition", new List<int> { SettingX, SettingY }); });//设定机械臂当前位置
ArmRun = new RelayCommand(() => {
//判断是否都未点击
if(!ArmRunDown&&!ArmRunUp&&!ArmRunLeft&&!ArmRunRight)
{
return;
}
ArmRunEnable = !ArmRunEnable;
if(ArmRunEnable)
{
ArmButtonName = "启动";
}
else
{
ArmButtonName = "停止";
}
if(ArmRunUp)
{
ActionManage.GetInstance.Send("ArmRunUp", !ArmRunEnable);
}
else if(ArmRunDown)
{
ActionManage.GetInstance.Send("ArmRunDown", !ArmRunEnable);
}
else if (ArmRunLeft)
{
ActionManage.GetInstance.Send("ArmRunLeft", !ArmRunEnable);
}
else if(ArmRunRight)
{
ActionManage.GetInstance.Send("ArmRunRight", !ArmRunEnable);
}
});//设定机械臂位置
#endregion

#region 配料仓控制


+ 1
- 0
BPASmartClient.MorkS/BPASmartClient.MorkS.csproj Vedi File

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

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.77" />
<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" />


+ 60
- 6
BPASmartClient.MorkS/Control_Morks.cs Vedi File

@@ -34,13 +34,11 @@ namespace BPASmartClient.MorkS

public override void DoMain()
{


MonitorViewModel.DeviceId = DeviceId;
ServerInit();
DataParse();

Json<MorksPar>.Read();
Json<OrderStatistics>.Read();
if (Json<MorksPar>.Data.parSets == null) Json<MorksPar>.Data.parSets = new ObservableCollection<ParSet>();
if (Json<MorksPar>.Data.parSets.Count < 6)
{
@@ -138,7 +136,43 @@ namespace BPASmartClient.MorkS
goodName = res.MorkOrder.GoodsName;
SortNum = res.MorkOrder.SortNum.ToString();
}

EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent() { SortNum = SortNum, GoodName = goodName, Status = oRDER_STATUS, SubOrderId = subid, deviceClientType = DeviceType });

var index = DataServer.GetInstance.morkS.MakeOrder.FindIndex(p => p.SortNum == SortNum);
if (index >= 0 && index < DataServer.GetInstance.morkS.MakeOrder.Count)
{
if (oRDER_STATUS == ORDER_STATUS.COMPLETED_COOK)
{
DataServer.GetInstance.morkS.MakeOrder.RemoveAt(index);
DataServer.GetInstance.morkS.MakeOrderOver.Add(new OrderMakeModel()
{
Status = oRDER_STATUS,
GoodName = goodName,
SortNum = SortNum,
StopTime = DateTime.Now.ToString("HH:mm:ss")
});
}
else if (oRDER_STATUS == ORDER_STATUS.COMPLETED_TAKE)
{
var temp = DataServer.GetInstance.morkS.MakeOrderOver.FirstOrDefault(p => p.SortNum == SortNum);
if (temp != null) DataServer.GetInstance.morkS.MakeOrderOver.Remove(temp);
}
else
{
DataServer.GetInstance.morkS.MakeOrder.ElementAt(index).Status = oRDER_STATUS;
}
}
else
{
DataServer.GetInstance.morkS.MakeOrder.Add(new OrderMakeModel()
{
Status = oRDER_STATUS,
GoodName = goodName,
SortNum = SortNum,
StartTime = DateTime.Now.ToString("HH:mm:ss")
});
}
}

private void GetStatus(string key, Action<object> action)
@@ -154,6 +188,16 @@ namespace BPASmartClient.MorkS

public override void ReadData()
{
DataServer.GetInstance.morkS.Alarm.Clear();
alarms.ForEach(item =>
{
DataServer.GetInstance.morkS.Alarm.Add(new AlarmModel()
{
AlarmTime = $"{item.Date} {item.Time}",
AlarmMs = item.Info
});
});

GetStatus("M230.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 24)
@@ -215,6 +259,11 @@ namespace BPASmartClient.MorkS
mORKS.TurntableUpLimit = bools[13];
mORKS.FeedComplete = bools[14];
mORKS.TurntableMoveInPlace = bools[15];
DataServer.GetInstance.morkS.MorkS_Temp = mORKS.TemperatureReached;
DataServer.GetInstance.morkS.Morks_SiloMeasUp = mORKS.TurntableUpLimit;
DataServer.GetInstance.morkS.Morks_SiloMeasDown = mORKS.TurntableLowerLimit;
DataServer.GetInstance.morkS.MorkS_NoBowMeas1 = mORKS.MissingBowl;
DataServer.GetInstance.morkS.MorkS_NoBowMeas2 = mORKS.MissingBowlSignal2;
}

}));
@@ -247,6 +296,7 @@ namespace BPASmartClient.MorkS
for (int i = 0; i < 6; i++)
{
mORKS.CookNoodlesComplete[i] = bools[i];
DataServer.GetInstance.morkS.Morks_NoodleUpOrDown[i] = bools[i];
}
}

@@ -256,6 +306,7 @@ namespace BPASmartClient.MorkS
{
if (obj is ushort[] UshortValue && UshortValue.Length > 0 && UshortValue.Length <= 1)
mORKS.TurntableFeedbackloc = UshortValue[0];
DataServer.GetInstance.morkS.MorkS_BinLocation = mORKS.TurntableFeedbackloc;
}));
}

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

//取餐完成逻辑处理
if (Delay.GetInstance("CompleteChange1").Start( !mORKS.TakeMealDetect, 1)&&mORKS.CookCompleteFlatBit == true)
if (Delay.GetInstance("CompleteChange1").Start(!mORKS.TakeMealDetect, 1) && mORKS.CookCompleteFlatBit == true)
{
OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE);
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成");
@@ -814,7 +868,7 @@ namespace BPASmartClient.MorkS
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.Bowloc, SuborderId = guid });
MessageLog.GetInstance.Show($"添加订单:碗位置【{(ushort)msm.Bowloc}】");
}
}
});
}


+ 11
- 4
BPASmartClient.MorkS/DataServer.cs Vedi File

@@ -6,6 +6,8 @@ using System.Threading;
using System.Threading.Tasks;
using BPA.Helper;
using BPASmartClient.MQTT;
using BPA.Message;
using BPASmartClient.Model;

namespace BPASmartClient.MorkS
{
@@ -16,22 +18,27 @@ namespace BPASmartClient.MorkS
public static DataServer GetInstance => _Instance ?? (_Instance = new DataServer());
private DataServer() { }

public ScreenModelMorkS morkS { get; set; } = new ScreenModelMorkS();

MQTTProxy mQTTProxy = new MQTTProxy();
public void Init()
{
MQTTProxy mQTTProxy = new MQTTProxy();
mQTTProxy.Connected = new Action(() =>
{
mQTTProxy.Subscrib("");
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机));
ThreadManage.GetInstance().StartLong(new Action(() =>
{
mQTTProxy.Publish("", "");
morkS.MorkS_OrderCount = Json<OrderStatistics>.Data.Count;
SendScreenDataModel sendScreenDataModel = new SendScreenDataModel();
sendScreenDataModel.Name = ScreenDeviceType.煮面机;
sendScreenDataModel.Value = morkS.ToJSON();
mQTTProxy.Publish(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机), sendScreenDataModel.ToJSON());
Thread.Sleep(100);
}), "海科食堂大屏监听");
});
mQTTProxy.Connect("UserName", "Password", "Host", 1883, $"MORKS 设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
}


//订单信息(正在制作,等待制作,制作完成)
//煮面炉上下状态(6个煮面炉上或下)
//温度状态(煮面炉温度是否到达)


+ 23
- 5
BPASmartClient.MorkTSingle/Control_MORKJC.cs Vedi File

@@ -89,7 +89,14 @@ namespace BPASmartClient.MorkTSingle
{
Thread.Sleep(1000);
OrderChange(morkT.morkOrderPushesCoffee.ElementAt(0).SuborderId, BPA.Message.Enum.ORDER_STATUS.COOKING);
new KLMCoffee_MakeCoffeeEvent() { DeviceId=DeviceId, KLMDrinkFaultCode = (KLMDrinkFaultType)(morkT.morkOrderPushesCoffee.ElementAt(0).Loc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水
if (!GVL_MORKJC.CoffeeKind)
{
new KLMCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, KLMDrinkFaultCode = (KLMDrinkFaultType)(morkT.morkOrderPushesCoffee.ElementAt(0).Loc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水
}
else
{
new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish();
}
morkT.IsCoffeeMake = true;
}
else if (morkT.MakeCoffeeFinish && IsHealth && morkT.morkOrderPushesCoffee.Count > 0 && morkT.IsCoffeeMake)
@@ -233,11 +240,22 @@ namespace BPASmartClient.MorkTSingle
{
if (morkT.IsCoffeeMake)
{
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
if (!GVL_MORKJC.CoffeeKind)
{
bFirstTrig_Coffee = false;
morkT.MakeCoffeeFinish = true;
});
EventBus.EventBus.GetInstance().Subscribe<KLMCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
bFirstTrig_Coffee = false;
morkT.MakeCoffeeFinish = true;
});
}
else
{
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CoffeEndCookEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
bFirstTrig_Coffee = false;
morkT.MakeCoffeeFinish = true;
});
}
if (morkT.MakeCoffeeFinish != true)
{
if (!bFirstTrig_Coffee)


+ 4
- 0
BPASmartClient.MorkTSingle/GVL_MORKJC.cs Vedi File

@@ -19,5 +19,9 @@ namespace BPASmartClient.MorkTSingle
/// 咖乐美咖啡机心跳
/// </summary>
public bool KLMCoffeeIsConnected = false;
/// <summary>
/// 咖啡种类false:咖乐美咖啡 true:咖博士
/// </summary>
public static bool CoffeeKind { get; set; } = true;
}
}

+ 25
- 4
BPASmartClient.S7Net/EntityClassResolution.cs Vedi File

@@ -57,6 +57,7 @@ namespace BPASmartClient.S7Net
default:
numBytes = GetClassSize(Activator.CreateInstance(type), numBytes, isInnerProperty: true);
if (type.IsClass) IncrementToEven(ref numBytes);
else if (!type.IsPrimitive && !type.IsEnum && type.IsValueType) IncrementToEven(ref numBytes);
break;
}

@@ -214,7 +215,8 @@ namespace BPASmartClient.S7Net
List<byte> bytes1 = new List<byte>();
if (sarray.Length > 2)
for (int i = 2; i < sarray.Length; i++) if (sarray[i] > 0) bytes1.Add(sarray[i]);
obj = GetGb2312()?.GetString(bytes1.ToArray()).Trim().Replace(" ", "").Replace("\n", "");
//obj = GetGb2312()?.GetString(bytes1.ToArray()).Trim().Replace(" ", "").Replace("\n", "");
obj = bytes1.ToArray().ToStringb().Trim().Replace(" ", "").Replace("\n", "");
numBytes += len;
break;
default:
@@ -243,6 +245,26 @@ namespace BPASmartClient.S7Net
return Encoding.GetEncoding("gb2312");
}


//public static Encoding GetGb2312(this Encoding encoding)
//{
// Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
// return Encoding.GetEncoding("gb2312");
//}

public static byte[] ToArrays(this string value)
{
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
return Encoding.GetEncoding("gb2312").GetBytes(value);
}

public static string ToStringb(this byte[] value)
{
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
return Encoding.GetEncoding("gb2312").GetString(value);
}


public static double FromBytes(object sourceClass, byte[] bytes, double numBytes = 0.0, bool isInnerClass = false)
{
if (bytes == null)
@@ -332,7 +354,8 @@ namespace BPASmartClient.S7Net
if (tempLen != null) len = tempLen.Len + 2;
}
array = new byte[len];
var res = GetGb2312()?.GetBytes(propertyValue?.ToString());
//var res = GetGb2312()?.GetBytes(propertyValue?.ToString());
var res = propertyValue?.ToString()?.ToArrays();
if (array.Length > 2) array[0] = (byte)(len - 2); array[1] = (byte)res.Length;

for (int i = 0; i < res?.Length; i++)
@@ -379,7 +402,6 @@ namespace BPASmartClient.S7Net
{
break;
}

numBytes = SetBytesFromProperty(array.GetValue(i), bytes, numBytes, accessableProperty);
}
}
@@ -388,7 +410,6 @@ namespace BPASmartClient.S7Net
numBytes = SetBytesFromProperty(accessableProperty.GetValue(sourceClass, null), bytes, numBytes, accessableProperty);
}
}

return numBytes;
}



+ 36
- 6
BPASmartClient.S7Net/SiemensHelper.cs Vedi File

@@ -1,4 +1,8 @@
using S7.Net;
using System.Net;
using System.Text;
using BPASmartClient.S7Net;
using System.Text;

namespace BPASmartClient.S7Net
{
@@ -58,6 +62,20 @@ namespace BPASmartClient.S7Net
return myPlc?.Read(dataType, db, address, varType, count);
}

public void WriteString(DataType dataType, int db, int startByteAdr, string value)
{
if (!IsConnected) return;
var res = value.ToArrays();
if (res != null)
{
List<byte> bytes = new List<byte>();
bytes.Add((byte)res.Length);
bytes.Add((byte)res.Length);
bytes.AddRange(res);
myPlc?.WriteBytes(dataType, db, startByteAdr, bytes.ToArray());
}
}

public string Write<TValue>(string address, TValue value, int Retries = 1)
{
if (IsConnected)
@@ -89,24 +107,36 @@ namespace BPASmartClient.S7Net
}
}

public void WriteString(int db,string txt, int startAddress = 0)
{
var temp = Encoding.ASCII.GetBytes(txt);
var bytes = S7.Net.Types.S7String.ToByteArray(txt, temp.Length);
myPlc.WriteBytes(DataType.DataBlock,db, startAddress, bytes);

}
public TResult ReadClass<TResult>(int db, int startByteAdr = 0) where TResult : class, new()
{
TResult sourceClass = new TResult();
int num = (int)EntityClassResolution.GetClassSize(sourceClass);
if (num <= 0) return sourceClass;
byte[] array = myPlc.ReadBytes(DataType.DataBlock, db, startByteAdr, num);
EntityClassResolution.FromBytes(sourceClass, array);
if (IsConnected)
{
byte[] array = myPlc.ReadBytes(DataType.DataBlock, db, startByteAdr, num);
EntityClassResolution.FromBytes(sourceClass, array);
}
return sourceClass;
}

public void WriteClass<TWriteModel>(TWriteModel sourceClass, int db, int startAddress = 0) where TWriteModel : class, new()
{
byte[] array = new byte[(int)EntityClassResolution.GetClassSize(sourceClass)];
EntityClassResolution.ToBytes(sourceClass, array);
myPlc.WriteBytes(DataType.DataBlock, db, startAddress, array);
if (IsConnected)
{
byte[] array = new byte[(int)EntityClassResolution.GetClassSize(sourceClass)];
EntityClassResolution.ToBytes(sourceClass, array);
myPlc.WriteBytes(DataType.DataBlock, db, startAddress, array);
}
}


//public ushort[] ReadMW(int address, int count)
//{
// if (!IsConnected) return default;


+ 4
- 3
BPASmartClient.ScreenALL/App.config Vedi File

@@ -1,9 +1,10 @@
<?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"/>
<!--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>

+ 1
- 1
BPASmartClient.ScreenALL/BPASmartClient.ScreenALL.csproj Vedi File

@@ -5,7 +5,7 @@
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<AssemblyName>监控大屏</AssemblyName>
<AssemblyName>海科食堂监控大屏</AssemblyName>
<ApplicationIcon>hbl.ico</ApplicationIcon>

</PropertyGroup>


+ 58
- 5
BPASmartClient.ScreenLib/AppMain.cs Vedi File

@@ -20,8 +20,8 @@ namespace BPASmartClient.ScreenLib
WindowLargeScreen windowLarge = new WindowLargeScreen();
#region 设置显示页面与标题
string TitleName = $"{type.Assembly.ManifestModule.Name.Replace(".dll", "")}";
string name= type.FullName.Split('.')[2];
string sbmc=string.Empty;
string name = type.FullName.Split('.')[2];
string sbmc = string.Empty;
switch (type.FullName)
{
case "BPASmartClient.ScreenALL.App":
@@ -37,10 +37,63 @@ namespace BPASmartClient.ScreenLib
windowLarge.Init(TitleName, new ScreenMorksControl()); windowLarge.Show();
break;
case "BPASmartClient.ScreenSplitMeals.App":
ScreenSplitMealsControl1 ScreenSplit=new ScreenSplitMealsControl1();
ScreenSplitMealsControl1 ScreenSplit = new ScreenSplitMealsControl1();
windowLarge.Init("一号" + TitleName, ScreenSplit);
windowLarge.Show();
ScreenSplit.Start(TitleName);

WindowLargeScreen windowLarge2 = new WindowLargeScreen();
windowLarge2.Init("二号" + TitleName, new ScreenSplitMealsControl2());
WindowLargeScreen windowLarge3 = new WindowLargeScreen();
windowLarge3.Init("三号" + TitleName, new ScreenSplitMealsControl3());

int i = 0;
foreach (System.Windows.Forms.Screen scr in System.Windows.Forms.Screen.AllScreens)
{
if (i.ToString() == System.Configuration.ConfigurationManager.AppSettings["一号屏"].ToString())
{
windowLarge.WindowStartupLocation = WindowStartupLocation.Manual;
windowLarge.Left = scr.WorkingArea.Left;
windowLarge.Top = scr.WorkingArea.Top;
windowLarge.Width = scr.Bounds.Width;
windowLarge.Height = scr.Bounds.Height;
windowLarge.WindowState = WindowState.Maximized;
windowLarge.ResizeMode = ResizeMode.NoResize;
windowLarge.WindowStyle = WindowStyle.None;
windowLarge.WindowState = WindowState.Normal;
windowLarge.ShowInTaskbar = false;
windowLarge.Topmost = true;
}
else if (i.ToString() == System.Configuration.ConfigurationManager.AppSettings["二号屏"].ToString())
{
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;
windowLarge2.Topmost = true;
}
else if (i.ToString() == System.Configuration.ConfigurationManager.AppSettings["三号屏"].ToString())
{
windowLarge3.WindowStartupLocation = WindowStartupLocation.Manual;
windowLarge3.Left = scr.WorkingArea.Left;
windowLarge3.Top = scr.WorkingArea.Top;
windowLarge3.Width = scr.Bounds.Width;
windowLarge3.Height = scr.Bounds.Height;
windowLarge3.WindowState = WindowState.Maximized;
windowLarge3.ResizeMode = ResizeMode.NoResize;
windowLarge3.WindowStyle = WindowStyle.None;
windowLarge3.WindowState = WindowState.Normal;
windowLarge3.ShowInTaskbar = false;
windowLarge3.Topmost = true;

}
i++;
}
windowLarge.Show(); windowLarge2.Show(); windowLarge3.Show();
break;
}
#endregion


+ 1
- 1
BPASmartClient.ScreenLib/BPASmartClient.ScreenLib.csproj Vedi File

@@ -19,7 +19,7 @@
</COMReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="BPA.CustomResource" Version="1.0.5" />
<PackageReference Include="BPA.CustomResource" Version="1.0.14" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1418.22" />
</ItemGroup>



+ 50
- 8
BPASmartClient.ScreenLib/Helper/Main.cs Vedi File

@@ -70,7 +70,7 @@ namespace BPASmartClient.ScreenLib
/// <summary>
/// 设备数据
/// </summary>
public Dictionary<string, Dictionary<string, string>> mqttDatasDic = new Dictionary<string, Dictionary<string, string>>();
public Dictionary<ScreenDeviceType, object> mqttDatasDic = new Dictionary<ScreenDeviceType, object>();
/// <summary>
/// 配置数据
/// </summary>
@@ -96,11 +96,23 @@ namespace BPASmartClient.ScreenLib
if (msg.Count > 0 && msg.TryDequeue(out string s))
{
SendScreenDataModel read= JsonConvert.DeserializeObject<SendScreenDataModel>(s);
if (read != null)
if (read != null && read.Value!=null)
{
read?.mqttAicDatasDic?.ToList().ForEach(data => {
mqttDatasDic[data.Key]= data.Value;
});
switch (read.Name)
{
case ScreenDeviceType.大炒:
mqttDatasDic[read.Name] = JsonConvert.DeserializeObject<ScreenModelMaxWok>(read.Value.ToString());
break;
case ScreenDeviceType.小炒:
mqttDatasDic[read.Name] = JsonConvert.DeserializeObject<ScreenModelMinWok>(read.Value.ToString());
break;
case ScreenDeviceType.分餐机:
mqttDatasDic[read.Name] = JsonConvert.DeserializeObject<ScreenModelSplitMeals>(read.Value.ToString());
break;
case ScreenDeviceType.煮面机:
mqttDatasDic[read.Name] = JsonConvert.DeserializeObject<ScreenModelMorkS>(read.Value.ToString());
break;
}
}
}
}
@@ -208,19 +220,49 @@ namespace BPASmartClient.ScreenLib
{
Name.Split(',')?.ToList().ForEach(x =>
{
mqttHelper.Subscrib(x);
if (x == "大炒")
{
mqttHelper.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.大炒));
}else if (x == "小炒")
{
mqttHelper.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.小炒));
}
else if (x == "分餐机")
{
mqttHelper.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.分餐机));
}
else if (x == "煮面机")
{
mqttHelper.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机));
}
});
}
else
{
mqttHelper.Subscrib(Name);
if (Name == "大炒")
{
mqttHelper.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.大炒));
}
else if (Name == "小炒")
{
mqttHelper.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.小炒));
}
else if (Name == "分餐机")
{
mqttHelper.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.分餐机));
}
else if (Name == "煮面机")
{
mqttHelper.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机));
}
}
});
mqttHelper.MessageRecive = new Action<string>((s) => { msg.Enqueue(s); });
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"{Name}:初始化连接Redis MQTT,原因:{ex.Message}");
MessageLog.GetInstance.ShowEx($"{Name}:初始化连接 MQTT,原因:{ex.Message}");
}

}


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

@@ -1,20 +0,0 @@
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
{
运行,
停止
}
}

+ 1
- 57
BPASmartClient.ScreenLib/Model/OrderMakeModel.cs Vedi File

@@ -12,7 +12,7 @@ namespace BPASmartClient.ScreenLib
/// <summary>
/// 订单制作Model
/// </summary>
public class OrderMakeModel : NotifyBase
public class OrderMakeFormModel : NotifyBase
{
/// <summary>
/// 状态
@@ -104,60 +104,4 @@ namespace BPASmartClient.ScreenLib
}
}

/// <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();
}
}
}
}

+ 188
- 186
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml Vedi File

@@ -1,187 +1,189 @@
<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 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 ViewData.IsRun,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 ViewData.SplitMeals_CreditCardCount_2,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="{Binding ViewData.SplitMeals_CreditCardNameBefore_2,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="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_2,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 ViewData.SplitMeals_CookType_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel>
<Border Style="{DynamicResource border顶部背景}" Width="370" Height="100" Margin="20,20,0,0" >
<TextBlock HorizontalAlignment="Center" Foreground="{DynamicResource foreground}" VerticalAlignment="Center" Text="{Binding .}" FontSize="60"></TextBlock>
</Border>
</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>
<!--<Grid Height="600" Width="950" Margin="0,10,0,20" > <Image Style="{DynamicResource imagezhu}"></Image> <Image Style="{DynamicResource image中1}" Margin="0,400,0,0"></Image> <GroupBox Margin="600,100,0,500" Header="{Binding GZallCout,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="累计故障数" Content="次" Width="100"/> <GroupBox Margin="600,400,0,0" Header="0" Style="{DynamicResource GroupStyle圆形}" Tag="告警次数" Content="次" Width="160"/> <GroupBox Margin="-500,100,0,0" Header="{Binding UserCout,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="日总接待人数" Content="人" Width="160"/> </Grid>-->
<GroupBox Margin="0,0,0,0" Height="340" Width="950" Header="信息通知区域" Style="{DynamicResource from}">
<DataGrid Margin="10,10,10,0" ItemsSource="{Binding ViewData.Alarm,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="250">
<DataGridTemplateColumn.Header>
<TextBlock Text="信息时间" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmTime}" Foreground="#a70909" FontSize="16" 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="#a70909" FontSize="16" 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="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 ViewData.IsRun,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 ViewData.SplitMeals_CreditCardCount_1,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="{Binding ViewData.SplitMeals_CreditCardNameBefore_1,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="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_1,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 ViewData.SplitMeals_CookType_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel>
<Border Style="{DynamicResource border顶部背景}" Width="370" Height="100" Margin="20,20,0,0" >
<TextBlock HorizontalAlignment="Center" Foreground="{DynamicResource foreground}" VerticalAlignment="Center" Text="{Binding .}" FontSize="60"></TextBlock>
</Border>
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</GroupBox>
</StackPanel>
</Grid>
</UserControl>

+ 0
- 40
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml.cs Vedi File

@@ -26,45 +26,5 @@ namespace BPASmartClient.ScreenLib
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();
}
}
}

+ 17
- 102
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1ViewModel.cs Vedi File

@@ -1,4 +1,5 @@
using BPA.Helper;
using BPA.Message;
using BPA.Message.Enum;
using System;
using System.Collections.Generic;
@@ -13,132 +14,46 @@ 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
public ScreenModelSplitMeals ViewData
{
get { return _AlarmList; }
get { return _ViewData; }
set
{
_AlarmList = value;
_ViewData = value;
OnPropertyChanged();
}
}
private ObservableCollection<AlarmMsModel> _AlarmList = new ObservableCollection<AlarmMsModel>();
private ScreenModelSplitMeals _ViewData = new ScreenModelSplitMeals();

/// <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>();
public ScreenDeviceType type = ScreenDeviceType.分餐机;
#endregion
public ScreenSplitMealsControl1ViewModel()
{
Init();
}

/// <summary>
/// 初始化
/// </summary>
public void Init()
public ScreenSplitMealsControl1ViewModel()
{
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))};
if (Main.GetInstance.mqttDatasDic.ContainsKey(type))
{
ScreenModelSplitMeals modelMaxWok = Main.GetInstance.mqttDatasDic[type] as ScreenModelSplitMeals;
if (modelMaxWok != null && modelMaxWok.Alarm != null)
modelMaxWok.Alarm = modelMaxWok.Alarm?.OrderByDescending(k => DateTime.Parse(k.AlarmTime)).ToList();
ViewData = modelMaxWok;
}
}));
Thread.Sleep(5000);
Thread.Sleep(1000);
}), $"{DateTime.Now}_1,线程服务");
}
}


+ 52
- 83
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2.xaml Vedi File

@@ -33,7 +33,7 @@
</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 HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.IsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
@@ -47,23 +47,12 @@
</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 HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_4,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="刷卡信息统计" Margin="20,10,0,0"/>
<GroupBox Header="当前操作信息" Margin="20,10,0,0"/>
<Grid Height="160">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
@@ -71,25 +60,25 @@
</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>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_4,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>
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_4,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 ItemsSource="{Binding ViewData.SplitMeals_CookType_4,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}"/>
<Border Style="{DynamicResource border顶部背景}" Width="370" Height="100" Margin="20,20,0,0" >
<TextBlock HorizontalAlignment="Center" Foreground="{DynamicResource foreground}" VerticalAlignment="Center" Text="{Binding .}" FontSize="60"></TextBlock>
</Border>
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>
@@ -103,41 +92,32 @@
<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>
<GroupBox Margin="0,0,0,0" Height="340" Width="950" Header="信息通知区域" Style="{DynamicResource from}">
<DataGrid Margin="10,10,10,0" ItemsSource="{Binding ViewData.Alarm,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="250">
<DataGridTemplateColumn.Header>
<TextBlock Text="信息时间" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmTime}" Foreground="#a70909" FontSize="16" 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="#a70909" FontSize="16" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</GroupBox>
</StackPanel>

<StackPanel Grid.Column="2" Margin="0,10,0,0">
@@ -151,7 +131,7 @@
</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 HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.IsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
@@ -165,23 +145,12 @@
</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 HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_3,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="刷卡信息统计" Margin="20,10,0,0"/>
<GroupBox Header="当前操作信息" Margin="20,10,0,0"/>
<Grid Height="160">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
@@ -189,25 +158,25 @@
</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>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_3,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>
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_3,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 ItemsSource="{Binding ViewData.SplitMeals_CookType_3,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}"/>
<Border Style="{DynamicResource border顶部背景}" Width="370" Height="100" Margin="20,20,0,0" >
<TextBlock HorizontalAlignment="Center" Foreground="{DynamicResource foreground}" VerticalAlignment="Center" Text="{Binding .}" FontSize="60"></TextBlock>
</Border>
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>


+ 17
- 102
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl2ViewModel.cs Vedi File

@@ -1,4 +1,5 @@
using BPA.Helper;
using BPA.Message;
using BPA.Message.Enum;
using System;
using System.Collections.Generic;
@@ -13,132 +14,46 @@ 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
public ScreenModelSplitMeals ViewData
{
get { return _AlarmList; }
get { return _ViewData; }
set
{
_AlarmList = value;
_ViewData = value;
OnPropertyChanged();
}
}
private ObservableCollection<AlarmMsModel> _AlarmList = new ObservableCollection<AlarmMsModel>();
private ScreenModelSplitMeals _ViewData = new ScreenModelSplitMeals();

/// <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>();
public ScreenDeviceType type = ScreenDeviceType.分餐机;
#endregion
public ScreenSplitMealsControl2ViewModel()
{
Init();
}

/// <summary>
/// 初始化
/// </summary>
public void Init()
public ScreenSplitMealsControl2ViewModel()
{
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))};
if (Main.GetInstance.mqttDatasDic.ContainsKey(type))
{
ScreenModelSplitMeals modelMaxWok = Main.GetInstance.mqttDatasDic[type] as ScreenModelSplitMeals;
if (modelMaxWok != null && modelMaxWok.Alarm != null)
modelMaxWok.Alarm = modelMaxWok.Alarm?.OrderByDescending(k => DateTime.Parse(k.AlarmTime)).ToList();
ViewData = modelMaxWok;
}
}));
Thread.Sleep(5000);
Thread.Sleep(1000);
}), $"{DateTime.Now}_2,线程服务");
}
}


+ 53
- 84
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl3.xaml Vedi File

@@ -23,7 +23,7 @@
</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">
<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" >
@@ -33,7 +33,7 @@
</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 HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.IsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
@@ -47,23 +47,12 @@
</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 HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_6,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="刷卡信息统计" Margin="20,10,0,0"/>
<GroupBox Header="当前操作信息" Margin="20,10,0,0"/>
<Grid Height="160">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
@@ -71,25 +60,25 @@
</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>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_6,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>
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_6,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 ItemsSource="{Binding ViewData.SplitMeals_CookType_6,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}"/>
<Border Style="{DynamicResource border顶部背景}" Width="370" Height="100" Margin="20,20,0,0" >
<TextBlock HorizontalAlignment="Center" Foreground="{DynamicResource foreground}" VerticalAlignment="Center" Text="{Binding .}" FontSize="60"></TextBlock>
</Border>
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>
@@ -103,41 +92,32 @@
<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>
<GroupBox Margin="0,0,0,0" Height="340" Width="950" Header="信息通知区域" Style="{DynamicResource from}">
<DataGrid Margin="10,10,10,0" ItemsSource="{Binding ViewData.Alarm,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="250">
<DataGridTemplateColumn.Header>
<TextBlock Text="信息时间" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmTime}" Foreground="#a70909" FontSize="16" 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="#a70909" FontSize="16" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</GroupBox>
</StackPanel>

<StackPanel Grid.Column="2" Margin="0,10,0,0">
@@ -151,7 +131,7 @@
</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 HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.IsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
@@ -165,23 +145,12 @@
</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 HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_5,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="刷卡信息统计" Margin="20,10,0,0"/>
<GroupBox Header="当前操作信息" Margin="20,10,0,0"/>
<Grid Height="160">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
@@ -189,25 +158,25 @@
</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>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_5,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>
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_5,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 ItemsSource="{Binding ViewData.SplitMeals_CookType_5,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}"/>
<Border Style="{DynamicResource border顶部背景}" Width="370" Height="100" Margin="20,20,0,0" >
<TextBlock HorizontalAlignment="Center" Foreground="{DynamicResource foreground}" VerticalAlignment="Center" Text="{Binding .}" FontSize="60"></TextBlock>
</Border>
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>


+ 17
- 102
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl3ViewModel.cs Vedi File

@@ -1,4 +1,5 @@
using BPA.Helper;
using BPA.Message;
using BPA.Message.Enum;
using System;
using System.Collections.Generic;
@@ -14,132 +15,46 @@ 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
public ScreenModelSplitMeals ViewData
{
get { return _AlarmList; }
get { return _ViewData; }
set
{
_AlarmList = value;
_ViewData = value;
OnPropertyChanged();
}
}
private ObservableCollection<AlarmMsModel> _AlarmList = new ObservableCollection<AlarmMsModel>();
private ScreenModelSplitMeals _ViewData = new ScreenModelSplitMeals();

/// <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>();
public ScreenDeviceType type = ScreenDeviceType.分餐机;
#endregion
public ScreenSplitMealsControl3ViewModel()
{
Init();
}

/// <summary>
/// 初始化
/// </summary>
public void Init()
public ScreenSplitMealsControl3ViewModel()
{
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))};
if (Main.GetInstance.mqttDatasDic.ContainsKey(type))
{
ScreenModelSplitMeals modelMaxWok = Main.GetInstance.mqttDatasDic[type] as ScreenModelSplitMeals;
if (modelMaxWok != null && modelMaxWok.Alarm != null)
modelMaxWok.Alarm = modelMaxWok.Alarm?.OrderByDescending(k => DateTime.Parse(k.AlarmTime)).ToList();
ViewData = modelMaxWok;
}
}));
Thread.Sleep(5000);
Thread.Sleep(1000);
}), $"{DateTime.Now}_3,线程服务");
}
}


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

@@ -1,31 +0,0 @@
<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>

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

@@ -1,41 +0,0 @@
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;
}
}
}

+ 291
- 114
BPASmartClient.ScreenLib/总监视大屏/ScreenALLControl.xaml Vedi File

@@ -4,7 +4,7 @@
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: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">
@@ -13,6 +13,135 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPA.CustomResource;component/Themes/ProlineStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
<Style x:Key="bfb" TargetType="{x:Type ProgressBar}">
<Setter Property="Foreground" Value="{StaticResource ProgressBar.Progress}" />
<Setter Property="Background" Value="{StaticResource ProgressBar.Background}" />
<Setter Property="BorderBrush" Value="{StaticResource ProgressBar.Border}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="Height" Value="16" />
<Setter Property="Width" Value="100" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ProgressBar}">
<ControlTemplate.Resources>
<Storyboard x:Key="maindh" RepeatBehavior="Forever">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="dh" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
<EasingDoubleKeyFrame KeyTime="0" Value="0.25" />
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.25" />
<EasingDoubleKeyFrame KeyTime="0:0:2" Value="0.25" />
</DoubleAnimationUsingKeyFrames>
<PointAnimationUsingKeyFrames Storyboard.TargetName="dh" Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)">
<EasingPointKeyFrame KeyTime="0" Value="-0.5,0.5" />
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.5,0.5" />
<EasingPointKeyFrame KeyTime="0:0:2" Value="1.5,0.5" />
</PointAnimationUsingKeyFrames>
</Storyboard>
</ControlTemplate.Resources>
<Grid x:Name="TemplateRoot">
<Border
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Opacity="0.3" />
<Rectangle x:Name="PART_Track" />
<Grid
x:Name="PART_Indicator"
HorizontalAlignment="Left"
ClipToBounds="true">
<Rectangle x:Name="dh" Fill="{DynamicResource ProgressBar.动画}">
<Rectangle.RenderTransform>
<TransformGroup>
<!-- 缩放变换 -->
<ScaleTransform ScaleX="1" ScaleY="1" />
<!-- 倾斜变换 -->
<SkewTransform AngleX="-45" AngleY="0" />
<!-- 旋转变换 -->
<RotateTransform Angle="0" />
<!-- 移动变换 -->
<TranslateTransform X="0" Y="0" />
</TransformGroup>
</Rectangle.RenderTransform>
</Rectangle>
<Rectangle
x:Name="Indicator"
Fill="{TemplateBinding Foreground}"
Visibility="Collapsed" />
<Rectangle
x:Name="Animation"
Fill="{DynamicResource ProgressBar.动画}"
RenderTransformOrigin="0.5,0.5">
<Rectangle.RenderTransform>
<TransformGroup>
<!-- 缩放变换 -->
<ScaleTransform ScaleX="1" ScaleY="1" />
<!-- 倾斜变换 -->
<SkewTransform AngleX="-45" AngleY="0" />
<!-- 旋转变换 -->
<RotateTransform Angle="0" />
<!-- 移动变换 -->
<TranslateTransform X="0" Y="0" />
</TransformGroup>
</Rectangle.RenderTransform>
</Rectangle>
</Grid>
<TextBlock
x:Name="textBlock"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontFamily="../Fonts/#Quartz M"
FontSize="12"
Foreground="{DynamicResource Titleforeground}"
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=Value, StringFormat={}百分比: {0:f2} %}"
Visibility="Collapsed" />
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Determinate" />
<VisualState x:Name="Indeterminate">
<Storyboard RepeatBehavior="Forever">
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="Animation" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
<EasingDoubleKeyFrame KeyTime="0" Value="0.25" />
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0.25" />
<EasingDoubleKeyFrame KeyTime="0:0:2" Value="0.25" />
</DoubleAnimationUsingKeyFrames>
<PointAnimationUsingKeyFrames Storyboard.TargetName="Animation" Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)">
<EasingPointKeyFrame KeyTime="0" Value="-0.5,0.5" />
<EasingPointKeyFrame KeyTime="0:0:1" Value="0.5,0.5" />
<EasingPointKeyFrame KeyTime="0:0:2" Value="1.5,0.5" />
</PointAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="Orientation" Value="Vertical">
<Setter TargetName="TemplateRoot" Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="90" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsIndeterminate" Value="true">
<Setter TargetName="Indicator" Property="Visibility" Value="Collapsed" />
<Setter TargetName="dh" Property="Visibility" Value="Collapsed" />
<Setter TargetName="Animation" Property="Visibility" Value="Visible" />
</Trigger>
<Trigger Property="IsIndeterminate" Value="False">
<Setter TargetName="Indicator" Property="Visibility" Value="Visible" />
<Setter TargetName="dh" Property="Visibility" Value="Visible" />
<Setter TargetName="Animation" Property="Visibility" Value="Collapsed" />
</Trigger>
<EventTrigger RoutedEvent="Loaded">
<BeginStoryboard Storyboard="{StaticResource maindh}" />
</EventTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
@@ -25,7 +154,7 @@
<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"/>
<GroupBox Header="设备信息" Margin="20,0,0,0"/>
<Grid Height="80" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
@@ -33,7 +162,7 @@
</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 HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData[大炒].IsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
@@ -45,46 +174,66 @@
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19">设备是否运行</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 Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="42" Foreground="#FFD2C106" Text="{Binding MaxCout,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock FontSize="42" Text="/"></TextBlock>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="42" Foreground="#FFD2C106" Text="{Binding ViewData[大炒].FailuresCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
</StackPanel>
<TextBlock Style="{DynamicResource textms}" >订单总数/故障数</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="2 号炒锅" Margin="20,0,0,0"/>
<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}">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData[大炒].WorkStatus_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Trigger Property="Text" Value="待机">
<Setter Property="Foreground" Value="Yellow"/>
</Trigger>
<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>
<TextBlock Style="{DynamicResource textms}" >1号炒锅</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>
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData[大炒].WorkStatus_2,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="Yellow"/>
</Trigger>
<Trigger Property="Text" Value="故障">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" >2号炒锅</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"/>
<GroupBox Header="设备信息" Margin="20,0,0,0"/>
<Grid Height="80" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
@@ -92,7 +241,7 @@
</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 HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData[小炒].IsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
@@ -104,46 +253,66 @@
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19">设备是否运行</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 Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="42" Foreground="#FFD2C106" Text="{Binding MinCout,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock FontSize="42" Text="/"></TextBlock>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="42" Foreground="#FFD2C106" Text="{Binding ViewData[小炒].FailuresCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
</StackPanel>
<TextBlock Style="{DynamicResource textms}" >订单总数/故障数</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="2 号炒锅" Margin="20,0,0,0"/>
<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}">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData[小炒].WorkStatus_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Trigger Property="Text" Value="待机">
<Setter Property="Foreground" Value="Yellow"/>
</Trigger>
<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>
<TextBlock Style="{DynamicResource textms}" >1号炒锅</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>
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData[小炒].WorkStatus_2,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="Yellow"/>
</Trigger>
<Trigger Property="Text" Value="故障">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" >2号炒锅</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"/>
<GroupBox Header="设备信息" Margin="20,0,0,0"/>
<Grid Height="80" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
@@ -151,7 +320,7 @@
</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 HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData[煮面机].IsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
@@ -163,25 +332,28 @@
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19" >设备是否运行</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 HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData[煮面机].WorkStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="异常">
<Trigger Property="Text" Value="待机">
<Setter Property="Foreground" Value="Yellow"/>
</Trigger>
<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>
<TextBlock Style="{DynamicResource textms}" >工作状态</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="订单信息统计" Margin="20,0,0,0"/>
<GroupBox Header="信息统计" Margin="20,0,0,0"/>
<Grid Height="80">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
@@ -189,29 +361,69 @@
</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>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="42" Foreground="#FFD2C106" Text="{Binding ViewData[煮面机].MorkS_OrderCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" >订单数</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>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="42" Foreground="#FFD2C106" Text="{Binding ViewData[煮面机].FailuresCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" >故障数</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> <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="{Binding GZallCout,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="累计故障数" Content="次" Width="100"/> <GroupBox Margin="600,400,0,0" Header="{Binding SplitMealsCout,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="食堂累计刷卡次数" Content="次" Width="160"/> <GroupBox Margin="-500,100,0,0" Header="{Binding UserCout,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="日总接待人数" Content="人" Width="160"/> </Grid> <GroupBox Margin="0,0,0,0" Height="340" Width="950" Header="信息通知区域" VerticalAlignment="Bottom" Style="{DynamicResource from}">
<!--<ListBox Margin="10,-10,10,10" ScrollViewer.VerticalScrollBarVisibility="Disabled" ItemsSource="{Binding AlarmAll,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel>
<Border Style="{DynamicResource border阴影边框}" Width="850" Height="50" Margin="20,10,0,5" >
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="300"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0" Margin="0,0,10,0" HorizontalAlignment="Right" Foreground="{DynamicResource HorizontalSliderThumbHoverBackgroundInverted }" VerticalAlignment="Center" Text="{Binding AlarmTime,StringFormat={}{0}}" FontSize="24"></TextBlock>
<TextBlock></TextBlock>
<TextBlock Grid.Column="1" Margin="40,0,0,0" HorizontalAlignment="Left" Foreground="{DynamicResource HorizontalSliderThumbHoverBackgroundInverted}" VerticalAlignment="Center" Text="{Binding AlarmMs}" FontSize="24"></TextBlock>
</Grid>
</Border>
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>-->
<DataGrid Margin="10,10,10,0" ItemsSource="{Binding AlarmAll,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="250">
<DataGridTemplateColumn.Header>
<TextBlock Text="信息时间" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmTime}" Foreground="#a70909" FontSize="16" 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="#a70909" FontSize="16" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</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">
<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"/>
<GroupBox Header="设备信息" Margin="20,0,0,0"/>
<Grid Height="80" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
@@ -219,7 +431,7 @@
</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 HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData[分餐机].IsRun,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
@@ -231,102 +443,67 @@
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,0,0,0" FontSize="19">设备是否运行</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 HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData[分餐机].WorkStatus,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Trigger Property="Text" Value="待机">
<Setter Property="Foreground" Value="Yellow"/>
</Trigger>
<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>
<TextBlock Style="{DynamicResource textms}" >工作状态</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="3 号分餐机" Margin="20,0,0,0"/>
<Grid Height="80" >
<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>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="42" Foreground="#FFD2C106" Text="{Binding SplitMealsCout,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" >刷卡总数</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>
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="42" Foreground="#FFD2C106" Text="{Binding ViewData[分餐机].FailuresCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" >故障数</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="640" Width="450" Header="今日商品热销统计" Style="{DynamicResource from}">
<ListBox
Background="Transparent"
BorderThickness="0"
ItemsSource="{Binding StatsCountAll,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel x:Name="mainPanel1" Margin="15,5,0,0" >
<StackPanel Orientation="Horizontal">
<TextBlock HorizontalAlignment="Left" Style="{DynamicResource textms}" Margin="10,5,0,0" FontSize="20" Text="{Binding Name}"/>
<TextBlock HorizontalAlignment="Left" Style="{DynamicResource textms}" Margin="10,5,0,0" FontSize="20" Text="/"/>
<TextBlock HorizontalAlignment="Left" Style="{DynamicResource textms}" Margin="10,5,0,0" FontSize="20" Text="{Binding Count, StringFormat={}{0} 单}"/>
</StackPanel>
<Grid HorizontalAlignment="Left" Margin="0,5,0,0">
<ProgressBar Style="{DynamicResource bfb}" Value="{Binding bfb,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Width="360" Height="24" Margin="10,0,0,0"></ProgressBar>
</Grid>
<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>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</GroupBox>
</StackPanel>
</Grid>

+ 159
- 129
BPASmartClient.ScreenLib/总监视大屏/ScreenALLControlViewModel.cs Vedi File

@@ -1,6 +1,8 @@
using BPA.CustomResource.UserControls;
using BPA.Helper;
using BPA.Message;
using BPA.Message.Enum;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -15,99 +17,125 @@ namespace BPASmartClient.ScreenLib
{
#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>>();

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<RadarModel> RadarModelList
public Dictionary<ScreenDeviceType, object> ViewData
{
get { return _RadarModelList; }
get { return _ViewData; }
set
{
_RadarModelList = value;
_ViewData = value;
OnPropertyChanged();
}
}
private ObservableCollection<RadarModel> _RadarModelList = new ObservableCollection<RadarModel>();
private Dictionary<ScreenDeviceType, object> _ViewData = new Dictionary<ScreenDeviceType, object>();

/// <summary>
/// 设备是否运行
/// 小炒总数
/// </summary>
public DevIsRun DevIsRun { get { return _DevIsRun; } set { _DevIsRun = value; OnPropertyChanged(); } }
private DevIsRun _DevIsRun = DevIsRun.停止;
public int MinCout
{
get { return _MinCout; }
set
{
_MinCout = value;
OnPropertyChanged();
}
}
private int _MinCout = 0;

/// <summary>
/// 设备状态
/// 大炒总数
/// </summary>
public DevRunStatus RunStatus { get { return _RunStatus; } set { _RunStatus = value; OnPropertyChanged(); } }
private DevRunStatus _RunStatus = DevRunStatus.正常;
public int MaxCout
{
get { return _MaxCout; }
set
{
_MaxCout = value;
OnPropertyChanged();
}
}
private int _MaxCout = 0;

/// <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;
public int SplitMealsCout
{
get { return _SplitMealsCout; }
set
{
_SplitMealsCout = value;
OnPropertyChanged();
}
}
private int _SplitMealsCout = 0;


/// <summary>
/// 广告地址
/// 日总接待人数
/// </summary>
public Uri GgAdder { get { return _GgAdder; } set { _GgAdder = value; OnPropertyChanged(); } }
private Uri _GgAdder = new Uri(System.Configuration.ConfigurationManager.AppSettings["GgAdder"].ToString());
public int UserCout
{
get { return _UserCout; }
set
{
_UserCout = value;
OnPropertyChanged();
}
}
private int _UserCout = 0;

/// <summary>
/// 正在制作订单数据
/// 累计故障数
/// </summary>
public ObservableCollection<OrderMakeModel> OrderMakeList
public int GZallCout
{
get { return _OrderMakeList; }
get { return _GZallCout; }
set
{
_OrderMakeList = value;
_GZallCout = value;
OnPropertyChanged();
}
}
private ObservableCollection<OrderMakeModel> _OrderMakeList = new ObservableCollection<OrderMakeModel>();
private int _GZallCout = 0;


/// <summary>
/// 制作完成订单数据
/// 总告警列表
/// </summary>
public ObservableCollection<OrderMakeModel> OrderMakeListOver
public ObservableCollection<AlarmModel> AlarmAll
{
get { return _OrderMakeListOver; }
get { return _AlarmAll; }
set
{
_OrderMakeListOver = value;
_AlarmAll = value;
OnPropertyChanged();
}
}
private ObservableCollection<OrderMakeModel> _OrderMakeListOver = new ObservableCollection<OrderMakeModel>();
private ObservableCollection<AlarmModel> _AlarmAll =new ObservableCollection<AlarmModel>();

/// <summary>
/// 告警数据
/// 今日商品热销统计
/// </summary>
public ObservableCollection<AlarmMsModel> AlarmList
public ObservableCollection<StatsAllModel> StatsCountAll
{
get { return _AlarmList; }
get { return _StatsBFB; }
set
{
_AlarmList = value;
_StatsBFB = value;
OnPropertyChanged();
}
}
private ObservableCollection<AlarmMsModel> _AlarmList = new ObservableCollection<AlarmMsModel>();


private ObservableCollection<StatsAllModel> _StatsBFB = new ObservableCollection<StatsAllModel>();
#endregion
public ScreenALLControlViewModel()
{
@@ -123,94 +151,96 @@ namespace BPASmartClient.ScreenLib
{
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) });

ViewData = Main.GetInstance.mqttDatasDic;
List<AlarmModel> alarms = new List<AlarmModel>();
List<StatsModel> Stats = new List<StatsModel>();
foreach (var item in Main.GetInstance.mqttDatasDic)
{
if (item.Value != null)
{
if((item.Value as ScreenModelBase).Alarm!=null)
alarms.AddRange((item.Value as ScreenModelBase).Alarm);
if ((item.Value as ScreenModelBase).StatsCount != null)
Stats.AddRange((item.Value as ScreenModelBase).StatsCount);
}
}

AlarmAll.Clear();
alarms?.OrderByDescending(k => DateTime.Parse(k.AlarmTime))?.ToList().ForEach(alarm => {
AlarmAll.Add(alarm);
});


int gz = 0;
if (ViewData.ContainsKey(ScreenDeviceType.小炒))
{
ScreenModelMinWok min = ViewData[ScreenDeviceType.小炒] as ScreenModelMinWok;
MinCout = min.MinWok_OrderCount_1 + min.MinWok_OrderCount_2;
gz += min.FailuresCount;
}

if (ViewData.ContainsKey(ScreenDeviceType.大炒))
{
ScreenModelMaxWok min = ViewData[ScreenDeviceType.大炒] as ScreenModelMaxWok;
MaxCout = min.MaxWok_OrderCount_1 + min.MaxWok_OrderCount_2;
gz += min.FailuresCount;

}

if (ViewData.ContainsKey(ScreenDeviceType.分餐机))
{
ScreenModelSplitMeals min = ViewData[ScreenDeviceType.分餐机] as ScreenModelSplitMeals;
SplitMealsCout = min.SplitMeals_CreditCardCount_1 + min.SplitMeals_CreditCardCount_2
+ min.SplitMeals_CreditCardCount_3 + min.SplitMeals_CreditCardCount_4
+ min.SplitMeals_CreditCardCount_5 + min.SplitMeals_CreditCardCount_6;
gz += min.FailuresCount;

}

int zmj_count = 0;
if (ViewData.ContainsKey(ScreenDeviceType.煮面机))
{
ScreenModelMorkS morks = ViewData[ScreenDeviceType.煮面机] as ScreenModelMorkS;
zmj_count = morks.MorkS_OrderCount;
gz += morks.FailuresCount;

}
UserCout = SplitMealsCout + MaxCout + MinCout + zmj_count;

GZallCout = gz;


if (Stats != null && Stats.Count > 0)
{
Dictionary<string, int> _Stats = new Dictionary<string, int>();
foreach (StatsModel item in Stats)
{
if(!_Stats.ContainsKey(item.Name))
_Stats[item.Name]= item.Count;
else
_Stats[item.Name] += item.Count;
}
List<StatsAllModel> _Statsall = new List<StatsAllModel>();
_Stats?.ToList().ForEach(par => {
_Statsall.Add(new StatsAllModel { Name = par.Key,Count = par.Value });
});
int maxcount = _Statsall.Max(k => k.Count);
_Statsall?.ForEach(par =>
{
par.bfb = (int)(((double)par.Count / (double)maxcount) * 100.0);
});
string str = JsonConvert.SerializeObject(_Statsall?.OrderByDescending(k => k.Count)?.ToList());
StatsCountAll= JsonConvert.DeserializeObject<ObservableCollection<StatsAllModel>>(str);
}
}));
Thread.Sleep(5000);
Thread.Sleep(2000);
}), $"{DateTime.Now},线程服务");
}
}

public class StatsAllModel: StatsModel
{
public int bfb { get; set; }
}
}

+ 404
- 319
BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControl.xaml Vedi File

@@ -1,320 +1,405 @@
<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 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 ViewData.IsRun,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 ViewData.WorkStatus_1,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="Yellow"/>
</Trigger>
<Trigger Property="Text" Value="故障">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
<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">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock FontSize="40" Text="{Binding ViewData.MaxWok_Task_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock FontSize="40" Foreground="#FFD2C106" Text="{Binding ViewData.MaxWok_Dishes_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat={}-{0:f2}}"></TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</GroupBox>
<GroupBox Margin="10,20,10,0" Height="275" Width="450" Header="设备当前流程" Style="{DynamicResource from}" Tag="Start">
<Grid>
<ListBox x:Name="PageList" BorderThickness="0" Margin="0,-20,0,0" Height="270" HorizontalAlignment="Stretch" VerticalAlignment="Top"
ItemsSource="{Binding ProcessModel1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Background="Transparent" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" >
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Width="500"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<DataTemplate.Resources>
<Storyboard RepeatBehavior="Forever" x:Key="csd_dh">
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.5" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1.5" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:2" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
<Storyboard RepeatBehavior="Forever" x:Key="csd_kaishi">
<ThicknessAnimationUsingKeyFrames Storyboard.TargetName="kaishi" Storyboard.TargetProperty="Margin" BeginTime="00:00:00">
<SplineThicknessKeyFrame KeyTime="00:00:00" Value="0" />
<SplineThicknessKeyFrame KeyTime="00:00:2" Value="-30" />
</ThicknessAnimationUsingKeyFrames>
</Storyboard>
</DataTemplate.Resources>
<Grid Margin="0,10,0,0" Height="100" Width="130" VerticalAlignment="Top" HorizontalAlignment="Left">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions>
<Border x:Name="kaishi" Background="{DynamicResource 椭圆}" BorderBrush="Aqua" Margin="60"/>
<Border Background="{DynamicResource 椭圆}" >
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock x:Name="wb" FontSize="32" Text="{Binding Name}"></TextBlock>
<TextBlock x:Name="xs" Style="{DynamicResource 数码管Text}" FontSize="24" Margin="0,0,0,0" Text="{Binding Id}"></TextBlock>
</StackPanel>
</Border>
<Image x:Name="image" Grid.Column="1" Style="{DynamicResource image右1}" Cursor="Hand" ></Image>
</Grid>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Status}" Value="正在执行">
<Setter TargetName="xs" Property="Foreground" Value="lime"/>
<Setter TargetName="wb" Property="Foreground" Value="lime"/>
<DataTrigger.EnterActions>
<BeginStoryboard x:Name="begin_name" Storyboard="{StaticResource csd_dh}"/>
<BeginStoryboard x:Name="begin_dh" Storyboard="{StaticResource csd_kaishi}"/>
</DataTrigger.EnterActions>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="执行完成">
<DataTrigger.EnterActions>
<StopStoryboard BeginStoryboardName="begin_name"/>
<StopStoryboard BeginStoryboardName="begin_dh"/>
</DataTrigger.EnterActions>
<Setter TargetName="xs" Property="Foreground" Value="#FFD2C106"/>
<Setter TargetName="wb" Property="Foreground" Value="#FFD2C106"/>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="未执行">
<DataTrigger.EnterActions>
<StopStoryboard BeginStoryboardName="begin_name"/>
<StopStoryboard BeginStoryboardName="begin_dh"/>
</DataTrigger.EnterActions>
<Setter TargetName="xs" Property="Foreground" Value="#a2c2e8"/>
<Setter TargetName="wb" Property="Foreground" Value="#a2c2e8"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsLast}" Value="1">
<DataTrigger.EnterActions>
<StopStoryboard BeginStoryboardName="begin_name"/>
</DataTrigger.EnterActions>
<Setter TargetName="image" Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</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 ViewData.MaxWok_HeatGear_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat={}{0:f2} 档}"/>
<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 ViewData.MaxWok_StirGear_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat={}{0:f2} 档}"/>
<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 ViewData.MaxWok_FlipSpeed_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat={}{0:f2}rpm}"/>
<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 ViewData.MaxWok_Temp_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat={}{0:f2}°C}"/>
<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>
<!--<Grid Height="600" Width="950" Margin="0,10,0,20" > <Image Style="{DynamicResource imagezhu}"></Image> <Image Style="{DynamicResource image中1}" Margin="0,400,0,0"></Image> <GroupBox Margin="600,100,0,500" Header="{Binding GZallCout,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="累计故障数" Content="次" Width="100"/> <GroupBox Margin="600,400,0,0" Header="0" Style="{DynamicResource GroupStyle圆形}" Tag="告警次数" Content="次" Width="160"/> <GroupBox Margin="-500,100,0,0" Header="{Binding UserCout,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="日总接待人数" Content="人" Width="160"/> </Grid>-->
<GroupBox Margin="0,0,0,0" Height="340" Width="950" Header="信息通知区域" Style="{DynamicResource from}">
<DataGrid Margin="10,10,10,0" ItemsSource="{Binding ViewData.Alarm,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="250">
<DataGridTemplateColumn.Header>
<TextBlock Text="信息时间" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmTime}" Foreground="#a70909" FontSize="16" 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="#a70909" FontSize="16" 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 ViewData.IsRun,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 ViewData.WorkStatus_2,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="Yellow"/>
</Trigger>
<Trigger Property="Text" Value="故障">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
<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">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock FontSize="40" Text="{Binding ViewData.MaxWok_Task_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock FontSize="40" Foreground="#FFD2C106" Text="{Binding ViewData.MaxWok_Dishes_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat={}-{0:f2}}"></TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</GroupBox>
<GroupBox Margin="10,20,10,0" Height="275" Width="450" Header="设备当前流程" Style="{DynamicResource from}" Tag="Start">
<Grid>
<ListBox BorderThickness="0" Margin="0,-20,0,0" Height="270" HorizontalAlignment="Stretch" VerticalAlignment="Top"
ItemsSource="{Binding ProcessModel2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Background="Transparent" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" >
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Width="500"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<DataTemplate.Resources>
<Storyboard RepeatBehavior="Forever" x:Key="csd_dh">
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.5" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1.5" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:2" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
<Storyboard RepeatBehavior="Forever" x:Key="csd_kaishi">
<ThicknessAnimationUsingKeyFrames Storyboard.TargetName="kaishi" Storyboard.TargetProperty="Margin" BeginTime="00:00:00">
<SplineThicknessKeyFrame KeyTime="00:00:00" Value="0" />
<SplineThicknessKeyFrame KeyTime="00:00:2" Value="-30" />
</ThicknessAnimationUsingKeyFrames>
</Storyboard>
</DataTemplate.Resources>
<Grid Margin="0,10,0,0" Height="100" Width="130" VerticalAlignment="Top" HorizontalAlignment="Left">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions>
<Border x:Name="kaishi" Background="{DynamicResource 椭圆}" BorderBrush="Aqua" Margin="60"/>
<Border Background="{DynamicResource 椭圆}" >
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock x:Name="wb" FontSize="32" Text="{Binding Name}"></TextBlock>
<TextBlock x:Name="xs" Style="{DynamicResource 数码管Text}" FontSize="24" Margin="0,0,0,0" Text="{Binding Id}"></TextBlock>
</StackPanel>
</Border>
<Image x:Name="image" Grid.Column="1" Style="{DynamicResource image右1}" Cursor="Hand" ></Image>
</Grid>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Status}" Value="正在执行">
<Setter TargetName="xs" Property="Foreground" Value="lime"/>
<Setter TargetName="wb" Property="Foreground" Value="lime"/>
<DataTrigger.EnterActions>
<BeginStoryboard x:Name="begin_name" Storyboard="{StaticResource csd_dh}"/>
<BeginStoryboard x:Name="begin_dh" Storyboard="{StaticResource csd_kaishi}"/>
</DataTrigger.EnterActions>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="执行完成">
<DataTrigger.EnterActions>
<StopStoryboard BeginStoryboardName="begin_name"/>
<StopStoryboard BeginStoryboardName="begin_dh"/>
</DataTrigger.EnterActions>
<Setter TargetName="xs" Property="Foreground" Value="#FFD2C106"/>
<Setter TargetName="wb" Property="Foreground" Value="#FFD2C106"/>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="未执行">
<DataTrigger.EnterActions>
<StopStoryboard BeginStoryboardName="begin_name"/>
<StopStoryboard BeginStoryboardName="begin_dh"/>
</DataTrigger.EnterActions>
<Setter TargetName="xs" Property="Foreground" Value="#a2c2e8"/>
<Setter TargetName="wb" Property="Foreground" Value="#a2c2e8"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsLast}" Value="1">
<DataTrigger.EnterActions>
<StopStoryboard BeginStoryboardName="begin_name"/>
</DataTrigger.EnterActions>
<Setter TargetName="image" Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</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 ViewData.MaxWok_HeatGear_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat={}{0:f2} 档}"/>
<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 ViewData.MaxWok_StirGear_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat={}{0:f2} 档}"/>
<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 ViewData.MaxWok_FlipSpeed_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat={}{0:f2}rpm}"/>
<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 ViewData.MaxWok_Temp_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat={}{0:f2}°C}"/>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">当前锅底温度</TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</GroupBox>
</StackPanel>
</Grid>
</UserControl>

+ 54
- 123
BPASmartClient.ScreenLib/炒锅/ScreenMaxWokControlViewModel.cs Vedi File

@@ -1,5 +1,7 @@
using BPA.Helper;
using BPA.Message;
using BPA.Message.Enum;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -18,159 +20,88 @@ namespace BPASmartClient.ScreenLib
/// </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>();
public ScreenModelMaxWok ViewData
{
get { return _ViewData; }
set
{
_ViewData = value;
OnPropertyChanged();
}
}
private ScreenModelMaxWok _ViewData = new ScreenModelMaxWok();

/// <summary>
/// 制作完成订单数据
/// 1号炒锅流程
/// </summary>
public ObservableCollection<OrderMakeModel> OrderMakeListOver
public ObservableCollection<ProcessModelForm> ProcessModel1
{
get { return _OrderMakeListOver; }
get { return _ProcessModel1; }
set
{
_OrderMakeListOver = value;
_ProcessModel1 = value;
OnPropertyChanged();
}
}
private ObservableCollection<OrderMakeModel> _OrderMakeListOver = new ObservableCollection<OrderMakeModel>();
private ObservableCollection<ProcessModelForm> _ProcessModel1 = new ObservableCollection<ProcessModelForm>();

/// <summary>
/// 告警数据
/// 2号炒锅流程
/// </summary>
public ObservableCollection<AlarmMsModel> AlarmList
public ObservableCollection<ProcessModelForm> ProcessModel2
{
get { return _AlarmList; }
get { return _ProcessModel2; }
set
{
_AlarmList = value;
_ProcessModel2 = value;
OnPropertyChanged();
}
}
private ObservableCollection<AlarmMsModel> _AlarmList = new ObservableCollection<AlarmMsModel>();

private ObservableCollection<ProcessModelForm> _ProcessModel2 = new ObservableCollection<ProcessModelForm>();

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

/// <summary>
/// 初始化
/// 当前刷新数据类型
/// </summary>
public void Init()
public ScreenDeviceType type = ScreenDeviceType.大炒;
#endregion

public ScreenMaxWokControlViewModel()
{
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机构出现故障!!!!" });
if (Main.GetInstance.mqttDatasDic.ContainsKey(type))
{
ScreenModelMaxWok modelMaxWok= Main.GetInstance.mqttDatasDic[type] as ScreenModelMaxWok;
if(modelMaxWok != null && modelMaxWok.Alarm!=null)
modelMaxWok.Alarm= modelMaxWok.Alarm?.OrderByDescending(k =>DateTime.Parse(k.AlarmTime)).ToList();
ProcessModel1=JsonConvert.DeserializeObject<ObservableCollection<ProcessModelForm>>(JsonConvert.SerializeObject(modelMaxWok.MaxWok_Process_1));
ProcessModel2 = JsonConvert.DeserializeObject<ObservableCollection<ProcessModelForm>>(JsonConvert.SerializeObject(modelMaxWok.MaxWok_Process_2));
ProcessModel1?.ToList().ForEach(par => { if (par.Id+1 == ProcessModel1.Count) { par.IsLast = 1; } else { par.IsLast = 0; } });
ProcessModel2?.ToList().ForEach(par => { if (par.Id+1 == ProcessModel2.Count) { par.IsLast = 1; } else { par.IsLast = 0; } });
ViewData = modelMaxWok;
}
}));
Thread.Sleep(5000);
Thread.Sleep(1000);
}), $"{DateTime.Now},线程服务");
}
}

/// <summary>
/// 是否最后
/// </summary>
public class ProcessModelForm: ProcessModel
{
public int IsLast
{
get;
set;
}
}
}

+ 403
- 301
BPASmartClient.ScreenLib/炒锅/ScreenMinWokControl.xaml Vedi File

@@ -1,302 +1,404 @@
<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 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 HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.IsRun,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 ViewData.WorkStatus_1,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="Yellow"/>
</Trigger>
<Trigger Property="Text" Value="故障">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
<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">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock FontSize="40" Text="{Binding ViewData.MinWok_Task_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock FontSize="40" Foreground="#FFD2C106" Text="{Binding ViewData.MinWok_Dishes_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat={}-{0:f2}}"></TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</GroupBox>
<GroupBox Margin="10,20,10,0" Height="275" Width="450" Header="设备当前流程" Style="{DynamicResource from}" Tag="Start">
<Grid>
<ListBox x:Name="PageList" BorderThickness="0" Margin="0,-20,0,0" Height="270" HorizontalAlignment="Stretch" VerticalAlignment="Top"
ItemsSource="{Binding ProcessModel1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Background="Transparent" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" >
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Width="500"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<DataTemplate.Resources>
<Storyboard RepeatBehavior="Forever" x:Key="csd_dh">
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.5" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1.5" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:2" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
<Storyboard RepeatBehavior="Forever" x:Key="csd_kaishi">
<ThicknessAnimationUsingKeyFrames Storyboard.TargetName="kaishi" Storyboard.TargetProperty="Margin" BeginTime="00:00:00">
<SplineThicknessKeyFrame KeyTime="00:00:00" Value="0" />
<SplineThicknessKeyFrame KeyTime="00:00:2" Value="-30" />
</ThicknessAnimationUsingKeyFrames>
</Storyboard>
</DataTemplate.Resources>
<Grid Margin="0,10,0,0" Height="100" Width="130" VerticalAlignment="Top" HorizontalAlignment="Left">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions>
<Border x:Name="kaishi" Background="{DynamicResource 椭圆}" BorderBrush="Aqua" Margin="60"/>
<Border Background="{DynamicResource 椭圆}" >
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock x:Name="wb" FontSize="32" Text="{Binding Name}"></TextBlock>
<TextBlock x:Name="xs" Style="{DynamicResource 数码管Text}" FontSize="24" Margin="0,0,0,0" Text="{Binding Id}"></TextBlock>
</StackPanel>
</Border>
<Image x:Name="image" Grid.Column="1" Style="{DynamicResource image右1}" Cursor="Hand" ></Image>
</Grid>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Status}" Value="正在执行">
<Setter TargetName="xs" Property="Foreground" Value="lime"/>
<Setter TargetName="wb" Property="Foreground" Value="lime"/>
<DataTrigger.EnterActions>
<BeginStoryboard x:Name="begin_name" Storyboard="{StaticResource csd_dh}"/>
<BeginStoryboard x:Name="begin_dh" Storyboard="{StaticResource csd_kaishi}"/>
</DataTrigger.EnterActions>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="执行完成">
<DataTrigger.EnterActions>
<StopStoryboard BeginStoryboardName="begin_name"/>
<StopStoryboard BeginStoryboardName="begin_dh"/>
</DataTrigger.EnterActions>
<Setter TargetName="xs" Property="Foreground" Value="#FFD2C106"/>
<Setter TargetName="wb" Property="Foreground" Value="#FFD2C106"/>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="未执行">
<DataTrigger.EnterActions>
<StopStoryboard BeginStoryboardName="begin_name"/>
<StopStoryboard BeginStoryboardName="begin_dh"/>
</DataTrigger.EnterActions>
<Setter TargetName="xs" Property="Foreground" Value="#a2c2e8"/>
<Setter TargetName="wb" Property="Foreground" Value="#a2c2e8"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsLast}" Value="1">
<DataTrigger.EnterActions>
<StopStoryboard BeginStoryboardName="begin_name"/>
</DataTrigger.EnterActions>
<Setter TargetName="image" Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</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 ViewData.MinWok_HeatGear_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat={}{0:f2} 档}"/>
<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 ViewData.MinWok_StirGear_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat={}{0:f2} 档}"/>
<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 ViewData.MinWok_FlipSpeed_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat={}{0:f2}rpm}"/>
<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 ViewData.MinWok_Temp_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat={}{0:f2}°C}"/>
<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>
<!--<Grid Height="600" Width="950" Margin="0,10,0,20" > <Image Style="{DynamicResource imagezhu}"></Image> <Image Style="{DynamicResource image中1}" Margin="0,400,0,0"></Image> <GroupBox Margin="600,100,0,500" Header="{Binding GZallCout,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="累计故障数" Content="次" Width="100"/> <GroupBox Margin="600,400,0,0" Header="0" Style="{DynamicResource GroupStyle圆形}" Tag="告警次数" Content="次" Width="160"/> <GroupBox Margin="-500,100,0,0" Header="{Binding UserCout,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="日总接待人数" Content="人" Width="160"/> </Grid>-->
<GroupBox Margin="0,0,0,0" Height="340" Width="950" Header="信息通知区域" Style="{DynamicResource from}">
<DataGrid Margin="10,10,10,0" ItemsSource="{Binding ViewData.Alarm,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="250">
<DataGridTemplateColumn.Header>
<TextBlock Text="信息时间" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmTime}" Foreground="#a70909" FontSize="16" 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="#a70909" FontSize="16" 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 ViewData.IsRun,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 ViewData.WorkStatus_2,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="Yellow"/>
</Trigger>
<Trigger Property="Text" Value="故障">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
<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">
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Center">
<TextBlock FontSize="40" Text="{Binding ViewData.MinWok_Task_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock FontSize="40" Foreground="#FFD2C106" Text="{Binding ViewData.MinWok_Dishes_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat={}-{0:f2}}"></TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</GroupBox>
<GroupBox Margin="10,20,10,0" Height="275" Width="450" Header="设备当前流程" Style="{DynamicResource from}" Tag="Start">
<Grid>
<ListBox BorderThickness="0" Margin="0,-20,0,0" Height="270" HorizontalAlignment="Stretch" VerticalAlignment="Top"
ItemsSource="{Binding ProcessModel2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
Background="Transparent" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" >
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Width="500"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<DataTemplate.Resources>
<Storyboard RepeatBehavior="Forever" x:Key="csd_dh">
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:0.5" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:01" Value="{x:Static Visibility.Visible}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:1.5" Value="{x:Static Visibility.Collapsed}"/>
<DiscreteObjectKeyFrame KeyTime="00:00:2" Value="{x:Static Visibility.Visible}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
<Storyboard RepeatBehavior="Forever" x:Key="csd_kaishi">
<ThicknessAnimationUsingKeyFrames Storyboard.TargetName="kaishi" Storyboard.TargetProperty="Margin" BeginTime="00:00:00">
<SplineThicknessKeyFrame KeyTime="00:00:00" Value="0" />
<SplineThicknessKeyFrame KeyTime="00:00:2" Value="-30" />
</ThicknessAnimationUsingKeyFrames>
</Storyboard>
</DataTemplate.Resources>
<Grid Margin="0,10,0,0" Height="100" Width="130" VerticalAlignment="Top" HorizontalAlignment="Left">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="30"/>
</Grid.ColumnDefinitions>
<Border x:Name="kaishi" Background="{DynamicResource 椭圆}" BorderBrush="Aqua" Margin="60"/>
<Border Background="{DynamicResource 椭圆}" >
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock x:Name="wb" FontSize="32" Text="{Binding Name}"></TextBlock>
<TextBlock x:Name="xs" Style="{DynamicResource 数码管Text}" FontSize="24" Margin="0,0,0,0" Text="{Binding Id}"></TextBlock>
</StackPanel>
</Border>
<Image x:Name="image" Grid.Column="1" Style="{DynamicResource image右1}" Cursor="Hand" ></Image>
</Grid>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Status}" Value="正在执行">
<Setter TargetName="xs" Property="Foreground" Value="lime"/>
<Setter TargetName="wb" Property="Foreground" Value="lime"/>
<DataTrigger.EnterActions>
<BeginStoryboard x:Name="begin_name" Storyboard="{StaticResource csd_dh}"/>
<BeginStoryboard x:Name="begin_dh" Storyboard="{StaticResource csd_kaishi}"/>
</DataTrigger.EnterActions>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="执行完成">
<DataTrigger.EnterActions>
<StopStoryboard BeginStoryboardName="begin_name"/>
<StopStoryboard BeginStoryboardName="begin_dh"/>
</DataTrigger.EnterActions>
<Setter TargetName="xs" Property="Foreground" Value="#FFD2C106"/>
<Setter TargetName="wb" Property="Foreground" Value="#FFD2C106"/>
</DataTrigger>
<DataTrigger Binding="{Binding Status}" Value="未执行">
<DataTrigger.EnterActions>
<StopStoryboard BeginStoryboardName="begin_name"/>
<StopStoryboard BeginStoryboardName="begin_dh"/>
</DataTrigger.EnterActions>
<Setter TargetName="xs" Property="Foreground" Value="#a2c2e8"/>
<Setter TargetName="wb" Property="Foreground" Value="#a2c2e8"/>
</DataTrigger>
<DataTrigger Binding="{Binding IsLast}" Value="1">
<DataTrigger.EnterActions>
<StopStoryboard BeginStoryboardName="begin_name"/>
</DataTrigger.EnterActions>
<Setter TargetName="image" Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</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 ViewData.MinWok_HeatGear_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat={}{0:f2} 档}"/>
<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 ViewData.MinWok_StirGear_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat={}{0:f2} 档}"/>
<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 ViewData.MinWok_FlipSpeed_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat={}{0:f2}rpm}"/>
<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 ViewData.MinWok_Temp_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat={}{0:f2}°C}"/>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">当前锅底温度</TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</GroupBox>
</StackPanel>
</Grid>
</UserControl>

+ 36
- 134
BPASmartClient.ScreenLib/炒锅/ScreenMinWokControlViewModel.cs Vedi File

@@ -1,5 +1,7 @@
using BPA.Helper;
using BPA.Message;
using BPA.Message.Enum;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -13,178 +15,78 @@ 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
public ScreenModelMinWok ViewData
{
get { return _OrderMakeList; }
get { return _ViewData; }
set
{
_OrderMakeList = value;
_ViewData = value;
OnPropertyChanged();
}
}
private ObservableCollection<OrderMakeModel> _OrderMakeList = new ObservableCollection<OrderMakeModel>();
private ScreenModelMinWok _ViewData = new ScreenModelMinWok();
/// <summary>
/// 制作完成订单数据
/// 1号炒锅流程
/// </summary>
public ObservableCollection<OrderMakeModel> OrderMakeListOver
public ObservableCollection<ProcessModelForm> ProcessModel1
{
get { return _OrderMakeListOver; }
get { return _ProcessModel1; }
set
{
_OrderMakeListOver = value;
_ProcessModel1 = value;
OnPropertyChanged();
}
}
private ObservableCollection<OrderMakeModel> _OrderMakeListOver = new ObservableCollection<OrderMakeModel>();
private ObservableCollection<ProcessModelForm> _ProcessModel1 = new ObservableCollection<ProcessModelForm>();

/// <summary>
/// 告警数据
/// 2号炒锅流程
/// </summary>
public ObservableCollection<AlarmMsModel> AlarmList
public ObservableCollection<ProcessModelForm> ProcessModel2
{
get { return _AlarmList; }
get { return _ProcessModel2; }
set
{
_AlarmList = value;
_ProcessModel2 = value;
OnPropertyChanged();
}
}
private ObservableCollection<AlarmMsModel> _AlarmList = new ObservableCollection<AlarmMsModel>();

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

private ObservableCollection<ProcessModelForm> _ProcessModel2 = new ObservableCollection<ProcessModelForm>();
/// <summary>
/// 初始化
/// 当前刷新数据类型
/// </summary>
public void Init()
public ScreenDeviceType type = ScreenDeviceType.小炒;
#endregion

public ScreenMinWokControlViewModel()
{
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))};
if (Main.GetInstance.mqttDatasDic.ContainsKey(type))
{
ScreenModelMinWok modelMaxWok = Main.GetInstance.mqttDatasDic[type] as ScreenModelMinWok;
if (modelMaxWok != null && modelMaxWok.Alarm != null)
modelMaxWok.Alarm = modelMaxWok.Alarm?.OrderByDescending(k => DateTime.Parse(k.AlarmTime)).ToList();
ProcessModel1 = JsonConvert.DeserializeObject<ObservableCollection<ProcessModelForm>>(JsonConvert.SerializeObject(modelMaxWok.MinWok_Process_1));
ProcessModel2 = JsonConvert.DeserializeObject<ObservableCollection<ProcessModelForm>>(JsonConvert.SerializeObject(modelMaxWok.MinWok_Process_2));
ProcessModel1?.ToList().ForEach(par => { if (par.Id + 1 == ProcessModel1.Count) { par.IsLast = 1; } else { par.IsLast = 0; } });
ProcessModel2?.ToList().ForEach(par => { if (par.Id + 1 == ProcessModel2.Count) { par.IsLast = 1; } else { par.IsLast = 0; } });
ViewData = modelMaxWok;
}
}));
Thread.Sleep(5000);
Thread.Sleep(1000);
}), $"{DateTime.Now},线程服务");
}
}


+ 392
- 362
BPASmartClient.ScreenLib/煮面机/ScreenMorksControl.xaml Vedi File

@@ -1,363 +1,393 @@
<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 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 ViewData.IsRun,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 ViewData.WorkStatus,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="Yellow"/>
</Trigger>
<Trigger Property="Text" Value="故障">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
<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="订单号" FontSize="18" 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="20" VerticalAlignment="Bottom" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="120">
<DataGridTemplateColumn.Header>
<TextBlock Text="商品名称" FontSize="18" 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="20" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="160">
<DataGridTemplateColumn.Header>
<TextBlock Text="开始时间" FontSize="18" 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="20" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="80">
<DataGridTemplateColumn.Header>
<TextBlock Text="状态" FontSize="18" 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="20" 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>
<!--<Grid Height="600" Width="950" Margin="0,10,0,20" > <Image Style="{DynamicResource imagezhu}"></Image> <Image Style="{DynamicResource image中1}" Margin="0,400,0,0"></Image> <GroupBox Margin="600,100,0,500" Header="{Binding GZallCout,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="累计故障数" Content="次" Width="100"/> <GroupBox Margin="600,400,0,0" Header="0" Style="{DynamicResource GroupStyle圆形}" Tag="告警次数" Content="次" Width="160"/> <GroupBox Margin="-500,100,0,0" Header="{Binding UserCout,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="日总接待人数" Content="人" Width="160"/> </Grid>-->
<GroupBox Margin="0,0,0,0" Height="340" Width="950" Header="信息通知区域" Style="{DynamicResource from}">
<DataGrid Margin="10,10,10,0" ItemsSource="{Binding ViewData.Alarm,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="250">
<DataGridTemplateColumn.Header>
<TextBlock Text="信息时间" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmTime}" Foreground="#a70909" FontSize="16" 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="#a70909" FontSize="16" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</GroupBox>
</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 ViewData.MorkS_OrderCount,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 HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.RobotStatu,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="Yellow"/>
</Trigger>
<Trigger Property="Text" Value="故障">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
<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="10,20,0,0" Height="780" Width="450" Header="设备当前状态" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Margin="0,10,0,0" Header="煮面炉状态监控"></GroupBox>
<Grid Height="100" Margin="0,10,0,0">
<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" >
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="#FFD2C106"></Setter>
<Setter Property="Text" Value="空闲"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding ViewData.MorkS_NoodleUpOrDown_1}" Value="true">
<Setter Property="Foreground" Value="Lime"/>
<Setter Property="Text" Value="煮面"></Setter>
</DataTrigger>
</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" >
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="#FFD2C106"></Setter>
<Setter Property="Text" Value="空闲"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding ViewData.MorkS_NoodleUpOrDown_2}" Value="true">
<Setter Property="Foreground" Value="Lime"/>
<Setter Property="Text" Value="煮面"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">煮面炉2号</TextBlock>
</StackPanel>
</Grid>
<Grid Height="100" Margin="0,10,0,0" >
<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" >
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="#FFD2C106"></Setter>
<Setter Property="Text" Value="空闲"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding ViewData.MorkS_NoodleUpOrDown_3}" Value="true">
<Setter Property="Foreground" Value="Lime"/>
<Setter Property="Text" Value="煮面"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">煮面炉3号</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" >
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="#FFD2C106"></Setter>
<Setter Property="Text" Value="空闲"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding ViewData.MorkS_NoodleUpOrDown_4}" Value="true">
<Setter Property="Foreground" Value="Lime"/>
<Setter Property="Text" Value="煮面"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">煮面炉4号</TextBlock>
</StackPanel>
</Grid>
<Grid Height="100" Margin="0,10,0,0">
<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" >
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="#FFD2C106"></Setter>
<Setter Property="Text" Value="空闲"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding ViewData.MorkS_NoodleUpOrDown_5}" Value="true">
<Setter Property="Foreground" Value="Lime"/>
<Setter Property="Text" Value="煮面"></Setter>
</DataTrigger>
</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" >
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="#FFD2C106"></Setter>
<Setter Property="Text" Value="空闲"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding ViewData.MorkS_NoodleUpOrDown_6}" Value="true">
<Setter Property="Foreground" Value="Lime"/>
<Setter Property="Text" Value="煮面"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">煮面炉6号</TextBlock>
</StackPanel>
</Grid>
<GroupBox Margin="0,40,0,0" Header="其他状态检测"></GroupBox>
<Grid Height="100" Margin="0,10,0,0">
<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" >
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="#a70909"></Setter>
<Setter Property="Text" Value="加热中"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding ViewData.MorkS_Temp}" Value="true">
<Setter Property="Foreground" Value="Lime"/>
<Setter Property="Text" Value="100°C"></Setter>
</DataTrigger>
</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" >
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="#a70909"></Setter>
<Setter Property="Text" Value="缺碗"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding ViewData.MorkS_NoBowMeas}" Value="true">
<Setter Property="Foreground" Value="Lime"/>
<Setter Property="Text" Value="充足"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">缺碗检测</TextBlock>
</StackPanel>
</Grid>
<Grid Height="100" Margin="0,10,0,0">
<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 ViewData.MorkS_BinLocation,StringFormat={}{0} 号}"/>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">料仓位置</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" >
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="#a70909"></Setter>
<Setter Property="Text" Value="缺面"></Setter>
<Style.Triggers>
<DataTrigger Binding="{Binding ViewData.MorkS_SiloMeas}" Value="true">
<Setter Property="Foreground" Value="Lime"/>
<Setter Property="Text" Value="充足"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">料仓物料检测</TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</GroupBox>
</StackPanel>
</Grid>
</UserControl>

+ 29
- 249
BPASmartClient.ScreenLib/煮面机/ScreenMorksControlViewModel.cs Vedi File

@@ -8,6 +8,7 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Newtonsoft.Json;
using BPA.Message;

namespace BPASmartClient.ScreenLib
{
@@ -19,41 +20,29 @@ namespace BPASmartClient.ScreenLib
/// </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;
public ScreenModelMorkS ViewData
{
get { return _ViewData; }
set
{
_ViewData = value;
OnPropertyChanged();
}
}
private ScreenModelMorkS _ViewData = new ScreenModelMorkS();

/// <summary>
/// 异常订单数
/// 当前刷新数据类型
/// </summary>
public int YCDdCount { get { return _YCDdCount; } set { _YCDdCount = value; OnPropertyChanged(); } }
private int _YCDdCount = 0;
public ScreenDeviceType type = ScreenDeviceType.煮面机;

/// <summary>
/// 正在制作订单数据
/// </summary>
public ObservableCollection<OrderMakeModel> OrderMakeList
public ObservableCollection<OrderMakeFormModel> OrderMakeList
{
get { return _OrderMakeList; }
set
@@ -62,12 +51,12 @@ namespace BPASmartClient.ScreenLib
OnPropertyChanged();
}
}
private ObservableCollection<OrderMakeModel> _OrderMakeList = new ObservableCollection<OrderMakeModel>();
private ObservableCollection<OrderMakeFormModel> _OrderMakeList = new ObservableCollection<OrderMakeFormModel>();

/// <summary>
/// 制作完成订单数据
/// </summary>
public ObservableCollection<OrderMakeModel> OrderMakeListOver
public ObservableCollection<OrderMakeFormModel> OrderMakeListOver
{
get { return _OrderMakeListOver; }
set
@@ -76,236 +65,27 @@ namespace BPASmartClient.ScreenLib
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>();

private ObservableCollection<OrderMakeFormModel> _OrderMakeListOver = new ObservableCollection<OrderMakeFormModel>();
#endregion
public ScreenMorksControlViewModel()
{
Init();
}

/// <summary>
/// 初始化
/// </summary>
public void Init()
public ScreenMorksControlViewModel()
{
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))};
if (Main.GetInstance.mqttDatasDic.ContainsKey(type))
{
ScreenModelMorkS modelMaxWok = Main.GetInstance.mqttDatasDic[type] as ScreenModelMorkS;
if (modelMaxWok != null && modelMaxWok.Alarm != null)
modelMaxWok.Alarm = modelMaxWok.Alarm?.OrderByDescending(k => DateTime.Parse(k.AlarmTime)).ToList();
ViewData = modelMaxWok;
OrderMakeList = JsonConvert.DeserializeObject<ObservableCollection<OrderMakeFormModel>>(JsonConvert.SerializeObject(ViewData.MakeOrder));
OrderMakeListOver = JsonConvert.DeserializeObject<ObservableCollection<OrderMakeFormModel>>(JsonConvert.SerializeObject(ViewData.MakeOrderOver));
}
}));
Thread.Sleep(5000);
Thread.Sleep(1000);
}), $"{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},线程服务");
}
}
}

+ 4
- 3
BPASmartClient.ScreenMinWok/App.config Vedi File

@@ -1,9 +1,10 @@
<?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"/>
<!--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>

+ 5
- 4
BPASmartClient.ScreenMorks/App.config Vedi File

@@ -1,9 +1,10 @@
<?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"/>
<!--MQTT配置-->
<add key="MQTTConnection" value="10.2.1.254,1883,admin,public"/>
<!--订阅主题设置:大炒,小炒,分餐机,煮面机-->
<add key="DeviceMC" value="大炒,小炒,分餐机,煮面机"/>
<add key="GgAdder" value="https://klxxcdn.oss-cn-hangzhou.aliyuncs.com/histudy/hrm/media/bg1.mp4"/>
</appSettings>
</configuration>

+ 8
- 3
BPASmartClient.ScreenSplitMeals/App.config Vedi File

@@ -1,9 +1,14 @@
<?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"/>
<!--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"/>

<add key="一号屏" value="0"/>
<add key="二号屏" value="0"/>
<add key="三号屏" value="0"/>
</appSettings>
</configuration>

+ 6
- 0
DosingSystem/App.config Vedi File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="IP" value="192.168.0.15"/>
</appSettings>
</configuration>

+ 1
- 0
DosingSystem/App.xaml Vedi File

@@ -28,6 +28,7 @@
<con:BoolToVisibilityConvert x:Key="BoolToVisibilityConvert" />
<con:CountIsVisiableConvert x:Key="CountIsVisiableConvert" />
<con:BoolToFillColorConverter x:Key="BoolToFillColorConverter" />
<con:RecipeStatusConvert x:Key="RecipeStatusConvert" />
</ResourceDictionary>

<ResourceDictionary>


+ 5
- 7
DosingSystem/App.xaml.cs Vedi File

@@ -28,12 +28,12 @@ namespace BPASmartClient.DosingSystem
BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut();
MenuInit();
DataInit();
string ip = "192.168.0.15";
SiemensDevice.GetInstance.Connect(ip);
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化
ThreadManage.GetInstance().Start(new Action(() =>
{
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化
}), "设备初始化");
MainView mv = new MainView();

//mv.Show();
mv.TitleName = "味魔方管理系统软件[简称:味魔方] 1.0.1";
LoginView lv = new LoginView();
var res = lv.ShowDialog();
if (res != null && res == true)
@@ -57,8 +57,6 @@ namespace BPASmartClient.DosingSystem

private void MenuInit()
{
//NfcServer.GetInstance.Init();

#region 配方管理菜单
ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
RecipeManage.Add(new SubMenumodel()


+ 5
- 0
DosingSystem/BPASmartClient.DosingSystem.csproj Vedi File

@@ -11,6 +11,11 @@
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
</PropertyGroup>

<ItemGroup>
<None Remove="App.config" />
<None Remove="tsconfig1.json" />
</ItemGroup>

<ItemGroup>
<Content Include="hbl.ico" />
</ItemGroup>


+ 7
- 4
DosingSystem/Model/DeviceInquire.cs Vedi File

@@ -52,10 +52,11 @@ namespace BPASmartClient.DosingSystem
BottomDeviceCurrentStatuses.ElementAt(BottomIndex).DeviceNum = DeviceLists.ElementAt(i).Value.deviceStatus.DeviceNum;
}

int deviceIndex = Array.FindIndex(devices.ToArray(), p => p.IpAddress == DeviceLists.ElementAt(i).Key && p.DeviceName != DeviceLists.ElementAt(i).Value.DeviceName);
int deviceIndex = Array.FindIndex(devices.ToArray(), p => p.IpAddress == DeviceLists.ElementAt(i).Key/* && p.DeviceName != DeviceLists.ElementAt(i).Value.DeviceName && p.DeviceNum != DeviceLists.ElementAt(i).Value.deviceStatus.DeviceNum*/);
if (deviceIndex >= 0 && deviceIndex < devices.Count)
{
devices.ElementAt(deviceIndex).DeviceName = DeviceLists.ElementAt(i).Value.DeviceName;
devices.ElementAt(deviceIndex).DeviceNum = DeviceLists.ElementAt(i).Value.deviceStatus.DeviceNum;
}
}
Thread.Sleep(200);
@@ -113,9 +114,10 @@ namespace BPASmartClient.DosingSystem
{
if (!string.IsNullOrEmpty(Json<DevicePar>.Data.BaseParModel.NetworkSegAddress)) IPSegment = Json<DevicePar>.Data.BaseParModel.NetworkSegAddress;
else Json<DevicePar>.Data.BaseParModel.NetworkSegAddress = IPSegment;
TestData();
//TestData();
IpAddressLines();
//DeviceDataInit();
SiemensDevice.GetInstance.Connect(Json<DevicePar>.Data.BaseParModel.DeviceAddress);
DeviceDataInit();
ThreadManage.GetInstance().StartLong(new Action(() =>
{
if (IPQueues.Count >= IPLists.Count)
@@ -305,6 +307,7 @@ namespace BPASmartClient.DosingSystem
modbusTcp.ShowEx = new Action<string>((s) => { MessageNotify.GetInstance.ShowRunLog(s); });
this.DeviceName = DeviceName;
AlarmHelper<AlarmInfo>.Init();

if (modbusTcp.Connected)
{
ThreadManage.GetInstance().StartLong(new Action(() =>
@@ -361,7 +364,7 @@ namespace BPASmartClient.DosingSystem
modbusTcp.SetUint(DeviceAddress.ServoManualSpeed, (uint)res.ServoManualSpeed);
modbusTcp.SetUint(DeviceAddress.SiloUpperLimitWeight, (uint)res.SiloUpperLimitWeight);
modbusTcp.SetUint(DeviceAddress.LowerLimitWeightOfSilo, (uint)res.LowerLimitWeightOfSilo);
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed * 100);
modbusTcp.SetUint(DeviceAddress.StirringSpeed, (uint)res.StirringSpeed);
MessageNotify.GetInstance.ShowRunLog($"{res.MaterialName},参数下发完成");
}
}


+ 5
- 0
DosingSystem/Model/RecipeModel.cs Vedi File

@@ -40,6 +40,11 @@ namespace BPASmartClient.DosingSystem
[Newtonsoft.Json.JsonIgnore]
public AutoResetEvent Are { get; set; } = new AutoResetEvent(false);

[Newtonsoft.Json.JsonIgnore]
public string RecipStatus { get { return _mRecipStatus; } set { _mRecipStatus = value; OnPropertyChanged(); } }
private string _mRecipStatus;


/// <summary>
/// 原料集合
/// </summary>


+ 4
- 0
DosingSystem/Model/StockStatusModel.cs Vedi File

@@ -14,11 +14,13 @@ namespace BPASmartClient.DosingSystem
/// </summary>
public double MaterialWeight { get { return _materialWeight; } set { _materialWeight = value; OnPropertyChanged(); } }
private double _materialWeight;

/// <summary>
/// 料仓物料名称
/// </summary>
public string MaterialName { get { return _materialName; } set { _materialName = value; OnPropertyChanged(); } }
private string _materialName;

/// <summary>
/// 是否真在运行
/// </summary>
@@ -48,10 +50,12 @@ namespace BPASmartClient.DosingSystem
/// </summary>
public int IssueStatus { get { return _isIssueStatus; } set { _isIssueStatus = value; OnPropertyChanged(); } }
private int _isIssueStatus;

/// <summary>
/// 下料重量
/// </summary>
public double IssueWeight { get { return _IssueWeight; } set { _IssueWeight = value; OnPropertyChanged(); } }
private double _IssueWeight;

}
}

+ 1
- 1
DosingSystem/Model/par/BasePar.cs Vedi File

@@ -24,7 +24,7 @@ namespace BPASmartClient.DosingSystem
/// 输送带设备 PLC IP 地址
/// </summary>
public string DeviceAddress { get { return _mDeviceAddress; } set { _mDeviceAddress = value; OnPropertyChanged(); } }
private string _mDeviceAddress = "192.168.0.1";
private string _mDeviceAddress = "192.168.0.15";

/// <summary>
/// 输送带数量


+ 0
- 1
DosingSystem/Model/par/DevicePar.cs Vedi File

@@ -17,7 +17,6 @@ namespace BPASmartClient.DosingSystem

public ObservableCollection<OutletInfoModel> OutletInfoModels { get; set; } = new ObservableCollection<OutletInfoModel>();


public BasePar BaseParModel { get { return _mBaseParModel; } set { _mBaseParModel = value; OnPropertyChanged(); } }
private BasePar _mBaseParModel = new BasePar();



+ 10
- 9
DosingSystem/Service/SiemensDevice.cs Vedi File

@@ -22,11 +22,17 @@ namespace BPASmartClient.DosingSystem

public void Connect(string ip)
{
//GlobalDevice.PlcData = MySiemens.ReadClass<PlcToComputer>(3);//获取PLC到上位机的数据
while (!MySiemens.IsConnected)
try
{
MySiemens.Connect(S7.Net.CpuType.S71200, ip);
Thread.Sleep(2000);
while (!MySiemens.IsConnected)
{
MySiemens.Connect(S7.Net.CpuType.S71200, ip);
Thread.Sleep(2000);
}
}
catch (Exception ex)
{
}
IsConnect = MySiemens.IsConnected;
bool tempValue = false;
@@ -41,7 +47,6 @@ namespace BPASmartClient.DosingSystem
{
if (IsConnect)
{
//测试使用
GlobalDevice.PlcData = MySiemens.ReadClass<PlcToComputer>(3);//获取PLC到上位机的数据
var res = MySiemens.Read(DataType.DataBlock, 4, 134, VarType.Word, 32);
if (res != null && res is ushort[] ushorts && ushorts.Length == 32)
@@ -80,11 +85,7 @@ namespace BPASmartClient.DosingSystem
return Add;
}
return default;


}



}
}

+ 4
- 4
DosingSystem/View/ChangeDeviceNameView.xaml.cs Vedi File

@@ -1,5 +1,4 @@
using BPASmartClient.Helper;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -12,6 +11,7 @@ using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using BPA.Helper;

namespace BPASmartClient.DosingSystem.View
{
@@ -23,8 +23,8 @@ namespace BPASmartClient.DosingSystem.View
public ChangeDeviceNameView()
{
InitializeComponent();
ActionManage.GetInstance.CancelRegister("ChangeDeviceNameViewClose");
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "ChangeDeviceNameViewClose");
//ActionManage.GetInstance.CancelRegister("ChangeDeviceNameViewClose");
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "ChangeDeviceNameViewClose", true);
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
}
}


+ 1
- 1
DosingSystem/View/NewRecipeView.xaml.cs Vedi File

@@ -31,7 +31,7 @@ namespace BPASmartClient.DosingSystem.View

private void cb_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
ActionManage.GetInstance.SendAsync("原料选择修改", (sender as ComboBox).SelectedValue);
//ActionManage.GetInstance.SendAsync("原料选择修改", (sender as ComboBox).SelectedValue);
}
}
}

+ 2
- 2
DosingSystem/View/RecipeControlView.xaml Vedi File

@@ -880,8 +880,8 @@
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="Yellow"
Text="等待执行" />
Foreground="{Binding RecipStatus,Converter={StaticResource RecipeStatusConvert}}"
Text="{Binding RecipStatus}" />
<Border
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"


+ 0
- 10
DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs Vedi File

@@ -49,21 +49,11 @@ namespace BPASmartClient.DosingSystem.ViewModel
}
}
}

});
}

private static string IpAddress = string.Empty;

//public BPARelayCommand ConfirmCommand { get; set; }

//public BPARelayCommand CancleCommand { get; set; }


//public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
//private string _mErrorInfo;


public string DeviceName { get { return _mDeviceName; } set { _mDeviceName = value; OnPropertyChanged(); } }
private string _mDeviceName;



+ 0
- 1
DosingSystem/ViewModel/ConveyerBeltManualViewModel.cs Vedi File

@@ -23,7 +23,6 @@ namespace BPASmartClient.DosingSystem.ViewModel
});
}
}

public ObservableCollection<ConveyerBeltModel> ConveyerBeltModels { get; set; } = new ObservableCollection<ConveyerBeltModel>();
}
}

+ 3
- 4
DosingSystem/ViewModel/NewRecipeViewModel.cs Vedi File

@@ -17,15 +17,15 @@ namespace BPASmartClient.DosingSystem.ViewModel
public NewRecipeViewModel()
{
ActionManage.GetInstance.RegisterAsync(new Action<object>((o) =>
{
{
if (!string.IsNullOrEmpty(o?.ToString()))
{
if (RawMaterials.FirstOrDefault(p => p.RawMaterialName == o.ToString()) != null)
{
App.Current.Dispatcher.Invoke(() => { MessageNotify.GetInstance.ShowDialog("前原料和其它原料重复,请重新选择!", DialogType.Warning); });
App.Current.Dispatcher.Invoke(() => { MessageNotify.GetInstance.ShowDialog("前原料和其它原料重复,请重新选择!", DialogType.Warning); });
}
}
}), "原料选择修改");
}), "原料选择修改");
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o != null && o is RecipeModel rm)
@@ -74,7 +74,6 @@ namespace BPASmartClient.DosingSystem.ViewModel
SaveCommand = new BPARelayCommand(() =>
{
if (string.IsNullOrEmpty(RecipeName)) { MessageNotify.GetInstance.ShowDialog("请输入配方名称!", DialogType.Warning); ErrorInfo = "请输入配方名称"; return; }

var tempRes = RawMaterials.GroupBy(p => p.RawMaterialName);
if (tempRes.Count() != RawMaterials.Count)
{


+ 257
- 38
DosingSystem/ViewModel/RecipeControlViewModel.cs Vedi File

@@ -59,7 +59,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
RecipeNames.Enqueue(deviceName);
var t = RecipeNames.GetHashCode();
var res = Recipes.FirstOrDefault(p => p.RecipeName == deviceName);
UserTreeWait.Add(new RecipeModel { SerialNum = UserTreeWait.Count + 1, RecipeName = deviceName, RawMaterials = res.RawMaterials });
UserTreeWait.Add(new RecipeModel { RecipStatus = "等待制作", SerialNum = UserTreeWait.Count + 1, RecipeName = deviceName, RawMaterials = res.RawMaterials });
}
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!");
MessageNotify.GetInstance.ShowUserLog($"下发工单 {Guid.NewGuid().ToString()}");
@@ -90,7 +90,8 @@ namespace BPASmartClient.DosingSystem.ViewModel
#region 配方下发到PLC操作相关
//配方数据写入到输送机
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == CurrentRecipeName);
List<int> recipeData = new List<int>();
/*List<int> recipeData = new List<int>();*/
List<int> BarrelNum = new List<int>();
if (res != null)
{
var tInfo = res.RawMaterials.GroupBy(p => p.Loc);//获取桶号信息
@@ -105,27 +106,47 @@ namespace BPASmartClient.DosingSystem.ViewModel
var tempDevice = DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == TempName);
if (tempDevice != null)
{
data = data.SetBitValue((byte)tempDevice.DeviceNum, true);
/*data = data.SetBitValue((byte)tempDevice.DeviceNum, true);*/
if (tempDevice.DeviceNum > 0)
{
int a = data.SetBitValue((byte)tInfo.ElementAt(i).ElementAt(m).Loc, true);
byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD);
int item = test1.ToInt();
SiemensDevice.GetInstance.MySiemens.Write($"DB4.DBD{2 + (tempDevice.DeviceNum - 1) * 4}", item);
MessageNotify.GetInstance.ShowRunLog($"下发配方DB4.DBD{2 + (tempDevice.DeviceNum - 1) * 4} :{item.ToBinString()}");
}
}
if (tInfo.ElementAt(i).ElementAt(m).Loc > 0)
{
if (!BarrelNum.Contains(tInfo.ElementAt(i).ElementAt(m).Loc))
{
BarrelNum.Add(tInfo.ElementAt(i).ElementAt(m).Loc);
}
}
}
recipeData.Add(data);
/*recipeData.Add(data);*/

}
}
}
if (recipeData.Count <= 0)
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD198", BarrelNum.Count);//配方使用桶数写入
/*if (recipeData.Count <= 0)
{
MessageNotify.GetInstance.ShowRunLog("配方数据解析失败");
return;
}
int offset = 2;
}*/
/*int offset = 2;
//写入配方数据
MessageNotify.GetInstance.ShowRunLog("开始写入配方数据");
recipeData.ForEach(item =>
{
byte[] test1 = item.ToBytes(BPA.Helper.DataFormat.ABCD);
item = test1.ToInt();
SiemensDevice.GetInstance.MySiemens.Write($"DB4.DBD{offset}", item);
MessageNotify.GetInstance.ShowRunLog($"下发配方DB4.DBD{offset} :{item.ToBinString()}");
offset = offset += 4;
});
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD198", recipeData.Count);//配方使用桶数写入
});*/
/*SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD198", recipeData.Count);//配方使用桶数写入*/
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX0.1", true);//配方执行启动
Stopwatch sw = new Stopwatch();
var recipe = Recipes.ElementAt(index);
@@ -211,6 +232,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
RecipeName = recipeComple.RecipeName,
SerialNum = UserTreeCompelete.Count + 1,
RecipCode = recipeComple.RecipCode,
RecipStatus = "制作完成"
});
});
App.Current.Dispatcher.Invoke(new Action(() =>
@@ -247,48 +269,244 @@ namespace BPASmartClient.DosingSystem.ViewModel
if (index >= 0 && index < recipeProcesses.ElementAt(recIndex).RawMaterials.Count)
{
//测试使用
//recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(index).RecipeStatus = RunStatus;
recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(index).RecipeStatus = RunStatus;
}
for (int j = 0; j < GlobalDevice.PlcData.IsAllowIngredients.Length; j++)
{
if (GlobalDevice.PlcData.IsAllowIngredients[j])
{
int cnt = j + 1;//获取允许配料信号桶号的料仓位置
int Raw_Loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.Loc == cnt);
int Device_Loc = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == cnt);
if (Raw_Loc >= 0 && Device_Loc >= 0)
int barrel = j + 1;//桶号
int cnt = GlobalDevice.PlcData.LocationFeedback[j];//允许配料的位置 0~6
int Location1 = 0;
int Location2 = 0;
if (cnt == -1)
{
MessageNotify.GetInstance.ShowRunLog("错误");
return;
}
else
{
float weight = Recipes.ElementAt(i).RawMaterials.ElementAt(Raw_Loc).RawMaterialWeight;
string deviceName = DeviceInquire.GetInstance.devices.ElementAt(Device_Loc).DeviceName;
int loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == deviceName);
if (cnt > 0 && loc >= 0 && deviceName != null && weight >= 0)
switch (cnt)
{
int St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == deviceName);
if (St_index < 0)
case 1:
int a1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 1);
int b1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 2);
if (a1 >= 0)
{
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a1).DeviceName && p.Loc == barrel);
}
if (b1 >= 0)
{
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b1).DeviceName && p.Loc == barrel);
}
break;
case 2:
int a2 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 3);
int b2 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 4);
if (a2 >= 0)
{
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a2).DeviceName && p.Loc == barrel);
}
if (b2 >= 0)
{
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b2).DeviceName && p.Loc == barrel);
}
break;
case 3:
int a3 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 5);
int b3 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 6);
if (a3 >= 0)
{
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a3).DeviceName && p.Loc == barrel);
}
if (b3 >= 0)
{
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b3).DeviceName && p.Loc == barrel);
}
break;
case 4:
int a4 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 7);
int b4 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 8);
if (a4 >= 0)
{
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a4).DeviceName && p.Loc == barrel);
}
if (b4 >= 0)
{
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b4).DeviceName && p.Loc == barrel);
}
break;
case 5:
int a5 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 9);
int b5 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 10);
if (a5 >= 0)
{
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a5).DeviceName && p.Loc == barrel);
}
if (b5 >= 0)
{
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b5).DeviceName && p.Loc == barrel);
}
break;
case 6:
int a6 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 11);
int b6 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == 12);
if (a6 >= 0)
{
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a6).DeviceName && p.Loc == barrel);
}
if (b6 >= 0)
{
Location2 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(b6).DeviceName && p.Loc == barrel);
}
break;
default:
break;
}
}
if (Location1 >= 0)
{
string RawName = Recipes.ElementAt(i).RawMaterials.ElementAt(Location1).RawMaterialName;
int abc = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceName == RawName);
int DeviceNum = DeviceInquire.GetInstance.devices.ElementAt(abc).DeviceNum;
if (DeviceNum > 0)
{
float weight = Recipes.ElementAt(i).RawMaterials.ElementAt(Location1).RawMaterialWeight;
int loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == RawName);
if (loc >= 0 && RawName != null && weight >= 0)
{
StockStatus.Add(new StockStatusModel()
int St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName);
if (St_index < 0)
{
StockStatus.Add(new StockStatusModel()
{
MaterialName = RawName,
IssueWeight = weight,
IssueStatus = 0,
});
}
St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName);
if (St_index >= 0)
{
MaterialName = deviceName,
IssueWeight = weight,
IssueStatus = 0,
});
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 1 && StockStatus.ElementAt(St_index).IssueStatus == 0)
{
StockStatus.ElementAt(St_index).IssueStatus = 1;
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).Start(weight);
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},开始出料");
}
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 3 && StockStatus.ElementAt(St_index).IssueStatus == 1)
{
//GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用
StockStatus.ElementAt(St_index).IssueStatus = 2;
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset();
int a = 0.SetBitValue((byte)(DeviceNum), true);
byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD);
int item = test1.ToInt();
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item);
MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}");
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位");
}
}
}
St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == deviceName);
if (St_index >= 0)
}
}
if (Location1 >= 0)
{

string RawName111 = Recipes.ElementAt(i).RawMaterials.ElementAt(Location1).RawMaterialName;
int St_index111 = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName111);
if (Location2 >= 0 && ((Location1 >= 0 && StockStatus.ElementAt(St_index111).IssueStatus == 2)))
{
string RawName = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialName;
int abc = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceName == RawName);
int DeviceNum = DeviceInquire.GetInstance.devices.ElementAt(abc).DeviceNum;
if (DeviceNum > 0)
{
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 1 && StockStatus.ElementAt(St_index).IssueStatus == 0)
float weight = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialWeight;
int loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == RawName);
if (loc >= 0 && RawName != null && weight >= 0)
{
StockStatus.ElementAt(St_index).IssueStatus = 1;
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).Start(weight);
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},开始出料");
int St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName);
if (St_index < 0)
{
StockStatus.Add(new StockStatusModel()
{
MaterialName = RawName,
IssueWeight = weight,
IssueStatus = 0,
});
}
St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName);
if (St_index >= 0)
{
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 1 && StockStatus.ElementAt(St_index).IssueStatus == 0)
{
StockStatus.ElementAt(St_index).IssueStatus = 1;
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).Start(weight);
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},开始出料");
}
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 3 && StockStatus.ElementAt(St_index).IssueStatus == 1)
{
//GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用
StockStatus.ElementAt(St_index).IssueStatus = 2;
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset();
int a = 0.SetBitValue((byte)(DeviceNum), true);
byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD);
int item = test1.ToInt();
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item);
MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}");
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位");
}
}
}
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 3 && StockStatus.ElementAt(St_index).IssueStatus == 1)
}
}
}
else
{
if (Location2 >= 0)
{
string RawName = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialName;
int abc = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceName == RawName);
int DeviceNum = DeviceInquire.GetInstance.devices.ElementAt(abc).DeviceNum;
if (DeviceNum >= 0)
{
float weight = Recipes.ElementAt(i).RawMaterials.ElementAt(Location2).RawMaterialWeight;
int loc = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == RawName);
if (cnt > 0 && loc >= 0 && RawName != null && weight >= 0)
{
GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用
StockStatus.ElementAt(St_index).IssueStatus = 2;
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset();
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", 0.SetBitValue((byte)loc, true));
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位");
int St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName);
if (St_index < 0)
{
StockStatus.Add(new StockStatusModel()
{
MaterialName = RawName,
IssueWeight = weight,
IssueStatus = 0,
});
}
St_index = Array.FindIndex(StockStatus.ToArray(), p => p.MaterialName == RawName);
if (St_index >= 0)
{
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 1 && StockStatus.ElementAt(St_index).IssueStatus == 0)
{
StockStatus.ElementAt(St_index).IssueStatus = 1;
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).Start(weight);
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},开始出料");
}
if (recipeProcesses.ElementAt(recIndex).RawMaterials.ElementAt(loc).RecipeStatus == 3 && StockStatus.ElementAt(St_index).IssueStatus == 1)
{
//GlobalDevice.PlcData.IsAllowIngredients[j] = false;//测试使用
StockStatus.ElementAt(St_index).IssueStatus = 2;
DeviceInquire.GetInstance.GetDevice(Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp).StatusReset();
int a = 0.SetBitValue((byte)(DeviceNum), true);
byte[] test1 = a.ToBytes(BPA.Helper.DataFormat.ABCD);
int item = test1.ToInt();
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBD130", item);
MessageNotify.GetInstance.ShowRunLog($"DB4.DBD130:{item.ToBinString()}");
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方{Recipes.ElementAt(i).RawMaterials.ElementAt(loc).DeviceIp},出料完成,状态复位");
}
}
}
}
}
@@ -299,7 +517,8 @@ namespace BPASmartClient.DosingSystem.ViewModel
if (StockStatus.Count >= Recipes.ElementAt(i).RawMaterials.Count && Finish_Count >= Recipes.ElementAt(i).RawMaterials.Count) //配方配料完成
{
StockStatus.Clear();
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX202.1", true);//配方使用桶数写入
SiemensDevice.GetInstance.MySiemens.Write("DB4.DBX202.1", true);//配料完成
MessageNotify.GetInstance.ShowRunLog($"配料完成");
int recipIndex = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == CurrentRecipeName);
App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.Clear(); }));
Recipes.ElementAt(recipIndex).IsEnable = true;


+ 3
- 10
DosingSystem/ViewModel/RecipeSettingsViewModel.cs Vedi File

@@ -72,16 +72,9 @@ namespace BPASmartClient.DosingSystem.ViewModel
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == o.ToString());
if (res != null)
{
if (res.IsEnable)
{
NewRecipeView nrv = new NewRecipeView();
ActionManage.GetInstance.Send("Details", res);
nrv.ShowDialog();
}
else
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, App.MainWindow, "提示", $"编辑【{o.ToString()}】配方失败,配方正在使用!");
}
NewRecipeView nrv = new NewRecipeView();
ActionManage.GetInstance.Send("Details", res);
nrv.ShowDialog();
}
//MessageLog.GetInstance.ShowUserLog($"编辑配方名称——{res.RecipeName}");
}


+ 0
- 1
DosingSystem/ViewModel/StockControViewModel.cs Vedi File

@@ -28,7 +28,6 @@ namespace BPASmartClient.DosingSystem.ViewModel
// }
// });
//});

statusTop = DeviceInquire.GetInstance.TopDeviceCurrentStatuses;
statusDown = DeviceInquire.GetInstance.BottomDeviceCurrentStatuses;



+ 13
- 0
DosingSystem/tsconfig1.json Vedi File

@@ -0,0 +1,13 @@
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5"
},
"exclude": [
"node_modules",
"wwwroot"
]
}

+ 46
- 0
SmartClient.sln Vedi File

@@ -192,6 +192,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.ScreenSplitM
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.ScreenLib", "BPASmartClient.ScreenLib\BPASmartClient.ScreenLib.csproj", "{798BBFFE-3BA2-40BA-BFE1-9502398F1F08}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WpfTest", "WpfTest\WpfTest.csproj", "{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WpfApp1", "WpfApp1\WpfApp1.csproj", "{81D03688-7361-45B8-A3EB-9B0A9222A338}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -1786,6 +1790,46 @@ Global
{798BBFFE-3BA2-40BA-BFE1-9502398F1F08}.Release|x64.Build.0 = Release|Any CPU
{798BBFFE-3BA2-40BA-BFE1-9502398F1F08}.Release|x86.ActiveCfg = Release|Any CPU
{798BBFFE-3BA2-40BA-BFE1-9502398F1F08}.Release|x86.Build.0 = Release|Any CPU
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Debug|ARM.ActiveCfg = Debug|Any CPU
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Debug|ARM.Build.0 = Debug|Any CPU
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Debug|ARM64.Build.0 = Debug|Any CPU
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Debug|x64.ActiveCfg = Debug|Any CPU
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Debug|x64.Build.0 = Debug|Any CPU
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Debug|x86.ActiveCfg = Debug|Any CPU
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Debug|x86.Build.0 = Debug|Any CPU
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Release|Any CPU.Build.0 = Release|Any CPU
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Release|ARM.ActiveCfg = Release|Any CPU
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Release|ARM.Build.0 = Release|Any CPU
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Release|ARM64.ActiveCfg = Release|Any CPU
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Release|ARM64.Build.0 = Release|Any CPU
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Release|x64.ActiveCfg = Release|Any CPU
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Release|x64.Build.0 = Release|Any CPU
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Release|x86.ActiveCfg = Release|Any CPU
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44}.Release|x86.Build.0 = Release|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Debug|Any CPU.Build.0 = Debug|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Debug|ARM.ActiveCfg = Debug|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Debug|ARM.Build.0 = Debug|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Debug|ARM64.Build.0 = Debug|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Debug|x64.ActiveCfg = Debug|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Debug|x64.Build.0 = Debug|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Debug|x86.ActiveCfg = Debug|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Debug|x86.Build.0 = Debug|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Release|Any CPU.ActiveCfg = Release|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Release|Any CPU.Build.0 = Release|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Release|ARM.ActiveCfg = Release|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Release|ARM.Build.0 = Release|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Release|ARM64.ActiveCfg = Release|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Release|ARM64.Build.0 = Release|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Release|x64.ActiveCfg = Release|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Release|x64.Build.0 = Release|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Release|x86.ActiveCfg = Release|Any CPU
{81D03688-7361-45B8-A3EB-9B0A9222A338}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1874,6 +1918,8 @@ Global
{286A2E28-B04E-4EA6-9017-D6FA6F8B9A48} = {C5968A90-F4CF-4904-88C4-62C77C820A04}
{135A0978-351F-4727-82CE-2B7A8632AF1B} = {C5968A90-F4CF-4904-88C4-62C77C820A04}
{798BBFFE-3BA2-40BA-BFE1-9502398F1F08} = {C6984F48-A0FE-47A4-B63B-E4E5BCFCD6D3}
{CD43FABA-D1ED-4524-AC51-60ECDE2EAD44} = {7BE13E55-D8B1-4232-AE63-8BF122633297}
{81D03688-7361-45B8-A3EB-9B0A9222A338} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC}


+ 9
- 0
WpfApp1/App.xaml Vedi File

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

+ 17
- 0
WpfApp1/App.xaml.cs Vedi File

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

namespace WpfApp1
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}

+ 10
- 0
WpfApp1/AssemblyInfo.cs Vedi 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)
)]

+ 12
- 0
WpfApp1/MainWindow.xaml Vedi File

@@ -0,0 +1,12 @@
<Window x:Class="WpfApp1.MainWindow"
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:WpfApp1"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>

</Grid>
</Window>

+ 90
- 0
WpfApp1/MainWindow.xaml.cs Vedi File

@@ -0,0 +1,90 @@
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;
using BPASmartClient.S7Net;

namespace WpfApp1
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
SiemensHelper siemensHelper = new SiemensHelper();
siemensHelper.Connect(S7.Net.CpuType.S71200, "192.168.101.16");
if (siemensHelper.IsConnected)
{
siemensHelper.WriteString(S7.Net.DataType.DataBlock, 1, 0, "cccc");
var res = siemensHelper.ReadClass<XL_Start_DB>(1);

//XL_Start_DB xL_Start_DB = new XL_Start_DB();
//xL_Start_DB.RecipeCode = "编码";
//xL_Start_DB.RecipeName = "名称";
//xL_Start_DB.StockCode = 1;
//xL_Start_DB.TrayCode = 2;
//for (int i = 0; i < xL_Start_DB.Powder.Length; i++)
//{
// xL_Start_DB.Powder[i].Powder_Name = $"料{i}";
// xL_Start_DB.Powder[i].Powder_Weight = (float)(5.0 + i);
//}
//for (int i = 0; i < xL_Start_DB.Material.Length; i++)
//{
// xL_Start_DB.Material[i].Material_Name = $"原料{i}";
// xL_Start_DB.Material[i].Material_Weight = (float)(50.0 + i);
// xL_Start_DB.Material[i].Material_BarrelNum = (short)(i + 1);
//}
//xL_Start_DB.Order_Request_ACK = true;
//xL_Start_DB.Order_Request = true;

//for (int i = 0; i < xL_Start_DB.Standby.Length; i++)
//{
// xL_Start_DB.Standby[i] = (short)(i + 100);
// xL_Start_DB.Standby1[i] = (short)(i + 300);
//}

res.RecipeCode = "";
res.RecipeName = "";
res.StockCode = 0;
res.TrayCode = 0;
for (int i = 0; i < res.Powder.Length; i++)
{
res.Powder[i].Powder_Name = "";
res.Powder[i].Powder_Weight = 0;
}
for (int i = 0; i < res.Material.Length; i++)
{
res.Material[i].Material_Name = "";
res.Material[i].Material_Weight = 0;
res.Material[i].Material_BarrelNum = 0;
}
res.Order_Request_ACK = false;
res.Order_Request = false;

for (int i = 0; i < res.Standby.Length; i++)
{
res.Standby[i] = 0;
res.Standby1[i] = 0;
}

siemensHelper.WriteClass<XL_Start_DB>(res, 1);

var res1 = siemensHelper.ReadClass<XL_Start_DB>(1);
}

}
}
}

+ 14
- 0
WpfApp1/WpfApp1.csproj Vedi File

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

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

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

</Project>

+ 100
- 0
WpfApp1/XL_Start_DB.cs Vedi File

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

namespace WpfApp1
{
internal class XL_Start_DB
{
//public XL_Start_DB()
//{
// for (int i = 0; i < Powder.Length; i++)
// {
// Powder[i] = new UDT2Start();
// }

// for (int i = 0; i < Material.Length; i++)
// {
// Material[i] = new UDTStart();
// }
//}

/// <summary>
/// 配方编码
/// </summary>
[Siemens(16)]
public string RecipeCode { get; set; }
/// <summary>
/// 配发名称
/// </summary>
///
[Siemens(16)]
public string RecipeName { get; set; }

/// <summary>
/// 工站的编号
/// </summary>
public short StockCode { get; set; }

/// <summary>
/// 托盘编号
/// </summary>
public short TrayCode { get; set; }

public UDT2Start[] Powder { get; set; } = new UDT2Start[10];

/// <summary>
/// 物料信息
/// </summary>
public UDTStart[] Material { get; set; } = new UDTStart[20];

/// <summary>
/// 西门子下发订单
/// </summary>
public bool Order_Request_ACK { get; set; }

public short[] Standby { get; set; } = new short[4];

/// <summary>
/// 上位机订单请求
/// </summary>
public bool Order_Request { get; set; }

public short[] Standby1 { get; set; } = new short[4];

}

public class UDTStart
{
[Siemens(6)]
/// <summary>
/// 原料名称
/// </summary>
public string Material_Name { get; set; }
/// <summary>
/// 原料重量
/// </summary>
public float Material_Weight { get; set; }
/// <summary>
/// 原料桶号
/// </summary>
public short Material_BarrelNum { get; set; }
}


public class UDT2Start
{
/// <summary>
/// 粉料仓名称
/// </summary>
[Siemens(6)]
public string Powder_Name { get; set; }
/// <summary>
/// 粉料仓重量
/// </summary>
public float Powder_Weight { get; set; }
}
}

+ 9
- 0
WpfTest/App.xaml Vedi File

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

Dato che sono stati cambiati molti file in questo diff, alcuni di essi non verranno mostrati

Caricamento…
Annulla
Salva