Browse Source

代码更新

master
pengliangyang 1 year ago
parent
commit
24a7495fb6
84 changed files with 5536 additions and 1785 deletions
  1. +12
    -8
      BPASmartClient.JAKA/JakaMachine.cs
  2. +2
    -0
      BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs
  3. +1
    -0
      BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs
  4. +263
    -77
      BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
  5. +10
    -0
      BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs
  6. +1
    -1
      BPASmartClient.JXJFoodBigStation/View/RecipeInfosView.xaml
  7. +97
    -17
      BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml
  8. +105
    -22
      BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml
  9. +2
    -2
      BPASmartClient.JXJFoodBigStation/View/SiemensRecipeSendDownView.xaml
  10. +0
    -1
      BPASmartClient.JXJFoodBigStation/View/StockBinRawMaterialView.xaml
  11. +1
    -0
      BPASmartClient.JXJFoodBigStation/ViewModel/ManualFlowViewModel.cs
  12. +22
    -9
      BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs
  13. +0
    -1
      BPASmartClient.JXJFoodBigStation/ViewModel/SiemensRecipeSendDownViewModel.cs
  14. +4
    -0
      BPASmartClient.JXJFoodBigStation/ViewModel/StockBinRawMaterialViewModel.cs
  15. +7
    -1
      BPASmartClient.JXJFoodSmallStation/App.xaml.cs
  16. +7
    -0
      BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj
  17. +4
    -0
      BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs
  18. +15
    -0
      BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/PlcReadAddressDB3.cs
  19. +64
    -26
      BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
  20. +2
    -0
      BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DevicePar.cs
  21. +29
    -0
      BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/RawMaterialStockBin.cs
  22. +39
    -5
      BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml
  23. +138
    -0
      BPASmartClient.JXJFoodSmallStation/View/StockBinRawMaterialView.xaml
  24. +28
    -0
      BPASmartClient.JXJFoodSmallStation/View/StockBinRawMaterialView.xaml.cs
  25. +53
    -0
      BPASmartClient.JXJFoodSmallStation/ViewModel/ManualFlowViewModel.cs
  26. +55
    -0
      BPASmartClient.JXJFoodSmallStation/ViewModel/StockBinRawMaterialViewModel.cs
  27. +1
    -0
      BPASmartClient.JakaRobot/BPASmartClient.JakaRobot.csproj
  28. +40
    -29
      BPASmartClient.JakaRobot/JaKaHelper.cs
  29. +14
    -0
      BPASmartClient.MilkTeaCube/BPASmartClient.MilkTeaCube.csproj
  30. +90
    -0
      BPASmartClient.MilkTeaCube/MilkTeaCubeMachine.cs
  31. +9
    -0
      BPASmartClient.MilkTeaCubeHelper/BPASmartClient.MilkTeaCubeHelper.csproj
  32. +8
    -0
      BPASmartClient.MilkTeaCubeHelper/Class1.cs
  33. +13
    -0
      BPASmartClient.Model/奶茶味魔方/MilkTeaCubeEvent.cs
  34. +10
    -0
      BPASmartClient.Model/电夹爪/GripperEvent.cs
  35. +14
    -0
      BPASmartClient.Model/电夹爪/WriteGripper.cs
  36. +81
    -26
      BPASmartClient.Model/节卡机器人/JakaModel.cs
  37. +265
    -168
      BPASmartClient.MorkBF/Control_MorkBF.cs
  38. +4
    -4
      BPASmartClient.MorkBF/GVL_MorkBF.cs
  39. +204
    -0
      BPASmartClient.MorkS3/Alarm.cs
  40. +28
    -0
      BPASmartClient.MorkS3/BPASmartClient.MorkS3.csproj
  41. +891
    -0
      BPASmartClient.MorkS3/Control_Morks.cs
  42. +52
    -0
      BPASmartClient.MorkS3/DataServer.cs
  43. +376
    -0
      BPASmartClient.MorkS3/GVL_MORKS.cs
  44. +3
    -3
      BPASmartClient.MorkS3/Model/Global.cs
  45. +16
    -0
      BPASmartClient.MorkS3/Model/MorksPar.cs
  46. +29
    -0
      BPASmartClient.MorkS3/Model/ParSet.cs
  47. +14
    -0
      BPASmartClient.MorkS3/Model/WritePar.cs
  48. +23
    -0
      BPASmartClient.MorkS3/OrderLocInfo.cs
  49. +117
    -0
      BPASmartClient.MorkS3/View/Debug.xaml
  50. +30
    -0
      BPASmartClient.MorkS3/View/Debug.xaml.cs
  51. +242
    -0
      BPASmartClient.MorkS3/View/Monitor.xaml
  52. +28
    -0
      BPASmartClient.MorkS3/View/Monitor.xaml.cs
  53. +130
    -0
      BPASmartClient.MorkS3/View/ParSet.xaml
  54. +28
    -0
      BPASmartClient.MorkS3/View/ParSet.xaml.cs
  55. +79
    -0
      BPASmartClient.MorkS3/ViewModel/DebugViewModel.cs
  56. +25
    -0
      BPASmartClient.MorkS3/ViewModel/MonitorViewModel.cs
  57. +49
    -0
      BPASmartClient.MorkS3/ViewModel/ParSetViewModel.cs
  58. +42
    -0
      BPASmartClient.MorkS3/VoiceAPI.cs
  59. +5
    -0
      BPASmartClient.MorkT_BarCounter/BPASmartClient.MorkT_BarCounter.csproj
  60. +309
    -553
      BPASmartClient.MorkT_BarCounter/Control_MorkT_BarCounter.cs
  61. +20
    -6
      BPASmartClient.MorkT_BarCounter/GVL_MorkT.cs
  62. +12
    -13
      BPASmartClient.MorkT_BarCounter/PolymerBatching.cs
  63. +92
    -414
      BPASmartClient.MorkT_BarCounter/View/DebugView.xaml
  64. +439
    -0
      BPASmartClient.MorkT_BarCounter/View/TestView.xaml
  65. +37
    -0
      BPASmartClient.MorkT_BarCounter/View/TestView.xaml.cs
  66. +54
    -350
      BPASmartClient.MorkT_BarCounter/ViewModel/DebugViewModel.cs
  67. +386
    -0
      BPASmartClient.MorkT_BarCounter/ViewModel/TestViewModel.cs
  68. +1
    -1
      BPASmartClient.MorkT_Container/Control_MorkT_Container.cs
  69. +8
    -8
      BPASmartClient.Morkt.JAKA.JC/Control_MORKJC.cs
  70. +15
    -0
      BPASmartClient.RobotGripper/BPASmartClient.RobotGripper.csproj
  71. +50
    -0
      BPASmartClient.RobotGripper/RobotGripperMachine.cs
  72. +1
    -1
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1ViewModel.cs
  73. +1
    -0
      BPASmartClient.ScreenLib/总监视大屏/ScreenALLControlViewModel.cs
  74. +77
    -0
      BPASmartClient.SerialPort/RobotGripperHelper.cs
  75. +2
    -2
      DosingSystem/App.xaml.cs
  76. +11
    -6
      DosingSystem/Model/DeviceInquire.cs
  77. +1
    -1
      DosingSystem/Model/par/LocalRecipe.cs
  78. +1
    -1
      DosingSystem/View/NewRecipeView.xaml.cs
  79. +1
    -1
      DosingSystem/View/RecipeSettingsView.xaml.cs
  80. +3
    -3
      DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs
  81. +12
    -12
      DosingSystem/ViewModel/NewRecipeViewModel.cs
  82. +6
    -6
      DosingSystem/ViewModel/RecipeControlViewModel.cs
  83. +6
    -6
      DosingSystem/ViewModel/RecipeSettingsViewModel.cs
  84. +70
    -1
      SmartClient.sln

+ 12
- 8
BPASmartClient.JAKA/JakaMachine.cs View File

@@ -17,18 +17,22 @@ namespace BPASmartClient.JAKA
ThreadManage.GetInstance().StartLong(new Action(() =>
{
IsConnected = jaKaHelper.IsConnected;
if (!IsConnected) IsWork = false;
while (IsConnected)
if (!IsConnected)
{
IsWork = false;
}
if (IsConnected)
{
IsWork = true;
if (status != null)
{
SetStatus("GetProgramStatus", (int)jaKaHelper.GetProgramStatus());
SetStatus("Get_RobotAO1", jaKaHelper.Get_RobotAO1());
SetStatus("Get_RobotDI0", jaKaHelper.Get_RobotDI(0));
SetStatus("Get_RobotDI1", jaKaHelper.Get_RobotDI(1));
SetStatus("Get_RobotDI2", jaKaHelper.Get_RobotDI(2));
SetStatus("Get_RobotDI3", jaKaHelper.Get_RobotDI(3));
SetStatus("Get_JakaRobotProgramStatus", (int)jaKaHelper.GetProgramStatus());
SetStatus("Get_JakaRobotAO1", Convert.ToInt32(jaKaHelper.Get_RobotAO1()));
SetStatus("Get_JakaRobotDI0", jaKaHelper.Get_RobotDI(0));
SetStatus("Get_JakaRobotDI1", jaKaHelper.Get_RobotDI(1));
SetStatus("Get_JakaRobotDI2", jaKaHelper.Get_RobotDI(2));
SetStatus("Get_JakaRobotDI3", jaKaHelper.Get_RobotDI(3));
SetStatus("Get_JakaRobotDI5", jaKaHelper.Get_RobotDI(5));
}
Thread.Sleep(500);
}


+ 2
- 0
BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs View File

@@ -47,6 +47,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model
/// 是否处于手动下发配方
/// </summary>
public static bool IsUseLocalRecipe { get; set; } = false;

public static bool BarrelWasherSign { get; set; }
/// <summary>
/// 订单请求
/// </summary>


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

@@ -64,6 +64,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
{
HK_PLC_S7.Write("DB99.DBW2.0",Convert.ToInt16(recipe.TrayCode));
HK_PLC_S7.Write("DB99.DBW4.0", Convert.ToInt16(recipe.TrayCode));
MessageNotify.GetInstance.ShowRunLog($"配方编号:{recipe.RecipeCode},托盘编号DB99.DBW2.0:{recipe.TrayCode},下发完成");
for (int barrel = 1; barrel < 6; barrel++)
{
if (barrel != 3)//桶的编号不为3 只为1,2,4,5号桶


+ 263
- 77
BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs View File

@@ -261,28 +261,28 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
foreach (var data in LocalRecipes)
{
if (LocalRecipeQueue1.Count == 0 && !LocalRecipeQueue2.Contains(data.RecipeCode) && !LocalRecipeQueue3.Contains(data.RecipeCode) && !LocalRecipeQueue4.Contains(data.RecipeCode))
if (LocalRecipeQueue1.Count == 0 && !LocalRecipeQueue2.Contains(data.RecipeCode) && !LocalRecipeQueue3.Contains(data.RecipeCode) && !LocalRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe1)
{
if (!(LocalRecipeQueue1.Contains(data.RecipeCode)))
{
LocalRecipeQueue1.Enqueue(data.RecipeCode);
}
}
else if (LocalRecipeQueue2.Count == 0 && !LocalRecipeQueue1.Contains(data.RecipeCode) && !LocalRecipeQueue3.Contains(data.RecipeCode) && !LocalRecipeQueue4.Contains(data.RecipeCode))
else if (LocalRecipeQueue2.Count == 0 && !LocalRecipeQueue1.Contains(data.RecipeCode) && !LocalRecipeQueue3.Contains(data.RecipeCode) && !LocalRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe2)
{
if (!(LocalRecipeQueue2.Contains(data.RecipeCode)))
{
LocalRecipeQueue2.Enqueue(data.RecipeCode);
}
}
else if (LocalRecipeQueue3.Count == 0 && !LocalRecipeQueue1.Contains(data.RecipeCode) && !LocalRecipeQueue2.Contains(data.RecipeCode) && !LocalRecipeQueue4.Contains(data.RecipeCode))
else if (LocalRecipeQueue3.Count == 0 && !LocalRecipeQueue1.Contains(data.RecipeCode) && !LocalRecipeQueue2.Contains(data.RecipeCode) && !LocalRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe3)
{
if (!(LocalRecipeQueue3.Contains(data.RecipeCode)))
{
LocalRecipeQueue3.Enqueue(data.RecipeCode);
}
}
else if (LocalRecipeQueue4.Count == 0 && !LocalRecipeQueue1.Contains(data.RecipeCode) && !LocalRecipeQueue2.Contains(data.RecipeCode) && !LocalRecipeQueue3.Contains(data.RecipeCode))
else if (LocalRecipeQueue4.Count == 0 && !LocalRecipeQueue1.Contains(data.RecipeCode) && !LocalRecipeQueue2.Contains(data.RecipeCode) && !LocalRecipeQueue3.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe4)
{
if (!(LocalRecipeQueue4.Contains(data.RecipeCode)))
{
@@ -297,6 +297,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
LocalRecipeQueue2.Clear();
LocalRecipeQueue3.Clear();
LocalRecipeQueue4.Clear();
GVL_BigStation.BarrelWasherSign = false;
GVL_BigStation.Recipe1DosingStatus = 0;
GVL_BigStation.Recipe2DosingStatus = 0;
GVL_BigStation.Recipe3DosingStatus = 0;
@@ -340,20 +341,43 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (HKDevice.PlcRead.IsAllowIssueRecipe1 && GVL_BigStation.Recipe1DosingStatus == 0 && Inplace)//配方1是否允许下发配发
{
HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true);
GVL_BigStation.Recipe1DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
if (LocalRecipes.ElementAt(index).IsWashingBarrel)
{
if (!GVL_BigStation.BarrelWasherSign)
{
GVL_BigStation.BarrelWasherSign = true;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");

HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true);
GVL_BigStation.Recipe1DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
}
else
{
HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true);
GVL_BigStation.Recipe1DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
}
if (HKDevice.PlcRead.ReceiveFinishRecipe1 && GVL_BigStation.Recipe1DosingStatus == 1)
{
GVL_BigStation.Recipe1DosingStatus = 2;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", false);
StockBinParReset();
GVL_BigStation.Recipe1DosingStatus = 2;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成");
}
if (GVL_BigStation.Recipe1DosingStatus == 2 && HKDevice.PlcRead.Recipe1DosingFinish)
{
if (LocalRecipes.ElementAt(index).IsWashingBarrel)
{
GVL_BigStation.BarrelWasherSign = false;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶复位
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶信号复位");
}
GVL_BigStation.Recipe1DosingStatus = 3;
switch (trayCode)
{
@@ -480,10 +504,27 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0 &&Inplace)//配方2是否允许下发配发
{
HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", true);
GVL_BigStation.Recipe2DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
if (LocalRecipes.ElementAt(index).IsWashingBarrel)
{
if (!GVL_BigStation.BarrelWasherSign)
{
GVL_BigStation.BarrelWasherSign = true;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");

HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", true);
GVL_BigStation.Recipe2DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
}
}
else
{
HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", true);
GVL_BigStation.Recipe2DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
}
}
if (HKDevice.PlcRead.ReceiveFinishRecipe2 && GVL_BigStation.Recipe2DosingStatus == 1)
{
@@ -494,6 +535,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (GVL_BigStation.Recipe2DosingStatus == 2 && HKDevice.PlcRead.Recipe2DosingFinish)
{
if (LocalRecipes.ElementAt(index).IsWashingBarrel)
{
GVL_BigStation.BarrelWasherSign = false;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶复位
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶信号复位");
}
switch (trayCode)
{
case 1:
@@ -620,10 +667,27 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (HKDevice.PlcRead.IsAllowIssueRecipe3 && GVL_BigStation.Recipe3DosingStatus == 0 && Inplace)//配方3是否允许下发配发
{
HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", true);
GVL_BigStation.Recipe3DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
if (LocalRecipes.ElementAt(index).IsWashingBarrel)
{
if (!GVL_BigStation.BarrelWasherSign)
{
GVL_BigStation.BarrelWasherSign = true;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");

HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", true);
GVL_BigStation.Recipe3DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
}
}
else
{
HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", true);
GVL_BigStation.Recipe3DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
}
}
if (HKDevice.PlcRead.ReceiveFinishRecipe3 && GVL_BigStation.Recipe3DosingStatus == 1)
{
@@ -634,6 +698,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (HKDevice.PlcRead.Recipe3DosingFinish && GVL_BigStation.Recipe3DosingStatus == 2)
{
if (LocalRecipes.ElementAt(index).IsWashingBarrel)
{
GVL_BigStation.BarrelWasherSign = false;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶复位
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶信号复位");
}
switch (trayCode)
{
case 1:
@@ -761,10 +831,27 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (HKDevice.PlcRead.IsAllowIssueRecipe4 && GVL_BigStation.Recipe4DosingStatus == 0 && Inplace)//配方4是否允许下发配发
{
HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", true);
GVL_BigStation.Recipe4DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
if (LocalRecipes.ElementAt(index).IsWashingBarrel)
{
if (!GVL_BigStation.BarrelWasherSign)
{
GVL_BigStation.BarrelWasherSign = true;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");

HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", true);
GVL_BigStation.Recipe4DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
}
}
else
{
HKDevice.StockBinPar(LocalRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", true);
GVL_BigStation.Recipe4DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}下发完成");
}
}
if (HKDevice.PlcRead.ReceiveFinishRecipe4 && GVL_BigStation.Recipe4DosingStatus == 1)
{
@@ -775,6 +862,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (GVL_BigStation.Recipe4DosingStatus == 2 && HKDevice.PlcRead.Recipe4DosingFinish)
{
if (LocalRecipes.ElementAt(index).IsWashingBarrel)
{
GVL_BigStation.BarrelWasherSign = false;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶复位
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶信号复位");
}
switch (trayCode)
{
case 1:
@@ -875,7 +968,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
foreach (var data in SiemensRecipes)
{
if (SiemensRecipeQueue1.Count == 0 && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode))
if (SiemensRecipeQueue1.Count == 0 && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe1)
{
if (!(SiemensRecipeQueue1.Contains(data.RecipeCode)))
{
@@ -910,7 +1003,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
}
}
else if (SiemensRecipeQueue2.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode))
else if (SiemensRecipeQueue2.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe2)
{
if (!(SiemensRecipeQueue2.Contains(data.RecipeCode)))
{
@@ -945,7 +1038,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
}
}
else if (SiemensRecipeQueue3.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode))
else if (SiemensRecipeQueue3.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue4.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe3)
{
if (!(SiemensRecipeQueue3.Contains(data.RecipeCode)))
{
@@ -980,7 +1073,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
}
}
else if (SiemensRecipeQueue4.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode))
else if (SiemensRecipeQueue4.Count == 0 && !SiemensRecipeQueue1.Contains(data.RecipeCode) && !SiemensRecipeQueue2.Contains(data.RecipeCode) && !SiemensRecipeQueue3.Contains(data.RecipeCode) && HKDevice.PlcRead.IsAllowIssueRecipe4)
{
if (!(SiemensRecipeQueue4.Contains(data.RecipeCode)))
{
@@ -1023,6 +1116,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
SiemensRecipeQueue2.Clear();
SiemensRecipeQueue3.Clear();
SiemensRecipeQueue4.Clear();
GVL_BigStation.BarrelWasherSign = false;
GVL_BigStation.Recipe1DosingStatus = 0;
GVL_BigStation.Recipe2DosingStatus = 0;
GVL_BigStation.Recipe3DosingStatus = 0;
@@ -1057,14 +1151,16 @@ namespace BPASmartClient.JXJFoodBigStation.Model
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
}
GVL_BigStation.Recipe1DosingStatus = 0;
SiemensRecipeQueue1.TryDequeue(out code);
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX320.2", false);
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", true);
MessageNotify.GetInstance.ShowRunLog($"队列1,西门子取消订单完成,订单号:{code}");
while (SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2301.DBX320.2") == false )
{
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", false);
SiemensRecipeQueue1.TryDequeue(out code);
MessageNotify.GetInstance.ShowRunLog($"队列1,西门子取消订单完成,订单号:{code}");
}
}
if (SiemensRecipeQueue2.Contains(code))
{
GVL_BigStation.Recipe2DosingStatus = 0;
App.Current.Dispatcher.Invoke(() =>
{
Json<RemoteRecipe>.Data.Recipes.RemoveAt(index);
@@ -1080,10 +1176,13 @@ namespace BPASmartClient.JXJFoodBigStation.Model
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
}
GVL_BigStation.Recipe2DosingStatus = 0;
SiemensRecipeQueue2.TryDequeue(out code);
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX320.2", false);
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", true);
MessageNotify.GetInstance.ShowRunLog($"队列2,西门子取消订单完成,订单号:{code}");
while (SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2301.DBX320.2") == false)
{
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", false);
SiemensRecipeQueue2.TryDequeue(out code);
MessageNotify.GetInstance.ShowRunLog($"队列2,西门子取消订单完成,订单号:{code}");
}
}
if (SiemensRecipeQueue3.Contains(code))
{
@@ -1102,11 +1201,14 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
}
GVL_BigStation.Recipe3DosingStatus = 0;
SiemensRecipeQueue3.TryDequeue(out code);
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX320.2", false);
GVL_BigStation.Recipe3DosingStatus = 0;
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", true);
MessageNotify.GetInstance.ShowRunLog($"队列3,西门子取消订单完成,订单号:{code}");
while (SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2301.DBX320.2") == false)
{
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", false);
SiemensRecipeQueue3.TryDequeue(out code);
MessageNotify.GetInstance.ShowRunLog($"队列3,西门子取消订单完成,订单号:{code}");
}
}
if (SiemensRecipeQueue4.Contains(code))
{
@@ -1126,10 +1228,13 @@ namespace BPASmartClient.JXJFoodBigStation.Model
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
}
GVL_BigStation.Recipe4DosingStatus = 0;
SiemensRecipeQueue4.TryDequeue(out code);
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX320.2", false);
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", true);
MessageNotify.GetInstance.ShowRunLog($"队列4,西门子取消订单完成,订单号:{code}");
while (SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2301.DBX320.2") == false)
{
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", false);
SiemensRecipeQueue4.TryDequeue(out code);
MessageNotify.GetInstance.ShowRunLog($"队列4,西门子取消订单完成,订单号:{code}");
}
}
GVL_BigStation.Order_Cancel = false;
GVL_BigStation.Order_CancelRecipeCode = "";
@@ -1149,19 +1254,24 @@ namespace BPASmartClient.JXJFoodBigStation.Model
{
MessageNotify.GetInstance.ShowRunLog($"订单取消异常,订单号:{GVL_BigStation.Order_CancelRecipeCode}");
}

GVL_BigStation.Order_Cancel = false;
GVL_BigStation.Order_CancelRecipeCode = "";
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX320.2", false);
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", true);
while (SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2301.DBX320.2") == false)
{
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", false);
}
}
}
else
{
GVL_BigStation.Order_Cancel = false;
GVL_BigStation.Order_CancelRecipeCode = "";
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX320.2", false);
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", true);
while (SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2301.DBX320.2") == false)
{
SiemensDevice.Siemens_PLC_S7.Write("DB2301.DBX330.1", false);
}
MessageNotify.GetInstance.ShowRunLog($"西门子取消订单,但未找到订单:{GVL_BigStation.Order_CancelRecipeCode}");
}
}
@@ -1180,7 +1290,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
switch (trayCode)
{
case 1:
Inplace = HKDevice.PlcRead.Tray1InPlace;
Inplace = HKDevice.PlcRead.Tray1InPlace;//上位机给plc发送AGV到位信号,plc固定托盘后反馈托盘是否到位
break;
case 2:
Inplace = HKDevice.PlcRead.Tray2InPlace;
@@ -1199,16 +1309,31 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (HKDevice.PlcRead.IsAllowIssueRecipe1 && GVL_BigStation.Recipe1DosingStatus == 0 && Inplace)//配方1是否允许下发配发
{
GVL_BigStation.DosingRecipe1Time = DateTime.Now;
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
{
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
if (!GVL_BigStation.BarrelWasherSign)
{
GVL_BigStation.BarrelWasherSign = true;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
GVL_BigStation.DosingRecipe1Time = DateTime.Now;
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true);
GVL_BigStation.Recipe1DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
}
else
{
GVL_BigStation.DosingRecipe1Time = DateTime.Now;
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true);
GVL_BigStation.Recipe1DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
HKDevice.HK_PLC_S7.Write("DB99.DBX0.3", true);
GVL_BigStation.Recipe1DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
if (HKDevice.PlcRead.ReceiveFinishRecipe1 && GVL_BigStation.Recipe1DosingStatus == 1)
{
@@ -1219,6 +1344,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (GVL_BigStation.Recipe1DosingStatus == 2 && HKDevice.PlcRead.Recipe1DosingFinish)
{
if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
{
GVL_BigStation.BarrelWasherSign = false;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶复位");
}
GVL_BigStation.Recipe1DosingFinish = true;
GVL_BigStation.Recipe1DosingStatus = 3;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
@@ -1350,28 +1481,47 @@ namespace BPASmartClient.JXJFoodBigStation.Model
default:
break;
}
if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0 && Inplace)//配方2是否允许下发配发
if (HKDevice.PlcRead.IsAllowIssueRecipe2 && GVL_BigStation.Recipe2DosingStatus == 0 && Inplace )//配方2是否允许下发配发
{
GVL_BigStation.DosingRecipe2Time = DateTime.Now;
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
{
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
if (!GVL_BigStation.BarrelWasherSign)
{
GVL_BigStation.BarrelWasherSign = true;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");

GVL_BigStation.DosingRecipe2Time = DateTime.Now;
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", true);
GVL_BigStation.Recipe2DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
}
else
{
GVL_BigStation.DosingRecipe2Time = DateTime.Now;
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", true);
GVL_BigStation.Recipe2DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", true);
GVL_BigStation.Recipe2DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
if (HKDevice.PlcRead.ReceiveFinishRecipe2 && GVL_BigStation.Recipe2DosingStatus == 1)
{
GVL_BigStation.Recipe2DosingStatus = 2;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.4", false);
StockBinParReset();
GVL_BigStation.Recipe2DosingStatus = 2;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成");
}
if (GVL_BigStation.Recipe2DosingStatus == 2 && HKDevice.PlcRead.Recipe2DosingFinish)
{
if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
{
GVL_BigStation.BarrelWasherSign = false;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶复位");
}
GVL_BigStation.Recipe2DosingFinish = true;
GVL_BigStation.Recipe2DosingStatus = 3;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
@@ -1505,26 +1655,44 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (HKDevice.PlcRead.IsAllowIssueRecipe3 && GVL_BigStation.Recipe3DosingStatus == 0 && Inplace)//配方3是否允许下发配发
{
GVL_BigStation.DosingRecipe3Time = DateTime.Now;
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
{
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
if (!GVL_BigStation.BarrelWasherSign)//其他配方在洗桶时,等待其他配方洗完,在发送数据
{
GVL_BigStation.BarrelWasherSign = true;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
GVL_BigStation.DosingRecipe3Time = DateTime.Now;
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", true);
GVL_BigStation.Recipe3DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
}
else
{
GVL_BigStation.DosingRecipe3Time = DateTime.Now;
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", true);
GVL_BigStation.Recipe3DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", true);
GVL_BigStation.Recipe3DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
if (HKDevice.PlcRead.ReceiveFinishRecipe3 && GVL_BigStation.Recipe3DosingStatus == 1)
{
GVL_BigStation.Recipe3DosingStatus = 2;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.5", false);
StockBinParReset();
GVL_BigStation.Recipe3DosingStatus = 2;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},PLC接收配方完成");
}
if (HKDevice.PlcRead.Recipe3DosingFinish && GVL_BigStation.Recipe3DosingStatus == 2)
{
if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
{
GVL_BigStation.BarrelWasherSign = false;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶复位");
}
GVL_BigStation.Recipe3DosingFinish = true;
GVL_BigStation.Recipe3DosingStatus = 3;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
@@ -1658,16 +1826,28 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (HKDevice.PlcRead.IsAllowIssueRecipe4 && GVL_BigStation.Recipe4DosingStatus == 0 && Inplace)//配方4是否允许下发配发
{
GVL_BigStation.DosingRecipe4Time = DateTime.Now;
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
{
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
if (!GVL_BigStation.BarrelWasherSign)//其他配方在洗桶时,等待其他配方洗完,在发送数据
{
GVL_BigStation.BarrelWasherSign = true;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", true);//洗桶
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},订单类型为洗桶");
GVL_BigStation.DosingRecipe4Time = DateTime.Now;
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", true);
GVL_BigStation.Recipe4DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
}
else
{
GVL_BigStation.DosingRecipe4Time = DateTime.Now;
HKDevice.StockBinPar(SiemensRecipes.ElementAt(index));
HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", true);
GVL_BigStation.Recipe4DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
HKDevice.HK_PLC_S7.Write("DB99.DBX0.6", true);
GVL_BigStation.Recipe4DosingStatus = 1;
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},下发完成");
}
if (HKDevice.PlcRead.ReceiveFinishRecipe4 && GVL_BigStation.Recipe4DosingStatus == 1)
{
@@ -1678,6 +1858,12 @@ namespace BPASmartClient.JXJFoodBigStation.Model
}
if (GVL_BigStation.Recipe4DosingStatus == 2 && HKDevice.PlcRead.Recipe4DosingFinish)
{
if (SiemensRecipes.ElementAt(index).IsWashingBarrel)
{
GVL_BigStation.BarrelWasherSign = false;
HKDevice.HK_PLC_S7.Write("DB99.DBX0.1", false);//洗桶
MessageNotify.GetInstance.ShowRunLog($"配方编号:{code},托盘编号:{trayCode},洗桶复位");
}
GVL_BigStation.Recipe1DosingFinish = true;
GVL_BigStation.Recipe4DosingStatus = 3;
MessageNotify.GetInstance.ShowRunLog($"配方状态:{code}配料完成");
@@ -1803,8 +1989,8 @@ namespace BPASmartClient.JXJFoodBigStation.Model
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0005", RawMaterialLocation = 3 });//榨菜丁
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0018", RawMaterialLocation = 4 });//炸豌豆
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0019", RawMaterialLocation = 5 });//高水分糍粑海椒
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0033", RawMaterialLocation = 6 });//辣豆瓣*/
/*RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0030", RawMaterialLocation = 11 });//备用生姜
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0033", RawMaterialLocation = 6 });//辣豆瓣
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0030", RawMaterialLocation = 11 });//备用生姜
RawMaterialsInfo.Add(new RawMaterial() { RawMaterialName = "0012", RawMaterialLocation = 12 });//豆豉细粒*/
foreach (var material in RawMaterialsInfo)
{


+ 10
- 0
BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs View File

@@ -28,8 +28,18 @@ namespace BPASmartClient.JXJFoodBigStation.Model
public int TrayCode { get { return _mTrayCode; } set { _mTrayCode = value; OnPropertyChanged(); } }
private int _mTrayCode;

/// <summary>
/// 配方类型是否为洗桶
/// </summary>
public string OrderType { get { return _mOrderType; } set { _mOrderType = value; OnPropertyChanged(); } }
private string _mOrderType;

/// <summary>
/// 配方类型是否为洗桶
/// </summary>
public bool IsWashingBarrel { get { return _mIsWashingBarrel; } set { _mIsWashingBarrel = value; OnPropertyChanged(); } }
private bool _mIsWashingBarrel;

/// <summary>
/// 原料数据
/// </summary>


+ 1
- 1
BPASmartClient.JXJFoodBigStation/View/RecipeInfosView.xaml View File

@@ -289,8 +289,8 @@
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,4,0,0">
<CheckBox Content="是否洗桶" FontSize="16" Foreground="#FF2AB2E7" Height="30" Width="180" Margin="0,0,10,0" IsChecked="{Binding IsWashingBarrel}"/>
<Button Content="添加原料" Width="180" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Cursor="Hand" Command="{Binding AddRecipe}" ></Button>
<Button Content="清除原料" Height="30" Width="180" Margin="0,0,10,0" Command="{Binding ClearRawMaterial}" Cursor="Hand"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="1" Margin="0,4,0,0" HorizontalAlignment="Center">
<Button Content="确认" Margin="0,0,10,0" Height="30" Width="180" Background="Transparent" BorderBrush="#FF2AB2E7" Foreground="#FF2AB2E7" Command="{Binding Comfirm}"></Button>


+ 97
- 17
BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml View File

@@ -226,36 +226,116 @@
Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="20" />
<RowDefinition Height="128" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="58" />
<RowDefinition Height="2" />
<RowDefinition Height="40" />
</Grid.RowDefinitions>

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

<TextBlock
Grid.Row="0"
Grid.ColumnSpan="2"
FontSize="14"
Margin="5,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#FF2AB2E7"
Text="配方信息" />
<TextBlock
Grid.Row="1"
Grid.Column="0"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontSize="18"
VerticalAlignment="Center"
FontSize="12"
Foreground="#FF2AB2E7"
Text="配方名称:" />
<TextBlock
Grid.Row="1"
Grid.Column="1"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="12"
Foreground="#FF2AB2E7"
Text="{Binding RecipeName}" />

<TextBlock
Grid.Row="1"
FontSize="16"
Margin="5,0,0,0"
VerticalAlignment="Top"
Grid.Row="2"
Grid.Column="0"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="12"
Foreground="#FF2AB2E7"
Text="配方信息:" />
Text="配方编号:" />

<ScrollViewer
<TextBlock
Grid.Row="2"
Grid.Column="1"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="12"
Foreground="#FF2AB2E7"
Text="{Binding RecipeCode}" />
<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="12"
Foreground="#FF2AB2E7"
Text="托盘编号:" />

<TextBlock
Grid.Row="3"
Grid.Column="1"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="12"
Foreground="#FF2AB2E7"
Text="{Binding TrayCode}" />

<TextBlock
Grid.Row="4"
Grid.Column="0"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="12"
Foreground="#FF2AB2E7"
Text="订单类型:" />

<TextBlock
Grid.Row="4"
Grid.Column="1"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="12"
Foreground="#FF2AB2E7"
Text="{Binding OrderType}" />
<!--<ScrollViewer
Grid.Row="5"
VerticalAlignment="Top"
Background="Transparent"
HorizontalScrollBarVisibility="Hidden"
@@ -299,12 +379,11 @@
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>


</ScrollViewer>
</ScrollViewer>-->

<Image
Grid.Row="3"
Grid.Row="6"
Grid.ColumnSpan="2"
Width="{Binding ElementName=tt, Path=ActualWidth}"
Height="2"
VerticalAlignment="Bottom"
@@ -313,7 +392,8 @@

<Grid
Name="gr"
Grid.Row="4"
Grid.Row="7"
Grid.ColumnSpan="2"
Height="30"
Margin="0,0,0,10"
VerticalAlignment="Bottom"


+ 105
- 22
BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml View File

@@ -448,34 +448,115 @@
Margin="5">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition Height="20" />
<RowDefinition Height="128" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="58" />
<RowDefinition Height="2" />
<RowDefinition Height="40" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Image
Grid.RowSpan="5"
Source="/BPASmartClient.CustomResource;component/Image/配方背景/竖背景框.png"
Stretch="Fill" />
Grid.RowSpan="8"
Grid.ColumnSpan="2"
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.Row="0"
Grid.ColumnSpan="2"
FontSize="14"
Margin="5,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#FF2AB2E7"
Text="配方信息" />

<TextBlock
Grid.Row="1"
FontSize="16"
Margin="5,0,0,0"
VerticalAlignment="Top"
Foreground="#FF2AB2E7"
Text="配方信息:" />
Grid.Row="1"
Grid.Column="0"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="12"
Foreground="#FF2AB2E7"
Text="配方名称:" />

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

<TextBlock
Grid.Row="2"
Grid.Column="0"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="12"
Foreground="#FF2AB2E7"
Text="配方编号:" />

<TextBlock
Grid.Row="2"
Grid.Column="1"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="12"
Foreground="#FF2AB2E7"
Text="{Binding RecipeCode}" />

<TextBlock
Grid.Row="3"
Grid.Column="0"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="12"
Foreground="#FF2AB2E7"
Text="托盘编号:" />

<TextBlock
Grid.Row="3"
Grid.Column="1"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="12"
Foreground="#FF2AB2E7"
Text="{Binding TrayCode}" />

<TextBlock
Grid.Row="4"
Grid.Column="0"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="12"
Foreground="#FF2AB2E7"
Text="订单类型:" />

<TextBlock
Grid.Row="4"
Grid.Column="1"
Margin="2,5,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="12"
Foreground="#FF2AB2E7"
Text="{Binding OrderType}" />

<!--<ScrollViewer
Grid.Row="2"
VerticalAlignment="Top"
Background="Transparent"
@@ -519,11 +600,12 @@
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</ScrollViewer>-->

<Image
Grid.Row="3"
Grid.Row="6"
Grid.ColumnSpan="2"
Width="{Binding ElementName=tt, Path=ActualWidth}"
Height="2"
VerticalAlignment="Bottom"
@@ -532,7 +614,8 @@

<Grid
Name="gr"
Grid.Row="4"
Grid.Row="7"
Grid.ColumnSpan="2"
Height="30"
Margin="0,0,0,10"
VerticalAlignment="Bottom"


+ 2
- 2
BPASmartClient.JXJFoodBigStation/View/SiemensRecipeSendDownView.xaml View File

@@ -455,8 +455,8 @@
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="3*"></ColumnDefinition>
<ColumnDefinition Width="7*"></ColumnDefinition>
</Grid.ColumnDefinitions>

<TextBlock


+ 0
- 1
BPASmartClient.JXJFoodBigStation/View/StockBinRawMaterialView.xaml View File

@@ -23,7 +23,6 @@
<pry:IcoButton
Margin="10"
Command="{Binding UpdateRawMaterial}"
IcoText="&#xe68e;"
Content="新增数据"
FontSize="28"
Foreground="Aqua"


+ 1
- 0
BPASmartClient.JXJFoodBigStation/ViewModel/ManualFlowViewModel.cs View File

@@ -47,6 +47,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
ClearAllRecipe = new RelayCommand(() =>
{
Json<RemoteRecipe>.Data.Recipes.Clear();
GVL_BigStation.SiemensSendRecipeStatus = 0;
});
ThreadManage.GetInstance().StartLong(new Action(() =>
{


+ 22
- 9
BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs View File

@@ -11,6 +11,8 @@ using BPASmartClient.JXJFoodBigStation.Model;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.JXJFoodBigStation.Model.Siemens;
using System.Windows.Forms;
using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.MessageShow;

namespace BPASmartClient.JXJFoodBigStation.ViewModel
{
@@ -29,7 +31,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
RecipeName = rm.RecipeName;
RecipeCode = rm.RecipeCode;
TrayCode = rm.TrayCode;
IsWashingBarrel = rm.IsWashingBarrel;
foreach (var item in rm.RawMaterial)
{
item.RawMaterialCount = (short)Array.FindIndex(ProcessControl.GetInstance.RawMaterialsInfo.ToArray(), p => p.RawMaterialName == item.RawMaterialName);
@@ -65,8 +67,18 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
var res = Json<LocalRecipe>.Data.Recipes.FirstOrDefault(p => p.RecipeCode == recipeCode);
if (res == null)
{
Json<LocalRecipe>.Data.Recipes.Add(new RecipeData { RecipeCode = recipeCode, RawMaterial= RawMaterialsInfo,RecipeName=RecipeName,TrayCode=TrayCode});
if (IsWashingBarrel)
{
Json<LocalRecipe>.Data.Recipes.Add(new RecipeData { RecipeCode = recipeCode,RecipeName = RecipeName, TrayCode = TrayCode, IsWashingBarrel = IsWashingBarrel });
if (RawMaterialsInfo.Count > 0)
NoticeDemoViewModel.OpenMsg(EnumPromptType.Info, App.MainWindow, "提示", $"订单类型为洗桶,不保存原料信息");
}
else
{
Json<LocalRecipe>.Data.Recipes.Add(new RecipeData { RecipeCode = recipeCode, RawMaterial = RawMaterialsInfo, RecipeName = RecipeName, TrayCode = TrayCode, IsWashingBarrel = IsWashingBarrel });
}
Json<LocalRecipe>.Save();
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"配方保存完成");
}
else
{
@@ -88,15 +100,16 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
}
bom.RecipeName = RecipeName;
bom.TrayCode = TrayCode;
bom.IsWashingBarrel = IsWashingBarrel;
if (IsWashingBarrel)
{
bom.RawMaterial.Clear();
}
Json<LocalRecipe>.Save();
ActionManage.GetInstance.Send("CloseRecipeInfosView");
}
});

ClearRawMaterial = new RelayCommand(() => {
RawMaterialsInfo.Clear();
});

RemoveRecipe = new RelayCommand<short>((index) => {
var res = RawMaterialsInfo.FirstOrDefault(p => p.RawMaterialCount == index);
if (res != null)
@@ -114,16 +127,16 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel

public int SelectIndex { get { return _mSelectIndex; } set { _mSelectIndex = value; OnPropertyChanged(); } }
private int _mSelectIndex;

public bool IsWashingBarrel { get { return _mIsWashingBarrel; } set { _mIsWashingBarrel = value; OnPropertyChanged(); } }
private bool _mIsWashingBarrel;

public RelayCommand ReturnPage { get; set; }

public RelayCommand AddRecipe { get; set; }

public RelayCommand Comfirm { get; set; }

public RelayCommand ClearRawMaterial { get; set; }

public RelayCommand<short> RemoveRecipe { get; set; }

public ObservableCollection<RawMaterial> RawMaterialsInfo { get; set; } = new ObservableCollection<RawMaterial>() ;


+ 0
- 1
BPASmartClient.JXJFoodBigStation/ViewModel/SiemensRecipeSendDownViewModel.cs View File

@@ -17,7 +17,6 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
public ObservableCollection<RecipeData> Recipes { get; set; } = Json<RemoteRecipe>.Data.Recipes;
public SiemensRecipeSendDownViewModel()
{
}
}
}

+ 4
- 0
BPASmartClient.JXJFoodBigStation/ViewModel/StockBinRawMaterialViewModel.cs View File

@@ -34,6 +34,10 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
SaveRawMaterialPara = new RelayCommand(() =>
{
Json<RawMaterialData>.Save();
foreach (var item in Json<RawMaterialData>.Data.RawMaterial)
{
MessageNotify.GetInstance.ShowUserLog($"料仓位置:"+ item.RawMaterialLocation+ ",物料编码:" + item.RawMaterialName);
}
MessageNotify.GetInstance.ShowUserLog($"原料与料仓对应关系保存成功");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"原料与料仓对应关系保存成功");
});


+ 7
- 1
BPASmartClient.JXJFoodSmallStation/App.xaml.cs View File

@@ -138,7 +138,13 @@ namespace BPASmartClient.JXJFoodSmallStation
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.SystemParView"
});
ParSet.Add(new SubMenumodel()
{
SubMenuName = "原料与料仓对应设置",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.StockBinRawMaterialView"
});
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe62d;",


+ 7
- 0
BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj View File

@@ -32,6 +32,9 @@
<Compile Update="View\ManualFlowView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="View\StockBinRawMaterialView.xaml.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>

<ItemGroup>
@@ -57,6 +60,10 @@
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\StockBinRawMaterialView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\SystemParView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>


+ 4
- 0
BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs View File

@@ -142,6 +142,10 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// 系统运行状态
/// </summary>
public static bool SystemRunStatus { get; set; } = false;
/// <summary>
/// 系统运行状态
/// </summary>
public static int Time { get; set; } = 1000;
#endregion
}
}

+ 15
- 0
BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/PlcReadAddressDB3.cs View File

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

namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
public class PlcReadAddressDB3
{
public bool[] VarBool { get; set; } =new bool[17];
public Single[] BarrelPos { get; set; } = new Single[8];
public bool[] IsAllowDosing { get; set; } = new bool[8];
}
}

+ 64
- 26
BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs View File

@@ -1,6 +1,7 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC;
using BPASmartClient.JXJFoodSmallStation.Model.RawMaterial;
using BPASmartClient.JXJFoodSmallStation.Model.Siemens;
using BPASmartClient.JXJFoodSmallStation.Model.WindSend;
using BPASmartClient.Modbus;
@@ -30,6 +31,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// 原料的名称和料仓的位置对应
/// </summary>
public Dictionary<string, short> RawMaterialsNamePos = new Dictionary<string, short>();
public ObservableCollection<RawMaterialStockBin> RawMaterialsInfo => Json<DevicePar>.Data.rawMaterialStockBin;
/// <summary>
/// 配方队列
/// </summary>
@@ -51,7 +53,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
public void Init()
{
testData();
for (int i = 0; i < 16; i++)
/*for (int i = 0; i < 16; i++)
{
if (DeviceInquire.GetInstance.GetDevice(i).DeviceName != null)
{
@@ -60,7 +62,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
RawMaterialsNamePos.Add(DeviceInquire.GetInstance.GetDevice(i).DeviceName, (short)DeviceInquire.GetInstance.GetDevice(i).deviceStatus.DeviceNum);
}
}
}
}*/
ActionManage.GetInstance.CancelRegister("SiemensRecipeRecive");
ActionManage.GetInstance.Register(new Action<object>((res) =>
{
@@ -88,6 +90,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
else
{
MessageNotify.GetInstance.ShowRunLog($"原料:{recipe.Material[i].Material_Name},不在配料表");
//MessageNotify.GetInstance.AlarmLog("配方名称与本地不符合");
}
}
@@ -170,6 +173,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
{
Json<RemoteRecipeDataColl>.Data.Recipes.Clear();
GVL_SmallStation.SiemensSendRecipeStatus = 0;

MessageNotify.GetInstance.ShowRunLog("系统流程复位,等待西门子重新下发订单");
}), "BPASystemReset",true);

@@ -347,7 +351,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}), "西门子配发下发流程处理", true);
ThreadManage.GetInstance().StartLong(new Action(() =>
{
if (!HKDevice.IsConnected)
if (HKDevice.IsConnected)
{
ManualOpen();
ManualClose();
@@ -380,6 +384,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
string address = "DB5.DBX" + (index / 8) + "." + (index % 8 - 1);
if (index == 8) address = "DB5.DBX0.7";
HKDevice.HK_PLC_S7.Write<bool>(address, true);
MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:{address},值:true");
}
}
else if (o.ToString().Contains("阻挡气缸"))
@@ -409,18 +414,22 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
else if (o.ToString().Contains("进料桶顶升气缸"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX3.6", false);//默认顶升
MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX3.6,值:false");
}
else if (o.ToString().Contains("出料桶顶升气缸1"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX3.7", true);
MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX3.7,值:true");
}
else if (o.ToString().Contains("出料桶顶升气缸2"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX4.0", true);
MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX4.0,值:true");
}
else if (o.ToString().Contains("出料桶顶升气缸3"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX4.1", true);
MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX4.1,值:true");
}
else if (o.ToString().Contains("托盘气缸1_1"))
{
@@ -455,6 +464,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
string address = "DB5.DBX" + (index / 8) + "." + (index % 8 - 1);
if (index == 8) address = "DB5.DBX0.7";
HKDevice.HK_PLC_S7.Write<bool>(address, false);
MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:{address},值:false");
}
}
else if (o.ToString().Contains("阻挡气缸"))
@@ -484,18 +494,22 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
else if (o.ToString().Contains("进料桶顶升气缸"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX3.6", true);
MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX3.6,值:true");
}
else if (o.ToString().Contains("出料桶顶升气缸1"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX3.7", false);
MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX3.7,值:false");
}
else if (o.ToString().Contains("出料桶顶升气缸2"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX4.0", false);
MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX4.0,值:false");
}
else if (o.ToString().Contains("出料桶顶升气缸3"))
{
HKDevice.HK_PLC_S7.Write("DB5.DBX4.1", false);
MessageNotify.GetInstance.ShowUserLog($"手动操作气缸,地址:DB5.DBX4.1,值:false");
}
else if (o.ToString().Contains("托盘气缸1_1"))
{
@@ -524,11 +538,11 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
if (HKDevice.IsConnected)
{
GVL_SmallStation.Station1HaveTray = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX0.7");//工站1 有货架
GVL_SmallStation.Station2HaveTray = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.0");//工站1 有货架
if (RTrig.GetInstance("WindSendDosingCompleToHKPLC").Start(GVL_SmallStation.WindSendDosingComple))
GVL_SmallStation.Station2HaveTray = HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.0");//工站2 有货架
if (GVL_SmallStation.WindSendDosingComple)
{
GVL_SmallStation.WindSendDosingComple = false;
HKDevice.HK_PLC_S7.Write<bool>("DB4.DBX1.7", true);
GVL_SmallStation.WindSendDosingComple = false;
MessageNotify.GetInstance.ShowRunLog("风送配料完成信号,发给产线plc信号");
}
if (HKDevice.HK_PLC_S7.Read<bool>("DB3.DBX1.1"))
@@ -787,10 +801,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
}
GVL_SmallStation.GetInstance.RecipeStatusID = 0;
RecipeQueueTray1.TryDequeue(out code);
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX440.1", false);
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true);
MessageNotify.GetInstance.ShowRunLog($"队列1,西门子取消订单完成,订单号:{code}");
while (SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2301.DBX440.1") == false)
{
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", false);
RecipeQueueTray1.TryDequeue(out code);
MessageNotify.GetInstance.ShowRunLog($"队列1,西门子取消订单完成,订单号:{code}");
}
}
else if (RecipeQueueTray2.Contains(code))
{
@@ -817,10 +834,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
MessageNotify.GetInstance.ShowRunLog($"AGV未到达工站前,未给plc下发配方,取消订单:{code}");
}
GVL_SmallStation.GetInstance.RecipeStatusID = 0;
RecipeQueueTray2.TryDequeue(out code);
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX440.1", false);
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true);
MessageNotify.GetInstance.ShowRunLog($"队列2,西门子取消订单完成,订单号:{code}");
while (SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2301.DBX440.1") == false)
{
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", false);
RecipeQueueTray2.TryDequeue(out code);
MessageNotify.GetInstance.ShowRunLog($"队列2,西门子取消订单完成,订单号:{code}");
}
}
GVL_SmallStation.Order_Cancel = false;
GVL_SmallStation.Order_CancelRecipeCode = "";
@@ -843,16 +863,22 @@ namespace BPASmartClient.JXJFoodSmallStation.Model

GVL_SmallStation.Order_Cancel = false;
GVL_SmallStation.Order_CancelRecipeCode = "";
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX440.1", false);
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true);
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true);
while (SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2201.DBX440.1") == false)
{
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", false);
}
}
}
else
{
GVL_SmallStation.Order_Cancel = false;
GVL_SmallStation.Order_CancelRecipeCode = "";
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX440.1", false);
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", true);
while (SiemensDevice.Siemens_PLC_S7.Read<bool>("DB2201.DBX440.1") == false)
{
SiemensDevice.Siemens_PLC_S7.Write("DB2201.DBX450.1", false);
}
MessageNotify.GetInstance.ShowRunLog($"西门子取消订单,但未找到订单:{code}");
}
}
@@ -1003,6 +1029,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
int i = GVL_SmallStation.GetInstance.DosingTray1Loc;
if (DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3)
{
Thread.Sleep(GVL_SmallStation.Time);
MessageNotify.GetInstance.ShowRunLog($"柔性味魔方,托盘1,配方:{recipeName},{i}号仓,配料完成");
int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i);
RemoteRecipes.ElementAt(index).RawMaterial.ElementAt(res).Laying_Off_Weight = DeviceInquire.GetInstance.GetDevice(i).deviceStatus.NowWeightFeedback;
@@ -1186,6 +1213,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
if (GVL_SmallStation.GetInstance.DosingTray2 == true && GVL_SmallStation.GetInstance.DosingTray1 == false && GVL_SmallStation.GetInstance.DosingTray2Loc > 0 && GVL_SmallStation.GetInstance.DosingTray2Loc < 16)
{
Thread.Sleep(GVL_SmallStation.Time);
int i = GVL_SmallStation.GetInstance.DosingTray2Loc;
if (RTrig.GetInstance("Tray2StatusDevice" + i).Start(DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3))
{
@@ -1274,19 +1302,29 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
}
}
private void testData()
public void testData()
{
RawMaterialsNamePos.Add("0051", 3);
RawMaterialsNamePos.Add("0052", 4);
RawMaterialsNamePos.Add("0054", 5);
RawMaterialsNamePos.Add("0057", 6);
RawMaterialsNamePos.Add("0050", 8);
RawMaterialsNamePos.Add("0048", 13);

RawMaterialsNamePos.Add("0036", 13);//I+G
RawMaterialsNamePos.Add("0037", 13);//味精
RawMaterialsNamePos.Add("0038", 13);//白糖
//RawMaterialsNamePos.Add("0051", 3);
//RawMaterialsNamePos.Add("0052", 4);
//RawMaterialsNamePos.Add("0054", 5);
//RawMaterialsNamePos.Add("0057", 6);
//RawMaterialsNamePos.Add("0050", 8);
//RawMaterialsNamePos.Add("0048", 13);

//RawMaterialsNamePos.Add("0036", 13);//I+G
//RawMaterialsNamePos.Add("0037", 13);//味精
//RawMaterialsNamePos.Add("0038", 13);//白糖
RawMaterialsNamePos.Clear();
foreach (var material in RawMaterialsInfo)
{
if (!string.IsNullOrEmpty(material.RawMaterialName))
{
if (!RawMaterialsNamePos.ContainsKey(material.RawMaterialName))
{
RawMaterialsNamePos.Add(material.RawMaterialName, (short)material.RawMaterialLocation);
}
}
}

}



+ 2
- 0
BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DevicePar.cs View File

@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;
using BPASmartClient.JXJFoodSmallStation.Model.Par;
using BPASmartClient.JXJFoodSmallStation.Model.RawMaterial;

namespace BPASmartClient.JXJFoodSmallStation.Model
{
@@ -14,5 +15,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
public ObservableCollection<DeviceParMode> deviceParModels { get; set; } = new ObservableCollection<DeviceParMode>();
public ConnectParMode deviceConnectPar { get { return _mdeviceConnectPar; } set { _mdeviceConnectPar = value; OnPropertyChanged(); } }
private ConnectParMode _mdeviceConnectPar = new ConnectParMode();
public ObservableCollection<RawMaterialStockBin> rawMaterialStockBin { get; set; } = new ObservableCollection<RawMaterialStockBin>();
}
}

+ 29
- 0
BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/RawMaterialStockBin.cs View File

@@ -0,0 +1,29 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodSmallStation.Model.RawMaterial
{
public class RawMaterialStockBin : ObservableObject
{

public short RawMaterialCount { get { return _mRawMaterialCount; } set { _mRawMaterialCount = value; OnPropertyChanged(); } }
private short _mRawMaterialCount;

/// <summary>
/// 原料名称
/// </summary>
public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } }
private string _mRawMaterialName;


/// <summary>
/// 原料对应料仓的位置
/// </summary>
public int RawMaterialLocation { get { return _mRawMaterialLocation; } set { _mRawMaterialLocation = value; OnPropertyChanged(); } }
private int _mRawMaterialLocation;
}
}

+ 39
- 5
BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml View File

@@ -94,7 +94,7 @@
Height="40"
Margin="5,0,5,0"
Command="{Binding SystemReset}"
Content="系统复位"
Content="PLC系统复位"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
@@ -112,10 +112,44 @@

</Grid>
<Grid Grid.Row="2">
<WrapPanel>
<TextBlock Text="心跳:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding Heartbeat}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
</WrapPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>

<WrapPanel>
<TextBlock Text="心跳:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding Heartbeat}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
</WrapPanel>
<WrapPanel Grid.Row="1">
<TextBlock Text="当前系统状态:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding OrderStatus}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
</WrapPanel>
<WrapPanel Grid.Row="2">
<TextBlock Text="柔性味魔方配料完成,延迟复位时间:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBox Text="{Binding time}" Width="150" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBox>
<TextBlock Text="ms" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<Button
Width="100"
Height="40"
Margin="5,0,5,0"
Command="{Binding TimeSet}"
Content="设置"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
</WrapPanel>
</Grid>
</Grid>
</Grid>
</UserControl>

+ 138
- 0
BPASmartClient.JXJFoodSmallStation/View/StockBinRawMaterialView.xaml View File

@@ -0,0 +1,138 @@
<UserControl x:Class="BPASmartClient.JXJFoodSmallStation.View.StockBinRawMaterialView"
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:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl.DataContext>
<vm:StockBinRawMaterialViewModel />
</UserControl.DataContext>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<!--#region 表格标题栏设置-->
<Grid>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
<pry:IcoButton
Margin="10"
Command="{Binding UpdateRawMaterial}"
Content="新增数据"
FontSize="28"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
Margin="10"
Command="{Binding SaveRawMaterialPara}"
Content="保存参数"
FontSize="28"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
</StackPanel>
</Grid>
<Grid
Grid.Row="1"
Margin="0,10,0,0"
Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBlock Text="序号" FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"/>
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
</Grid>
<TextBlock Grid.Column="1" FontSize="24" Text="料仓位置" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" />
<TextBlock Grid.Column="2" FontSize="24" Text="原料编号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" />
<TextBlock Grid.Column="3" FontSize="24" Text="编辑" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" />
</Grid>
<Grid Grid.Row="2">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" >
<ItemsControl ItemsSource="{Binding RawMaterialInfo}" Foreground="Aqua">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="gr" >
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid Grid.Column="0" Margin="5">
<TextBlock
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding RawMaterialCount}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="1" Margin="5">
<TextBox
Width="50"
FontSize="16"
TextAlignment="Center"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding RawMaterialLocation}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />

</Grid>
<Grid Grid.Column="2" Margin="5">
<TextBox
Width="50"
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding RawMaterialName}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="3">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<pry:IcoButton
Margin="3,4,4,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#11F53F62"
BorderThickness="0"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialLocation}"
Content="删除"
EnterBackground="#22F53F62"
Foreground="#FFF53F62"
IcoText="&#xe68e;"
Style="{StaticResource IcoButtonStyle}" />
</StackPanel>
</Grid>
</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" />
</Trigger>
</DataTemplate.Triggers>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.JXJFoodSmallStation/View/StockBinRawMaterialView.xaml.cs View File

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

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

+ 53
- 0
BPASmartClient.JXJFoodSmallStation/ViewModel/ManualFlowViewModel.cs View File

@@ -16,6 +16,7 @@ using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC;
using System.Threading;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using BPASmartClient.CustomResource.Pages.Model;

namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
@@ -23,47 +24,93 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
public ManualFlowViewModel()
{
time = GVL_SmallStation.Time;
Test1Command = new RelayCommand(() =>
{
GVL_SmallStation.AGV_PutTray1Finish = true;
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,AGV送托盘完成");
});
Test2Command = new RelayCommand(() =>
{
GVL_SmallStation.WindSendDosingComple = true;
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,粉料仓配料完成");
});
Test3Command = new RelayCommand(() =>
{
GVL_SmallStation.AGV_GetTray1Finish = true;
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,AGV取托盘完成");
});
Test4Command = new RelayCommand(() =>
{
GVL_SmallStation.CylinderReset = true;
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,气缸收紧错位复位");
});
Test5Command = new RelayCommand(() =>
{
GVL_SmallStation.WindSendAllowAGVPutGet = true;
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,粉料仓提升到位");
});
Test6Command = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("AGVPutTrayFinish");
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,AGV放货架流程完成");
});
CLearRecipeInfo = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("CLearRecipeInfo");
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,配方清零");
});
SystemReset = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("ManualSystemReset");
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,PLC系统复位");
});
BPAResetCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("BPASystemReset");
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,上位机初始化");
});
ThreadManage.GetInstance().StartLong(new Action(() =>
{
Heartbeat = GVL_SmallStation.GetInstance.HeartBeatFromPlc;
switch (GVL_SmallStation.SiemensSendRecipeStatus)
{
case 0:
OrderStatus = "初始状态";
break;
case 1:
OrderStatus = "向西门子请求配方";
break;
case 2:
OrderStatus = "上位机接收到配方";
break;
case 3:
OrderStatus = "西门子确认上位机接收到配方";
break;
case 4:
OrderStatus = "上位机向西门子请求配料";
break;
case 5:
OrderStatus = "西门子确认配料";
break;
case 6:
OrderStatus = "上位机将配方进行配料";
break;
case 7:
OrderStatus = "配料完成";
break;
default:
OrderStatus = "无意义";
break;
}
Thread.Sleep(100);
}), "流程手动设备状态读取",true);
TimeSet = new RelayCommand(() =>
{
GVL_SmallStation.Time = time;
MessageNotify.GetInstance.ShowUserLog($"设置柔性味魔方复位时间:{time}s");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"{time.ToString()}:设置成功!");
});
}
public RelayCommand Test1Command { get; set; }
public RelayCommand Test2Command { get; set; }
@@ -71,9 +118,15 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
public RelayCommand Test4Command { get; set; }
public RelayCommand Test5Command { get; set; }
public RelayCommand Test6Command { get; set; }
public RelayCommand TimeSet { get; set; }
public static bool Heartbeat { get { return _mHeartbeat; } set { _mHeartbeat = value; OnStaticPropertyChanged(); } }
private static bool _mHeartbeat;

public int time { get { return _mtime; } set { _mtime = value; OnStaticPropertyChanged(); } }
private int _mtime;
public static string OrderStatus { get { return _mOrderStatus; } set { _mOrderStatus = value; OnStaticPropertyChanged(); } }
private static string _mOrderStatus = "无意义";
public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged;
public static void OnStaticPropertyChanged([CallerMemberName] string PropName = "")
{


+ 55
- 0
BPASmartClient.JXJFoodSmallStation/ViewModel/StockBinRawMaterialViewModel.cs View File

@@ -0,0 +1,55 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.Helper;
using BPASmartClient.JXJFoodSmallStation.Model;
using BPASmartClient.JXJFoodSmallStation.Model.RawMaterial;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
public class StockBinRawMaterialViewModel : ObservableObject
{
public StockBinRawMaterialViewModel()
{
RawMaterialInfo = Json<DevicePar>.Data.rawMaterialStockBin;
RemoveCommand = new RelayCommand<Object>((loc) =>
{
if (loc is int pos)
{
var res = RawMaterialInfo.FirstOrDefault(p => p.RawMaterialLocation == pos);
if (res != null) RawMaterialInfo.Remove(res);
}
});
SaveRawMaterialPara = new RelayCommand(() =>
{
Json<DevicePar>.Save();
ProcessControl.GetInstance.testData();
foreach (var item in Json<DevicePar>.Data.rawMaterialStockBin)
{
MessageNotify.GetInstance.ShowUserLog($"料仓位置:"+ item.RawMaterialLocation+ ",物料编码:" + item.RawMaterialName);
}
MessageNotify.GetInstance.ShowUserLog($"原料与料仓对应关系保存成功");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"原料与料仓对应关系保存成功");
});
UpdateRawMaterial = new RelayCommand(() =>
{
RawMaterialInfo.Add(new RawMaterialStockBin() { RawMaterialCount = (short)(RawMaterialInfo.Count + 1)});
});
}
public ObservableCollection<RawMaterialStockBin> RawMaterialInfo { get; set; } = new ObservableCollection<RawMaterialStockBin>();
public RelayCommand<Object> RemoveCommand { get; set; }
public RelayCommand SaveRawMaterialPara { get; set; }
public RelayCommand UpdateRawMaterial { get; set; }
}
}

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

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

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



+ 40
- 29
BPASmartClient.JakaRobot/JaKaHelper.cs View File

@@ -1,4 +1,5 @@
using BPASmartClient.Message;
using BPASmartClient.Helper;
using BPASmartClient.Message;
using System.Text;

namespace BPASmartClient.JakaRobot
@@ -72,44 +73,50 @@ namespace BPASmartClient.JakaRobot
//private JaKaHelper() { }
public bool IsIdle { get; set; } = false;
public bool IsConnected { get { return login; } }
public bool IsDeviceFirstInit { get; set; }

public void Connect(string ip)
{
bool ErrorFlag = false;
while (rshd == -1 || login == false)
ThreadManage.GetInstance().StartLong(new Action(() =>
{
try
if (rshd == -1 || login == false)
{
jakaAPI.create_handler(ip.ToCharArray(), ref rshd);

login = true;
try
{
jakaAPI.create_handler(ip.ToCharArray(), ref rshd);
login = true;

}
catch (Exception ex)
{
if (!ErrorFlag)
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx(ex.ToString());
ErrorFlag = true;
login = false;
if (!ErrorFlag)
{
MessageLog.GetInstance.ShowEx(ex.ToString());
ErrorFlag = true;
login = false;
}
Thread.Sleep(3000);
}
Thread.Sleep(3000);
}
}
if (login)
{
try
{
Power_On();//打开机器人电源
Thread.Sleep(1000);
Enable_robot();//机器人上使能
MessageLog.GetInstance.Show("机器人已上电使能");
}
catch (Exception ex)
}
if (login && IsDeviceFirstInit==false)
{
MessageLog.GetInstance.ShowEx("机器人未完成上电和使能");
try
{
Power_On();//打开机器人电源
Thread.Sleep(1000);
Enable_robot();//机器人上使能
IsDeviceFirstInit = true;
MessageLog.GetInstance.Show("机器人已上电使能");
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx("机器人未完成上电和使能");
}
}
}
Thread.Sleep(5000);
}), $"节卡机器人连接", true);
}
public void Power_On()
{
@@ -319,13 +326,14 @@ namespace BPASmartClient.JakaRobot
try
{
//加载
file = Programname.ToCharArray();
p: file = Programname.ToCharArray();
MessageLog.GetInstance.Show($"调用文件名:{Programname}");
status = new JKTYPE.ProgramState();
jakaAPI.get_program_state(ref rshd, ref status);
if (status != JKTYPE.ProgramState.PROGRAM_IDLE)
{
MessageLog.GetInstance.Show($"程序运行中,无法加载程序!!!");
goto p;
}
else
{
@@ -336,11 +344,13 @@ namespace BPASmartClient.JakaRobot
else
{
MessageLog.GetInstance.Show($"加载程序失败!!!");
goto p;
}
}
if (status == JKTYPE.ProgramState.PROGRAM_RUNNING)
{
MessageLog.GetInstance.Show($"程序处于已处于启动状态!!!");
goto p;
}
else if (status == JKTYPE.ProgramState.PROGRAM_IDLE)
{
@@ -349,6 +359,7 @@ namespace BPASmartClient.JakaRobot
if (jakafile.Length == 0)
{
MessageLog.GetInstance.Show($"未加载程序,无法运行!!!");
goto p;
}
else
{


+ 14
- 0
BPASmartClient.MilkTeaCube/BPASmartClient.MilkTeaCube.csproj View File

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

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

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

</Project>

+ 90
- 0
BPASmartClient.MilkTeaCube/MilkTeaCubeMachine.cs View File

@@ -0,0 +1,90 @@
using BPASmartClient.Peripheral;
using System;
using BPASmartClient.Modbus;
using BPASmartClient.Helper;
using System.Threading;
using BPASmartClient.Model.奶茶味魔方;
using BPASmartClient.EventBus;
using static BPASmartClient.EventBus.EventBus;

namespace BPASmartClient.MilkTeaCube
{
public class MilkTeaCubeMachine: BasePeripheral
{
public ModbusTcp modbus =new ModbusTcp();
public override void Init()
{
modbus.ModbusTcpConnect(communicationPar.IPAddress);
ThreadManage.GetInstance().StartLong(new Action(() =>
{
IsConnected = modbus.Connected;
if (!IsConnected) IsWork = false;
if (IsConnected)
{
IsWork = true;
if (status != null)
{
var a = modbus.Read("LB0");
var b = modbus.Read("LB13");
if (a is bool[] a1 && b is bool[] b1)
{
SetStatus("Get_MilkTeaCubeStatus", a1[0]);
SetStatus("Get_MilkTeaCubeDosingStatus", b1[0]);
}
}
Thread.Sleep(500);
}
Thread.Sleep(1000);
}), $"奶茶味魔方设备连接", true);
EventBus.EventBus.GetInstance().Subscribe<MilkTea_MakeMilkTeaEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
if (@event == null) return;
var par = @event as MilkTea_MakeMilkTeaEvent;
switch (par?.TagName)
{
case "Start":
modbus.Write("LB14",true);
break;
case "ParameterSet":
modbus.Write("LB14", false);
Thread.Sleep(500);
modbus.Write("LW1002", par.MilkTeaKind[0]);
modbus.Write("LW1006", par.MilkTeaKind[1]);
modbus.Write("LW1008", par.MilkTeaKind[2]);
modbus.Write("LW1010", par.MilkTeaKind[3]);
modbus.Write("LW1012", par.MilkTeaKind[4]);
modbus.Write("LW1014", par.MilkTeaKind[5]);
modbus.Write("LW1016", par.MilkTeaKind[6]);
modbus.Write("LW1018", par.MilkTeaKind[7]);
modbus.Write("LW1020", par.MilkTeaKind[8]);
modbus.Write("LW1022", par.MilkTeaKind[9]);
modbus.Write("LW1024", par.MilkTeaKind[10]);
modbus.Write("LW1026", par.MilkTeaKind[11]);
break;
case "StartSignReset":
modbus.Write("LB14", false);
break;
default:
break;
}
});
}
public override void Start()
{
}

public override void Stop()
{
}

public override void WriteData(string address, object value)
{

}

protected override void InitStatus()
{
}
}
}

+ 9
- 0
BPASmartClient.MilkTeaCubeHelper/BPASmartClient.MilkTeaCubeHelper.csproj View File

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

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

</Project>

+ 8
- 0
BPASmartClient.MilkTeaCubeHelper/Class1.cs View File

@@ -0,0 +1,8 @@
using System;

namespace BPASmartClient.MilkTeaCubeHelper
{
public class Class1
{
}
}

+ 13
- 0
BPASmartClient.Model/奶茶味魔方/MilkTeaCubeEvent.cs View File

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

namespace BPASmartClient.Model.奶茶味魔方
{
public class MilkTea_MakeMilkTeaEvent : BaseEvent
{
public ushort[] MilkTeaKind { get; set; } = new ushort[12];
}
}

+ 10
- 0
BPASmartClient.Model/电夹爪/GripperEvent.cs View File

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

namespace BPASmartClient.Model.电夹爪
{
public class Wrtie : WriteGripper { }
}

+ 14
- 0
BPASmartClient.Model/电夹爪/WriteGripper.cs View File

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

namespace BPASmartClient.Model.电夹爪
{
public class WriteGripper:BaseEvent
{
public string CH_Number { get; set; }
public string PWMOutput { get; set; }
}
}

+ 81
- 26
BPASmartClient.Model/节卡机器人/JakaModel.cs View File

@@ -8,31 +8,82 @@ namespace BPASmartClient.Model
{
public class JakaModel
{
public const string SENCE_取杯 = "10000";
public const string SENCE_放杯位检测 = "10100";
public const string SENCE_取杯检测 = "11000";

public const string SENCE_接咖啡 = "12000";
public const string SENCE_接果汁1 = "12001";
public const string SENCE_接果汁2 = "12002";
public const string SENCE_接果汁3 = "12003";
public const string SENCE_接果汁4 = "12004";
public const string SENCE_接茶 = "12005";
public const string SENCE_接水 = "12006";
public const string SENCE_接茶_接水 = "12007";

public const string SENCE_放咖啡杯 = "13000";//接饮料位---放饮料过渡位
public const string SENCE_放果汁杯1 = "13001";
public const string SENCE_放果汁杯2 = "13002";
public const string SENCE_放果汁杯3 = "13003";
public const string SENCE_放果汁杯4 = "13004";
public const string SENCE_放茶水杯 = "13005";

public const string SENCE_放杯 = "14000";//放杯过渡位到-放杯

public const string SENCE_放杯检测 = "15000";

public const string SENCE_初始位 = "20000";
public const string SENCE_初始位 = "1000";

public const string SENCE_初始位_取杯位 = "1010";

public const string SENCE_取杯位_取杯放杯检测位 = "1011";

public const string SENCE_取杯放杯检测位_取杯位 = "1012";

public const string SENCE_取杯位_接咖啡位 = "1020";

public const string SENCE_取杯位_接奶茶位 = "1021";

public const string SENCE_等奶茶_接奶茶位 = "1022";

public const string SENCE_接咖啡位_放咖啡位 = "1030";

public const string SENCE_接奶茶位_放奶茶位 = "1031";

public const string SENCE_落杯 = "1100";

public const string SENCE_初始位_取杯位检测 = "1200";

public const string SENCE_取杯位检测_取杯位 = "1300";

public const string SENCE_取杯位_接咖啡 = "1400";

public const string SENCE_取杯位_接奶茶 = "1500";

public const string SENCE_初始位_放杯位检测 = "1600";

public const string SENCE_放杯位检测_接咖啡 = "1610";

public const string SENCE_放杯位检测_接奶茶 = "1620";

public const string SENCE_接咖啡_放杯位 = "1700";

public const string SENCE_接奶茶_放杯位 = "1800";

public const string SENCE_异常回初始位 = "1900";

public const string SENCE_接咖啡_初始位 = "1910";

public const string SENCE_接奶茶_初始位 = "1920";

public const string SENCE_放杯位_初始位 = "2000";



public const string SENCE_初始位_落杯位 = "100";

public const string SENCE_落杯位_接咖啡位 = "110";

public const string SENCE_接咖啡位_初始位 = "120";

public const string SENCE_落杯位_接奶茶等待位 = "150";

public const string SENCE_接奶茶等待位_初始位 = "160";


public const string SENCE_接咖啡_放咖啡杯 = "";
public const string SENCE_接水 = "";
public const string SENCE_放茶水杯 = "";
public const string SENCE_接茶_接水 = "";
public const string SENCE_接果汁1 = "";
public const string SENCE_接果汁2 = "";
public const string SENCE_接果汁3 = "";
public const string SENCE_接果汁4 = "";
public const string SENCE_放果汁杯1 = "";
public const string SENCE_放果汁杯2 = "";
public const string SENCE_放果汁杯3 = "";
public const string SENCE_放果汁杯4 = "";
public const string SENCE_取杯检测 = "";
public const string SENCE_放杯 = "";
public const string SENCE_放杯检测 = "";
public const string SENCE_接茶 = "";

}

public class WriteJaka : BaseEvent
@@ -48,6 +99,10 @@ namespace BPASmartClient.Model
public ushort Length { get; set; }
public object ReadPar { get; set; }
}

public enum Kind:int
{
咖啡 = 1,
奶茶 = 2
}
}


+ 265
- 168
BPASmartClient.MorkBF/Control_MorkBF.cs View File

@@ -37,7 +37,7 @@ namespace BPASmartClient.MorkBF
ActionManage.GetInstance.Register(new Action(() =>
{
GlobalFoodMenu.LocalFoodMenus.Clear();
if(BPASmartClient.Helper.Json<LocalFryPotMessage>.Data.FryPotMessage.Count>0)
if (BPASmartClient.Helper.Json<LocalFryPotMessage>.Data.FryPotMessage.Count > 0)
{
foreach (var item in BPASmartClient.Helper.Json<LocalFryPotMessage>.Data.FryPotMessage)
{
@@ -50,7 +50,8 @@ namespace BPASmartClient.MorkBF
DataParse();//数据解析
ScreenDataServer();//大屏数据上报
ActionManage.GetInstance.Send("更新菜单");
//ThreadManage.GetInstance().Start(FirePot1_Process, "炒锅1流程");
ThreadManage.GetInstance().Start(FirePot1_Process, "炒锅1流程");
ThreadManage.GetInstance().Start(FirePot2_Process, "炒锅2流程");
DeviceProcessLogShow("MORKF 设备初始化完成");
}

@@ -97,23 +98,26 @@ namespace BPASmartClient.MorkBF
private void CommandRegist()
{
#region 炒锅
ActionManage.GetInstance.Register(FirePot_SetFireGear, "FirePot_SetFireGear");//炒锅设定加热挡位
ActionManage.GetInstance.Register(FirePot_SetFireGear, "FirePot_SetFireGear");//炒锅设定加热挡位1-5
ActionManage.GetInstance.Register(FirePot_SetStirGear, "FirePot_SetStirGear");//炒锅设定搅拌挡位1-5
ActionManage.GetInstance.Register(FirePot_SetTurnSpeed, "FirePot_SetTurnSpeed");//炒锅翻转速度0-800
ActionManage.GetInstance.Register(FirePot_SetPotAngle, "FirePot_SetPotAngle");//设定炒锅角度挡位1-4
ActionManage.GetInstance.Register(FirePot_StartPassWay, "FirePot_StartPassWay");//通道出料需求值+启动

ActionManage.GetInstance.Register(FirePot_StartFire, "FirePot_StartFire");//炒锅加热启动
ActionManage.GetInstance.Register(FirePot_StartFire, "FirePot_StopFire");//炒锅关闭加热
ActionManage.GetInstance.Register(FirePot_SetStirGear, "FirePot_SetStirGear");//炒锅设定搅拌挡位
ActionManage.GetInstance.Register(FirePot_StartStir, "FirePot_StartStir");//炒锅搅拌启动
ActionManage.GetInstance.Register(FirePot_StartStir, "FirePot_StopStir");//炒锅搅拌停止
ActionManage.GetInstance.Register(FirePot_SetTurnSpeed, "FirePot_SetTurnSpeed");//炒锅翻转频率设定
ActionManage.GetInstance.Register(FirePot_SetPotAngle, "FirePot_SetPotAngle");//设定炒锅角度
ActionManage.GetInstance.Register(FirePot_StartPassWay, "FirePot_StartPassWay");//炒锅翻转频率设定

ActionManage.GetInstance.Register(FirePot_Reset, "FirePot_Reset");//复位;
ActionManage.GetInstance.Register(FirePot_PotGotoOrigin, "FirePot_PotGotoOrigin");//炒锅回原点
ActionManage.GetInstance.Register(FirePot_PotGotoInFoodPosition, "FirePot_PotGotoInFoodPosition");//炒锅去投料位置
ActionManage.GetInstance.Register(FirePot_StartOutFood, "FirePot_StartOutFood");//出餐启动
ActionManage.GetInstance.Register(FirePot_Clean, "FirePot_Clean");//清洗

ActionManage.GetInstance.Register(FirePot_Reset, "FirePot_Reset");//复位;
ActionManage.GetInstance.Register(FirePot_StartPumpWater, "FirePot_StartPumpWater");//抽水启动
ActionManage.GetInstance.Register(FirePot_StartPumpWater, "FirePot_StopPumpWater");//抽水关闭
ActionManage.GetInstance.Register(FirePot_PotGotoInFoodPosition, "FirePot_PotGotoInFoodPosition");//炒锅去投料位置

ActionManage.GetInstance.Register(FirePot_PushReach, "FirePot_PushReach");//推杆伸出
ActionManage.GetInstance.Register(FirePot_PushRetract, "FirePot_PushRetract");//推杆缩回
ActionManage.GetInstance.Register(FirePot_PotForward, "FirePot_PotForward");//翻转正转
@@ -129,12 +133,11 @@ namespace BPASmartClient.MorkBF

public override void MainTask()
{
if(morkBF.RobotActinQueue.Count>0&&! morkBF.Robot_Start)//机器人启动
{
if( morkBF.RobotActinQueue.TryDequeue(out RobotAction_Pot robotAction))
{
morkBF.Robot_IsBusy =true;
morkBF.Robot_IsBusy = true;
RobotProcess(robotAction);
}
}
@@ -142,11 +145,10 @@ namespace BPASmartClient.MorkBF

private void FirePot1_Process()
{
if (morkBF.FirePan1_Order.Count > 0 && morkBF.FirePot1_InitCompleted && morkBF.FirePot2_IsAuto && !morkBF.FirePan1_Busy)
if (morkBF.FirePan1_Order.Count > 0 && morkBF.FryPan1_InitComplete && morkBF.FryPan1_ManualOrAutoMode && !morkBF.FirePan1_Busy)
{
if (morkBF.FirePan1_Order.TryDequeue(out FryPotMessages result))
{

morkBF.FirePan1_Busy = true;
morkBF.FryPot1_CurrentProcess = result.fryPotProcesses;
foreach (var item in result.fryPotProcesses)
@@ -178,17 +180,56 @@ namespace BPASmartClient.MorkBF
}
}
FirePot_StartFire(new object[] { 1, false });//关火
Thread.Sleep(result.FryOffStirTime*1000);//关火翻炒时间
Thread.Sleep(result.FryOffStirTime * 1000);//关火翻炒时间
FirePot_StartStir(new object[] { 1, false });//关闭搅拌
Message.MessageLog.GetInstance.Show($"炒锅1炒制{result.GoodName}完成");

}
}
}

private void FirePot2_Process()
{
if (morkBF.FirePan2_Order.Count > 0 && morkBF.FryPan2_InitComplete && morkBF.FryPan2_ManualOrAutoMode && !morkBF.FirePan2_Busy)
{
if (morkBF.FirePan2_Order.TryDequeue(out FryPotMessages result))
{
morkBF.FirePan2_Busy = true;
morkBF.FryPot2_CurrentProcess = result.fryPotProcesses;
foreach (var item in result.fryPotProcesses)
{
switch (item.fryActions)
{
case FryAction.冷锅加热:
FirePot_PotPerHeat(item, 2);
MessageLog.GetInstance.Show("炒锅2---冷锅加热完成");
break;
case FryAction.热油:
FirePot_HeatOil(item, 2);
MessageLog.GetInstance.Show("炒锅2---热油完成");
break;
case FryAction.机器人加调料:
FirePot_RobotGetSeasoning(item, 2);
MessageLog.GetInstance.Show("炒锅2---机器人加调料完成");
break;
case FryAction.通道出调料:
FirePot_PasswayOutSeasoning(item, 2);
MessageLog.GetInstance.Show("炒锅2---通道出调料完成");
break;
case FryAction.炒制菜品:
FirePot_FryFood(item, 2);
MessageLog.GetInstance.Show("炒锅2---炒制菜品完成");
break;
default:
break;
}
}
FirePot_StartFire(new object[] { 1, false });//关火
Thread.Sleep(result.FryOffStirTime * 1000);//关火翻炒时间
FirePot_StartStir(new object[] { 1, false });//关闭搅拌
Message.MessageLog.GetInstance.Show($"炒锅1炒制{result.GoodName}完成");

}
}
}


@@ -223,7 +264,7 @@ namespace BPASmartClient.MorkBF
private void FirePot_PotPerHeat(FryPotProcess item,int i)
{
bool isRobotWork = false;
FirePot_SetFireGear(new object[]{ i, item.FryGear});//设定加热挡位
FirePot_StartFire(new object[] { i, true });
isRobotWork = IsRobotNextWork(i,item.FryTime);//下个流程动作是否需要机器人
@@ -318,7 +359,7 @@ namespace BPASmartClient.MorkBF
{
Thread.Sleep(300);
}
if((int)robotAction.subTask1>0&& (int)robotAction.subTask1<16)//任务1
if ((int)robotAction.subTask1 > 0 && (int)robotAction.subTask1 < 16)//任务1
{
Robot_Write("GI1", (int)robotAction.subTask1);
Thread.Sleep(1000);
@@ -327,7 +368,7 @@ namespace BPASmartClient.MorkBF
Thread.Sleep(300);
}
}
if((int)robotAction.subTask1>15) //出餐
if ((int)robotAction.subTask1 > 15) //出餐
{

}
@@ -368,104 +409,85 @@ namespace BPASmartClient.MorkBF
MessageLog.GetInstance.Show($"机器人完成[{robotAction.MainTask.ToString()}]任务");
}

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

}
}),0);

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

morkBF.FryPan1_InitComplete = values[0];
morkBF.FryPan1_ManualOrAutoMode = values[1];
morkBF.FryPan1_EStop = values[2];
morkBF.FryPan1_InPosition1 = values[3];
morkBF.FryPan1_InPosition2 = values[4];
morkBF.FryPan1_InPosition3 = values[5];
morkBF.FryPan1_InPosition4 = values[6];
morkBF.FryPan1_InPositionUnload = values[7];
morkBF.FryPan1_InPositionload = values[8];
morkBF.FryPan1_InPositionWashPot = values[9];
morkBF.FryPan1_UnloadFinishCH1 = values[10];
morkBF.FryPan1_UnloadFinishCH2 = values[11];
morkBF.FryPan1_UnloadFinishCH3 = values[12];
morkBF.FryPan1_UnloadFinishCH4 = values[13];
morkBF.FryPan1_UnloadFinishCH5 = values[14];
morkBF.FryPan1_UnloadFinishCH6 = values[15];
morkBF.FryPan1_UnloadFinishCH7 = values[16];
morkBF.FryPan1_UnloadFinishCH8 = values[17];
}
}), 0);

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

}
}), 0);
}),0);

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

morkBF.FryPan1_TemperatureNow = values[0];
morkBF.FryPan1_MixingSpeedNow = values[1];
morkBF.FryPan1_FryAngle = values[2];
morkBF.FryPan1_HeatingGearNow = values[3];
}
}), 0);

GetStatus("VW2250", new Action<object>((o) =>
GetStatus("M40.0", new Action<object>((o) =>
{
if (o == null) return;
if (o is int[] values && values.Length == 1)
if (o is bool[] values && values.Length == 18)
{
dataReport.FirePot1_PotState = values[0];
morkBF.FryPan2_InitComplete = values[0];
morkBF.FryPan2_ManualOrAutoMode = values[1];
morkBF.FryPan2_EStop = values[2];
morkBF.FryPan2_InPosition1 = values[3];
morkBF.FryPan2_InPosition2 = values[4];
morkBF.FryPan2_InPosition3 = values[5];
morkBF.FryPan2_InPosition4 = values[6];
morkBF.FryPan2_InPositionUnload = values[7];
morkBF.FryPan2_InPositionload = values[8];
morkBF.FryPan2_InPositionWashPot = values[9];
morkBF.FryPan2_UnloadFinishCH1 = values[10];
morkBF.FryPan2_UnloadFinishCH2 = values[11];
morkBF.FryPan2_UnloadFinishCH3 = values[12];
morkBF.FryPan2_UnloadFinishCH4 = values[13];
morkBF.FryPan2_UnloadFinishCH5 = values[14];
morkBF.FryPan2_UnloadFinishCH6 = values[15];
morkBF.FryPan2_UnloadFinishCH7 = values[16];
morkBF.FryPan2_UnloadFinishCH8 = values[17];
}
}), 1);
GetStatus("VW2350", new Action<object>((o) =>

GetStatus("VW200", new Action<object>((o) =>
{
if (o == null) return;
if (o is int[] values && values.Length == 1)
if (o is short[] values && values.Length == 4)
{
dataReport.FirePot2_PotState = values[0];
morkBF.FryPan2_TemperatureNow = values[0];
morkBF.FryPan2_MixingSpeedNow = values[1];
morkBF.FryPan2_FryAngle = values[2];
morkBF.FryPan2_HeatingGearNow = values[3];
}
}), 1);

}

public override void ResetProgram()
@@ -538,133 +560,130 @@ namespace BPASmartClient.MorkBF
Thread.Sleep(200);
}
/// <summary>
/// 炒锅1加热启停
/// 炒锅1设置搅拌挡位
/// </summary>
/// <param name="b"></param>
private void FirePot_StartFire(object[] o)
/// <param name="o"></param>
private void FirePot_SetStirGear(object[] o)
{
if (o == null) return;
if (o.Length == 2 && o[0] is int fryNo && o[1] is bool value)
if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
{
if (fryNo == 1)
{
FirePot1_Write("M10.0", value);
FirePot1_Write("VW102", (ushort)value);
}
else if (fryNo == 2)
{
FirePot2_Write("M10.0", value);
FirePot2_Write("VW102", (ushort)value);
}
}
Thread.Sleep(200);
}
}
/// <summary>
/// 炒锅1设置搅拌挡位
/// 设置炒锅翻转速度
/// </summary>
/// <param name="o"></param>
private void FirePot_SetStirGear(object[] o)
private void FirePot_SetTurnSpeed(object[] o)
{
if (o == null) return;
if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
{
if (fryNo == 1)
{
FirePot1_Write("VW102", (ushort)value);
FirePot1_Write("VW104", (ushort)value);
}
else if (fryNo == 2)
{
FirePot2_Write("VW102", (ushort)value);
FirePot2_Write("VW104", (ushort)value);
}
}
Thread.Sleep(200);
}
/// <summary>
/// 炒锅1搅拌启停
/// 设定炒锅角度
/// </summary>
/// <param name="o"></param>
private void FirePot_StartStir(object[] o)
private void FirePot_SetPotAngle(object[] o)
{
if (o == null) return;
if (o.Length == 2 && o[0] is int fryNo && o[1] is bool value)
if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
{
if (fryNo == 1)
{
FirePot1_Write("M10.1", value);
FirePot1_Write("VW106", (ushort)value);
}
else if (fryNo == 2)
{
FirePot2_Write("M10.1", value);
FirePot2_Write("VW106", (ushort)value);
}
}
Thread.Sleep(200);
}
/// <summary>
/// 设置炒锅1翻转速度
/// 通道出料启动
/// </summary>
/// <param name="o"></param>
private void FirePot_SetTurnSpeed(object[] o)
private void FirePot_StartPassWay(object[] o)
{
if (o == null) return;
if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
if (o.Length == 3 && o[0] is int fryNo && o[1] is int value1 && o[2] is int value2)
{
if (fryNo == 1)
{
FirePot1_Write("VW104", (ushort)value);
FirePot1_Write(morkBF.Fire_PasswayValue[value1], (ushort)value2);//写入需求值
Thread.Sleep(200);
FirePot1_Write(morkBF.Fire_PasswayWrite[value1], true);//启动通道
}
else if (fryNo == 2)
{
FirePot2_Write("VW104", (ushort)value);
FirePot2_Write(morkBF.Fire_PasswayValue[value1], (ushort)value2);
Thread.Sleep(200);
FirePot2_Write(morkBF.Fire_PasswayWrite[value1], true);
}
}
Thread.Sleep(200);
}
/// <summary>
/// 设定炒锅角度
/// 炒锅1加热启停
/// </summary>
/// <param name="o"></param>
private void FirePot_SetPotAngle(object[] o)
/// <param name="b"></param>
private void FirePot_StartFire(object[] o)
{
if (o == null) return;
if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
if (o.Length == 2 && o[0] is int fryNo && o[1] is bool value)
{
if (fryNo == 1)
{
FirePot1_Write("VW106", (ushort)value);
FirePot1_Write("M10.0", value);
}
else if (fryNo == 2)
{
FirePot2_Write("VW106", (ushort)value);
FirePot2_Write("M10.0", value);
}
}
Thread.Sleep(200);
}
}
/// <summary>
/// 通道出料启动
/// 炒锅搅拌启停
/// </summary>
/// <param name="o"></param>
private void FirePot_StartPassWay(object[] o)
private void FirePot_StartStir(object[] o)
{
if (o == null) return;
if (o.Length == 3 && o[0] is int fryNo && o[1] is int value1&& o[2] is int value2)
if (o.Length == 2 && o[0] is int fryNo && o[1] is bool value)
{
if (fryNo == 1)
{
FirePot1_Write(morkBF.Fire_PasswayValue[value1], (ushort)value2);//写入需求值
Thread.Sleep(200);
FirePot1_Write(morkBF.Fire_PasswayWrite[value1], true);//启动通道哦
FirePot1_Write("M10.1", value);
}
else if (fryNo == 2)
{
FirePot2_Write(morkBF.Fire_PasswayValue[value1], (ushort)value2);
Thread.Sleep(200);
FirePot2_Write(morkBF.Fire_PasswayWrite[value1], true);
FirePot2_Write("M10.1", value);
}
}
Thread.Sleep(200);
}



/// <summary>
/// 炒锅复位
/// </summary>
@@ -683,46 +702,103 @@ namespace BPASmartClient.MorkBF

}
}


}
/// <summary>
/// 炒锅回原点
/// 炒锅设定加热挡位 锁定
/// </summary>
/// <param name="o"></param>
private void FirePot_PotGotoOrigin(object o)
private void FirePot_SetFireGearLock(object[] o)
{
if (o == null) return;
if (o is int i)
if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
{
if (i == 1)
if (fryNo == 1)
{
FirePot1_Write("M10.5", true);
FirePot1_Write("M10.2", value);
}
else if (i == 2)
else if (fryNo == 2)
{
FirePot2_Write("M10.5", true);
FirePot2_Write("M10.2", value);
}
}
Thread.Sleep(200);
}
/// <summary>
/// 炒锅去投料位置
/// 炒锅1设置搅拌挡位锁定
/// </summary>
/// <param name="o"></param>
private void FirePot_PotGotoInFoodPosition(object o)
private void FirePot_SetStirGearLock(object[] o)
{
if (o == null) return;
if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
{
if (fryNo == 1)
{
FirePot1_Write("M10.3", value);
}
else if (fryNo == 2)
{
FirePot1_Write("M10.3", value);
}
}
Thread.Sleep(200);
}
/// <summary>
/// 设置炒锅翻转速度锁定
/// </summary>
/// <param name="o"></param>
private void FirePot_SetTurnSpeedLock(object[] o)
{
if (o == null) return;
if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
{
if (fryNo == 1)
{
FirePot1_Write("M10.4", value);
}
else if (fryNo == 2)
{
FirePot1_Write("M10.4", value);
}
}
Thread.Sleep(200);
}
/// <summary>
/// 设定炒锅角度值锁定
/// </summary>
/// <param name="o"></param>
private void FirePot_SetPotAngleLock(object[] o)
{
if (o == null) return;
if (o.Length == 2 && o[0] is int fryNo && o[1] is int value)
{
if (fryNo == 1)
{
FirePot1_Write("M11.1", value);
}
else if (fryNo == 2)
{
FirePot1_Write("M11.1", value);
}
}
Thread.Sleep(200);
}
/// <summary>
/// 炒锅回原点
/// </summary>
/// <param name="o"></param>
private void FirePot_PotGotoOrigin(object o)
{
if (o == null) return;
if (o is int i)
{
if (i == 1)
{
FirePot1_Write("M11.2", true);
FirePot1_Write("M10.5", true);
}
else if (i == 2)
{
FirePot2_Write("M11.2", true);
FirePot2_Write("M10.5", true);
}
}
Thread.Sleep(200);
@@ -758,7 +834,7 @@ namespace BPASmartClient.MorkBF
{
if (i == 1)
{
FirePot1_Write("M10.7", true);
FirePot1_Write("M10.7", true);

}
else if (i == 2)
@@ -768,8 +844,9 @@ namespace BPASmartClient.MorkBF
}
Thread.Sleep(200);
}
/// <summary>
/// 抽水启动
/// 抽洗锅水启动
/// </summary>
/// <param name="o"></param>
private void FirePot_StartPumpWater(object[] o)
@@ -788,6 +865,26 @@ namespace BPASmartClient.MorkBF
}
Thread.Sleep(200);
}
/// <summary>
/// 炒锅去投料位置
/// </summary>
/// <param name="o"></param>
private void FirePot_PotGotoInFoodPosition(object o)
{
if (o == null) return;
if (o is int i)
{
if (i == 1)
{
FirePot1_Write("M11.2", true);
}
else if (i == 2)
{
FirePot2_Write("M11.2", true);
}
}
Thread.Sleep(200);
}

/// <summary>
/// 推杆伸出
@@ -922,8 +1019,8 @@ namespace BPASmartClient.MorkBF
ScreenModelMaxWok maxWok = new ScreenModelMaxWok
{
IsRun = IsHealth ? IsRun.运行 : IsRun.停止,
WorkStatus_1 = morkBF.FirePot1_Temperature > 0 ? WorkStatus.工作 : WorkStatus.待机,
WorkStatus_2 = morkBF.FirePot2_Temperature > 0 ? WorkStatus.工作 : WorkStatus.待机,
WorkStatus_1 = morkBF.FryPan1_TemperatureNow > 0 ? WorkStatus.工作 : WorkStatus.待机,
WorkStatus_2 = morkBF.FryPan2_TemperatureNow > 0 ? WorkStatus.工作 : WorkStatus.待机,
RobotStatu = WorkStatus.工作,
Alarm = new List<AlarmModel>(),
FailuresCount = 0,
@@ -934,12 +1031,12 @@ namespace BPASmartClient.MorkBF
MaxWok_Task_2 = ((PotState)dataReport.FirePot2_PotState).ToString(),
MaxWok_Process_1 = SetFirePotPorcess(new Random().Next(0,11)),
MaxWok_Process_2 = SetFirePotPorcess(new Random().Next(0, 11)),
MaxWok_HeatGear_1 = morkBF.FirePot1_FireGear.ToString(),
MaxWok_HeatGear_2 = morkBF.FirePot2_FireGear.ToString(),
MaxWok_StirGear_1 = morkBF.FirePot1_StirGear.ToString(),
MaxWok_StirGear_2 = morkBF.FirePot2_StirGear.ToString(),
MaxWok_FlipSpeed_1 = morkBF.FirePot1_FlipSpeed.ToString(),
MaxWok_FlipSpeed_2 = morkBF.FirePot2_FlipSpeed.ToString(),
MaxWok_HeatGear_1 = morkBF.FryPan1_HeatingGearNow.ToString(),
MaxWok_HeatGear_2 = morkBF.FryPan2_HeatingGearNow.ToString(),
MaxWok_StirGear_1 = morkBF.FryPan1_FryAngle.ToString(),
MaxWok_StirGear_2 = morkBF.FryPan2_FryAngle.ToString(),
MaxWok_FlipSpeed_1 = morkBF.FryPan1_MixingSpeedNow.ToString(),
MaxWok_FlipSpeed_2 = morkBF.FryPan2_MixingSpeedNow.ToString(),
MaxWok_Temp_1 = new Random().Next(250, 450).ToString(),
MaxWok_Temp_2 = new Random().Next(250, 450).ToString(),
MaxWok_OrderCount_1 = 2,
@@ -959,17 +1056,17 @@ namespace BPASmartClient.MorkBF
{
if (potState > 0)
{
if(potState <=3)
if (potState <= 3)
{
SetState(2);
}
else if(potState>3&&potState < 9) SetState(3);
else if(potState == 9) SetState(4);
else if (potState > 3 && potState < 9) SetState(3);
else if (potState == 9) SetState(4);
else if (potState == 10) SetState(5);
}
else
{
foreach(var item in dataReport.processModels)
else
{
foreach (var item in dataReport.processModels)
{
item.Status = ProcessStatus.未执行;
}
@@ -987,8 +1084,8 @@ namespace BPASmartClient.MorkBF
{
dataReport.processModels[i].Status = ProcessStatus.正在执行;
}
else if( i<c) dataReport.processModels[i].Status = ProcessStatus.执行完成;
else if (i > c ) dataReport.processModels[i].Status = ProcessStatus.未执行;
else if (i < c) dataReport.processModels[i].Status = ProcessStatus.执行完成;
else if (i > c) dataReport.processModels[i].Status = ProcessStatus.未执行;
}
}
}


+ 4
- 4
BPASmartClient.MorkBF/GVL_MorkBF.cs View File

@@ -41,8 +41,8 @@ namespace BPASmartClient.MorkBF
/// </summary>
public List<FryPotProcess> FryPot2_CurrentProcess;

#region 炒锅1读取数据
#region 旧数据
/*#region 炒锅1读取数据
/// <summary>
/// 炒锅1锅低温度
/// </summary>
@@ -155,7 +155,6 @@ namespace BPASmartClient.MorkBF
public int FirePot1_FlipSpeed { get; set; } = 0;

#endregion

#region 炒锅2读取数据
/// <summary>
/// 炒锅2锅低温度
@@ -325,6 +324,7 @@ namespace BPASmartClient.MorkBF
//[VariableMonitor("机器人动作反馈GI4", "GI4", "4")]
//public int Robot_GI4ActionCallback { get; set; }

#endregion*/
#endregion
//新版大炒的通讯协议 2023/01/15
#region 炒锅1读取数据
@@ -480,7 +480,7 @@ namespace BPASmartClient.MorkBF

public Dictionary<int, bool> FirePot2_CompleteSingle { get; set; }

public GVL_MorkBF()
{


+ 204
- 0
BPASmartClient.MorkS3/Alarm.cs View File

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

namespace BPASmartClient.MorkS3
{
public class Alarm : IAlarm
{
/// <summary>
/// 煮面机左侧低温报警
/// PLC ---> M230.0
/// ModbusTcp --> 1570
/// </summary>
[Alarm("煮面机左侧低温报警")]
public bool MachineLeftLowTemperature { get; set; }

/// <summary>
/// 煮面机左侧低温报警
/// PLC ---> M230.1
/// ModbusTcp --> 1571
/// </summary>
[Alarm("煮面机右侧低温报警")]
public bool MachineRightLowTemperature { get; set; }

/// <summary>
/// 供碗1缺碗
/// PLC ---> 230.2
/// ModbusTcp --> 1572
/// </summary>
[Alarm("供碗1缺碗")]
public bool Supply1_LossBowl { get; set; }

/// <summary>
/// 供碗2缺碗
/// PLC ---> M230.3
/// ModbusTcp --> 1573
/// </summary>
[Alarm("供碗2缺碗")]
public bool Supply2_LossBowl { get; set; }

/// <summary>
/// 供碗1出碗检测异常
/// PLC ---> M230.4
/// ModbusTcp --> 1574
/// </summary>
[Alarm("供碗1出碗检测异常")]
public bool Supply1_ErrorOutBowl { get; set; }

/// <summary>
/// 供碗2出碗检测异常
/// PLC ---> M230.5
/// ModbusTcp --> 1575
/// </summary>
[Alarm("供碗2出碗检测异常")]
public bool Supply2_ErrorOutBowl { get; set; }

/// <summary>
/// 推碗气缸故障
/// PLC ---> M230.6
/// ModbusTcp --> 1576
/// </summary>
[Alarm("推碗气缸故障")]
public bool PushBowlCylinderError { get; set; }

/// <summary>
/// 煮面机通讯异常
/// PLC ---> M230.7
/// ModbusTcp --> 1577
/// </summary>
[Alarm("煮面机通讯异常")]
public bool NoodleMacCommunicateError { get; set; }

/// <summary>
/// 配料机通讯异常
/// PLC ---> M231.0
/// ModbusTcp --> 1580
/// </summary>
[Alarm("配料机通讯异常")]
public bool DosingMacCommunicateError { get; set; }

/// <summary>
/// 机器人通讯异常
/// PLC ---> M231.1
/// ModbusTcp --> 1581
/// </summary>
[Alarm("机器人通讯异常")]
public bool RobotMacCommunicateError { get; set; }

/// <summary>
/// 机器人通讯异常
/// PLC ---> M231.2
/// ModbusTcp --> 1581
/// </summary>
[Alarm("设备急停")]
public bool DeviceEstop { get; set; }

/// <summary>
/// PLC电池电压低
/// PLC ---> M231.3
/// ModbusTcp --> 1583
/// </summary>
[Alarm("PLC电池电压低")]
public bool RobotInitError { get; set; }

/// <summary>
/// 机器人急停
/// PLC ---> M231.4
/// ModbusTcp --> 1584
/// </summary>
[Alarm("机器人急停")]
public bool RobotUrgentStop { get; set; }

/// <summary>
/// 机器人不在远程模式
/// PLC ---> M231.5
/// ModbusTcp --> 1585
/// </summary>
[Alarm("机器人不在远程模式")]
public bool RobotNotInRemoteMode { get; set; }

/// <summary>
/// 机器人伺服未就绪
/// PLC ---> M231.6
/// ModbusTcp --> 1586
/// </summary>
[Alarm("机器人伺服未就绪")]
public bool RobotNotInReady { get; set; }

/// <summary>
/// 机器人本体异常
/// PLC ---> M231.7
/// ModbusTcp --> 1587
/// </summary>
[Alarm("机器人本体异常")]
public bool RobotSelfInException { get; set; }

/// <summary>
/// 煮面机左侧缺水
/// PLC ---> M232.0
/// ModbusTcp --> 1570
/// </summary>
[Alarm("煮面机左侧缺水报警")]
public bool LeftLackWater { get; set; }

/// <summary>
/// 煮面机右侧缺水
/// PLC ---> M232.1
/// ModbusTcp --> 1571
/// </summary>
[Alarm("煮面机右侧缺水报警")]
public bool RightLackWater { get; set; }

/// <summary>
/// 丝杆初始化失败
/// PLC ---> M232.2
/// ModbusTcp --> 1571
/// </summary>
[Alarm("丝杆初始化失败")]
public bool SvrewInitFail { get; set; }

/// <summary>
/// 转盘初始化失败
/// PLC ---> M232.3
/// ModbusTcp --> 1571
/// </summary>
[Alarm("转盘初始化失败")]
public bool TurntableInitFail { get; set; }

/// <summary>
/// 机器人初始化失败
/// PLC ---> M232.4
/// ModbusTcp --> 1571
/// </summary>
[Alarm("机器人初始化失败")]
public bool RobotInitFail { get; set; }

/// <summary>
/// 煮面机初始化失败
/// PLC ---> M232.5
/// ModbusTcp --> 1571
/// </summary>
[Alarm("煮面机初始化失败")]
public bool NoodleCookerInitFail { get; set; }

/// <summary>
/// 推碗1步进推杆初始化失败
/// PLC ---> M232.6
/// ModbusTcp --> 1571
/// </summary>
[Alarm("推碗1步进推杆初始化失败")]
public bool PushBowlInitFail1 { get; set; }

/// <summary>
/// 推碗2步进推杆初始化失败
/// PLC ---> M232.7
/// ModbusTcp --> 1571
/// </summary>
[Alarm("推碗2步进推杆初始化失败")]
public bool PushBowlInitFail2 { get; set; }
}
}

+ 28
- 0
BPASmartClient.MorkS3/BPASmartClient.MorkS3.csproj View File

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

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<BaseOutputPath>bin\</BaseOutputPath>
<DebugType>portable</DebugType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="BPA.Models" Version="1.0.38" />
<PackageReference Include="Microsoft.Toolkit" Version="7.1.2" />
<PackageReference Include="System.Speech" Version="7.0.0" />
</ItemGroup>


<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" />
<ProjectReference Include="..\BPASmartClient.CustomResource\BPASmartClient.CustomResource.csproj" />
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" />
<ProjectReference Include="..\BPASmartClient.EventBus\BPASmartClient.EventBus.csproj" />
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.MORKSM.BK.PLC\BPASmartClient.PLC.csproj" />
</ItemGroup>

</Project>

+ 891
- 0
BPASmartClient.MorkS3/Control_Morks.cs View File

@@ -0,0 +1,891 @@
using System;
using System.Collections.Generic;
using BPA.Message.Enum;
using BPASmartClient.Device;
using BPASmartClient.EventBus;
using BPASmartClient.Model;
using BPASmartClient.Peripheral;
using static BPASmartClient.EventBus.EventBus;
using BPASmartClient.Helper;
using System.Threading;
using BPASmartClient.Message;
using BPA.Message;
using System.Linq;
using BPASmartClient.Model.PLC;
using System.Threading.Tasks;
using System.Reflection;
using BPASmartClient.MorkS3.Model;
using System.Collections.ObjectModel;
using BPASmartClient.MorkS3.ViewModel;
using BPASmartClient.Business;
using BPASmartClient.Model.小炒机;
using BPA.Models;
using System.Speech.Synthesis;
using System.Windows.Forms;
using System.Media;

namespace BPASmartClient.MorkS3
{
public class Control_Morks : BaseDevice
{
public override DeviceClientType DeviceType => DeviceClientType.MORKS;
GVL_MORKS mORKS = new GVL_MORKS();
Alarm alarm = new Alarm();

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)
{
Json<MorksPar>.Data.parSets.Clear();
for (int i = 0; i < 6; i++)
{
Json<MorksPar>.Data.parSets.Add(new ParSet()
{
CheckBoxContext = $"煮面口{i + 1}屏蔽",
Minute = 1,
Second = 0,
IsShield = false,
TextBlockContext = $"煮面口{i + 1}时间设定"
});
}
}

ActionManage.GetInstance.Register(new Action<object[]>((o) =>
{
if (o.Length > 0)
{
Random rd = new Random();
ThreadManage.GetInstance().StartLong(new Action(() =>
{
int NoodleLoc = (int)o[0] == 0 ? rd.Next(1, 6) : (int)o[0];
int BowlLoc = (int)o[1] == 0 ? rd.Next(10, 12) : (int)o[1];

string guid = new Guid().ToString();

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

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

ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value);
}), "WriteVW");
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o != null && o is WritePar writePar) WriteData(writePar.Address, writePar.Value);
}), "WriteBools");
ActionManage.GetInstance.Register(new Action(() => { DeviceInit(); }), "InitDevice");
}

public override void ResetProgram()
{
mORKS = null;
mORKS = new GVL_MORKS();
}

public override void Stop()
{

}

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

//配方数据信息
EventBus.EventBus.GetInstance().Subscribe<RecipeBomEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
if (@event == null) return;
if (@event is RecipeBomEvent recipe)
{
recipeBoms = recipe.recipeBoms;
WriteRecipeBoms();
}
});


}

private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
{
var res = mORKS.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid);
string goodName = string.Empty;
string SortNum = string.Empty;
if (res != null)
{
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)
{
if (peripheralStatus.ContainsKey(key))
{
if (peripheralStatus[key] != null)
{
action?.Invoke(peripheralStatus[key]);
}
}
}

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)
{
alarm.MachineLeftLowTemperature = bools[0];
alarm.MachineRightLowTemperature = bools[1];
alarm.Supply1_LossBowl = bools[2];
alarm.Supply2_LossBowl = bools[3];
alarm.Supply1_ErrorOutBowl = bools[4];
alarm.Supply2_ErrorOutBowl = bools[5];
alarm.PushBowlCylinderError = bools[6];
alarm.NoodleMacCommunicateError = bools[7];
alarm.DosingMacCommunicateError = bools[8];
alarm.RobotMacCommunicateError = bools[9];
alarm.DeviceEstop = bools[10];
alarm.RobotInitError = bools[11];
alarm.RobotUrgentStop = bools[12];
alarm.RobotNotInRemoteMode = bools[13];
alarm.RobotNotInReady = bools[14];
alarm.RobotSelfInException = bools[15];
alarm.LeftLackWater = bools[16];
alarm.RightLackWater = bools[17];
alarm.SvrewInitFail = bools[18];
alarm.TurntableInitFail = bools[19];
alarm.RobotInitFail = bools[20];
alarm.NoodleCookerInitFail = bools[21];
alarm.PushBowlInitFail1 = bools[22];
alarm.PushBowlInitFail2 = bools[23];
}
}));

GetStatus("M0.3", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 3)
{
mORKS.RobotTakeNoodle = bools[0];
mORKS.RobotOutMeal = bools[1];
mORKS.MoveTurntable = bools[2];
}
}));

GetStatus("M100.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 16)
{
mORKS.InitComplete = bools[0];
mORKS.TakeBowlIdle = bools[1];
mORKS.TemperatureReached = bools[2];
mORKS.AllowFallNoodle = bools[3];
mORKS.RbTakeNoodleComplete = bools[4];
mORKS.RbFallNoodleComplete = bools[5];
mORKS.RbOutMealComplete = bools[6];
mORKS.RobotIdle = bools[7];
mORKS.TakeMealDetect = bools[8];
mORKS.MissingBowl = bools[9];
Initing = bools[10];
mORKS.TurntableLowerLimit = bools[11];
mORKS.MissingBowlSignal2 = bools[12];
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;
}

}));

GetStatus("M235.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 1)
{
mORKS.Error = bools[0];
}
}));


GetStatus("M102.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 7)
{
for (int i = 0; i < 6; i++)
{
mORKS.NoodleCookerStatus[i] = bools[i];
}
mORKS.Feeding = bools[6];
}
}));

GetStatus("M103.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 6)
{
for (int i = 0; i < 6; i++)
{
mORKS.CookNoodlesComplete[i] = bools[i];
DataServer.GetInstance.morkS.Morks_NoodleUpOrDown[i] = bools[i];
}
}

}));

GetStatus("VW372", new Action<object>((obj) =>
{
if (obj is ushort[] UshortValue && UshortValue.Length > 0 && UshortValue.Length <= 1)
mORKS.TurntableFeedbackloc = UshortValue[0];
DataServer.GetInstance.morkS.MorkS_BinLocation = mORKS.TurntableFeedbackloc;
}));

GetStatus("M0.1", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 8)
{
for (int i = 0; i < 8; i++)
{
mORKS.InitComplete = bools[0];
}
}

}));
}

/// <summary>
/// 数据解析
/// </summary>
private void DataParse()
{
EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle)
{
if (@event == null) return;
if (@event is DoOrderEvent order)
{
mORKS.doOrderEvents.Add(order);
if (order.MorkOrder.GoodBatchings == null) return;
if (mORKS.HistorySuborderId.Contains(order.MorkOrder.SuborderId)) return;
OrderCount++;
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);
foreach (var item in order.MorkOrder.GoodBatchings)
{
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
if (res != null)
{
if (ushort.TryParse(res.BatchingLoc, out ushort loc))
{
if (loc >= 1 && loc <= 5)
{
if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { GoodName = order.MorkOrder.GoodsName, Loc = ushort.Parse(res.BatchingLoc), SuborderId = order.MorkOrder.SuborderId, BatchingId = res.BatchingId });
}
else if (loc >= 10 && loc <= 11)
{
int index = 0;
if (recipeBoms != null)
{
index = Array.FindIndex(recipeBoms.RecipeIds?.ToArray(), p => p.RecipeId == order.MorkOrder.RecipeId);
index++;
}
if (mORKS.TakeBowlTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo()
{
BatchingId = res.BatchingId,
GoodName = order.MorkOrder.GoodsName,
Loc = ushort.Parse(res.BatchingLoc),
SuborderId = order.MorkOrder.SuborderId,
RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0
});
}
}
}
}
}
});
}

public override void MainTask()
{
mORKS.AllowRun = mORKS.InitComplete;
if (Json<KeepDataBase>.Data.IsVerify)
IsHealth = mORKS.Error && mORKS.InitComplete;
else
IsHealth = true;

TakeBowlTask();

TakeNoodleTask();

OutNoodleTask();

SingleDetect();

TurntableControl();

var data = new List<bool>();
for (int i = 0; i < Json<MorksPar>.Data.parSets.Count; i++)
{
data.Add(Json<MorksPar>.Data.parSets.ElementAt(i).IsShield);
}

WriteControl("M260.0", data.ToArray());

}

private void BowlControl(OrderLocInfo orderLocInfo)
{
if (orderLocInfo.Loc >= 10 && orderLocInfo.Loc <= 11)
{
mORKS.TakeBowlId = orderLocInfo.SuborderId;
mORKS.TakeBowName = orderLocInfo.GoodName;
TakeBowlControl(orderLocInfo.Loc);
SetRecipeNumber(orderLocInfo.RecipeNumber);
OrderChange(mORKS.TakeBowlId, ORDER_STATUS.COOKING);
DeviceProcessLogShow($"订单【{ mORKS.TakeBowlId}】执行取碗控制,位置:[{orderLocInfo.Loc}]");
mORKS.TakeBowlInterlock = true;
}
}

/// <summary>
/// 取碗控制
/// </summary>
private void TakeBowlTask()
{
if (mORKS.AllowRun && mORKS.TakeBowlTask.Count > 0 && !mORKS.TakeBowlIdle && !mORKS.TakeBowlInterlock)
{
DeviceProcessLogShow("开始取碗流程");
ushort BowLoc = 0;
var res = orderMaterialDelivery?.BatchingInfo?.Where(p => p.BatchingId == mORKS.TakeBowlTask.ElementAt(0).BatchingId).ToList();
if (res == null || res?.Count == 0)
{
if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo)) BowlControl(orderLocInfo);
}
else
{
foreach (var item in res)
{
if (ushort.TryParse(item.BatchingLoc, out ushort loc))
{
//DeviceProcessLogShow($"位置:={loc},检测开关1:{alarm.Supply1_LossBowl},检测开关1:{alarm.Supply2_LossBowl}");
if (loc == 10 && !alarm.Supply1_LossBowl)
{
BowLoc = loc;
break;
}
else if (loc == 11 && !alarm.Supply2_LossBowl)
{
BowLoc = loc;
break;
}
}
}

if (BowLoc >= 10 && BowLoc <= 11)
{
if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo))
{
orderLocInfo.Loc = BowLoc;
BowlControl(orderLocInfo);
}
}
}
}
}

/// <summary>
/// 转台控制
/// </summary>
private void TurntableControl()
{
if (Global.EnableLocalSimOrder)
{
//不做轮询,直接取面,模拟订单使用
if (mORKS.TurntableMoveInPlace && !mORKS.Feeding && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0)
{
if (mORKS.TurntableLowerLimit)
{
TurntableStart(mORKS.RBTakeNoodleTask.ElementAt(0).Loc);
mORKS.TurntableLocLists.Clear();
mORKS.AllowTakeNoodle = true;
DeviceProcessLogShow($"控制机器人去转台【{mORKS.RBTakeNoodleTask.ElementAt(0).Loc}】号位置取面");
}
}
}
else
{
//正常轮询
if (mORKS.TurntableMoveInPlace && !mORKS.Feeding && mORKS.InitComplete && !mORKS.AllowTakeNoodle && mORKS.RBTakeNoodleTask.Count > 0)
{
var result = orderMaterialDelivery.BatchingInfo.Where(p => p.BatchingId == mORKS.RBTakeNoodleTask.ElementAt(0).BatchingId).ToList();
if (result != null)
{
var res = result.FirstOrDefault(P => P.BatchingLoc == mORKS.TurntableFeedbackloc.ToString());
if (mORKS.TurntableLowerLimit && res != null)
{
TurntableStart(mORKS.TurntableFeedbackloc);
mORKS.TurntableLocLists.Clear();
mORKS.AllowTakeNoodle = true;
DeviceProcessLogShow($"控制机器人去转台【{mORKS.TurntableFeedbackloc}】号位置取面");
}
else
{
if (!mORKS.TurntableInterlock)
{
foreach (var item in result)
{
if (ushort.TryParse(item.BatchingLoc, out ushort loc))
{
if (mORKS.TurntableFeedbackloc != loc && !mORKS.TurntableLocLists.Contains(loc))
{
if (!mORKS.TurntableLowerLimit)
{
WriteData("M32.7", false);
DeviceProcessLogShow($"执行了转台启动互锁信号复位");
}
TurntableStart(loc);
DeviceProcessLogShow($"没有物料检测的启动转台控制,转台位置:[{loc}]");
break;
}
else if (mORKS.TurntableFeedbackloc == loc && !mORKS.TurntableLocLists.Contains(loc)) mORKS.TurntableLocLists.Add(loc);
}
}
}
}
}
else DeviceProcessLogShow("未找到可用的物料信息");
}
}

//if (DelayRTrig.GetInstance("互锁信号复位").Start(!mORKS.TurntableLowerLimit && mORKS.TurntableMoveInPlace, 2))
//{
// if (!mORKS.TurntableLowerLimit)
// {
// WriteData("M32.7", false);
// DeviceProcessLogShow($"执行了转台启动互锁信号复位");
// }
//}

//补料中检测
if (RTrig.GetInstance("mORKS.Feeding").Start(mORKS.Feeding))
{
mORKS.AllowTakeNoodle = false;
mORKS.TakeNoodleInterlock = false;
}

//转台到位检测
if (RTrig.GetInstance("TurntableInPlace").Start(mORKS.TurntableMoveInPlace && mORKS.CurrentLoc == mORKS.TurntableFeedbackloc))
{
mORKS.CurrentLoc = 0;
mORKS.TurntableInterlock = false;
DeviceProcessLogShow("转台到位检测");
}

//补料完成检测
if (RTrig.GetInstance("FeedComplete").Start(mORKS.FeedComplete))
{
if (!mORKS.AllowTakeNoodle && mORKS.TurntableLocLists.Count > 0)
{
mORKS.TurntableLocLists.Clear();
mORKS.TurntableInterlock = false;
DeviceProcessLogShow("补料完成检测");
}
}

}

/// <summary>
/// 取面任务
/// </summary>
private void TakeNoodleTask()
{
//取面控制
if (mORKS.AllowRun && mORKS.RobotIdle && !mORKS.Feeding && !mORKS.RobotTaskInterlock && mORKS.AllowTakeNoodle && mORKS.TurntableMoveInPlace && !mORKS.TakeNoodleInterlock && !mORKS.OutNoodleing && mORKS.RBTakeNoodleTask.Count > 0)
{
int loc = Array.FindIndex(mORKS.NoodleCookerStatus, p => p == false);//查找煮面炉空闲位置
if (loc >= 0 && loc <= 5)
{
if (mORKS.RBTakeNoodleTask.TryDequeue(out OrderLocInfo orderLocInfo))
{
mORKS.CookNodelId[loc] = orderLocInfo.SuborderId;
SetFallNoodleLoc((ushort)(loc + 1));
//机器人开始取面
RobotTakeNoodle();
OrderChange(orderLocInfo.SuborderId, ORDER_STATUS.COOKING);
DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】,机器人倒面至【{loc + 1}】号煮面栏");
//写入煮面时间
List<ushort> values = new List<ushort>();
values.Add(Json<MorksPar>.Data.parSets.ElementAt(loc).Minute);
values.Add(Json<MorksPar>.Data.parSets.ElementAt(loc).Second);
WriteData($"VW{116 + (loc * 6)}", values.ToArray());
mORKS.TakeNoodleInterlock = true;
}
}
}
}

/// <summary>
/// 出餐控制
/// </summary>
private void OutNoodleTask()
{
if (mORKS.AllowFallNoodle && mORKS.RobotTaskInterlock && !mORKS.TakeNoodleInterlock && mORKS.RobotIdle && !mORKS.TakeMealDetect)
{
int loc = Array.FindIndex(mORKS.CookNodelId, p => p == mORKS.IngredientsCompleteId && p.Length > 0);
if (loc >= 0 && loc <= 5)
{
if (mORKS.CookNoodlesComplete[loc])
{
SetTakeNoodleLoc((ushort)(loc + 1));
RobotOutMeal();
CookNoodleStatusReset((ushort)(loc + 1));
ResetAllowFallNoodle();


//新增,待测试
if (mORKS.RbOutMealComplete)
{
ResetCookComplete();
mORKS.CookCompleteFlatBit = false;
DeviceProcessLogShow("取餐过程中复位出餐完成信号");
}

if (!string.IsNullOrEmpty(mORKS.OutMealId)) OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE);
mORKS.OutMealId = mORKS.IngredientsCompleteId;
mORKS.OutMealName = mORKS.IngredientsCompleteName;
mORKS.IngredientsCompleteId = string.Empty;
mORKS.CookNodelId[loc] = string.Empty;
DeviceProcessLogShow($"{loc + 1} 号位置出餐控制,订单ID:{ mORKS.OutMealId}");

mORKS.OutNoodleing = true;
}
}
}
}

/// <summary>
/// 信号检测
/// </summary>
private void SingleDetect()
{
//允许倒面信号检测
if (RTrig.GetInstance("AllowFallNoodle").Start(mORKS.AllowFallNoodle))
{
mORKS.IngredientsCompleteId = mORKS.TakeBowlId;
mORKS.IngredientsCompleteName = mORKS.TakeBowName;
mORKS.TakeBowlId = string.Empty;
mORKS.TakeBowName = string.Empty;
DeviceProcessLogShow($"碗到位,允许到面,{mORKS.IngredientsCompleteId}");
mORKS.TakeBowlInterlock = false;
}

//出餐完成信号检测
if (RTrig.GetInstance("CompleteChange").Start(mORKS.RbOutMealComplete))
{
OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_COOK);
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】制作完成");
mORKS.CookCompleteFlatBit = true;
mORKS.OutNoodleing = false;
WaitMeaLSpeak(mORKS.OutMealName);
}

//取餐完成逻辑处理
if (Delay.GetInstance("CompleteChange1").Start(!mORKS.TakeMealDetect, 1) && mORKS.CookCompleteFlatBit == true)
{
OrderChange(mORKS.OutMealId, ORDER_STATUS.COMPLETED_TAKE);
DeviceProcessLogShow($"订单【{mORKS.OutMealId}】取餐完成");
ResetCookComplete();
mORKS.CookCompleteFlatBit = false;
mORKS.OutMealId = string.Empty;
mORKS.OutMealName = string.Empty;
}

//机器人取面完成信号检测
if (RTrig.GetInstance("TakeNoodleComplete").Start(mORKS.RbTakeNoodleComplete))
{
mORKS.TakeNoodleInterlock = false;
mORKS.AllowTakeNoodle = false;
mORKS.TurntableInterlock = false;
DeviceProcessLogShow("机器人取面完成信号检测");
TakeNoodleCompleteReset();
}

int OutMealRequstCount = mORKS.CookNoodlesComplete.Where(p => p == true).ToList().Count;
int mlCount = mORKS.NoodleCookerStatus.Where(p => p == true).ToList().Count;
int index = Array.FindIndex(mORKS.CookNodelId, p => p == mORKS.IngredientsCompleteId);

bool isok = index >= 0 && index < mORKS.CookNoodlesComplete.Length && mORKS.CookNoodlesComplete[index];

mORKS.PriorityJudgment = Delay.GetInstance("取餐优先级判断").Start(mORKS.TurntableLocLists.Count > 0 && !mORKS.TurntableLowerLimit, 4);
//mORKS.RobotTaskInterlock = OutMealRequstCount > 0 && mORKS.AllowFallNoodle && (mlCount >= 2 || mORKS.RBTakeNoodleTask.Count == 0 || mORKS.PriorityJudgment);
mORKS.RobotTaskInterlock = isok && mORKS.AllowFallNoodle && (mlCount >= 2 || mORKS.RBTakeNoodleTask.Count == 0 || mORKS.PriorityJudgment);


}
/// <summary>
/// 语音提醒取餐
/// </summary>
/// <param name="meal"></param>
private void WaitMeaLSpeak(string meal)
{
VoiceAPI.m_SystemPlayWav(@"Vioce\电子提示音.wav");
Thread.Sleep(1000);
if (meal != null) mORKS.speech.Speak(meal);
VoiceAPI.m_SystemPlayWav(@"Vioce\取餐通知.wav");
}

#region PLC 控制函数

private void WriteData(string address, object value)
{
EventBus.EventBus.GetInstance().Publish(new WriteModel() { DeviceId = DeviceId, Address = address, Value = value });
}

/// <summary>
/// 写入配方数据到 PLC
/// </summary>
private void WriteRecipeBoms()
{
List<ushort> recipeBoms = new List<ushort>();
if (this.recipeBoms == null) return;
foreach (var item in this.recipeBoms.RecipeIds)
{
foreach (var rec in item.Recipes)
{
recipeBoms.Add((ushort)rec);
}
}
if (recipeBoms.Count > 0)
{
//配方数据地址范围:VW2000 - VW2278
WriteData("VW2000", recipeBoms.ToArray());
DeviceProcessLogShow("写配方成功");
}
else { DeviceProcessLogShow("配方数据为空"); }
}


/// <summary>
/// 取面完成复位
/// </summary>
private void TakeNoodleCompleteReset()
{
WriteData("M100.4", false);

}

/// <summary>
/// 指定煮面口状态复位
/// </summary>
/// <param name="num"></param>
private void CookNoodleStatusReset(int num)
{
if (num >= 1 && num <= 6)
{
WriteData($"102.{num - 1}", false);
DeviceProcessLogShow($"{num}号煮面口占用复位");
}

}

/// <summary>
/// 写配方编号
/// </summary>
/// <param name="num"></param>
private void SetRecipeNumber(ushort num)
{
WriteData("VW0", num);
}

/// <summary>
/// 启动转台
/// </summary>
/// <param name="loc"></param>
private void TurntableStart(ushort loc)
{
mORKS.CurrentLoc = loc;
mORKS.TurntableInterlock = true;
mORKS.TurntableLocLists.Add(loc);
WriteData("VW2", loc);
WriteData("M0.5", true);
}

/// <summary>
/// 设置倒面位置
/// </summary>
/// <param name="loc"></param>
private void SetFallNoodleLoc(ushort loc)
{
WriteData("VW4", loc);
}

/// <summary>
/// 设置取面位置
/// </summary>
/// <param name="loc"></param>
private void SetTakeNoodleLoc(ushort loc)
{
WriteData("VW6", loc);
}

/// <summary>
/// 取碗控制
/// </summary>
/// <param name="loc"></param>
private void TakeBowlControl(ushort loc)
{
if (loc == 10)//小碗
{
WriteData("M0.1", true);
}
else if (loc == 11)//大碗
{
WriteData("M0.2", true);
}
}

/// <summary>
/// 机器人取面
/// </summary>
private void RobotTakeNoodle()
{
WriteData("M0.3", true);
}

/// <summary>
/// 机器人取餐
/// </summary>
private void RobotOutMeal()
{
WriteData("M0.4", true);
}

/// <summary>
/// 制作完成信号复位
/// </summary>
private void ResetCookComplete()
{
WriteData("M100.6", false);
}

/// <summary>
/// 复位允许取面信号
/// </summary>
private void ResetAllowFallNoodle()
{
WriteData("M100.3", false);
}

/// <summary>
/// 设备初始化
/// </summary>
public async void DeviceInit()
{
WriteData("M0.0", true);
await Task.Delay(1000);
WriteData("M0.0", false);
}

public override void SimOrder()
{
EventBus.EventBus.GetInstance().Subscribe<MorksSimorderModel>(0, delegate (IEvent @event, EventCallBackHandle callBackHandle)
{
if (@event != null && @event is MorksSimorderModel msm)
{
string guid = Guid.NewGuid().ToString();
if (msm.NoodleLoc >= 1 && msm.NoodleLoc <= 5)
{
mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.NoodleLoc, SuborderId = guid });
MessageLog.GetInstance.Show($"添加订单:面条位置【{(ushort)msm.NoodleLoc}】");
}

if (msm.Bowloc >= 10 && msm.Bowloc <= 11)
{
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo() { Loc = (ushort)msm.Bowloc, SuborderId = guid });
MessageLog.GetInstance.Show($"添加订单:碗位置【{(ushort)msm.Bowloc}】");
}

}
});
}
#endregion


}
}

+ 52
- 0
BPASmartClient.MorkS3/DataServer.cs View File

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

namespace BPASmartClient.MorkS3
{
public class DataServer
{

private volatile static DataServer _Instance;
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.Connected = new Action(() =>
{
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(ScreenDeviceType.煮面机));
ThreadManage.GetInstance().StartLong(new Action(() =>
{
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个煮面炉上或下)
//温度状态(煮面炉温度是否到达)
//料仓位置(当前料仓在几号位置)
//料仓上下物料检测
//落碗机构缺碗检测
//机器人状态
//当日订单总量
//报警信息
}
}

+ 376
- 0
BPASmartClient.MorkS3/GVL_MORKS.cs View File

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

namespace BPASmartClient.MorkS3
{
public class GVL_MORKS : IStatus
{
public List<string> HistorySuborderId { get; set; } = new List<string>();
/// <summary>
/// 机器人取面
/// PLC -> M0.3
/// ModbusTcp -> 323
/// </summary>
public bool RobotTakeNoodle { get; set; }

/// <summary>
/// 机器人出餐
/// PLC -> M0.4
/// ModbusTcp -> 324
/// </summary>
public bool RobotOutMeal { get; set; }

/// <summary>
/// 移动转台
/// PLC -> M0.5
/// ModbusTcp -> 325
/// </summary>
public bool MoveTurntable { get; set; }


#region 临时变量
/// <summary>
/// 允许运行
/// </summary>
//[Circuit(new string[] { "机器人取面", "取碗控制" }, "允许运行")]
[VariableMonitor("允许运行")]
public bool AllowRun { get; set; }

/// <summary>
/// 优先级判断
/// </summary>
[VariableMonitor("优先级判断条件")]
public bool PriorityJudgment { get; set; }

/// <summary>
/// 机器人任务互锁信号,false:取面,true:出餐
/// </summary>
//[Circuit(new string[] { "机器人取面", "出面控制" }, "机器人互锁", new bool[] { true, false })]
[VariableMonitor("机器人任务互锁信号")]
public bool RobotTaskInterlock { get; set; }

/// <summary>
/// 取碗互锁信号
/// </summary>
//[Circuit("取碗控制", "取碗互锁", true)]
[VariableMonitor("取碗互锁信号")]
public bool TakeBowlInterlock { get; set; }

/// <summary>
/// 取面互锁信号
/// </summary>
//[Circuit(new string[] { "机器人取面", "出面控制" }, "取面互锁信号", new bool[] { true, true })]
[VariableMonitor("取面互锁信号")]
public bool TakeNoodleInterlock { get; set; }

/// <summary>
/// 出面中
/// </summary>
//[Circuit("机器人取面", "出面中", true)]
[VariableMonitor("出面中")]
public bool OutNoodleing { get; set; }

/// <summary>
/// 允许取面
/// </summary>
//[Circuit(new string[] { "转台控制", "机器人取面" }, "允许取面", new bool[] { true, false })]
[VariableMonitor("允许取面")]
public bool AllowTakeNoodle { get; set; }

/// <summary>
/// 转台互锁信号
/// </summary>
[VariableMonitor("转台互锁信号")]
public bool TurntableInterlock { get; set; }
#endregion

/// <summary>
/// 初始化完成
/// PLC -> M100.0
/// ModbusTcp -> 1120
/// </summary>
//[Circuit(new string[] { "允许运行", "转台控制", "转台控制" }, "初始化完成")]
[VariableMonitor("初始化完成", "M100.0", "1120")]
public bool InitComplete { get; set; }

/// <summary>
/// 取碗机构空闲,True:忙碌,false:空闲
/// PLC -> M100.1
/// ModbusTcp -> 1121
/// </summary>
//[Circuit("取碗控制", "取碗机构空闲", true)]
[VariableMonitor("取碗机构空闲", "M100.1", "1121")]
public bool TakeBowlIdle { get; set; }

/// <summary>
/// 温度到达,True:表示到达,false:未到达
/// PLC -> M100.2
/// ModbusTcp -> 1122
/// </summary>
//[Circuit("允许运行", "温度到达")]
[VariableMonitor("温度到达", "M100.2", "1122")]
public bool TemperatureReached { get; set; }

/// <summary>
/// 允许到面,配料完成
/// PLC -> M100.3
/// ModbusTcp -> 1123
/// </summary>
//[Circuit("出面控制", "允许到面")]
[VariableMonitor("允许到面", "M100.3", "1123")]
public bool AllowFallNoodle { get; set; }

/// <summary>
/// 机器人取面完成
/// PLC -> M100.4
/// ModbusTcp -> 1124
/// </summary>
[VariableMonitor("机器人取面完成", "M100.4", "1124")]
public bool RbTakeNoodleComplete { get; set; }

/// <summary>
/// 机器人倒面完成
/// PLC -> M100.5
/// ModbusTcp -> 1125
/// </summary>
[VariableMonitor("机器人倒面完成", "M100.5", "1125")]
public bool RbFallNoodleComplete { get; set; }

/// <summary>
/// 机器人出餐完成,上报取餐完成
/// PLC -> M100.6
/// ModbusTcp -> 1126
/// </summary>
[VariableMonitor("机器人出餐完成", "M100.6", "1126")]
public bool RbOutMealComplete { get; set; }

/// <summary>
/// 机器人空闲
/// PLC -> M100.7
/// ModbusTcp -> 1127
/// </summary>
//[Circuit(new string[] { "机器人取面", "出面控制" }, "机器人空闲")]
[VariableMonitor("机器人空闲", "M100.7", "1127")]
public bool RobotIdle { get; set; }

/// <summary>
/// 取餐口检测
/// PLC -> M101.0
/// ModbusTcp -> 1128
/// </summary>
//[Circuit("出面控制", "取餐口检测", true)]
[VariableMonitor("取餐口检测", "M101.0", "1128")]
public bool TakeMealDetect { get; set; }

/// <summary>
/// 缺碗信号,false:缺碗,true:有碗
/// PLC -> M101.1
/// ModbusTcp -> 1129
/// </summary>
[VariableMonitor("缺碗信号", "M101.1", "1129")]
public bool MissingBowl { get; set; }

/// <summary>
/// 设备初始化中,执行中等于1,2秒后复位
/// PLC -> M101.2
/// ModbusTcp -> 1130
/// </summary>
[VariableMonitor("设备初始化中", "M101.2", "1130")]
public bool DeviceIniting { get; set; }

/// <summary>
/// 转台下限检测
/// PLC -> M101.3
/// ModbusTcp -> 1131
/// </summary>
//[Circuit("转台控制", "转台下限检测有物料")]
[VariableMonitor("转台下限检测", "M101.3", "1131")]
public bool TurntableLowerLimit { get; set; }

/// <summary>
/// 缺碗信号 2
/// PLC -> M101.4
/// ModbusTcp -> 1132
/// </summary>
[VariableMonitor("缺碗信号 2", "M101.4", "1132")]
public bool MissingBowlSignal2 { get; set; }

/// <summary>
/// 转台上限检测
/// PLC -> M101.5
/// ModbusTcp -> 1133
/// </summary>
[VariableMonitor("转台上限检测", "M101.5", "1133")]
public bool TurntableUpLimit { get; set; }

/// <summary>
/// 补料完成
/// PLC -> M101.6
/// ModbusTcp -> 1134
/// </summary>
[VariableMonitor("补料完成", "M101.6", "1134")]
public bool FeedComplete { get; set; }

/// <summary>
/// 转台移动到位
/// PLC -> M101.7
/// ModbusTcp -> 1135
/// </summary>
//[Circuit(new string[] { "转台控制", "机器人取面" }, "转台移动到位")]
[VariableMonitor("转台移动到位", "M101.7", "1135")]
public bool TurntableMoveInPlace { get; set; }

/// <summary>
/// 煮面炉状态,True:忙碌,false:空闲
/// M102.0 - M102.5
/// 1136 - 1141
/// </summary>
[VariableMonitor("煮面炉状态", "M102.0", "1136")]
public bool[] NoodleCookerStatus { get; set; } = new bool[6] { false, false, false, false, false, false };

/// <summary>
/// 补料中
/// M102.6
/// 1142
/// </summary>
[VariableMonitor("补料中", "M102.6", "1142")]
public bool Feeding { get; set; }

/// <summary>
/// 煮面完成,上升后给信号
/// M103.0 - M103.5
/// 1144 - 1149
/// </summary>
[VariableMonitor("煮面完成", "M103.0", "1144")]
public bool[] CookNoodlesComplete { get; set; } = new bool[6] { false, false, false, false, false, false };

/// <summary>
/// 硬件设备异常
/// PLC -> M235.0
/// True:设备正常,False:设备异常
/// </summary>
[VariableMonitor("硬件设备异常", "M235.0", "")]
public bool Error { get; set; } = false;

/// <summary>
/// 配方编号
/// PLC -> VW0
/// ModbusTcp -> 100
/// </summary>
[VariableMonitor("配方编号", "VW0", "100")]
public ushort RecipeNumber { get; set; }

/// <summary>
/// 转台设置位置
/// PLC -> VW2
/// ModbusTcp -> 101
/// </summary>
[VariableMonitor("转台设置位置", "VW2", "101")]
public ushort TurntableLoc { get; set; }

/// <summary>
/// 到面至煮面炉位置
/// PLC -> VW4
/// ModbusTcp -> 102
/// </summary>
[VariableMonitor("到面至煮面炉位置", "VW4", "102")]
public ushort FallNoodleLoc { get; set; }

/// <summary>
/// 取面位置
/// PLC -> VW6
/// ModbusTcp -> 103
/// </summary>
[VariableMonitor("取面位置", "VW6", "103")]
public ushort TakeNoodleLoc { get; set; }

/// <summary>
/// 转台反馈位置
/// PLC -> VW372
/// ModbusTcp -> 286
/// </summary>
[VariableMonitor("转台反馈位置", "VW372", "286")]
public ushort TurntableFeedbackloc { get; set; }

/// <summary>
/// 机器人取面位置队列
/// </summary>
//[Circuit(new string[] { "转台控制", "机器人取面" }, "有机器人取面队列")]
public ConcurrentQueue<OrderLocInfo> RBTakeNoodleTask { get; set; } = new ConcurrentQueue<OrderLocInfo>();

/// <summary>
/// 出碗队列
/// </summary>
//[Circuit("取碗控制", "有取碗队列数量")]
public ConcurrentQueue<OrderLocInfo> TakeBowlTask { get; set; } = new ConcurrentQueue<OrderLocInfo>();

public List<DoOrderEvent> doOrderEvents { get; set; } = new List<DoOrderEvent>();

/// <summary>
/// 是否有面条
/// </summary>
public bool IsNoodles { get; set; } = true;

/// <summary>
/// 制作完成标志
/// </summary>
[VariableMonitor("制作完成标志")]
public bool CookCompleteFlatBit { get; set; }


#region 订单ID记录
/// <summary>
/// 取碗订单ID
/// </summary>
public string TakeBowlId = string.Empty;
/// <summary>
/// 取碗订单名称
/// </summary>
public string TakeBowName = string.Empty;

/// <summary>
/// 配料完成订单ID
/// </summary>
public string IngredientsCompleteId = string.Empty;
/// <summary>
/// 配料完成订单名称
/// </summary>
public string IngredientsCompleteName = string.Empty;

/// <summary>
/// 煮面口对应的订单ID
/// </summary>
public string[] CookNodelId = new string[6] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, };

/// <summary>
/// 出餐订单ID
/// </summary>
public string OutMealId = string.Empty;
/// <summary>
/// 出餐订单名称
/// </summary>
public string OutMealName = string.Empty;

/// <summary>
/// 转台位置轮询
/// </summary>
public List<ushort> TurntableLocLists = new List<ushort>();

/// <summary>
/// 转台当前启动位置
/// </summary>
[VariableMonitor("转台当前启动位置")]
public ushort CurrentLoc { get; set; } = 0;

public SpeechSynthesizer speech = new SpeechSynthesizer();

#endregion
}
}

BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/PlcWriteAddressDB7.cs → BPASmartClient.MorkS3/Model/Global.cs View File

@@ -4,10 +4,10 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
namespace BPASmartClient.MorkS3.Model
{
public class PlcWriteAddressDB7
public class Global
{
public static bool EnableLocalSimOrder { get; set; }
}
}

+ 16
- 0
BPASmartClient.MorkS3/Model/MorksPar.cs View File

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

namespace BPASmartClient.MorkS3.Model
{
internal class MorksPar
{
public ObservableCollection<ParSet> parSets { get; set; } = new ObservableCollection<ParSet>();
}
}

+ 29
- 0
BPASmartClient.MorkS3/Model/ParSet.cs View File

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

namespace BPASmartClient.Model
{
public class ParSet
{
public ushort Minute { get { return _mMinute; } set { _mMinute = value; } }
private ushort _mMinute;

public ushort Second { get { return _mSecond; } set { _mSecond = value; } }
private ushort _mSecond;


public bool IsShield { get { return _mIsShield; } set { _mIsShield = value; } }
private bool _mIsShield;


public string TextBlockContext { get { return _mTextBlockContext; } set { _mTextBlockContext = value; } }
private string _mTextBlockContext;

public string CheckBoxContext { get { return _mCheckBoxContext; } set { _mCheckBoxContext = value; } }
private string _mCheckBoxContext;

}
}

+ 14
- 0
BPASmartClient.MorkS3/Model/WritePar.cs View File

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

namespace BPASmartClient.MorkS3.Model
{
public class WritePar
{
public string Address { get; set; }
public object Value { get; set; }
}
}

+ 23
- 0
BPASmartClient.MorkS3/OrderLocInfo.cs View File

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

namespace BPASmartClient.MorkS3
{
public class OrderLocInfo
{
public string SuborderId { get; set; }
public ushort Loc { get; set; }
public ushort RecipeNumber { get; set; }
public int BatchingId { get; set; }
public string GoodName { get; set; }

public int RecipeId { get; set; }

public List<int> Recipes { get; set; }

}
}

+ 117
- 0
BPASmartClient.MorkS3/View/Debug.xaml View File

@@ -0,0 +1,117 @@
<UserControl
x:Class="BPASmartClient.MorkS3.View.Debug"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkS3.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.MorkS3.ViewModel"
Name="调试界面"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

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

<UserControl.Resources>
<Style x:Key="TextboxStyle" TargetType="TextBox">
<Setter Property="FontSize" Value="18" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" />
<Setter Property="Width" Value="150" />
<Setter Property="BorderBrush" Value="{StaticResource TitleBorderColor}" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="CaretBrush" Value="Aqua" />
</Style>
<Style x:Key="CheckBox" TargetType="CheckBox">
<Setter Property="Foreground" Value="Aqua" />
<Setter Property="FontSize" Value="16" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="Margin" Value="10,0" />
<Setter Property="IsChecked" Value="False" />
</Style>
</UserControl.Resources>

<Grid Margin="20">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>

<StackPanel>
<StackPanel Margin="10,0,0,20" Orientation="Horizontal">
<TextBlock
FontSize="18"
Foreground="{StaticResource TitleBorderColor}"
Text="面条位置:" />
<TextBox Style="{StaticResource TextboxStyle}" Text="{Binding NoodleLoc}" />
<CheckBox
Background="White"
Content="随机面条位置"
IsChecked="{Binding IsNoodPositon}"
Style="{StaticResource CheckBox}" />

</StackPanel>

<StackPanel Margin="10,0,0,20" Orientation="Horizontal">
<TextBlock
FontSize="18"
Foreground="{StaticResource TitleBorderColor}"
Text="面碗位置:" />
<TextBox Style="{StaticResource TextboxStyle}" Text="{Binding BowlLoc}" />
<CheckBox
Background="White"
Content="随机面碗位置"
IsChecked="{Binding IsBowPositon}"
Style="{StaticResource CheckBox}" />
<CheckBox
Background="White"
Command="{Binding EnableLacalSimOrder}"
Content="启用本地模拟功能"
IsChecked="{Binding LocalSimOrder}"
Style="{StaticResource CheckBox}" />
</StackPanel>

<StackPanel Orientation="Horizontal">
<Button
Grid.Row="0"
Width="170"
HorizontalAlignment="Left"
Command="{Binding SimOrderRandomCommand}"
Content="启动随机模拟订单"
Style="{StaticResource ButtonStyle}"
Visibility="{Binding VisibilitySimOrder}" />
<Button
Grid.Row="0"
Width="170"
HorizontalAlignment="Left"
Command="{Binding SimOrderRandomCloseCommand}"
Content="关闭随机模拟订单"
Style="{StaticResource ButtonStyle}"
Visibility="{Binding VisibilitySimOrder}" />
<Button
Grid.Row="0"
Width="130"
HorizontalAlignment="Left"
Command="{Binding SimOrderCommand}"
Content="模拟订单"
Style="{StaticResource ButtonStyle}"
Visibility="{Binding VisibilitySimOrder}" />
<Button
Grid.Row="0"
Width="120"
HorizontalAlignment="Left"
Command="{Binding InitCommand}"
Content="初始化设备"
Style="{StaticResource ButtonStyle}" />
</StackPanel>
</StackPanel>



</Grid>
</UserControl>

+ 30
- 0
BPASmartClient.MorkS3/View/Debug.xaml.cs View File

@@ -0,0 +1,30 @@
using BPASmartClient.MorkS3.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

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

}
}

+ 242
- 0
BPASmartClient.MorkS3/View/Monitor.xaml View File

@@ -0,0 +1,242 @@
<UserControl
x:Class="BPASmartClient.MorkS3.View.Monitor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkS3.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.MorkS3.ViewModel"
Name="监控画面"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

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

<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary>
<!--<convert:TextDisplayConvert x:Key="textDisplayConvert" />
<convert:IsEnableConvert x:Key="isEnableConvert" />
<convert:AnalogAlarmConvert x:Key="analogAlarmConvert" />
<convert:DiscreteAlarmConvert x:Key="discreteAlarmConvert" />
<convert:AlarmTypeTextConvert x:Key="alarmTypeTextConvert" />-->
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" />
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" />
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" />
<SolidColorBrush x:Key="CursorColor" Color="Aqua" />
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" />

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

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

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

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

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

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

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


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



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

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

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

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

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

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


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

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

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

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

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

</Grid>

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

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


</Grid>

</UserControl>

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

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

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

+ 130
- 0
BPASmartClient.MorkS3/View/ParSet.xaml View File

@@ -0,0 +1,130 @@
<UserControl
x:Class="BPASmartClient.MorkS3.View.ParSet"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.MorkS3.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.MorkS3.ViewModel"
Name="参数设置界面"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">

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

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

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

</ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

</UserControl.Resources>

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

<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">

<TextBlock Style="{StaticResource TextBlockStyle}" Text="请点击按钮保存参数:" />

<pry:IcoButton
Grid.Column="5"
Width="140"
HorizontalAlignment="Left"
Command="{Binding SaveInfoCommand}"
Content="保存配置"
FontSize="16"
IcoText="&#xe936;"
Style="{StaticResource IcoButtonStyle}">
<pry:IcoButton.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />
<GradientStop Offset="1" Color="White" />
</LinearGradientBrush>
</pry:IcoButton.Foreground>
</pry:IcoButton>


</StackPanel>

<!-- 参数放置面板 -->
<Grid Grid.Row="2">
<ItemsControl ItemsSource="{Binding parSets}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock Style="{StaticResource TextBlockStyle}" Text="{Binding TextBlockContext}" />
<TextBox
Width="100"
Margin="10,0,0,0"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding Minute}" />
<TextBlock Style="{StaticResource TextBlockStyle}" Text="(分)" />
<TextBox
Width="100"
Margin="0,10"
VerticalAlignment="Center"
Background="Transparent"
BorderBrush="#FF23CACA"
CaretBrush="Aqua"
FontFamily="楷体"
FontSize="21"
Foreground="#ff34f7f7"
Text="{Binding Second}" />
<TextBlock Style="{StaticResource TextBlockStyle}" Text="(秒)" />

<CheckBox
Height="20"
Margin="10"
VerticalAlignment="Center"
Background="#FF2AB2E7"
Content="{Binding CheckBoxContext}"
FontSize="14"
Foreground="#00c2f4"
IsChecked="{Binding IsShield}"
Template="{StaticResource CbTemplate}" />

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

</Grid>

</Grid>


</UserControl>

+ 28
- 0
BPASmartClient.MorkS3/View/ParSet.xaml.cs View File

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

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

+ 79
- 0
BPASmartClient.MorkS3/ViewModel/DebugViewModel.cs View File

@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmartClient.Helper;
using BPASmartClient.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.EventBus;
using BPASmartClient.MorkS3.Model;
using System.Windows;
using BPASmartClient.Message;

namespace BPASmartClient.MorkS3.ViewModel
{
public class DebugViewModel : ObservableObject
{
public DebugViewModel()
{
InitCommand = new RelayCommand(() => {
ActionManage.GetInstance.Send("InitDevice");
ActionManage.GetInstance.Send("初始化设定煮面时间");
});
SimOrderCommand = new RelayCommand(() =>
{
new MorksSimorderModel() { Bowloc = this.BowlLoc, NoodleLoc = this.NoodleLoc }.Publish();
});
SimOrderRandomCommand = new RelayCommand(() =>
{
int NoodPosition = 0;
int BowPosion = 0;
NoodPosition = IsNoodPositon == true ? 0 : NoodleLoc;
BowPosion = IsBowPositon == true ? 0 : BowlLoc;
ActionManage.GetInstance.Send("EnableForOrder", new object[] { NoodPosition, BowPosion });
});
SimOrderRandomCloseCommand = new RelayCommand(() =>
{
ThreadManage.GetInstance().StopTask("ForOrder");
MessageLog.GetInstance.Show("停止模拟随机订单");
});
EnableLacalSimOrder = new RelayCommand(() =>
{
Global.EnableLocalSimOrder = LocalSimOrder;
VisibilitySimOrder = LocalSimOrder == true ? Visibility.Visible : Visibility.Collapsed;
});
VisibilitySimOrder = LocalSimOrder == true? Visibility.Visible : Visibility.Collapsed;
}

public RelayCommand InitCommand { get; set; }

public RelayCommand SimOrderCommand { get; set; }

public RelayCommand SimOrderRandomCommand { get; set; }

public RelayCommand SimOrderRandomCloseCommand { get; set; }

public RelayCommand EnableLacalSimOrder { get; set; }
public int NoodleLoc { get { return _mNoodleLoc; } set { _mNoodleLoc = value; OnPropertyChanged(); } }
private int _mNoodleLoc = 1;


public int BowlLoc { get { return _mBowlLoc; } set { _mBowlLoc = value; OnPropertyChanged(); } }
private int _mBowlLoc = 10;

public bool IsNoodPositon { get { return _isNoodPositon; } set { _isNoodPositon = value; OnPropertyChanged(); } }
private bool _isNoodPositon = false;

public bool IsBowPositon { get { return _isBowPositon; } set { _isBowPositon = value; OnPropertyChanged(); } }
private bool _isBowPositon = false;

public bool LocalSimOrder { get { return _localSimOrder; } set { _localSimOrder = value; OnPropertyChanged(); } }
private bool _localSimOrder = Global.EnableLocalSimOrder;

public Visibility VisibilitySimOrder { get { return _visibilitySimOrder; } set { _visibilitySimOrder = value; OnPropertyChanged(); } }
private Visibility _visibilitySimOrder;
}
}

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

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

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

}

public static int DeviceId { get; set; }

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

}
}

+ 49
- 0
BPASmartClient.MorkS3/ViewModel/ParSetViewModel.cs View File

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

namespace BPASmartClient.MorkS3.ViewModel
{
public class ParSetViewModel : ObservableObject
{
public ParSetViewModel()
{
SaveInfoCommand = new RelayCommand(SaveSettingData);

ActionManage.GetInstance.Register(SaveSettingData, "初始化设定煮面时间");
}

public RelayCommand SaveInfoCommand { get; set; }

public ObservableCollection<ParSet> parSets { get; set; } = Json<MorksPar>.Data.parSets;

private void SaveSettingData()
{
List<ushort> values = new List<ushort>();
values.Clear();

List<bool> bools = new List<bool>();
bools.Clear();

for (int i = 0; i < Json<MorksPar>.Data.parSets.Count; i++)
{
values.Clear();
values.Add(Json<MorksPar>.Data.parSets[i].Minute);
values.Add(Json<MorksPar>.Data.parSets[i].Second);
bools.Add(Json<MorksPar>.Data.parSets[i].IsShield);
ActionManage.GetInstance.Send("WriteVW", new WritePar() { Address = $"VW{116 + (i * 6)}", Value = values.ToArray() });
}
ActionManage.GetInstance.Send("WriteBools", new WritePar() { Address = "M260.0", Value = bools.ToArray() });
Json<MorksPar>.Save();
}
}
}

+ 42
- 0
BPASmartClient.MorkS3/VoiceAPI.cs View File

@@ -0,0 +1,42 @@
using BPASmartClient.Message;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.MorkS3
{
public class VoiceAPI
{
public VoiceAPI()
{
}
[DllImport("winmm.dll")]
public static extern bool PlaySound(string pszSound, int hmod, int fdwSound);


// 系统播放wav格式的文件
public static void m_SystemPlayWav(string strPlayFile)
{
try
{
if (strPlayFile.Trim() == "")
{ return; }//为空不放

string strPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
strPath = strPath + strPlayFile;

int SND_FILENAME = 0x00020000;
int SND_ASYNC = 0x0001;
PlaySound(strPath, 0, SND_ASYNC | SND_FILENAME);//播放音乐
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx(ex.Message);
}
}
}
}

+ 5
- 0
BPASmartClient.MorkT_BarCounter/BPASmartClient.MorkT_BarCounter.csproj View File

@@ -16,12 +16,17 @@
<ProjectReference Include="..\BPASmartClient.Juicer\BPASmartClient.Juicer.csproj" />
<ProjectReference Include="..\BPASmartClient.Lebai\BPASmartClient.Lebai.csproj" />
<ProjectReference Include="..\BPASmartClient.MCU\BPASmartClient.MCU.csproj" />
<ProjectReference Include="..\BPASmartClient.MilkTeaCube\BPASmartClient.MilkTeaCube.csproj" />
<ProjectReference Include="..\BPASmartClient.RobotGripper\BPASmartClient.RobotGripper.csproj" />
</ItemGroup>

<ItemGroup>
<Page Update="View\DebugView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
</Page>
<Page Update="View\TestView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
</Page>
</ItemGroup>

</Project>

+ 309
- 553
BPASmartClient.MorkT_BarCounter/Control_MorkT_BarCounter.cs
File diff suppressed because it is too large
View File


+ 20
- 6
BPASmartClient.MorkT_BarCounter/GVL_MorkT.cs View File

@@ -71,6 +71,13 @@ namespace BPASmartClient.MorkT_BarCounter
public const int JUICE_放杯 = 20120;
public const int JUICE_放杯检测 = 20120;
#endregion


/// <summary>
/// <summary>
/// 咖啡订单队列
/// </summary>
public ConcurrentQueue<OrderLocInfo> morkOrderPushesAll = new ConcurrentQueue<OrderLocInfo>();
/// <summary>
/// <summary>
/// 咖啡订单队列
@@ -99,18 +106,25 @@ namespace BPASmartClient.MorkT_BarCounter
public bool MakeJuiceEnd = false;

/// <summary>
/// 做茶订单队列
/// 出果汁完成,是否去取果汁
/// </summary>
public ConcurrentQueue<OrderLocInfo> morkOrderPushesTea = new ConcurrentQueue<OrderLocInfo>();
public static ushort[] MilkTeaCHValue = new ushort[12] {200,200,200,200,200,200,200,200,200,200,200,200 };
/// <summary>
/// 接水口是否有茶水杯
/// 做茶订单队列
/// </summary>
public bool IsHaveTeaWaterCup = false;
public ConcurrentQueue<OrderLocInfo> morkOrderPushesMilkTea = new ConcurrentQueue<OrderLocInfo>();
/// <summary>
/// 水已经接完,是否去取水
/// 接奶茶口是否有奶茶
/// </summary>
public bool MakeTeaEnd = false;
public bool IsHaveTeaMilkTeaCup = false;

/// <summary>
/// 奶茶做完成
/// </summary>
public bool MakeMilkTeaEnd = false;
public static bool DI0 = false;
public static bool DI1 = false;
public static bool DI2 = false;
/// <summary>
/// 做开水订单队列
/// </summary>


+ 12
- 13
BPASmartClient.MorkT_BarCounter/PolymerBatching.cs View File

@@ -19,15 +19,15 @@ namespace BPASmartClient.MorkT_BarCounter
/// <summary>
/// 果汁
/// </summary>
JUICE,
//JUICE,
/// <summary>
/// 茶水
/// </summary>
TEA,
MilkTea,
/// <summary>
/// 水
/// </summary>
WATER,
//WATER,
/// <summary>
/// 杯子
/// </summary>
@@ -42,10 +42,10 @@ namespace BPASmartClient.MorkT_BarCounter

internal class PolymerBatching
{
internal const string Juicer_MAIN_BATCHIN1_LOC = "52";
internal const string Juicer_MAIN_BATCHIN2_LOC = "53";
internal const string Juicer_MAIN_BATCHIN3_LOC = "54";
internal const string Juicer_MAIN_BATCHIN4_LOC = "55";
//internal const string Juicer_MAIN_BATCHIN1_LOC = "52";
//internal const string Juicer_MAIN_BATCHIN2_LOC = "53";
//internal const string Juicer_MAIN_BATCHIN3_LOC = "54";
//internal const string Juicer_MAIN_BATCHIN4_LOC = "55";
//internal const string Juicer_MAIN_BATCHIN5_LOC = "56";
//internal const string Juicer_MAIN_BATCHIN6_LOC = "57";
//internal const string Juicer_MAIN_BATCHIN7_LOC = "58";
@@ -80,12 +80,11 @@ namespace BPASmartClient.MorkT_BarCounter
{"24",GOODS_TYPE.COFFEE},
{"25",GOODS_TYPE.COFFEE},
{ COFFEE_HOLDER_LOC,GOODS_TYPE.CUP},
{"56",GOODS_TYPE.TEA },
{"61",GOODS_TYPE.WATER },
{Juicer_MAIN_BATCHIN1_LOC,GOODS_TYPE.JUICE},
{Juicer_MAIN_BATCHIN2_LOC,GOODS_TYPE.JUICE},
{Juicer_MAIN_BATCHIN3_LOC,GOODS_TYPE.JUICE},
{Juicer_MAIN_BATCHIN4_LOC,GOODS_TYPE.JUICE},
{"60",GOODS_TYPE.MilkTea },
//{Juicer_MAIN_BATCHIN1_LOC,GOODS_TYPE.JUICE},
//{Juicer_MAIN_BATCHIN2_LOC,GOODS_TYPE.JUICE},
//{Juicer_MAIN_BATCHIN3_LOC,GOODS_TYPE.JUICE},
//{Juicer_MAIN_BATCHIN4_LOC,GOODS_TYPE.JUICE},
//{Juicer_MAIN_BATCHIN5_LOC,GOODS_TYPE.JUICE},
//{Juicer_MAIN_BATCHIN6_LOC,GOODS_TYPE.JUICE},
//{Juicer_MAIN_BATCHIN7_LOC,GOODS_TYPE.JUICE},


+ 92
- 414
BPASmartClient.MorkT_BarCounter/View/DebugView.xaml View File

@@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:BPASmartClient.MorkT_BarCounter.ViewModel"
mc:Ignorable="d"
Name="试界面"
Name="试界面"
d:DesignHeight="500" d:DesignWidth="1000" Unloaded="Dubug_Unloaded">
<UserControl.DataContext>
<vm:DebugViewModel/>
@@ -18,422 +18,100 @@
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid Grid.ColumnSpan="2">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="10*"/>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="15*"/>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Border BorderThickness="0,0,1,1" BorderBrush="DodgerBlue" Grid.Row="0" Grid.Column="0"></Border>
<Border BorderThickness="0,0,1,1" BorderBrush="DodgerBlue" Grid.Row="1" Grid.Column="0"></Border>
<Border BorderThickness="0,0,1,0" BorderBrush="DodgerBlue" Grid.Row="2" Grid.Column="0"></Border>
<Border BorderThickness="0,0,0,1" BorderBrush="DodgerBlue" Grid.Row="0" Grid.Column="1"></Border>
<Border BorderThickness="0,0,0,1" BorderBrush="DodgerBlue" Grid.Row="1" Grid.Column="1"></Border>
<Border BorderThickness="0,0,0,0" BorderBrush="DodgerBlue" Grid.Row="2" Grid.Column="1"></Border>
<GroupBox Grid.Row="0" Grid.Column="0"
FontFamily="楷体"
FontSize="20"
Header=" 乐白机器人 ">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<StackPanel Orientation="Horizontal">
<TextBlock Text="连接状态:" />
<TextBlock Text="{Binding RobotConnected}"
Margin="40,0"/>
</StackPanel>
</Grid>
<Grid Grid.Row="1">
<StackPanel Orientation="Horizontal">
<TextBlock Text="当前模式:" Margin="0,1"/>
<TextBlock Text="{Binding RobotMode}"
Margin="40,0"/>
</StackPanel>
</Grid>
<Grid Grid.Row="2">
<DockPanel>
<Button Content="启动" Width="50" Height="40"
Command="{Binding Button_RobotControlCommand}"
CommandParameter="机器人启动">
</Button>
<Button Content="暂停" Width="50" Height="40"
Command="{Binding Button_RobotControlCommand}"
CommandParameter="暂停"/>
<Button Content="恢复" Width="50" Height="40"
Command="{Binding Button_RobotControlCommand}"
CommandParameter="恢复"/>
<Button Content="急停" Width="50" Height="40"
Command="{Binding Button_RobotControlCommand}"
CommandParameter="机器人急停"/>
</DockPanel>
</Grid>
<Grid Grid.Row="0" Grid.Column="1" >
<StackPanel Orientation="Horizontal" >
<TextBlock>TCP DI:</TextBlock>
<CheckBox IsEnabled="false" IsChecked="{Binding Robot_TCPDI0}" FontSize="14">DI0</CheckBox>
</StackPanel>
</Grid>
<Grid Grid.Row="1" Grid.Column="1" >
<StackPanel Orientation="Horizontal" >
<TextBlock>DI:</TextBlock>
<CheckBox IsEnabled="false" Name="Robot_DI0" FontSize="14" IsChecked="{Binding Robot_DI0}">DI0</CheckBox>
<CheckBox IsEnabled="false" Name="Robot_DI1" FontSize="14" IsChecked="{Binding Robot_DI1}">DI1</CheckBox>
<CheckBox IsEnabled="false" Name="Robot_DI2" FontSize="14" IsChecked="{Binding Robot_DI2}">DI2</CheckBox>
<CheckBox IsEnabled="false" Name="Robot_DI3" FontSize="14" IsChecked="{Binding Robot_DI3}">DI3</CheckBox>
</StackPanel>
</Grid>
<Grid Grid.Row="2" Grid.Column="1">
<StackPanel Orientation="Horizontal" >
<TextBlock>DO:</TextBlock>
<ComboBox SelectedIndex="{Binding Robot_DOutput_Pin}">
<ComboBoxItem IsSelected="true">DO0</ComboBoxItem>
<ComboBoxItem>DO1</ComboBoxItem>
<ComboBoxItem>DO2</ComboBoxItem>
<ComboBoxItem>DO3</ComboBoxItem>
</ComboBox>
<ComboBox SelectedIndex="{Binding Robot_DOutput_Value}">
<ComboBoxItem IsSelected="true">true</ComboBoxItem>
<ComboBoxItem>false</ComboBoxItem>
</ComboBox>
<Button Content="输出" Command="{Binding Robot_DOutput}"/>
</StackPanel>
</Grid>
</Grid>
</GroupBox>
<GroupBox Grid.Row="1" Grid.Column="0"
Header="单片机控制"
FontSize="18"
FontFamily="楷体">
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Row="0">
<StackPanel Orientation="Horizontal">
<TextBlock >连接状态:</TextBlock>
<TextBlock Text="{Binding MCUConnected}" />
</StackPanel>
</Grid>
<Grid Grid.Row="1">
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="12">DI:</TextBlock>
<CheckBox FontSize="12" IsEnabled="false" IsChecked="{Binding CH0}">DI0</CheckBox>
<CheckBox FontSize="12" IsEnabled="false" Name="CH1">DI1</CheckBox>
<CheckBox FontSize="12" IsEnabled="false" Name="CH2">DI2</CheckBox>
<CheckBox FontSize="12" IsEnabled="false" Name="CH3">DI3</CheckBox>
<CheckBox FontSize="12" IsEnabled="false" Name="CH4">DI4</CheckBox>
<CheckBox FontSize="12" IsEnabled="false" Name="CH5">DI5</CheckBox>
<CheckBox FontSize="12" IsEnabled="false" Name="CH6">DI6</CheckBox>
<CheckBox FontSize="12" IsEnabled="false" Name="CH7">DI7</CheckBox>
</StackPanel>
</Grid>
<Grid Grid.Row="2" Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="12" HorizontalAlignment="Center">DO输出</TextBlock>
<ComboBox Width="50" FontSize="12" HorizontalAlignment="Center" SelectedIndex="{Binding MCU_DO_CH}">
<ComboBoxItem IsSelected="true">DO0</ComboBoxItem>
<ComboBoxItem>DO1</ComboBoxItem>
<ComboBoxItem>DO2</ComboBoxItem>
<ComboBoxItem>DO3</ComboBoxItem>
<ComboBoxItem>DO4</ComboBoxItem>
<ComboBoxItem>DO5</ComboBoxItem>
<ComboBoxItem>DO6</ComboBoxItem>
<ComboBoxItem>DO7</ComboBoxItem>
</ComboBox>
<ComboBox FontSize="12" HorizontalAlignment="Center" SelectedIndex="{Binding MCU_DO_CH}">
<ComboBoxItem IsSelected="true">True</ComboBoxItem>
<ComboBoxItem>False</ComboBoxItem>
</ComboBox>
<Button Width="50" Command="{Binding Button_MCUDOuputCommand}">输出</Button>
</StackPanel>
</Grid>
<Grid Grid.Column="1">
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="12" HorizontalAlignment="Center">舵机控制</TextBlock>
<ComboBox Margin="0,0,0,0" FontSize="12" Width="60" SelectedIndex="{Binding MCU_PWM_CH}">
<ComboBoxItem IsSelected="true">舵机1</ComboBoxItem>
<ComboBoxItem>舵机2</ComboBoxItem>
<ComboBoxItem>舵机3</ComboBoxItem>
<ComboBoxItem>舵机4</ComboBoxItem>
</ComboBox>
<TextBox Width="50" Text="{Binding PWMInputNumber}"></TextBox>
<Button FontSize="15" HorizontalAlignment="Center" Command="{Binding Button_MCUOuputCommand}">输出</Button>
</StackPanel>
</Grid>
</Grid>
</Grid>
</GroupBox>
<GroupBox Grid.Row="2" Grid.Column="0"
FontFamily="楷体"
FontSize="20"
Header=" 果汁机 ">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="5*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="3*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="3*"/>
</Grid.RowDefinitions>
<Grid>
<TextBlock Text="连接状态:" />
</Grid>
<Grid Grid.Column="1">
<TextBlock Text="{Binding JuicerConnected}"
Margin="120,0,0,0"/>
</Grid>
<Grid Grid.Row="1">
<TextBlock Text="设备状态:" />
</Grid>
<Grid Grid.Column="1" Grid.Row="1">
<StackPanel Orientation="Horizontal" >
<Button IsEnabled="False" Command="{Binding JuiceState_Heating}" >制热</Button>
<Button IsEnabled="False" Command="{Binding JuiceState_Cooling}" >制冷</Button>
<Button IsEnabled="False" Command="{Binding JuiceState_LackOfWater}" >缺水</Button>
<Button IsEnabled="False" Command="{Binding JuiceState_ChildLocks}" >童锁</Button>
<Button IsEnabled="False" Command="{Binding JuiceState_Using}" >使用</Button>
</StackPanel>
</Grid>
<Grid Grid.Row="2">
<TextBlock>果汁:</TextBlock>
</Grid>
<Grid Grid.Column="1" Grid.Row="2">
<StackPanel Orientation="Horizontal">
<ComboBox SelectedItem="{Binding MakeJuice_Index}">
<ComboBoxItem IsSelected="true">0</ComboBoxItem>
<ComboBoxItem>1</ComboBoxItem>
<ComboBoxItem>2</ComboBoxItem>
<ComboBoxItem>3</ComboBoxItem>
<ComboBoxItem>4</ComboBoxItem>
<ComboBoxItem>5</ComboBoxItem>
<ComboBoxItem>6</ComboBoxItem>
<ComboBoxItem>7</ComboBoxItem>
</ComboBox>
<Button Command="{Binding Button_MakeJuiceCommand}" Content="制作" />
</StackPanel>
</Grid>
</Grid>
</GroupBox>
<GroupBox Grid.Row="0" Grid.Column="1"
Header="订单模拟"
FontSize="18"
FontFamily="楷体">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Grid.Column="0">
<StackPanel Orientation="Horizontal">
<TextBlock>咖啡:</TextBlock>
<ComboBox Margin="10,0"
Width="100"
ItemsSource="{Binding Coffees}"
SelectedItem="{Binding SimOrderCoffeeList}" />
<Button Command="{Binding SimOrderMakeCoffee}">制作</Button>
</StackPanel>
</Grid>
<Grid Grid.Row="1" Grid.Column="0">
<StackPanel Orientation="Horizontal">
<TextBlock>果汁:</TextBlock>
<ComboBox SelectedIndex="{Binding SimOrder_JuiceList}">
<ComboBoxItem IsSelected="true" >饮品1</ComboBoxItem>
<ComboBoxItem>饮品2</ComboBoxItem>
<ComboBoxItem>饮品3</ComboBoxItem>
<ComboBoxItem>饮品4</ComboBoxItem>
</ComboBox>
<ComboBox SelectedItem="{Binding SimOrder_JuiceMakeID}">
<ComboBoxItem IsSelected="true">热饮</ComboBoxItem>
<ComboBoxItem>常温</ComboBoxItem>
<ComboBoxItem>冷饮</ComboBoxItem>
</ComboBox>
<Button Command="{Binding SimOrderMakeJuice}">制作</Button>
</StackPanel>
</Grid>
<Grid Grid.Row="0" Grid.Column="1">
<StackPanel Orientation="Horizontal">
<TextBlock>开水:</TextBlock>
<Button Command="{Binding SimOrderMakeWater}">制作</Button>
</StackPanel>
</Grid>
<Grid Grid.Row="1" Grid.Column="1">
<StackPanel Orientation="Horizontal">
<TextBlock>茶水:</TextBlock>
<Button Command="{Binding SimOrderMakeTea}">制作</Button>
</StackPanel>
</Grid>
</Grid>
</GroupBox>
<GroupBox Grid.Row="1" Grid.Column="1"
Header="制冰机控制"
FontSize="18"
FontFamily="楷体">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<StackPanel Orientation="Horizontal" >
<TextBlock>连接状态:</TextBlock>
<TextBlock Text="{Binding IceMakerConnected}" />
</StackPanel>
</Grid>
<Grid Grid.Row="0" Grid.Column="1">
<StackPanel Orientation="Horizontal">
<Button Command="{Binding IceMaker_BtnPowerOn}">开机</Button>
<Button Command="{Binding IceMaker_BtnStandby}">待机</Button>
<Button Command="{Binding IceMaker_BtnPump}" >抽水</Button>
</StackPanel>
</Grid>
<Grid Grid.Row="1" Grid.ColumnSpan="2">
<StackPanel Orientation="Horizontal" >
<TextBlock>设备状态:</TextBlock>
<TextBlock Text="{Binding IceMakerState}" />
<Button IsEnabled="False" Name="IceMaker_State1" >开机状态</Button>
<Button IsEnabled="False" Name="IceMaker_State2" >待机状态</Button>
<Button IsEnabled="False" Name="IceMaker_State3" >电机故障</Button>
<Button IsEnabled="False" Name="IceMaker_State4" >冰满</Button>
</StackPanel>
</Grid>
<Grid Grid.Row="2" Grid.Column="0">
<StackPanel Orientation="Horizontal">
<TextBlock>控制:</TextBlock>
<Button Command="{Binding IceMaker_BtnStart}">开始出冰</Button>
<Button Command="{Binding IceMaker_BtnEnd}">结束出冰</Button>
</StackPanel>
</Grid>
<Grid Grid.Row="2" Grid.Column="01">
<StackPanel Orientation="Horizontal" >
<TextBlock>出冰时间:</TextBlock>
<TextBox Width="50" Text="{Binding IceMaker_IceTime}"></TextBox>
<TextBlock>s</TextBlock>
<Button Command="{Binding IceMaker_BtnSetIceTime}">设置</Button>
</StackPanel>
</Grid>
</Grid>
</GroupBox>
<GroupBox Grid.Row="2" Grid.Column="1"
FontFamily="楷体"
FontSize="20"
Header=" 咖啡机">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Row="0">
<TextBlock Text="连接状态" />
</Grid>
<Grid Grid.Row="0" Grid.Column="1">
<TextBlock Text="{Binding CoffeeConnected}"/>
</Grid>
<Grid Grid.Row="1" Grid.RowSpan="2" Grid.ColumnSpan="2">
<Grid.Resources>
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>
<TextBlock Height="23" Width="100" FontSize="18" HorizontalAlignment="Center">咖啡机状态</TextBlock>
<TextBlock FontSize="18"
Grid.Column="1"
Text="{Binding CoffeeStatus}" Height="23" />
<TextBlock Grid.Column="2" Height="23" Width="80" FontSize="18">应用状态</TextBlock>
<TextBlock FontSize="18"
Grid.Column="3"
Text="{Binding AppStatus}" Height="23"/>
<TextBlock Grid.Row="1" Grid.Column="0" Height="22" Width="80" FontSize="18">告警信息</TextBlock>
<TextBlock FontSize="15"
Grid.Row="1"
Grid.Column="1"
Text="{Binding Warning}" />
<TextBlock Grid.Row="1" Grid.Column="2" Height="22" Width="80" FontSize="18">故障信息</TextBlock>
<TextBlock FontSize="18"
Grid.Row="1"
Grid.Column="3"
Text="{Binding CaffeeFault}" Height="22" Width="60" />
</Grid>
<Grid Grid.Row="3" Grid.ColumnSpan="2">
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock>饮品</TextBlock>
<ComboBox Margin="10,0"
Width="100"
ItemsSource="{Binding Coffees}"
SelectedItem="{Binding SelectedCoffee}" />
<Button Margin="10,0"
Command="{Binding Button_MakeCoffeeCommand }"
Content="制作"/>
<Button Margin="10,0"
Command="{Binding Button_StopMakeCoffeCommand}"
Content="停止制作"/>
</StackPanel>
</Grid>
<Grid Grid.Row="4" Grid.ColumnSpan="2">
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock>模式</TextBlock>
<ComboBox Margin="10,0"
Width="100"
ItemsSource="{Binding CoffeeCmds}"
SelectedItem="{Binding SelectedCoffeeCmd}"/>
<Button Margin="10,0"
Command="{Binding Button_CoffeeModeSetCommand}"
Content="设置" Cursor="Hand"/>
</StackPanel>
</Grid>
</Grid>
</GroupBox>
<WrapPanel>
<TextBlock Grid.Column="0" Height="22" Width="100" FontSize="14">机器人执行程序:</TextBlock>
<TextBox Margin="10" Width="80" Text="{Binding JakaRobotProgram}"></TextBox>
<Button Margin="10" Content="启动" Width="50" Command="{Binding RobotControlCommand}"></Button>
</WrapPanel>
<WrapPanel Grid.Column="1">
<TextBlock Grid.Column="0" Height="22" Width="100" FontSize="14">咖啡机执行程序:</TextBlock>
<TextBox Margin="10" Width="80" Text="{Binding CoffeeKind}"></TextBox>
<Button Margin="10" Content="启动" Width="50" Command="{Binding CoffeeControlCommand}"></Button>
</WrapPanel>
<Grid Grid.Column="2">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<WrapPanel Grid.Row="0" Grid.Column="0" >
<TextBlock Width="80" FontSize="14">通道1的值:</TextBlock>
<TextBox Margin="2" Width="50" Text="{Binding CH_Value[0]}"></TextBox>
</WrapPanel>
<WrapPanel Grid.Row="0" Grid.Column="1" >
<TextBlock Width="80" FontSize="14">通道2的值:</TextBlock>
<TextBox Margin="2" Width="50" Text="{Binding CH_Value[1]}"></TextBox>
</WrapPanel>
<WrapPanel Grid.Row="1" Grid.Column="0" >
<TextBlock Width="80" FontSize="14">通道3的值:</TextBlock>
<TextBox Margin="2" Width="50" Text="{Binding CH_Value[2]}"></TextBox>
</WrapPanel>
<WrapPanel Grid.Row="1" Grid.Column="1" >
<TextBlock Width="80" FontSize="14">通道4的值:</TextBlock>
<TextBox Margin="2" Width="50" Text="{Binding CH_Value[3]}"></TextBox>
</WrapPanel>
<WrapPanel Grid.Row="2" Grid.Column="0" >
<TextBlock Width="80" FontSize="14">通道5的值:</TextBlock>
<TextBox Margin="2" Width="50" Text="{Binding CH_Value[4]}"></TextBox>
</WrapPanel>
<WrapPanel Grid.Row="2" Grid.Column="1" >
<TextBlock Width="80" FontSize="14">通道6的值:</TextBlock>
<TextBox Margin="2" Width="50" Text="{Binding CH_Value[5]}"></TextBox>
</WrapPanel>
<WrapPanel Grid.Row="3" Grid.Column="0" >
<TextBlock Width="80" FontSize="14">通道7的值:</TextBlock>
<TextBox Margin="2" Width="50" Text="{Binding CH_Value[6]}"></TextBox>
</WrapPanel>
<WrapPanel Grid.Row="3" Grid.Column="1" >
<TextBlock Width="80" FontSize="14">通道8的值:</TextBlock>
<TextBox Margin="2" Width="50" Text="{Binding CH_Value[7]}"></TextBox>
</WrapPanel>
<WrapPanel Grid.Row="4" Grid.Column="0" >
<TextBlock Width="80" FontSize="14">通道9的值:</TextBlock>
<TextBox Margin="2" Width="50" Text="{Binding CH_Value[8]}"></TextBox>
</WrapPanel>
<WrapPanel Grid.Row="4" Grid.Column="1" >
<TextBlock Width="80" FontSize="14">通道10的值:</TextBlock>
<TextBox Margin="2" Width="50" Text="{Binding CH_Value[9]}"></TextBox>
</WrapPanel>
<WrapPanel Grid.Row="5" Grid.Column="0" >
<TextBlock Width="80" FontSize="14">通道11的值:</TextBlock>
<TextBox Margin="2" Width="50" Text="{Binding CH_Value[10]}"></TextBox>
</WrapPanel>
<WrapPanel Grid.Row="5" Grid.Column="1" >
<TextBlock Width="80" FontSize="14">通道12的值:</TextBlock>
<TextBox Margin="2" Width="50" Text="{Binding CH_Value[11]}"></TextBox>
</WrapPanel>
<WrapPanel Grid.Row="6" Grid.ColumnSpan="2" >
<TextBlock Height="22" Width="100" FontSize="14">味魔方执行程序:</TextBlock>
<TextBox Margin="2" Width="80" Text="{Binding MilkTeaCub}"></TextBox>
<Button Margin="2" Content="启动" Width="50" Command="{Binding MikeTeaCupControlCommand}"></Button>
<Button Margin="2" Content="设置参数" Width="60" Command="{Binding MikeTeaCupSetParCommand}"></Button>
</WrapPanel>
</Grid>

<WrapPanel Grid.Row="1">
<TextBlock Grid.Column="0" Height="22" Width="100" FontSize="14">电爪执行程序:</TextBlock>
<TextBox Margin="10" Width="80" Text="{Binding GripperProgam}"></TextBox>
<Button Margin="10" Content="启动" Width="50" Command="{Binding GripperControlCommand}"></Button>
</WrapPanel>
</Grid>
</UserControl>

+ 439
- 0
BPASmartClient.MorkT_BarCounter/View/TestView.xaml View File

@@ -0,0 +1,439 @@
<UserControl x:Class="BPASmartClient.MorkT_BarCounter.View.TestView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:BPASmartClient.MorkT_BarCounter.ViewModel"
mc:Ignorable="d"
Name="测试界面"
d:DesignHeight="500" d:DesignWidth="1000" Unloaded="Dubug_Unloaded">
<UserControl.DataContext>
<vm:TestViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10*"/>
<ColumnDefinition Width="10*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="10*"/>
<RowDefinition Height="10*"/>
<RowDefinition Height="15*"/>
</Grid.RowDefinitions>
<Border BorderThickness="0,0,1,1" BorderBrush="DodgerBlue" Grid.Row="0" Grid.Column="0"></Border>
<Border BorderThickness="0,0,1,1" BorderBrush="DodgerBlue" Grid.Row="1" Grid.Column="0"></Border>
<Border BorderThickness="0,0,1,0" BorderBrush="DodgerBlue" Grid.Row="2" Grid.Column="0"></Border>
<Border BorderThickness="0,0,0,1" BorderBrush="DodgerBlue" Grid.Row="0" Grid.Column="1"></Border>
<Border BorderThickness="0,0,0,1" BorderBrush="DodgerBlue" Grid.Row="1" Grid.Column="1"></Border>
<Border BorderThickness="0,0,0,0" BorderBrush="DodgerBlue" Grid.Row="2" Grid.Column="1"></Border>
<GroupBox Grid.Row="0" Grid.Column="0"
FontFamily="楷体"
FontSize="20"
Header=" 乐白机器人 ">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<StackPanel Orientation="Horizontal">
<TextBlock Text="连接状态:" />
<TextBlock Text="{Binding RobotConnected}"
Margin="40,0"/>
</StackPanel>
</Grid>
<Grid Grid.Row="1">
<StackPanel Orientation="Horizontal">
<TextBlock Text="当前模式:" Margin="0,1"/>
<TextBlock Text="{Binding RobotMode}"
Margin="40,0"/>
</StackPanel>
</Grid>
<Grid Grid.Row="2">
<DockPanel>
<Button Content="启动" Width="50" Height="40"
Command="{Binding Button_RobotControlCommand}"
CommandParameter="机器人启动">
</Button>
<Button Content="暂停" Width="50" Height="40"
Command="{Binding Button_RobotControlCommand}"
CommandParameter="暂停"/>
<Button Content="恢复" Width="50" Height="40"
Command="{Binding Button_RobotControlCommand}"
CommandParameter="恢复"/>
<Button Content="急停" Width="50" Height="40"
Command="{Binding Button_RobotControlCommand}"
CommandParameter="机器人急停"/>
</DockPanel>
</Grid>
<Grid Grid.Row="0" Grid.Column="1" >
<StackPanel Orientation="Horizontal" >
<TextBlock>TCP DI:</TextBlock>
<CheckBox IsEnabled="false" IsChecked="{Binding Robot_TCPDI0}" FontSize="14">DI0</CheckBox>
</StackPanel>
</Grid>
<Grid Grid.Row="1" Grid.Column="1" >
<StackPanel Orientation="Horizontal" >
<TextBlock>DI:</TextBlock>
<CheckBox IsEnabled="false" Name="Robot_DI0" FontSize="14" IsChecked="{Binding Robot_DI0}">DI0</CheckBox>
<CheckBox IsEnabled="false" Name="Robot_DI1" FontSize="14" IsChecked="{Binding Robot_DI1}">DI1</CheckBox>
<CheckBox IsEnabled="false" Name="Robot_DI2" FontSize="14" IsChecked="{Binding Robot_DI2}">DI2</CheckBox>
<CheckBox IsEnabled="false" Name="Robot_DI3" FontSize="14" IsChecked="{Binding Robot_DI3}">DI3</CheckBox>
</StackPanel>
</Grid>
<Grid Grid.Row="2" Grid.Column="1">
<StackPanel Orientation="Horizontal" >
<TextBlock>DO:</TextBlock>
<ComboBox SelectedIndex="{Binding Robot_DOutput_Pin}">
<ComboBoxItem IsSelected="true">DO0</ComboBoxItem>
<ComboBoxItem>DO1</ComboBoxItem>
<ComboBoxItem>DO2</ComboBoxItem>
<ComboBoxItem>DO3</ComboBoxItem>
</ComboBox>
<ComboBox SelectedIndex="{Binding Robot_DOutput_Value}">
<ComboBoxItem IsSelected="true">true</ComboBoxItem>
<ComboBoxItem>false</ComboBoxItem>
</ComboBox>
<Button Content="输出" Command="{Binding Robot_DOutput}"/>
</StackPanel>
</Grid>
</Grid>
</GroupBox>
<GroupBox Grid.Row="1" Grid.Column="0"
Header="单片机控制"
FontSize="18"
FontFamily="楷体">
<Grid>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Row="0">
<StackPanel Orientation="Horizontal">
<TextBlock >连接状态:</TextBlock>
<TextBlock Text="{Binding MCUConnected}" />
</StackPanel>
</Grid>
<Grid Grid.Row="1">
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="12">DI:</TextBlock>
<CheckBox FontSize="12" IsEnabled="false" IsChecked="{Binding CH0}">DI0</CheckBox>
<CheckBox FontSize="12" IsEnabled="false" Name="CH1">DI1</CheckBox>
<CheckBox FontSize="12" IsEnabled="false" Name="CH2">DI2</CheckBox>
<CheckBox FontSize="12" IsEnabled="false" Name="CH3">DI3</CheckBox>
<CheckBox FontSize="12" IsEnabled="false" Name="CH4">DI4</CheckBox>
<CheckBox FontSize="12" IsEnabled="false" Name="CH5">DI5</CheckBox>
<CheckBox FontSize="12" IsEnabled="false" Name="CH6">DI6</CheckBox>
<CheckBox FontSize="12" IsEnabled="false" Name="CH7">DI7</CheckBox>
</StackPanel>
</Grid>
<Grid Grid.Row="2" Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="12" HorizontalAlignment="Center">DO输出</TextBlock>
<ComboBox Width="50" FontSize="12" HorizontalAlignment="Center" SelectedIndex="{Binding MCU_DO_CH}">
<ComboBoxItem IsSelected="true">DO0</ComboBoxItem>
<ComboBoxItem>DO1</ComboBoxItem>
<ComboBoxItem>DO2</ComboBoxItem>
<ComboBoxItem>DO3</ComboBoxItem>
<ComboBoxItem>DO4</ComboBoxItem>
<ComboBoxItem>DO5</ComboBoxItem>
<ComboBoxItem>DO6</ComboBoxItem>
<ComboBoxItem>DO7</ComboBoxItem>
</ComboBox>
<ComboBox FontSize="12" HorizontalAlignment="Center" SelectedIndex="{Binding MCU_DO_CH}">
<ComboBoxItem IsSelected="true">True</ComboBoxItem>
<ComboBoxItem>False</ComboBoxItem>
</ComboBox>
<Button Width="50" Command="{Binding Button_MCUDOuputCommand}">输出</Button>
</StackPanel>
</Grid>
<Grid Grid.Column="1">
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="12" HorizontalAlignment="Center">舵机控制</TextBlock>
<ComboBox Margin="0,0,0,0" FontSize="12" Width="60" SelectedIndex="{Binding MCU_PWM_CH}">
<ComboBoxItem IsSelected="true">舵机1</ComboBoxItem>
<ComboBoxItem>舵机2</ComboBoxItem>
<ComboBoxItem>舵机3</ComboBoxItem>
<ComboBoxItem>舵机4</ComboBoxItem>
</ComboBox>
<TextBox Width="50" Text="{Binding PWMInputNumber}"></TextBox>
<Button FontSize="15" HorizontalAlignment="Center" Command="{Binding Button_MCUOuputCommand}">输出</Button>
</StackPanel>
</Grid>
</Grid>
</Grid>
</GroupBox>
<GroupBox Grid.Row="2" Grid.Column="0"
FontFamily="楷体"
FontSize="20"
Header=" 果汁机 ">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="5*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="3*"/>
<RowDefinition Height="3*"/>
<RowDefinition Height="3*"/>
</Grid.RowDefinitions>
<Grid>
<TextBlock Text="连接状态:" />
</Grid>
<Grid Grid.Column="1">
<TextBlock Text="{Binding JuicerConnected}"
Margin="120,0,0,0"/>
</Grid>
<Grid Grid.Row="1">
<TextBlock Text="设备状态:" />
</Grid>
<Grid Grid.Column="1" Grid.Row="1">
<StackPanel Orientation="Horizontal" >
<Button IsEnabled="False" Command="{Binding JuiceState_Heating}" >制热</Button>
<Button IsEnabled="False" Command="{Binding JuiceState_Cooling}" >制冷</Button>
<Button IsEnabled="False" Command="{Binding JuiceState_LackOfWater}" >缺水</Button>
<Button IsEnabled="False" Command="{Binding JuiceState_ChildLocks}" >童锁</Button>
<Button IsEnabled="False" Command="{Binding JuiceState_Using}" >使用</Button>
</StackPanel>
</Grid>
<Grid Grid.Row="2">
<TextBlock>果汁:</TextBlock>
</Grid>
<Grid Grid.Column="1" Grid.Row="2">
<StackPanel Orientation="Horizontal">
<ComboBox SelectedItem="{Binding MakeJuice_Index}">
<ComboBoxItem IsSelected="true">0</ComboBoxItem>
<ComboBoxItem>1</ComboBoxItem>
<ComboBoxItem>2</ComboBoxItem>
<ComboBoxItem>3</ComboBoxItem>
<ComboBoxItem>4</ComboBoxItem>
<ComboBoxItem>5</ComboBoxItem>
<ComboBoxItem>6</ComboBoxItem>
<ComboBoxItem>7</ComboBoxItem>
</ComboBox>
<Button Command="{Binding Button_MakeJuiceCommand}" Content="制作" />
</StackPanel>
</Grid>
</Grid>
</GroupBox>
<GroupBox Grid.Row="0" Grid.Column="1"
Header="订单模拟"
FontSize="18"
FontFamily="楷体">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0" Grid.Column="0">
<StackPanel Orientation="Horizontal">
<TextBlock>咖啡:</TextBlock>
<ComboBox Margin="10,0"
Width="100"
ItemsSource="{Binding Coffees}"
SelectedItem="{Binding SimOrderCoffeeList}" />
<Button Command="{Binding SimOrderMakeCoffee}">制作</Button>
</StackPanel>
</Grid>
<Grid Grid.Row="1" Grid.Column="0">
<StackPanel Orientation="Horizontal">
<TextBlock>果汁:</TextBlock>
<ComboBox SelectedIndex="{Binding SimOrder_JuiceList}">
<ComboBoxItem IsSelected="true" >饮品1</ComboBoxItem>
<ComboBoxItem>饮品2</ComboBoxItem>
<ComboBoxItem>饮品3</ComboBoxItem>
<ComboBoxItem>饮品4</ComboBoxItem>
</ComboBox>
<ComboBox SelectedItem="{Binding SimOrder_JuiceMakeID}">
<ComboBoxItem IsSelected="true">热饮</ComboBoxItem>
<ComboBoxItem>常温</ComboBoxItem>
<ComboBoxItem>冷饮</ComboBoxItem>
</ComboBox>
<Button Command="{Binding SimOrderMakeJuice}">制作</Button>
</StackPanel>
</Grid>
<Grid Grid.Row="0" Grid.Column="1">
<StackPanel Orientation="Horizontal">
<TextBlock>开水:</TextBlock>
<Button Command="{Binding SimOrderMakeWater}">制作</Button>
</StackPanel>
</Grid>
<Grid Grid.Row="1" Grid.Column="1">
<StackPanel Orientation="Horizontal">
<TextBlock>茶水:</TextBlock>
<Button Command="{Binding SimOrderMakeTea}">制作</Button>
</StackPanel>
</Grid>
</Grid>
</GroupBox>
<GroupBox Grid.Row="1" Grid.Column="1"
Header="制冰机控制"
FontSize="18"
FontFamily="楷体">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<StackPanel Orientation="Horizontal" >
<TextBlock>连接状态:</TextBlock>
<TextBlock Text="{Binding IceMakerConnected}" />
</StackPanel>
</Grid>
<Grid Grid.Row="0" Grid.Column="1">
<StackPanel Orientation="Horizontal">
<Button Command="{Binding IceMaker_BtnPowerOn}">开机</Button>
<Button Command="{Binding IceMaker_BtnStandby}">待机</Button>
<Button Command="{Binding IceMaker_BtnPump}" >抽水</Button>
</StackPanel>
</Grid>
<Grid Grid.Row="1" Grid.ColumnSpan="2">
<StackPanel Orientation="Horizontal" >
<TextBlock>设备状态:</TextBlock>
<TextBlock Text="{Binding IceMakerState}" />
<Button IsEnabled="False" Name="IceMaker_State1" >开机状态</Button>
<Button IsEnabled="False" Name="IceMaker_State2" >待机状态</Button>
<Button IsEnabled="False" Name="IceMaker_State3" >电机故障</Button>
<Button IsEnabled="False" Name="IceMaker_State4" >冰满</Button>
</StackPanel>
</Grid>
<Grid Grid.Row="2" Grid.Column="0">
<StackPanel Orientation="Horizontal">
<TextBlock>控制:</TextBlock>
<Button Command="{Binding IceMaker_BtnStart}">开始出冰</Button>
<Button Command="{Binding IceMaker_BtnEnd}">结束出冰</Button>
</StackPanel>
</Grid>
<Grid Grid.Row="2" Grid.Column="01">
<StackPanel Orientation="Horizontal" >
<TextBlock>出冰时间:</TextBlock>
<TextBox Width="50" Text="{Binding IceMaker_IceTime}"></TextBox>
<TextBlock>s</TextBlock>
<Button Command="{Binding IceMaker_BtnSetIceTime}">设置</Button>
</StackPanel>
</Grid>
</Grid>
</GroupBox>
<GroupBox Grid.Row="2" Grid.Column="1"
FontFamily="楷体"
FontSize="20"
Header=" 咖啡机">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Row="0">
<TextBlock Text="连接状态" />
</Grid>
<Grid Grid.Row="0" Grid.Column="1">
<TextBlock Text="{Binding CoffeeConnected}"/>
</Grid>
<Grid Grid.Row="1" Grid.RowSpan="2" Grid.ColumnSpan="2">
<Grid.Resources>
<Style TargetType="TextBlock">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>
</Grid.Resources>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="2*" />
<ColumnDefinition Width="3*" />
</Grid.ColumnDefinitions>
<TextBlock Height="23" Width="100" FontSize="18" HorizontalAlignment="Center">咖啡机状态</TextBlock>
<TextBlock FontSize="18"
Grid.Column="1"
Text="{Binding CoffeeStatus}" Height="23" />
<TextBlock Grid.Column="2" Height="23" Width="80" FontSize="18">应用状态</TextBlock>
<TextBlock FontSize="18"
Grid.Column="3"
Text="{Binding AppStatus}" Height="23"/>
<TextBlock Grid.Row="1" Grid.Column="0" Height="22" Width="80" FontSize="18">告警信息</TextBlock>
<TextBlock FontSize="15"
Grid.Row="1"
Grid.Column="1"
Text="{Binding Warning}" />
<TextBlock Grid.Row="1" Grid.Column="2" Height="22" Width="80" FontSize="18">故障信息</TextBlock>
<TextBlock FontSize="18"
Grid.Row="1"
Grid.Column="3"
Text="{Binding CaffeeFault}" Height="22" Width="60" />
</Grid>
<Grid Grid.Row="3" Grid.ColumnSpan="2">
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock>饮品</TextBlock>
<ComboBox Margin="10,0"
Width="100"
ItemsSource="{Binding Coffees}"
SelectedItem="{Binding SelectedCoffee}" />
<Button Margin="10,0"
Command="{Binding Button_MakeCoffeeCommand }"
Content="制作"/>
<Button Margin="10,0"
Command="{Binding Button_StopMakeCoffeCommand}"
Content="停止制作"/>
</StackPanel>
</Grid>
<Grid Grid.Row="4" Grid.ColumnSpan="2">
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock>模式</TextBlock>
<ComboBox Margin="10,0"
Width="100"
ItemsSource="{Binding CoffeeCmds}"
SelectedItem="{Binding SelectedCoffeeCmd}"/>
<Button Margin="10,0"
Command="{Binding Button_CoffeeModeSetCommand}"
Content="设置" Cursor="Hand"/>
</StackPanel>
</Grid>
</Grid>
</GroupBox>
</Grid>
</UserControl>

+ 37
- 0
BPASmartClient.MorkT_BarCounter/View/TestView.xaml.cs View File

@@ -0,0 +1,37 @@
using BPASmartClient.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

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

private void Dubug_Unloaded(object sender, RoutedEventArgs e)
{
ThreadManage.GetInstance().StopTask("MorkT-状态刷新");
ThreadManage.GetInstance().StopTask("MorkT-传感器监视");

}
}

}

+ 54
- 350
BPASmartClient.MorkT_BarCounter/ViewModel/DebugViewModel.cs View File

@@ -11,6 +11,8 @@ using BPASmartClient.Model.冰淇淋.Enum;
using BPASmartClient.Model.单片机;
using BPASmartClient.Model.单片机.Enum;
using BPASmartClient.Model.咖啡机.Enum;
using BPASmartClient.Model.奶茶味魔方;
using BPASmartClient.Model.电夹爪;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
@@ -19,368 +21,70 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;
namespace BPASmartClient.MorkT_BarCounter.ViewModel;
public class DebugViewModel : ObservableObject
public class DebugViewModel : ObservableObject
{
public DebugViewModel()
{
#region 乐白机器人
/// <summary>
/// 乐白机器人连接状态
/// </summary>
public string RobotConnected { get { return _robotConnected; } set { _robotConnected = value; OnPropertyChanged(); } }
private string _robotConnected { get; set; }
/// <summary>
/// 乐白机器人的模式状态
/// </summary>
public string RobotMode { get { return _robotMode; } set { _robotMode = value; OnPropertyChanged(); } }
private string _robotMode { get; set; }
/// <summary>
/// 机器人控制指令
/// </summary>
public RelayCommand<object> Button_RobotControlCommand { get; set; }

public RelayCommand Robot_DOutput { get; set; }
/// <summary>
/// 机器人控制
/// </summary>
/// <param name="o"></param>
private void Button_RobotControl(object o)
{
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiControlEvent { DeviceId = DeviceId, LebaiControl = o.ToString() });
}
private void Button_RobotDoutput()
RobotControlCommand = new RelayCommand(() =>
{
bool DO_Value =int.Parse(Robot_DOutput_Value) == 0;
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { Pin = int.Parse(Robot_DOutput_Pin), Value = DO_Value });
}
public string Robot_TCPDI0 { get { return _robot_TCPDI0; } set { _robot_TCPDI0 = value;OnPropertyChanged(); } }
private string _robot_TCPDI0;

public string Robot_DI0 { get { return _robot_DI0; } set { _robot_DI0 = value; OnPropertyChanged(); } }
private string _robot_DI0;
public string Robot_DI1 { get { return _robot_DI1; } set { _robot_DI1 = value; OnPropertyChanged(); } }
private string _robot_DI1;
public string Robot_DI2 { get { return _robot_DI2; } set { _robot_DI2 = value; OnPropertyChanged(); } }
private string _robot_DI2;
public string Robot_DI3 { get { return _robot_DI3; } set { _robot_DI3 = value; OnPropertyChanged(); } }
private string _robot_DI3;

public string Robot_DOutput_Pin { get { return _robot_DOutput_Pin; } set { _robot_DOutput_Pin = value; OnPropertyChanged(); } }
private string _robot_DOutput_Pin { get; set; }
public string Robot_DOutput_Value { get { return _robot_DOutput_Valuet; } set { _robot_DOutput_Valuet = value; OnPropertyChanged(); } }
private string _robot_DOutput_Valuet { get; set; }
#endregion
#region 单片机
public string MCUConnected { get { return _mcuConnected; } set { _mcuConnected = value; OnPropertyChanged(); } }
private string _mcuConnected { get; set; }

public string MCUDI0 { get { return _mCUDI0; } set { _mCUDI0 = value; OnPropertyChanged(); } }
private string _mCUDI0 { get; set; }
public string MCUDI1 { get { return _mCUDI1; } set { _mCUDI1 = value; OnPropertyChanged(); } }
private string _mCUDI1 { get; set; }
public string MCUDI2 { get { return _mCUDI2; } set { _mCUDI2 = value; OnPropertyChanged(); } }
private string _mCUDI2 { get; set; }
public string MCUDI3 { get { return _mCUDI3; } set { _mCUDI3 = value; OnPropertyChanged(); } }
private string _mCUDI3 { get; set; }
public string MCUDI4 { get { return _mCUDI4; } set { _mCUDI4 = value; OnPropertyChanged(); } }
private string _mCUDI4 { get; set; }
public string MCUDI5 { get { return _mCUDI5; } set { _mCUDI5 = value; OnPropertyChanged(); } }
private string _mCUDI5 { get; set; }
public string MCUDI6 { get { return _mCUDI6; } set { _mCUDI6 = value; OnPropertyChanged(); } }
private string _mCUDI6 { get; set; }
public string MCUDI7 { get { return _mCUDI7; } set { _mCUDI7 = value; OnPropertyChanged(); } }
private string _mCUDI7 { get; set; }

public RelayCommand Button_MCUOuputCommand { get; set; }
public RelayCommand Button_MCUDOuputCommand { get; set; }

public int MCU_PWM_CH { get { return _choosePWM; } set { _choosePWM = value; OnPropertyChanged(); } }
private int _choosePWM = 1;
public int PWMInputNumber { get { return _pwmInputNumber; } set { _pwmInputNumber = value; OnPropertyChanged(); } }
private int _pwmInputNumber = 1;
new WriteJaka() { DeviceId = 126, TagName = "JaKaProgramName", Value = JakaRobotProgram }.Publish();

private int[] DICH { get { return _diCH; } set { _diCH = value; OnPropertyChanged(); } }
private int[] _diCH = new int[8];

public int MCU_DO_CH { get { return _mcuDO_CH; } set { _mcuDO_CH = value; OnPropertyChanged(); } }
private int _mcuDO_CH = 1;
public bool MCU_DO_Value { get { return _mcu_DO_Valuer; } set { _mcu_DO_Valuer = value; OnPropertyChanged(); } }
private bool _mcu_DO_Valuer = true;

private void Button_McuPWMOutput()
});
CoffeeControlCommand = new RelayCommand(() =>
{
string sChoosePWM = Convert.ToString(MCU_PWM_CH + 1);
new WriteMcu() { TagName = "ServoControl", Address = sChoosePWM, Value = PWMInputNumber }.Publish();
}
private void Button_McuDOutput()
new DRCoffee_MakeCoffeeEvent() { DeviceId = 126, DrinkCode = (DrCoffeeDrinksCode)(CoffeeKind) }.Publish();
});
MikeTeaCupControlCommand = new RelayCommand(() =>
{
string sChooseDO = Convert.ToString(MCU_DO_CH + 1);
new WriteMcu() { TagName = "OutputControl", Address = sChooseDO, Value = MCU_DO_Value }.Publish();
}
#endregion
#region 果汁机
/// <summary>
/// 果汁机的连接状态
/// </summary>
public string JuicerConnected { get { return _JuicerConnected; } set { _JuicerConnected = value; OnPropertyChanged(); } }
private string _JuicerConnected { get; set; }

public string JuiceState_Heating { get { return _juiceState_Heating; } set { _juiceState_Heating = value;OnPropertyChanged(); } }
public string _juiceState_Heating { get; set; }
public string JuiceState_Cooling { get { return _juiceState_Cooling; } set { _juiceState_Cooling = value; OnPropertyChanged(); } }
public string _juiceState_Cooling { get; set; }
public string JuiceState_LackOfWater { get { return _juiceState_LackOfWater; } set { _juiceState_LackOfWater = value; OnPropertyChanged(); } }
public string _juiceState_LackOfWater { get; set; }
public string JuiceState_ChildLocks { get { return _juiceState_ChildLocks; } set { _juiceState_ChildLocks = value; OnPropertyChanged(); } }
public string _juiceState_ChildLocks { get; set; }
public string JuiceState_Using { get { return _juiceState_Using; } set { _juiceState_Using = value; OnPropertyChanged(); } }
public string _juiceState_Using { get; set; }

public string MakeJuice_Index { get { return _makeJuice_Index; } set { _makeJuice_Index = value; OnPropertyChanged(); } }
public string _makeJuice_Index { get; set; }
public RelayCommand Button_MakeJuiceCommand { get; set; }

public void Button_MakeJuice()
new MilkTea_MakeMilkTeaEvent() { DeviceId = 126, TagName = "ParameterSet", MilkTeaKind = GVL_MorkT.MilkTeaCHValue }.Publish(); //写入奶茶参数
new MilkTea_MakeMilkTeaEvent() { DeviceId = 126, TagName = "Start" }.Publish();
});
GripperControlCommand = new RelayCommand(() =>
{
new WriteJuicer() { Value = MakeJuice_Index }.Publish();
}
#endregion
#region 制冰机
public string IceMakerConnect { get { return _iceMakerConnect; } set { _iceMakerConnect = value;OnPropertyChanged(); } }
private string _iceMakerConnect { get; set; }
public string IceMakerState { get { return _iceMakerState; } set { _iceMakerState = value; OnPropertyChanged(); } }
private string _iceMakerState { get; set; }
public int IceMaker_IceTime { get { return _iceMaker_IceTime; } set { _iceMaker_IceTime = value; OnPropertyChanged(); } }
private int _iceMaker_IceTime = 3;

#region 订单模拟
public RelayCommand SimOrderMakeCoffee { get; set; }
public RelayCommand SimOrderMakeJuice { get; set; }
public RelayCommand SimOrderMakeTea { get; set; }
public RelayCommand SimOrderMakeWater { get; set; }

public int SimOrder_JuiceList { get { return _simOrder_JuiceList; } set { _simOrder_JuiceList = value; OnPropertyChanged(); } }
public int _simOrder_JuiceList { get; set; }
public string SimOrder_JuiceMakeID { get { return _simOrder_JuiceMakeID; } set { _simOrder_JuiceMakeID = value; OnPropertyChanged(); } }
public string _simOrder_JuiceMakeID { get; set; }
#endregion

public RelayCommand IceMaker_BtnPowerOn { get; set; }
public RelayCommand IceMaker_BtnStandby { get; set;}
public RelayCommand IceMaker_BtnPump { get; set;}

public RelayCommand IceMaker_BtnStart { get; set; }
public RelayCommand IceMaker_BtnEnd { get; set; }
public RelayCommand IceMaker_BtnSetIceTime { get; set; }

private void IceMaker_BtnPowerOnCommand()
{
new PowerOnMakeIce().Publish();
}
private void IceMaker_BtnStandbyCommand()
{
new StandbyMakeIce().Publish();
}
private void IceMaker_BtnPumpCommand()
{
new PumpMakeIce().Publish();
}
private void IceMaker_BtnStartCommand()
{
new StartMakeIce().Publish();
}
private void IceMaker_BtnEndCommand()
{
new StopMakeIce().Publish();
}
private void IceMaker_BtnSetIceTimeCommand()
{
new SetIceNumber{ Value= IceMaker_IceTime }.Publish();
}
#endregion
#region 咖啡机
/// <summary>
/// 咖啡机连接状态
/// </summary>
public string CoffeeConnected { get { return _coffeeConnected; } set { _coffeeConnected = value; OnPropertyChanged(); } }
private string _coffeeConnected { get; set; }
/// <summary>
/// 咖啡机状态
/// </summary>
public string CoffeeStatus { get { return _coffeeStatus; } set { _coffeeStatus = value; OnPropertyChanged(); } }
private string _coffeeStatus { get; set; }
/// <summary>
/// 应用状态
/// </summary>
public string AppStatus { get { return _appStatus; } set { _appStatus = value; OnPropertyChanged(); } }
private string _appStatus { get; set; }
/// <summary>
/// 告警
/// </summary>
public string Warning { get { return _warning; } set { _warning = value; OnPropertyChanged(); } }
public string _warning { get; set; }
/// <summary>
/// 故障信息
/// </summary>
public string CaffeeFault { get { return _caffeeFault; } set { _caffeeFault = value; OnPropertyChanged(); } }
public string _caffeeFault { get; set; }

public List<string> Coffees { get; set; } = new List<string>();
public string SelectedCoffee { get { return _selectedCoffee; } set { _selectedCoffee = value; OnPropertyChanged(); } }
public string _selectedCoffee { get; set; }

public List<string> CoffeeCmds { get; set; } = new List<string>();
public string SelectedCoffeeCmd { get; set; }

public string SimOrderCoffeeList { get { return _simOrderCoffeeList; } set { _simOrderCoffeeList = value; OnPropertyChanged(); } }
public string _simOrderCoffeeList { get; set; }
/// <summary>
/// 制作咖啡
/// </summary>
public RelayCommand Button_MakeCoffeeCommand { get; set; }
/// <summary>
/// 停止制作咖啡
/// </summary>
public RelayCommand Button_StopMakeCoffeCommand { get; set; }
/// <summary>
/// 咖啡模式设置
/// </summary>
public RelayCommand Button_CoffeeModeSetCommand { get; set; }

private void Button_MakeCoffee()
{
EventBus.EventBus.GetInstance().Publish(new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (DrCoffeeDrinksCode)Enum.Parse(typeof(DrCoffeeDrinksCode), SelectedCoffee) });
}
private void Button_StopMakeCoffe()
{
EventBus.EventBus.GetInstance().Publish(new DRCoffee_CancelMakeCoffeeEvent() { DeviceId = DeviceId });
}
private void Button_CoffeeModeSet()
{
EventBus.EventBus.GetInstance().Publish(new DRCoffee_CoffeeCommCmdEvent() { DeviceId = DeviceId, CommCmd = (DrCoffeeCommCmd)Enum.Parse(typeof(DrCoffeeCommCmd), SelectedCoffeeCmd) });
}

#endregion
/// <summary>
/// 设备ID
/// </summary>
public int DeviceId { get; set; }
/// <summary>
/// 设备数据
/// </summary>
public ObservableCollection<VariableMonitor> variableMonitors { get; set; }
public DebugViewModel()
{
SimOrderMakeCoffee = new RelayCommand(() =>
{
new MorkTSimOrder() { OrderNum = 1, DrinkCode = (DrCoffeeDrinksCode)Enum.Parse(typeof(DrCoffeeDrinksCode), SimOrderCoffeeList) }.Publish();
});
SimOrderMakeJuice = new RelayCommand(() =>
{
new MorkTSimOrder() { OrderNum = 2, JuiceList = SimOrder_JuiceList, JuiceMakeID = SimOrder_JuiceMakeID }.Publish();
});
SimOrderMakeTea = new RelayCommand(() =>
string value = GripperProgam + "";
if (value.Length == 1)
{
new MorkTSimOrder() { OrderNum = 3 }.Publish();
});
SimOrderMakeWater = new RelayCommand(() =>
{
new MorkTSimOrder() { OrderNum = 4 }.Publish();
});
Button_RobotControlCommand = new RelayCommand<object>(Button_RobotControl);
Robot_DOutput = new RelayCommand(Button_RobotDoutput);

Button_MakeCoffeeCommand = new RelayCommand(Button_MakeCoffee);
Button_StopMakeCoffeCommand = new RelayCommand(Button_StopMakeCoffe);
Button_CoffeeModeSetCommand = new RelayCommand(Button_CoffeeModeSet);
Button_MCUOuputCommand = new RelayCommand(Button_McuPWMOutput);
Button_MCUDOuputCommand = new RelayCommand(Button_McuDOutput);

Button_MakeJuiceCommand = new RelayCommand(Button_MakeJuice);

IceMaker_BtnPowerOn = new RelayCommand(IceMaker_BtnPowerOnCommand);
IceMaker_BtnStandby = new RelayCommand(IceMaker_BtnStandbyCommand);
IceMaker_BtnPump = new RelayCommand(IceMaker_BtnPumpCommand);
IceMaker_BtnStart = new RelayCommand(IceMaker_BtnStartCommand);
IceMaker_BtnEnd = new RelayCommand(IceMaker_BtnEndCommand);
IceMaker_BtnSetIceTime = new RelayCommand(IceMaker_BtnSetIceTimeCommand);
foreach (DrCoffeeDrinksCode code in Enum.GetValues(typeof(DrCoffeeDrinksCode)))
value = "000" + value;
}
else if (value.Length == 2)
{
Coffees.Add(code.ToString());
value = "00" + value;
}
SelectedCoffee = Coffees[0];
SimOrderCoffeeList = Coffees[0];
foreach (DrCoffeeCommCmd code in Enum.GetValues(typeof(DrCoffeeCommCmd)))
else if (value.Length == 3)
{
CoffeeCmds.Add(code.ToString());
value = "0" + value;
}
SelectedCoffeeCmd = CoffeeCmds[0];

Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices().ForEach(device =>
else
{
if (device.Name == "MorkT") DeviceId = device.DeviceId
;
});
ThreadManage.GetInstance().StartLong(new Action(() =>
value = "1350";
}
new WriteGripper() { DeviceId = 126, TagName = "PWMControl", CH_Number = "0", PWMOutput = value }.Publish();//夹爪的幅度控制
});
MikeTeaCupSetParCommand = new RelayCommand(() =>
{
for (int i = 0; i < 12; i++)
{
variableMonitors = Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices()?.FirstOrDefault(p => p.DeviceId == DeviceId)?.variableMonitors;
if (variableMonitors != null && variableMonitors.Count > 0)
{
#region 机器人
RobotConnected = variableMonitors.FirstOrDefault(p => p.Notes == "机器人连接状态").CurrentValue == "True" ? "已连接" : "未连接";
RobotMode = variableMonitors.FirstOrDefault(p => p.Notes == "机器人状态").CurrentValue;
Robot_TCPDI0 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人TCP输入状态").CurrentValue;
Robot_DI0 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人输入0状态").CurrentValue;
Robot_DI1 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人输入1状态").CurrentValue;
Robot_DI2 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人输入2状态").CurrentValue;
Robot_DI3 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人输入3状态").CurrentValue;

#endregion

#region 咖啡机
CoffeeConnected = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
CoffeeStatus = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机状态").CurrentValue;
AppStatus = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机应用状态").CurrentValue;
Warning = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机告警").CurrentValue;
CaffeeFault = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机故障").CurrentValue;
#endregion

#region 单片机
MCUConnected = variableMonitors.FirstOrDefault(p => p.Notes == "单片机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
MCUDI0 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入0状态").CurrentValue;
MCUDI1 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入1状态").CurrentValue;
MCUDI2 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入2状态").CurrentValue;
MCUDI3 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入3状态").CurrentValue;
MCUDI4 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入4状态").CurrentValue;
MCUDI5 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入5状态").CurrentValue;
MCUDI6 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入6状态").CurrentValue;
MCUDI7 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入7状态").CurrentValue;
#endregion

#region 制冰机
IceMakerConnect = variableMonitors.FirstOrDefault(p => p.Notes == "制冰机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
IceMakerState = variableMonitors.FirstOrDefault(p => p.Notes == "制冰机设备状态").CurrentValue;
#endregion

#region 果汁机
JuicerConnected = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
JuiceState_Heating = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机制热").CurrentValue;
JuiceState_Cooling = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机制冷").CurrentValue;
JuiceState_LackOfWater = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机缺水").CurrentValue;
JuiceState_ChildLocks = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机童锁").CurrentValue;
JuiceState_Using = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机使用").CurrentValue;

#endregion
}
Thread.Sleep(500);
}), "MorkT-状态刷新");
}
GVL_MorkT.MilkTeaCHValue[i] = (ushort)CH_Value[i];
}
});
}
public int JakaRobotProgram { get { return _JakaRobotProgram; } set { _JakaRobotProgram = value; OnPropertyChanged(); } }
private int _JakaRobotProgram { get; set; }
public RelayCommand RobotControlCommand { get; set; }
public RelayCommand MikeTeaCupSetParCommand { get; set; }
public int CoffeeKind { get { return _CoffeeKind; } set { _CoffeeKind = value; OnPropertyChanged(); } }
private int _CoffeeKind { get; set; }
public RelayCommand CoffeeControlCommand { get; set; }

public int MilkTeaCub { get { return _MilkTeaCub; } set { _MilkTeaCub = value; OnPropertyChanged(); } }
private int _MilkTeaCub { get; set; }
public RelayCommand MikeTeaCupControlCommand { get; set; }
public int GripperProgam { get { return _GripperProgam; } set { _GripperProgam = value; OnPropertyChanged(); } }
private int _GripperProgam { get; set; }

public int[] CH_Value { get { return _CH_Value; } set { _CH_Value = value; OnPropertyChanged(); } }
private int[] _CH_Value { get; set; } = new int[12] {200,200,200,200,200,200,200,200,200,200,200,200 };

public RelayCommand GripperControlCommand { get; set; }
}


+ 386
- 0
BPASmartClient.MorkT_BarCounter/ViewModel/TestViewModel.cs View File

@@ -0,0 +1,386 @@
using BPASmartClient.Business;
using BPASmartClient.Device;
using BPASmartClient.DRCoffee;
using BPASmartClient.EventBus;
using BPASmartClient.Helper;
using BPASmartClient.LebaiRobot;
using BPASmartClient.Message;
using BPASmartClient.Model;
using BPASmartClient.Model.乐白机器人;
using BPASmartClient.Model.冰淇淋.Enum;
using BPASmartClient.Model.单片机;
using BPASmartClient.Model.单片机.Enum;
using BPASmartClient.Model.咖啡机.Enum;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Threading;
namespace BPASmartClient.MorkT_BarCounter.ViewModel;
public class TestViewModel : ObservableObject
{
#region 乐白机器人
/// <summary>
/// 乐白机器人连接状态
/// </summary>
public string RobotConnected { get { return _robotConnected; } set { _robotConnected = value; OnPropertyChanged(); } }
private string _robotConnected { get; set; }
/// <summary>
/// 乐白机器人的模式状态
/// </summary>
public string RobotMode { get { return _robotMode; } set { _robotMode = value; OnPropertyChanged(); } }
private string _robotMode { get; set; }
/// <summary>
/// 机器人控制指令
/// </summary>
public RelayCommand<object> Button_RobotControlCommand { get; set; }

public RelayCommand Robot_DOutput { get; set; }
/// <summary>
/// 机器人控制
/// </summary>
/// <param name="o"></param>
private void Button_RobotControl(object o)
{
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiControlEvent { DeviceId = DeviceId, LebaiControl = o.ToString() });
}
private void Button_RobotDoutput()
{
bool DO_Value =int.Parse(Robot_DOutput_Value) == 0;
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetOutPutEvent { Pin = int.Parse(Robot_DOutput_Pin), Value = DO_Value });
}
public string Robot_TCPDI0 { get { return _robot_TCPDI0; } set { _robot_TCPDI0 = value;OnPropertyChanged(); } }
private string _robot_TCPDI0;

public string Robot_DI0 { get { return _robot_DI0; } set { _robot_DI0 = value; OnPropertyChanged(); } }
private string _robot_DI0;
public string Robot_DI1 { get { return _robot_DI1; } set { _robot_DI1 = value; OnPropertyChanged(); } }
private string _robot_DI1;
public string Robot_DI2 { get { return _robot_DI2; } set { _robot_DI2 = value; OnPropertyChanged(); } }
private string _robot_DI2;
public string Robot_DI3 { get { return _robot_DI3; } set { _robot_DI3 = value; OnPropertyChanged(); } }
private string _robot_DI3;

public string Robot_DOutput_Pin { get { return _robot_DOutput_Pin; } set { _robot_DOutput_Pin = value; OnPropertyChanged(); } }
private string _robot_DOutput_Pin { get; set; }
public string Robot_DOutput_Value { get { return _robot_DOutput_Valuet; } set { _robot_DOutput_Valuet = value; OnPropertyChanged(); } }
private string _robot_DOutput_Valuet { get; set; }
#endregion
#region 单片机
public string MCUConnected { get { return _mcuConnected; } set { _mcuConnected = value; OnPropertyChanged(); } }
private string _mcuConnected { get; set; }

public string MCUDI0 { get { return _mCUDI0; } set { _mCUDI0 = value; OnPropertyChanged(); } }
private string _mCUDI0 { get; set; }
public string MCUDI1 { get { return _mCUDI1; } set { _mCUDI1 = value; OnPropertyChanged(); } }
private string _mCUDI1 { get; set; }
public string MCUDI2 { get { return _mCUDI2; } set { _mCUDI2 = value; OnPropertyChanged(); } }
private string _mCUDI2 { get; set; }
public string MCUDI3 { get { return _mCUDI3; } set { _mCUDI3 = value; OnPropertyChanged(); } }
private string _mCUDI3 { get; set; }
public string MCUDI4 { get { return _mCUDI4; } set { _mCUDI4 = value; OnPropertyChanged(); } }
private string _mCUDI4 { get; set; }
public string MCUDI5 { get { return _mCUDI5; } set { _mCUDI5 = value; OnPropertyChanged(); } }
private string _mCUDI5 { get; set; }
public string MCUDI6 { get { return _mCUDI6; } set { _mCUDI6 = value; OnPropertyChanged(); } }
private string _mCUDI6 { get; set; }
public string MCUDI7 { get { return _mCUDI7; } set { _mCUDI7 = value; OnPropertyChanged(); } }
private string _mCUDI7 { get; set; }

public RelayCommand Button_MCUOuputCommand { get; set; }
public RelayCommand Button_MCUDOuputCommand { get; set; }

public int MCU_PWM_CH { get { return _choosePWM; } set { _choosePWM = value; OnPropertyChanged(); } }
private int _choosePWM = 1;
public int PWMInputNumber { get { return _pwmInputNumber; } set { _pwmInputNumber = value; OnPropertyChanged(); } }
private int _pwmInputNumber = 1;

private int[] DICH { get { return _diCH; } set { _diCH = value; OnPropertyChanged(); } }
private int[] _diCH = new int[8];

public int MCU_DO_CH { get { return _mcuDO_CH; } set { _mcuDO_CH = value; OnPropertyChanged(); } }
private int _mcuDO_CH = 1;
public bool MCU_DO_Value { get { return _mcu_DO_Valuer; } set { _mcu_DO_Valuer = value; OnPropertyChanged(); } }
private bool _mcu_DO_Valuer = true;

private void Button_McuPWMOutput()
{
string sChoosePWM = Convert.ToString(MCU_PWM_CH + 1);
new WriteMcu() { TagName = "ServoControl", Address = sChoosePWM, Value = PWMInputNumber }.Publish();
}
private void Button_McuDOutput()
{
string sChooseDO = Convert.ToString(MCU_DO_CH + 1);
new WriteMcu() { TagName = "OutputControl", Address = sChooseDO, Value = MCU_DO_Value }.Publish();
}
#endregion
#region 果汁机
/// <summary>
/// 果汁机的连接状态
/// </summary>
public string JuicerConnected { get { return _JuicerConnected; } set { _JuicerConnected = value; OnPropertyChanged(); } }
private string _JuicerConnected { get; set; }

public string JuiceState_Heating { get { return _juiceState_Heating; } set { _juiceState_Heating = value;OnPropertyChanged(); } }
public string _juiceState_Heating { get; set; }
public string JuiceState_Cooling { get { return _juiceState_Cooling; } set { _juiceState_Cooling = value; OnPropertyChanged(); } }
public string _juiceState_Cooling { get; set; }
public string JuiceState_LackOfWater { get { return _juiceState_LackOfWater; } set { _juiceState_LackOfWater = value; OnPropertyChanged(); } }
public string _juiceState_LackOfWater { get; set; }
public string JuiceState_ChildLocks { get { return _juiceState_ChildLocks; } set { _juiceState_ChildLocks = value; OnPropertyChanged(); } }
public string _juiceState_ChildLocks { get; set; }
public string JuiceState_Using { get { return _juiceState_Using; } set { _juiceState_Using = value; OnPropertyChanged(); } }
public string _juiceState_Using { get; set; }

public string MakeJuice_Index { get { return _makeJuice_Index; } set { _makeJuice_Index = value; OnPropertyChanged(); } }
public string _makeJuice_Index { get; set; }
public RelayCommand Button_MakeJuiceCommand { get; set; }

public void Button_MakeJuice()
{
new WriteJuicer() { Value = MakeJuice_Index }.Publish();
}
#endregion
#region 制冰机
public string IceMakerConnect { get { return _iceMakerConnect; } set { _iceMakerConnect = value;OnPropertyChanged(); } }
private string _iceMakerConnect { get; set; }
public string IceMakerState { get { return _iceMakerState; } set { _iceMakerState = value; OnPropertyChanged(); } }
private string _iceMakerState { get; set; }
public int IceMaker_IceTime { get { return _iceMaker_IceTime; } set { _iceMaker_IceTime = value; OnPropertyChanged(); } }
private int _iceMaker_IceTime = 3;

#region 订单模拟
public RelayCommand SimOrderMakeCoffee { get; set; }
public RelayCommand SimOrderMakeJuice { get; set; }
public RelayCommand SimOrderMakeTea { get; set; }
public RelayCommand SimOrderMakeWater { get; set; }

public int SimOrder_JuiceList { get { return _simOrder_JuiceList; } set { _simOrder_JuiceList = value; OnPropertyChanged(); } }
public int _simOrder_JuiceList { get; set; }
public string SimOrder_JuiceMakeID { get { return _simOrder_JuiceMakeID; } set { _simOrder_JuiceMakeID = value; OnPropertyChanged(); } }
public string _simOrder_JuiceMakeID { get; set; }
#endregion

public RelayCommand IceMaker_BtnPowerOn { get; set; }
public RelayCommand IceMaker_BtnStandby { get; set;}
public RelayCommand IceMaker_BtnPump { get; set;}

public RelayCommand IceMaker_BtnStart { get; set; }
public RelayCommand IceMaker_BtnEnd { get; set; }
public RelayCommand IceMaker_BtnSetIceTime { get; set; }

private void IceMaker_BtnPowerOnCommand()
{
new PowerOnMakeIce().Publish();
}
private void IceMaker_BtnStandbyCommand()
{
new StandbyMakeIce().Publish();
}
private void IceMaker_BtnPumpCommand()
{
new PumpMakeIce().Publish();
}
private void IceMaker_BtnStartCommand()
{
new StartMakeIce().Publish();
}
private void IceMaker_BtnEndCommand()
{
new StopMakeIce().Publish();
}
private void IceMaker_BtnSetIceTimeCommand()
{
new SetIceNumber{ Value= IceMaker_IceTime }.Publish();
}
#endregion
#region 咖啡机
/// <summary>
/// 咖啡机连接状态
/// </summary>
public string CoffeeConnected { get { return _coffeeConnected; } set { _coffeeConnected = value; OnPropertyChanged(); } }
private string _coffeeConnected { get; set; }
/// <summary>
/// 咖啡机状态
/// </summary>
public string CoffeeStatus { get { return _coffeeStatus; } set { _coffeeStatus = value; OnPropertyChanged(); } }
private string _coffeeStatus { get; set; }
/// <summary>
/// 应用状态
/// </summary>
public string AppStatus { get { return _appStatus; } set { _appStatus = value; OnPropertyChanged(); } }
private string _appStatus { get; set; }
/// <summary>
/// 告警
/// </summary>
public string Warning { get { return _warning; } set { _warning = value; OnPropertyChanged(); } }
public string _warning { get; set; }
/// <summary>
/// 故障信息
/// </summary>
public string CaffeeFault { get { return _caffeeFault; } set { _caffeeFault = value; OnPropertyChanged(); } }
public string _caffeeFault { get; set; }

public List<string> Coffees { get; set; } = new List<string>();
public string SelectedCoffee { get { return _selectedCoffee; } set { _selectedCoffee = value; OnPropertyChanged(); } }
public string _selectedCoffee { get; set; }

public List<string> CoffeeCmds { get; set; } = new List<string>();
public string SelectedCoffeeCmd { get; set; }

public string SimOrderCoffeeList { get { return _simOrderCoffeeList; } set { _simOrderCoffeeList = value; OnPropertyChanged(); } }
public string _simOrderCoffeeList { get; set; }
/// <summary>
/// 制作咖啡
/// </summary>
public RelayCommand Button_MakeCoffeeCommand { get; set; }
/// <summary>
/// 停止制作咖啡
/// </summary>
public RelayCommand Button_StopMakeCoffeCommand { get; set; }
/// <summary>
/// 咖啡模式设置
/// </summary>
public RelayCommand Button_CoffeeModeSetCommand { get; set; }

private void Button_MakeCoffee()
{
EventBus.EventBus.GetInstance().Publish(new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (DrCoffeeDrinksCode)Enum.Parse(typeof(DrCoffeeDrinksCode), SelectedCoffee) });
}
private void Button_StopMakeCoffe()
{
EventBus.EventBus.GetInstance().Publish(new DRCoffee_CancelMakeCoffeeEvent() { DeviceId = DeviceId });
}
private void Button_CoffeeModeSet()
{
EventBus.EventBus.GetInstance().Publish(new DRCoffee_CoffeeCommCmdEvent() { DeviceId = DeviceId, CommCmd = (DrCoffeeCommCmd)Enum.Parse(typeof(DrCoffeeCommCmd), SelectedCoffeeCmd) });
}

#endregion
/// <summary>
/// 设备ID
/// </summary>
public int DeviceId { get; set; }
/// <summary>
/// 设备数据
/// </summary>
public ObservableCollection<VariableMonitor> variableMonitors { get; set; }
public TestViewModel()
{
SimOrderMakeCoffee = new RelayCommand(() =>
{
new MorkTSimOrder() { OrderNum = 1, DrinkCode = (DrCoffeeDrinksCode)Enum.Parse(typeof(DrCoffeeDrinksCode), SimOrderCoffeeList) }.Publish();
});
SimOrderMakeJuice = new RelayCommand(() =>
{
new MorkTSimOrder() { OrderNum = 2, JuiceList = SimOrder_JuiceList, JuiceMakeID = SimOrder_JuiceMakeID }.Publish();
});
SimOrderMakeTea = new RelayCommand(() =>
{
new MorkTSimOrder() { OrderNum = 3 }.Publish();
});
SimOrderMakeWater = new RelayCommand(() =>
{
new MorkTSimOrder() { OrderNum = 4 }.Publish();
});
Button_RobotControlCommand = new RelayCommand<object>(Button_RobotControl);
Robot_DOutput = new RelayCommand(Button_RobotDoutput);

Button_MakeCoffeeCommand = new RelayCommand(Button_MakeCoffee);
Button_StopMakeCoffeCommand = new RelayCommand(Button_StopMakeCoffe);
Button_CoffeeModeSetCommand = new RelayCommand(Button_CoffeeModeSet);
Button_MCUOuputCommand = new RelayCommand(Button_McuPWMOutput);
Button_MCUDOuputCommand = new RelayCommand(Button_McuDOutput);

Button_MakeJuiceCommand = new RelayCommand(Button_MakeJuice);

IceMaker_BtnPowerOn = new RelayCommand(IceMaker_BtnPowerOnCommand);
IceMaker_BtnStandby = new RelayCommand(IceMaker_BtnStandbyCommand);
IceMaker_BtnPump = new RelayCommand(IceMaker_BtnPumpCommand);
IceMaker_BtnStart = new RelayCommand(IceMaker_BtnStartCommand);
IceMaker_BtnEnd = new RelayCommand(IceMaker_BtnEndCommand);
IceMaker_BtnSetIceTime = new RelayCommand(IceMaker_BtnSetIceTimeCommand);
foreach (DrCoffeeDrinksCode code in Enum.GetValues(typeof(DrCoffeeDrinksCode)))
{
Coffees.Add(code.ToString());
}
SelectedCoffee = Coffees[0];
SimOrderCoffeeList = Coffees[0];
foreach (DrCoffeeCommCmd code in Enum.GetValues(typeof(DrCoffeeCommCmd)))
{
CoffeeCmds.Add(code.ToString());
}
SelectedCoffeeCmd = CoffeeCmds[0];

Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices().ForEach(device =>
{
if (device.Name == "MorkT") DeviceId = device.DeviceId
;
});
ThreadManage.GetInstance().StartLong(new Action(() =>
{
variableMonitors = Plugin.GetInstance()?.GetPlugin<DeviceMgr>()?.GetDevices()?.FirstOrDefault(p => p.DeviceId == DeviceId)?.variableMonitors;
if (variableMonitors != null && variableMonitors.Count > 0)
{
#region 机器人
RobotConnected = variableMonitors.FirstOrDefault(p => p.Notes == "机器人连接状态").CurrentValue == "True" ? "已连接" : "未连接";
RobotMode = variableMonitors.FirstOrDefault(p => p.Notes == "机器人状态").CurrentValue;
Robot_TCPDI0 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人TCP输入状态").CurrentValue;
Robot_DI0 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人输入0状态").CurrentValue;
Robot_DI1 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人输入1状态").CurrentValue;
Robot_DI2 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人输入2状态").CurrentValue;
Robot_DI3 = variableMonitors.FirstOrDefault(p => p.Notes == "机器人输入3状态").CurrentValue;

#endregion

#region 咖啡机
CoffeeConnected = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
CoffeeStatus = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机状态").CurrentValue;
AppStatus = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机应用状态").CurrentValue;
Warning = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机告警").CurrentValue;
CaffeeFault = variableMonitors.FirstOrDefault(p => p.Notes == "咖啡机故障").CurrentValue;
#endregion

#region 单片机
MCUConnected = variableMonitors.FirstOrDefault(p => p.Notes == "单片机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
MCUDI0 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入0状态").CurrentValue;
MCUDI1 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入1状态").CurrentValue;
MCUDI2 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入2状态").CurrentValue;
MCUDI3 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入3状态").CurrentValue;
MCUDI4 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入4状态").CurrentValue;
MCUDI5 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入5状态").CurrentValue;
MCUDI6 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入6状态").CurrentValue;
MCUDI7 = variableMonitors.FirstOrDefault(p => p.Notes == "单片机输入7状态").CurrentValue;
#endregion

#region 制冰机
IceMakerConnect = variableMonitors.FirstOrDefault(p => p.Notes == "制冰机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
IceMakerState = variableMonitors.FirstOrDefault(p => p.Notes == "制冰机设备状态").CurrentValue;
#endregion

#region 果汁机
JuicerConnected = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机连接状态").CurrentValue == "True" ? "已连接" : "未连接";
JuiceState_Heating = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机制热").CurrentValue;
JuiceState_Cooling = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机制冷").CurrentValue;
JuiceState_LackOfWater = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机缺水").CurrentValue;
JuiceState_ChildLocks = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机童锁").CurrentValue;
JuiceState_Using = variableMonitors.FirstOrDefault(p => p.Notes == "果汁机使用").CurrentValue;

#endregion
}
Thread.Sleep(500);
}), "MorkT-状态刷新");
}
}


+ 1
- 1
BPASmartClient.MorkT_Container/Control_MorkT_Container.cs View File

@@ -284,7 +284,7 @@ namespace BPASmartClient.MorkT_Container

Sence(GVL_MorkT.攀华_放杯);
Wait();
while (!morkTLebaiJC.RobotGetInput0)
if (!morkTLebaiJC.RobotGetInput0)
{
DeviceProcessLogShow("咖啡杯未安全放置在放杯位");
}


+ 8
- 8
BPASmartClient.Morkt.JAKA.JC/Control_MORKJC.cs View File

@@ -386,8 +386,8 @@ namespace BPASmartClient.MorktJAKAJC
if (resultTakeCup == 1)
{
DeviceProcessLogShow("咖啡杯取杯完成");
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接咖啡 }.Publish();
Wait(int.Parse(JakaModel.SENCE_接咖啡));
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯位_接咖啡 }.Publish();
Wait(int.Parse(JakaModel.SENCE_取杯位_接咖啡));

new DRCoffee_MakeCoffeeEvent() { DeviceId = DeviceId, DrinkCode = (DrCoffeeDrinksCode)int.Parse(mainMaterialLoc) }.Publish(); //接咖啡控制 //DrCoffeeDrinksCode.热水
are.WaitOne(1000 * 180);
@@ -401,8 +401,8 @@ namespace BPASmartClient.MorktJAKAJC
}
private void PutCoffeeCup()
{
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_放咖啡杯 }.Publish();
Wait(int.Parse(JakaModel.SENCE_放咖啡杯));
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_接咖啡_放咖啡杯 }.Publish();
Wait(int.Parse(JakaModel.SENCE_接咖啡_放咖啡杯));
int resultputCup = putCup();
if (resultputCup == 1)
{
@@ -735,8 +735,8 @@ namespace BPASmartClient.MorktJAKAJC
Thread.Sleep(100);
new WriteJaka() { TagName = "Set_RobotAO1", Value = 0 }.Publish();
Wait(0);
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯 }.Publish();
Wait(int.Parse(JakaModel.SENCE_取杯));
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯位检测_取杯位 }.Publish();
Wait(int.Parse(JakaModel.SENCE_取杯位检测_取杯位));
//取杯到位,使用落杯器
new WriteJaka() { TagName = "JakaDOutput", DO_Index = 1, Value = true }.Publish();
if (sensor_Sign(1)==1 )
@@ -768,8 +768,8 @@ namespace BPASmartClient.MorktJAKAJC
Thread.Sleep(100);
new WriteJaka() { TagName = "JakaDOutput", DO_Index = 0, Value = true }.Publish();
Thread.Sleep(100);
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯 }.Publish();
Wait(int.Parse(JakaModel.SENCE_取杯));
new WriteJaka() { TagName = "JaKaProgramName", Value = JakaModel.SENCE_取杯位检测_取杯位 }.Publish();
Wait(int.Parse(JakaModel.SENCE_取杯位检测_取杯位));
getCup_cnt = getCup_cnt + 1;
Thread.Sleep(100);
new WriteJaka() { TagName = "JakaDOutput", DO_Index = 0, Value = false }.Publish();


+ 15
- 0
BPASmartClient.RobotGripper/BPASmartClient.RobotGripper.csproj View File

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

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.Peripheral\BPASmartClient.Peripheral.csproj" />
<ProjectReference Include="..\BPASmartClient.SerialPort\BPASmartClient.SerialPort.csproj" />
</ItemGroup>

</Project>

+ 50
- 0
BPASmartClient.RobotGripper/RobotGripperMachine.cs View File

@@ -0,0 +1,50 @@
using System;
using BPASmartClient.Peripheral;
using BPASmartClient.SerialPort;
using BPASmartClient.Model.µç¼Ðצ;
using static BPASmartClient.EventBus.EventBus;
using BPASmartClient.EventBus;

namespace BPASmartClient.RobotGripper
{
public class RobotGripperMachine:BasePeripheral
{
RobotGripperHelper machineHelper = new RobotGripperHelper();
public override void Init()
{
machineHelper.Open(communicationPar.SerialPort, communicationPar.BaudRate);
EventBus.EventBus.GetInstance().Subscribe<WriteGripper>(DeviceId,delegate(IEvent @event, EventCallBackHandle callBack)
{
if (@event == null) return;
var par = @event as WriteGripper;
switch (par?.TagName)
{
case "PWMControl":
machineHelper.Write(Convert.ToByte(par?.CH_Number), Convert.ToString(par?.PWMOutput));
break;
default:
break;
}
});
}
public override void Start()
{

}

public override void Stop()
{
machineHelper.Stop(communicationPar.SerialPort);
}

public override void WriteData(string address, object value)
{

}

protected override void InitStatus()
{

}
}
}

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

@@ -62,7 +62,7 @@ namespace BPASmartClient.ScreenLib
if (Main.GetInstance.mqttDatasDic.ContainsKey(type))
{
ScreenModelSplitMeals modelMaxWok = Main.GetInstance.mqttDatasDic[type] as ScreenModelSplitMeals;
if (modelMaxWok != null && modelMaxWok.Alarm != null)
if (modelMaxWok != null && modelMaxWok.Alarm != null)
modelMaxWok.Alarm = modelMaxWok.Alarm?.OrderByDescending(k => DateTime.Parse(k.AlarmTime)).ToList();
ViewData = modelMaxWok;



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

@@ -236,6 +236,7 @@ namespace BPASmartClient.ScreenLib
string str = JsonConvert.SerializeObject(_Statsall?.OrderByDescending(k => k.Count)?.ToList());
StatsCountAll= JsonConvert.DeserializeObject<ObservableCollection<StatsAllModel>>(str);
}
//假数据
}));
Thread.Sleep(1000);
}), $"{DateTime.Now},线程服务");


+ 77
- 0
BPASmartClient.SerialPort/RobotGripperHelper.cs View File

@@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.IO.Ports;
using System.Threading;
using System.Collections.Concurrent;
using BPASmartClient.Message;
using BPASmartClient.Helper;

namespace BPASmartClient.SerialPort
{
public class RobotGripperHelper
{

private System.IO.Ports.SerialPort comPort = new System.IO.Ports.SerialPort();
public bool IsOpen => comPort.IsOpen;

public bool Open(string portName, int baudRate)
{
if (!System.IO.Ports.SerialPort.GetPortNames().Contains(portName))
{
MessageLog.GetInstance.Show($"{portName} 串口不存在");
}
if (!comPort.IsOpen)
{
comPort.PortName = portName;
comPort.BaudRate = baudRate;
comPort.DataBits = 8;
comPort.Parity = Parity.None;
comPort.StopBits = StopBits.One;
/*comPort.ReadTimeout = 1000;
comPort.WriteTimeout = 1000;*/
//comPort.RtsEnable = true; //设置为 true后会读取不到数据
comPort.DtrEnable = true;//获取或设置一个值,该值在串行通信过程中启用数据终端就绪 (DTR) 信号。
//comPort.RtsEnable = true;//获取或设置一个值,该值指示在串行通信中是否启用请求发送 (RTS) 信号
try
{
comPort.Open();
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx(ex.ToString());
}
}
/* ThreadManage.GetInstance().StartLong(new Action(() =>
{
Thread.Sleep(5000);
}), $"开启电爪设备通讯", true);*/
MessageLog.GetInstance.Show($"{portName} 串口打开成功");
return comPort.IsOpen;
}
public bool Stop(string portName)
{
comPort.Close();
MessageLog.GetInstance.Show($"{portName} 串口关闭成功");
return comPort.IsOpen;
}
/// <summary>
/// 舵机控制 #000P1300T1000!
/// </summary>
/// <param name="index">通道号 0 - 5</param>
/// <param name="value">夹爪幅度 0500 - 2500</param>
/// <param name="time">夹爪时间 0000-9999</param>
public void Write(byte index,string value,string time ="1000")
{
byte[] PwmNumber = Encoding.ASCII.GetBytes(value);
byte[] Times = Encoding.ASCII.GetBytes(time);
//byte[] buffers = new byte[15] { 0x23, 0x30, 0x30, 0x30, 0x50, PwmNumber[0], PwmNumber[1], PwmNumber[2], PwmNumber[3], 0x54, Times[0], Times[1], Times[2], Times[3], 0x21 };
byte[] buffers = new byte[15] { 0x23, 0x30, 0x30, 0x30, 0x50, 0x31, 0x30, 0x35,0x30, 0x54, 0x31,0x30,0x30,0x30, 0x21 };
if (IsOpen) comPort.Write(buffers, 0, buffers.Length);
}
}
}

+ 2
- 2
DosingSystem/App.xaml.cs View File

@@ -56,7 +56,7 @@ namespace BPASmartClient.DosingSystem
protected override void OnExit(ExitEventArgs e)
{
base.OnExit(e);
Json<LocaPar>.Save();
Json<LocalRecipe>.Save();
Json<DevicePar>.Save();
Json<LocaMaterial>.Save();
BPASmartClient.CustomResource.Pages.Model.MessageNotify.GetInstance.LogSave();
@@ -290,7 +290,7 @@ namespace BPASmartClient.DosingSystem
private void DataInit()
{
//Config.GetInstance.Init();
Json<LocaPar>.Read();
Json<LocalRecipe>.Read();
Json<DevicePar>.Read();
Json<LocaMaterial>.Read();
}


+ 11
- 6
DosingSystem/Model/DeviceInquire.cs View File

@@ -177,12 +177,13 @@ namespace BPASmartClient.DosingSystem
Ping myPing = new Ping();
myPing.PingCompleted += new PingCompletedEventHandler(_myPing_PingCompleted);
myPing.SendAsync(item, 1000, null);
});
}

private void _myPing_PingCompleted(object sender, PingCompletedEventArgs e)
{
if (e.Reply.Status == IPStatus.Success)
if (e.Reply != null && e.Reply.Status == IPStatus.Success)
{
string ip = e.Reply.Address.ToString();
if (!DeviceLists.ContainsKey(ip))
@@ -208,13 +209,13 @@ namespace BPASmartClient.DosingSystem
BottomDeviceCurrentStatuses.Add(new DeviceCurrentStatus() { DeviceName = DeviceName });


for (int i = 0; i < Json<LocaPar>.Data.Recipes.Count; i++)
for (int i = 0; i < Json<LocalRecipe>.Data.Recipes.Count; i++)
{
for (int m = 0; m < Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.Count; m++)
for (int m = 0; m < Json<LocalRecipe>.Data.Recipes.ElementAt(i).RawMaterials.Count; m++)
{
if (Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp == ip)
if (Json<LocalRecipe>.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).DeviceIp == ip)
{
Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).RawMaterialName = DeviceName;
Json<LocalRecipe>.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).RawMaterialName = DeviceName;
}
}
}
@@ -278,7 +279,11 @@ namespace BPASmartClient.DosingSystem
}
else IPQueues.Enqueue(e.Reply.Address.ToString());
}
else IPQueues.Enqueue(e.Reply.Address.ToString());
else
{
if(e.Reply !=null)
IPQueues.Enqueue(e.Reply.Address.ToString());
}
}
}



DosingSystem/Model/par/LocaPar.cs → DosingSystem/Model/par/LocalRecipe.cs View File

@@ -9,7 +9,7 @@ using BPASmartClient.Model;

namespace BPASmartClient.DosingSystem
{
public class LocaPar
public class LocalRecipe
{
public ObservableCollection<RecipeModel> Recipes { get; set; } = new ObservableCollection<RecipeModel>();


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

@@ -26,7 +26,7 @@ namespace BPASmartClient.DosingSystem.View
this.btClose.Click += (o, e) => { this.Close(); };
this.br.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
ActionManage.GetInstance.Register(new Action(() => { this.Close(); }), "CloseNewRecipeView", true);
this.Unloaded += (o, s) => { Json<LocaPar>.Save(); };
this.Unloaded += (o, s) => { Json<LocalRecipe>.Save(); };
}

private void cb_SelectionChanged(object sender, SelectionChangedEventArgs e)


+ 1
- 1
DosingSystem/View/RecipeSettingsView.xaml.cs View File

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

private void RecipeSettingsView_Unloaded(object sender, RoutedEventArgs e)
{
Json<LocaPar>.Save();
Json<LocalRecipe>.Save();
}

//public static void SetAlignment()


+ 3
- 3
DosingSystem/ViewModel/ChangeDeviceNameViewModel.cs View File

@@ -38,11 +38,11 @@ namespace BPASmartClient.DosingSystem.ViewModel
res.RawMaterialName = DeviceName;
DeviceInquire.GetInstance.devices.ElementAt(index).DeviceName = DeviceName;
DeviceInquire.GetInstance.GetDevice(IpAddress).SetDeviceName(DeviceName);//设置PLC名称
for (int i = 0; i < Json<LocaPar>.Data.Recipes.Count; i++)
for (int i = 0; i < Json<LocalRecipe>.Data.Recipes.Count; i++)
{
for (int m = 0; m < Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.Count; m++)
for (int m = 0; m < Json<LocalRecipe>.Data.Recipes.ElementAt(i).RawMaterials.Count; m++)
{
Json<LocaPar>.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).RawMaterialName = DeviceName;
Json<LocalRecipe>.Data.Recipes.ElementAt(i).RawMaterials.ElementAt(m).RawMaterialName = DeviceName;
}
}
ActionManage.GetInstance.Send("ChangeDeviceNameViewClose");


+ 12
- 12
DosingSystem/ViewModel/NewRecipeViewModel.cs View File

@@ -37,7 +37,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
RawMaterials.Add(item);
}
RecipCode = rm.RecipCode;
Index = Array.FindIndex(Json<LocaPar>.Data.Recipes.ToArray(), p => p.RecipeName == RecipeName);
Index = Array.FindIndex(Json<LocalRecipe>.Data.Recipes.ToArray(), p => p.RecipeName == RecipeName);
}
}), "Details", true);

@@ -82,17 +82,17 @@ namespace BPASmartClient.DosingSystem.ViewModel
}

//编辑配方
if (Index >= 0 && Index < Json<LocaPar>.Data.Recipes.Count)
if (Index >= 0 && Index < Json<LocalRecipe>.Data.Recipes.Count)
{
var res = Array.FindIndex(Json<LocaPar>.Data.Recipes.ToArray(), p => p.RecipeName == RecipeName);
var res = Array.FindIndex(Json<LocalRecipe>.Data.Recipes.ToArray(), p => p.RecipeName == RecipeName);
if (res >= 0 && res != Index)
{
ErrorInfo = "配方名称已经存在!";
MessageNotify.GetInstance.ShowDialog("配方名称已经存在!", DialogType.Warning);
return;
}
Json<LocaPar>.Data.Recipes.ElementAt(Index).RecipeName = RecipeName;
Json<LocaPar>.Data.Recipes.ElementAt(Index).RawMaterials.Clear();
Json<LocalRecipe>.Data.Recipes.ElementAt(Index).RecipeName = RecipeName;
Json<LocalRecipe>.Data.Recipes.ElementAt(Index).RawMaterials.Clear();
RawMaterials.ToList()?.ForEach(item =>
{
var res = DeviceInquire.GetInstance.devices.FirstOrDefault(p => p.DeviceName == item.RawMaterialName);
@@ -105,14 +105,14 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
item.RawMaterialSource = 0;
}
Json<LocaPar>.Data.Recipes.ElementAt(Index).RawMaterials.Add(item);
Json<LocalRecipe>.Data.Recipes.ElementAt(Index).RawMaterials.Add(item);
});
Json<LocaPar>.Save();
Json<LocalRecipe>.Save();
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"{RecipeName} 配方编辑完成");
}
else //新建配方
{
if (Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName) != null)
if (Json<LocalRecipe>.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName) != null)
{
ErrorInfo = "配方名称已存在!";
MessageNotify.GetInstance.ShowDialog("配方名称已经存在!", DialogType.Warning);
@@ -133,12 +133,12 @@ namespace BPASmartClient.DosingSystem.ViewModel
}
TempRawMaterials.Add(item);
});
Json<LocaPar>.Data.Recipes.Add(new RecipeModel()
Json<LocalRecipe>.Data.Recipes.Add(new RecipeModel()
{
RecipeName = RecipeName,
RawMaterials = TempRawMaterials,
});
Json<LocaPar>.Save();
Json<LocalRecipe>.Save();
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"新建配方成功!");
}
ActionManage.GetInstance.Send("CloseNewRecipeView");
@@ -177,9 +177,9 @@ namespace BPASmartClient.DosingSystem.ViewModel
var dates = date.Split("-").ToList();
StringBuilder sb = new StringBuilder();
dates?.ForEach((item) => { sb.Append(item); });
Json<LocaPar>.Data.Recipes.Add(new RecipeModel()
Json<LocalRecipe>.Data.Recipes.Add(new RecipeModel()
{
SerialNum = Json<LocaPar>.Data.Recipes.Count + 1,
SerialNum = Json<LocalRecipe>.Data.Recipes.Count + 1,
RawMaterials = RawMaterials,
RecipCode = sb.ToString(),
RecipeName = RecipeName,


+ 6
- 6
DosingSystem/ViewModel/RecipeControlViewModel.cs View File

@@ -45,7 +45,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
await Task.Factory.StartNew(new Action(() =>
{
Recipes.ElementAt(index).IsEnable = true;
Json<LocaPar>.Data.Recipes.ElementAt(index).IsEnable = true;
Json<LocalRecipe>.Data.Recipes.ElementAt(index).IsEnable = true;
Recipes.ElementAt(index).Are.Set();
App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.Clear(); }));
SiemensDevice.GetInstance.MySiemens.Write("M10.5", true);
@@ -89,7 +89,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
}
Recipes.ElementAt(index).IsEnable = false;
Json<LocaPar>.Data.Recipes.ElementAt(index).IsEnable = false;
Json<LocalRecipe>.Data.Recipes.ElementAt(index).IsEnable = false;
}
MessageNotify.GetInstance.ShowUserLog($"下发工单 {Recipes.ElementAt(index).RecipeName}");
RecipeNames.Enqueue(deviceName);
@@ -124,7 +124,7 @@ namespace BPASmartClient.DosingSystem.ViewModel

#region 配方下发到PLC操作相关
//配方数据写入到输送机
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == CurrentRecipeName);
var res = Json<LocalRecipe>.Data.Recipes.FirstOrDefault(p => p.RecipeName == CurrentRecipeName);
/*List<int> recipeData = new List<int>();*/
List<int> BarrelNum = new List<int>();
if (res != null)
@@ -574,7 +574,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
else
{
int a1 = Array.FindIndex(DeviceInquire.GetInstance.devices.ToArray(), p => p.DeviceNum == cnt);
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a1).DeviceName && p.Loc == barrel);
Location1 = Array.FindIndex(Recipes.ElementAt(i).RawMaterials.ToArray(), p => p.RawMaterialName == DeviceInquire.GetInstance.devices.ElementAt(a1).DeviceName && p.Loc == barrel);
}
if (Location1 >= 0)
{
@@ -654,7 +654,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
int recipIndex = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == CurrentRecipeName);
App.Current.Dispatcher.Invoke(new Action(() => { recipeProcesses.Clear(); }));
Recipes.ElementAt(recipIndex).IsEnable = true;
Json<LocaPar>.Data.Recipes.ElementAt(recipIndex).IsEnable = true;
Json<LocalRecipe>.Data.Recipes.ElementAt(recipIndex).IsEnable = true;
Recipes.ElementAt(recipIndex).Are.Set();
Thread.Sleep(100);
}
@@ -672,7 +672,7 @@ namespace BPASmartClient.DosingSystem.ViewModel

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

public static ObservableCollection<RecipeModel> Recipes { get; set; } = Json<LocaPar>.Data.Recipes;
public static ObservableCollection<RecipeModel> Recipes { get; set; } = Json<LocalRecipe>.Data.Recipes;

public static string CurrentRecipeName { get { return _RecipeName; } set { _RecipeName = value; OnStaticPropertyChanged(); } }
private static string _RecipeName;


+ 6
- 6
DosingSystem/ViewModel/RecipeSettingsViewModel.cs View File

@@ -24,7 +24,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
public RecipeSettingsViewModel()
{
Recipes = Json<LocaPar>.Data.Recipes;
Recipes = Json<LocalRecipe>.Data.Recipes;

NewMaterital = new BPARelayCommand(() =>
{
@@ -39,7 +39,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
});
SaveRecipe = new BPARelayCommand(() =>
{
Json<LocaPar>.Save();
Json<LocalRecipe>.Save();
MessageNotify.GetInstance.ShowUserLog("保存配方");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方保存成功!");
});
@@ -49,11 +49,11 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
if (MessageNotify.GetInstance.ShowDialog($"是否删除【{o.ToString()}】配方,删除后数据将永久丢失!无法找回", DialogType.Warning))
{
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == o.ToString());
var res = Json<LocalRecipe>.Data.Recipes.FirstOrDefault(p => p.RecipeName == o.ToString());
if (res.IsEnable)
{
if (res != null) Json<LocaPar>.Data.Recipes.Remove(res);
Json<LocaPar>.Save();
if (res != null) Json<LocalRecipe>.Data.Recipes.Remove(res);
Json<LocalRecipe>.Save();
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方删除成功!");
MessageNotify.GetInstance.ShowUserLog($"删除配方 {res.RecipeName}");
}
@@ -69,7 +69,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
if (!string.IsNullOrEmpty(o?.ToString()))
{
var res = Json<LocaPar>.Data.Recipes.FirstOrDefault(p => p.RecipeName == o.ToString());
var res = Json<LocalRecipe>.Data.Recipes.FirstOrDefault(p => p.RecipeName == o.ToString());
if (res != null)
{
NewRecipeView nrv = new NewRecipeView();


+ 70
- 1
SmartClient.sln View File

@@ -202,7 +202,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.DosingSystem
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "设备监控", "设备监控", "{106E84C1-CAC5-4F14-9E31-201D3202C9FD}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MaxWokControl", "BPASmartClient.MaxWokControl\BPASmartClient.MaxWokControl.csproj", "{888382C0-6750-4E81-BED3-0F38775DCCCB}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MaxWokControl", "BPASmartClient.MaxWokControl\BPASmartClient.MaxWokControl.csproj", "{888382C0-6750-4E81-BED3-0F38775DCCCB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkS3", "BPASmartClient.MorkS3\BPASmartClient.MorkS3.csproj", "{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.RobotGripper", "BPASmartClient.RobotGripper\BPASmartClient.RobotGripper.csproj", "{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MilkTeaCube", "BPASmartClient.MilkTeaCube\BPASmartClient.MilkTeaCube.csproj", "{915F0718-B7AC-428D-ACD5-7DAACC28539F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -1898,6 +1904,66 @@ Global
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|x64.Build.0 = Release|Any CPU
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|x86.ActiveCfg = Release|Any CPU
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|x86.Build.0 = Release|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Debug|ARM.ActiveCfg = Debug|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Debug|ARM.Build.0 = Debug|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Debug|ARM64.Build.0 = Debug|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Debug|x64.ActiveCfg = Debug|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Debug|x64.Build.0 = Debug|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Debug|x86.ActiveCfg = Debug|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Debug|x86.Build.0 = Debug|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Release|Any CPU.Build.0 = Release|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Release|ARM.ActiveCfg = Release|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Release|ARM.Build.0 = Release|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Release|ARM64.ActiveCfg = Release|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Release|ARM64.Build.0 = Release|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Release|x64.ActiveCfg = Release|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Release|x64.Build.0 = Release|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Release|x86.ActiveCfg = Release|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Release|x86.Build.0 = Release|Any CPU
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}.Debug|ARM.ActiveCfg = Debug|Any CPU
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}.Debug|ARM.Build.0 = Debug|Any CPU
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}.Debug|ARM64.Build.0 = Debug|Any CPU
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}.Debug|x64.ActiveCfg = Debug|Any CPU
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}.Debug|x64.Build.0 = Debug|Any CPU
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}.Debug|x86.ActiveCfg = Debug|Any CPU
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}.Debug|x86.Build.0 = Debug|Any CPU
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}.Release|Any CPU.Build.0 = Release|Any CPU
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}.Release|ARM.ActiveCfg = Release|Any CPU
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}.Release|ARM.Build.0 = Release|Any CPU
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}.Release|ARM64.ActiveCfg = Release|Any CPU
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}.Release|ARM64.Build.0 = Release|Any CPU
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}.Release|x64.ActiveCfg = Release|Any CPU
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}.Release|x64.Build.0 = Release|Any CPU
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}.Release|x86.ActiveCfg = Release|Any CPU
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}.Release|x86.Build.0 = Release|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Debug|ARM.ActiveCfg = Debug|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Debug|ARM.Build.0 = Debug|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Debug|ARM64.Build.0 = Debug|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Debug|x64.ActiveCfg = Debug|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Debug|x64.Build.0 = Debug|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Debug|x86.ActiveCfg = Debug|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Debug|x86.Build.0 = Debug|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Release|Any CPU.Build.0 = Release|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Release|ARM.ActiveCfg = Release|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Release|ARM.Build.0 = Release|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Release|ARM64.ActiveCfg = Release|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Release|ARM64.Build.0 = Release|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Release|x64.ActiveCfg = Release|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Release|x64.Build.0 = Release|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Release|x86.ActiveCfg = Release|Any CPU
{915F0718-B7AC-428D-ACD5-7DAACC28539F}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1992,6 +2058,9 @@ Global
{B79914B9-3A81-426B-88FF-8ABAF5C92AB5} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{106E84C1-CAC5-4F14-9E31-201D3202C9FD} = {7BE13E55-D8B1-4232-AE63-8BF122633297}
{888382C0-6750-4E81-BED3-0F38775DCCCB} = {106E84C1-CAC5-4F14-9E31-201D3202C9FD}
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD}
{915F0718-B7AC-428D-ACD5-7DAACC28539F} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC}


Loading…
Cancel
Save