Browse Source

本地菜单

master
NXX 1 year ago
parent
commit
d36335d8a5
100 changed files with 7394 additions and 2490 deletions
  1. +1
    -1
      BPASmart.ConfigurationSoftware/BPASmart.ConfigurationSoftware.csproj
  2. +1
    -1
      BPASmart.PageLoad/BPASmart.PageLoad.csproj
  3. +1
    -1
      BPASmart.Server/BPASmart.Server.csproj
  4. +1
    -1
      BPASmart.VariableManager/BPASmart.VariableManager.csproj
  5. +30
    -31
      BPASmartClient.AGV/AGVHelper.cs
  6. +2
    -2
      BPASmartClient.Business/BPASmartClient.Business.csproj
  7. +2
    -2
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  8. +1
    -2
      BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
  9. +34
    -28
      BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs
  10. +72
    -1
      BPASmartClient.CustomResource/Pages/View/MainView.xaml
  11. +1
    -1
      BPASmartClient.CustomResource/Pages/View/RunLogView.xaml
  12. +1
    -1
      BPASmartClient.CustomResource/Pages/View/UserLogView.xaml
  13. +16
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs
  14. +1
    -1
      BPASmartClient.Device/BPASmartClient.Device.csproj
  15. +6
    -5
      BPASmartClient.Device/BaseDevice.cs
  16. +2
    -2
      BPASmartClient.DosingSystemSingle/BPASmartClient.DosingSystemSingle.csproj
  17. +120
    -0
      BPASmartClient.Helper/ExpandMethod.cs
  18. +0
    -1
      BPASmartClient.Helper/ThreadManage.cs
  19. +12
    -8
      BPASmartClient.JAKA/JakaMachine.cs
  20. +2
    -0
      BPASmartClient.JXJFoodBigStation/App.config
  21. +16
    -1
      BPASmartClient.JXJFoodBigStation/App.xaml.cs
  22. +8
    -0
      BPASmartClient.JXJFoodBigStation/BPASmartClient.JXJFoodBigStation.csproj
  23. +84
    -2
      BPASmartClient.JXJFoodBigStation/Model/GVL_BigStation.cs
  24. +23
    -1
      BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs
  25. +18
    -7
      BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs
  26. +14
    -14
      BPASmartClient.JXJFoodBigStation/Model/HK_PLC/StockBinName.cs
  27. +16
    -0
      BPASmartClient.JXJFoodBigStation/Model/HardWare/BomMaterial.cs
  28. +1487
    -621
      BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
  29. +10
    -4
      BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterial.cs
  30. +16
    -0
      BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterialData.cs
  31. +20
    -0
      BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RecipeData.cs
  32. +25
    -0
      BPASmartClient.JXJFoodBigStation/Model/RecipeDosing.cs
  33. +8
    -0
      BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Start_DB.cs
  34. +19
    -6
      BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs
  35. +122
    -0
      BPASmartClient.JXJFoodBigStation/View/BomOfMaterialView.xaml
  36. +28
    -0
      BPASmartClient.JXJFoodBigStation/View/BomOfMaterialView.xaml.cs
  37. +8
    -9
      BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml
  38. +160
    -14
      BPASmartClient.JXJFoodBigStation/View/ManualFlowView.xaml
  39. +1
    -1
      BPASmartClient.JXJFoodBigStation/View/RecipeInfosView.xaml
  40. +110
    -18
      BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml
  41. +109
    -27
      BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml
  42. +8
    -8
      BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml.cs
  43. +3
    -3
      BPASmartClient.JXJFoodBigStation/View/SiemensRecipeSendDownView.xaml
  44. +20
    -27
      BPASmartClient.JXJFoodBigStation/View/StockBinRawMaterialView.xaml
  45. +75
    -0
      BPASmartClient.JXJFoodBigStation/ViewModel/BomOfMaterialViewModel.cs
  46. +2
    -2
      BPASmartClient.JXJFoodBigStation/ViewModel/HKPlcCommMonitorViewModel.cs
  47. +19
    -89
      BPASmartClient.JXJFoodBigStation/ViewModel/HardwareStatusViewModel.cs
  48. +87
    -21
      BPASmartClient.JXJFoodBigStation/ViewModel/ManualFlowViewModel.cs
  49. +25
    -12
      BPASmartClient.JXJFoodBigStation/ViewModel/RecipeInfosViewModel.cs
  50. +24
    -0
      BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs
  51. +5
    -3
      BPASmartClient.JXJFoodBigStation/ViewModel/RecipeSendDownViewModel.cs
  52. +0
    -1
      BPASmartClient.JXJFoodBigStation/ViewModel/SiemensRecipeSendDownViewModel.cs
  53. +5
    -19
      BPASmartClient.JXJFoodBigStation/ViewModel/StockBinRawMaterialViewModel.cs
  54. +62
    -19
      BPASmartClient.JXJFoodSmallStation/App.xaml.cs
  55. +22
    -1
      BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj
  56. +21
    -0
      BPASmartClient.JXJFoodSmallStation/Model/Bom/BomMaterial.cs
  57. +16
    -0
      BPASmartClient.JXJFoodSmallStation/Model/Bom/BomMaterialData.cs
  58. +27
    -0
      BPASmartClient.JXJFoodSmallStation/Model/GVL/PlcInfos.cs
  59. +20
    -0
      BPASmartClient.JXJFoodSmallStation/Model/GVL/VarCommAttribute.cs
  60. +203
    -54
      BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs
  61. +0
    -41
      BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/DataComm.cs
  62. +16
    -0
      BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceRead.cs
  63. +77
    -34
      BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceStatus.cs
  64. +23
    -0
      BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceWrite.cs
  65. +178
    -0
      BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/PlcReadAddressDB3.cs
  66. +2122
    -963
      BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
  67. +7
    -4
      BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs
  68. +6
    -0
      BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DevicePar.cs
  69. +3
    -0
      BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceParModel.cs
  70. +29
    -0
      BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/RawMaterialStockBin.cs
  71. +1
    -0
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/RemoteRecipeData.cs
  72. +2
    -0
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/RemoteRecipeDataColl.cs
  73. +39
    -17
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/SiemensDeviceStatus.cs
  74. +2
    -0
      BPASmartClient.JXJFoodSmallStation/Model/Siemens/XL_Start_DB.cs
  75. +32
    -0
      BPASmartClient.JXJFoodSmallStation/Model/VarMonitor.cs
  76. +4
    -3
      BPASmartClient.JXJFoodSmallStation/Model/WindSend/WindSendDeviceStatus.cs
  77. +7
    -1
      BPASmartClient.JXJFoodSmallStation/Model/WindSend/WindSendRawMaterial.cs
  78. +250
    -0
      BPASmartClient.JXJFoodSmallStation/View/BomOfMaterialView.xaml
  79. +28
    -0
      BPASmartClient.JXJFoodSmallStation/View/BomOfMaterialView.xaml.cs
  80. +23
    -10
      BPASmartClient.JXJFoodSmallStation/View/DeviceMaterialParView.xaml
  81. +13
    -12
      BPASmartClient.JXJFoodSmallStation/View/ManualCommView.xaml
  82. +71
    -15
      BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml
  83. +5
    -0
      BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml.cs
  84. +104
    -0
      BPASmartClient.JXJFoodSmallStation/View/PlcVarMonitorView.xaml
  85. +28
    -0
      BPASmartClient.JXJFoodSmallStation/View/PlcVarMonitorView.xaml.cs
  86. +90
    -0
      BPASmartClient.JXJFoodSmallStation/View/ProcessMonitorView.xaml
  87. +28
    -0
      BPASmartClient.JXJFoodSmallStation/View/ProcessMonitorView.xaml.cs
  88. +2
    -2
      BPASmartClient.JXJFoodSmallStation/View/RecipeReceiveView.xaml
  89. +304
    -0
      BPASmartClient.JXJFoodSmallStation/View/RobotView.xaml
  90. +28
    -0
      BPASmartClient.JXJFoodSmallStation/View/RobotView.xaml.cs
  91. +140
    -0
      BPASmartClient.JXJFoodSmallStation/View/StockBinRawMaterialView.xaml
  92. +28
    -0
      BPASmartClient.JXJFoodSmallStation/View/StockBinRawMaterialView.xaml.cs
  93. +64
    -240
      BPASmartClient.JXJFoodSmallStation/View/WindSendParView.xaml
  94. +2
    -1
      BPASmartClient.JXJFoodSmallStation/View/WindSendParView.xaml.cs
  95. +85
    -0
      BPASmartClient.JXJFoodSmallStation/ViewModel/BomOfMaterialViewModel.cs
  96. +2
    -2
      BPASmartClient.JXJFoodSmallStation/ViewModel/HardwareStatusViewModel.cs
  97. +5
    -23
      BPASmartClient.JXJFoodSmallStation/ViewModel/ManualCommViewModel.cs
  98. +174
    -42
      BPASmartClient.JXJFoodSmallStation/ViewModel/ManualControlViewModel.cs
  99. +97
    -7
      BPASmartClient.JXJFoodSmallStation/ViewModel/ManualFlowViewModel.cs
  100. +23
    -0
      BPASmartClient.JXJFoodSmallStation/ViewModel/PlcVarMonitorViewModel.cs

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

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

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

<ItemGroup>


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

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

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

<ItemGroup>


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

@@ -9,7 +9,7 @@

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



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

@@ -30,7 +30,7 @@

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

<ItemGroup>


+ 30
- 31
BPASmartClient.AGV/AGVHelper.cs View File

@@ -96,9 +96,8 @@ namespace BPASmartClient.AGV
/// AGV去1号线体装桶到炒锅1
/// </summary>
/// <returns></returns>
public string AgvToLineOneLoadRoller(string robotJobId)
public string AgvToLineOneLoadRoller(string robotJobId, int priority=1)
{

//bool b = Convert.ToBoolean(config.AppSettings.Settings["appKey"].Value);//配置文件信息读取
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
@@ -113,7 +112,7 @@ namespace BPASmartClient.AGV
AGVModel httpModel = new AGVModel();
httpModel.robotJobId = robotJobId;//上游提供
httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号
httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级
httpModel.jobPriority = priority;//任务执行的优先级
httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value);//0:根据优先级来执行,1:强制执行
httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
@@ -160,7 +159,7 @@ namespace BPASmartClient.AGV
/// AGV去1号线体装桶到炒锅4
/// </summary>
/// <returns></returns>
public string AgvFromLineOneToFryFourLoadRoller(string robotJobId)
public string AgvFromLineOneToFryFourLoadRoller(string robotJobId, int priority = 1)
{

//bool b = Convert.ToBoolean(config.AppSettings.Settings["appKey"].Value);//配置文件信息读取
@@ -177,7 +176,7 @@ namespace BPASmartClient.AGV
AGVModel httpModel = new AGVModel();
httpModel.robotJobId = robotJobId;//上游提供
httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号
httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级
httpModel.jobPriority = priority;//任务执行的优先级
httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value);//0:根据优先级来执行,1:强制执行
httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
@@ -223,7 +222,7 @@ namespace BPASmartClient.AGV
/// AGV去2号线体装桶到炒锅2
/// </summary>
/// <returns></returns>
public string AgvToLineTwoLoadRoller(string robotJobId)
public string AgvToLineTwoLoadRoller(string robotJobId, int priority = 1)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
@@ -238,7 +237,7 @@ namespace BPASmartClient.AGV
AGVModel httpModel = new AGVModel();
httpModel.robotJobId = robotJobId;//上游提供
httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号
httpModel.jobPriority =Convert.ToInt32( config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级
httpModel.jobPriority =priority;//任务执行的优先级
httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行
httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
@@ -278,7 +277,7 @@ namespace BPASmartClient.AGV
/// AGV去2号线体装桶到炒锅5
/// </summary>
/// <returns></returns>
public string AgvFromLineTwoToFryFiveLoadRoller(string robotJobId)
public string AgvFromLineTwoToFryFiveLoadRoller(string robotJobId, int priority = 1)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
@@ -293,7 +292,7 @@ namespace BPASmartClient.AGV
AGVModel httpModel = new AGVModel();
httpModel.robotJobId = robotJobId;//上游提供
httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号
httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级
httpModel.jobPriority = priority;//任务执行的优先级
httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行
httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
@@ -333,7 +332,7 @@ namespace BPASmartClient.AGV
/// AGV去3号线体装桶
/// </summary>
/// <returns></returns>
public string AgvToLineThreeLoadRoller(string robotJobId)
public string AgvToLineThreeLoadRoller(string robotJobId, int priority = 1)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
@@ -348,7 +347,7 @@ namespace BPASmartClient.AGV
AGVModel httpModel = new AGVModel();
httpModel.robotJobId = robotJobId;//上游提供
httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号
httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级
httpModel.jobPriority = priority;//任务执行的优先级
httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行
httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
@@ -388,7 +387,7 @@ namespace BPASmartClient.AGV
/// AGV从清洗台到4号线体卸桶
/// </summary>
/// <returns></returns>
public string AgvFromCleanToLineFourUnLoadRoller(string robotJobId)
public string AgvFromCleanToLineFourUnLoadRoller(string robotJobId, int priority = 1)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
@@ -403,7 +402,7 @@ namespace BPASmartClient.AGV
AGVModel httpModel = new AGVModel();
httpModel.robotJobId = robotJobId;//上游提供
httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号
httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级
httpModel.jobPriority = priority;//任务执行的优先级
httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行
httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
@@ -443,7 +442,7 @@ namespace BPASmartClient.AGV
/// AGV离开炒锅1
/// </summary>
/// <returns></returns>
public string AgvLeaveFryPotOne(string robotJobId)
public string AgvLeaveFryPotOne(string robotJobId, int priority = 1)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
@@ -458,7 +457,7 @@ namespace BPASmartClient.AGV
AGVModel httpModel = new AGVModel();
httpModel.robotJobId = robotJobId;//上游提供
httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号
httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级
httpModel.jobPriority = priority;//任务执行的优先级
httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行
httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
@@ -498,7 +497,7 @@ namespace BPASmartClient.AGV
/// AGV离开炒锅2
/// </summary>
/// <returns></returns>
public string AgvLeaveFryPotTwo(string robotJobId)
public string AgvLeaveFryPotTwo(string robotJobId, int priority = 1 )
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
@@ -513,7 +512,7 @@ namespace BPASmartClient.AGV
AGVModel httpModel = new AGVModel();
httpModel.robotJobId = robotJobId;//上游提供
httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号
httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级
httpModel.jobPriority = priority;//任务执行的优先级
httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行
httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
@@ -553,7 +552,7 @@ namespace BPASmartClient.AGV
/// AGV离开炒锅3
/// </summary>
/// <returns></returns>
public string AgvLeaveFryPotThree(string robotJobId)
public string AgvLeaveFryPotThree(string robotJobId, int priority = 1)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
@@ -568,7 +567,7 @@ namespace BPASmartClient.AGV
AGVModel httpModel = new AGVModel();
httpModel.robotJobId = robotJobId;//上游提供
httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号
httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级
httpModel.jobPriority = priority;//任务执行的优先级
httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行
httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
@@ -608,7 +607,7 @@ namespace BPASmartClient.AGV
/// AGV离开炒锅4
/// </summary>
/// <returns></returns>
public string AgvLeaveFryPotFour(string robotJobId)
public string AgvLeaveFryPotFour(string robotJobId, int priority = 1)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
@@ -623,7 +622,7 @@ namespace BPASmartClient.AGV
AGVModel httpModel = new AGVModel();
httpModel.robotJobId = robotJobId;//上游提供
httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号
httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级
httpModel.jobPriority = priority;//任务执行的优先级
httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行
httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
@@ -663,7 +662,7 @@ namespace BPASmartClient.AGV
/// AGV离开炒锅5
/// </summary>
/// <returns></returns>
public string AgvLeaveFryPotFive(string robotJobId)
public string AgvLeaveFryPotFive(string robotJobId, int priority = 1)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
@@ -678,7 +677,7 @@ namespace BPASmartClient.AGV
AGVModel httpModel = new AGVModel();
httpModel.robotJobId = robotJobId;//上游提供
httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号
httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级
httpModel.jobPriority = priority;//任务执行的优先级
httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行
httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
@@ -719,7 +718,7 @@ namespace BPASmartClient.AGV
/// AGV从1号线运空桶洗桶
/// </summary>
/// <returns></returns>
public string AgvLeaveLOneToClean(string robotJobId)
public string AgvLeaveLOneToClean(string robotJobId, int priority = 1)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
@@ -734,7 +733,7 @@ namespace BPASmartClient.AGV
AGVModel httpModel = new AGVModel();
httpModel.robotJobId = robotJobId;//上游提供
httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号
httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级
httpModel.jobPriority = priority;//任务执行的优先级
httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行
httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
@@ -774,7 +773,7 @@ namespace BPASmartClient.AGV
/// AGV从2号线运空桶洗桶
/// </summary>
/// <returns></returns>
public string AgvLeaveLTwoToClean(string robotJobId)
public string AgvLeaveLTwoToClean(string robotJobId,int priority=1)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
@@ -789,7 +788,7 @@ namespace BPASmartClient.AGV
AGVModel httpModel = new AGVModel();
httpModel.robotJobId = robotJobId;//上游提供
httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号
httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级
httpModel.jobPriority = priority;//任务执行的优先级
httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行
httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
@@ -829,7 +828,7 @@ namespace BPASmartClient.AGV
/// AGV从3号线运空桶洗桶
/// </summary>
/// <returns></returns>
public string AgvLeaveLThreeToClean(string robotJobId)
public string AgvLeaveLThreeToClean(string robotJobId,int priority=1)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
@@ -844,7 +843,7 @@ namespace BPASmartClient.AGV
AGVModel httpModel = new AGVModel();
httpModel.robotJobId = robotJobId;//上游提供
httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号
httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级
httpModel.jobPriority = priority;//任务执行的优先级
httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行
httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
@@ -884,7 +883,7 @@ namespace BPASmartClient.AGV
/// AGV从洗桶处运桶到4号洗桶线
/// </summary>
/// <returns></returns>
public string AgvLeaveCleanToLFour(string robotJobId)
public string AgvLeaveCleanToLFour(string robotJobId, int priority = 1)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
@@ -899,7 +898,7 @@ namespace BPASmartClient.AGV
AGVModel httpModel = new AGVModel();
httpModel.robotJobId = robotJobId;//上游提供
httpModel.warehouseId = long.Parse(config.AppSettings.Settings["warehouseId"].Value); //仓库编号
httpModel.jobPriority = Convert.ToInt32(config.AppSettings.Settings["jobPriority"].Value);//任务执行的优先级
httpModel.jobPriority = priority;//任务执行的优先级
httpModel.jobPriorityType = Convert.ToInt32(config.AppSettings.Settings["jobPriorityType"].Value); ;//0:根据优先级来执行,1:强制执行
httpModel.jobType = config.AppSettings.Settings["jobType"].Value; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据


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

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

<ItemGroup>
<PackageReference Include="BPA.ApolloClient" Version="1.0.12" />
<PackageReference Include="BPA.Helper" Version="1.0.33" />
<PackageReference Include="BPA.Message" Version="1.0.84" />
<PackageReference Include="BPA.Helper" Version="1.0.54" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />


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

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

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.28" />
<PackageReference Include="BPA.Message" Version="1.0.84" />
<PackageReference Include="BPA.Helper" Version="1.0.54" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="MahApps.Metro.IconPacks.FontAwesome" Version="4.11.0" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
</ItemGroup>


+ 1
- 2
BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs View File

@@ -25,7 +25,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
if (string.IsNullOrEmpty(name)) name = typeof(AlarmT).Name;
if (_Instance == null) _Instance = new ConcurrentDictionary<string, AlarmT>();
if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new AlarmT());
return _Instance[name];
return _Instance[name];
}
}
private AlarmHelper() { }
@@ -67,7 +67,6 @@ namespace BPASmartClient.CustomResource.Pages.Model
}
Thread.Sleep(100);
}), $"{typeof(AlarmT).Name},报警通用模块监听");

}

/// <summary>


+ 34
- 28
BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs View File

@@ -81,7 +81,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
catch (Exception)
{

// throw;
// throw;
}
}
}
@@ -109,34 +109,40 @@ namespace BPASmartClient.CustomResource.Pages.Model

public bool ShowDialog(string info, DialogType dialogType = DialogType.Information)
{
PromptView PV = new PromptView();
PV.TextBlockInfo = info;
switch (dialogType)
bool result = false;
Application.Current.Dispatcher.Invoke(() =>
{
case DialogType.Warning:
PV.TextBlockIcon = "&#xe61f;";
PV.TextBlockForeground = Brushes.Yellow;
PV.infoType.Text = "警告:";
//PV.Cancel.Visibility = Visibility.Collapsed;
break;
case DialogType.Error:
PV.TextBlockIcon = "&#xed1a;";
PV.TextBlockForeground = Brushes.Red;
PV.infoType.Text = "错误:";
//PV.Cancel.Visibility = Visibility.Collapsed;
break;
case DialogType.Information:
PV.TextBlockIcon = "&#xe657;";
PV.TextBlockForeground = Brushes.DeepSkyBlue;
PV.infoType.Text = "提示:";
//PV.Cancel.Visibility = Visibility.Visible;
break;
default:
break;
}
PV.infoType.Foreground = PV.TextBlockForeground;
var res = PV.ShowDialog();
return res == null ? false : (bool)res;
PromptView PV = new PromptView();
PV.TextBlockInfo = info;
switch (dialogType)
{
case DialogType.Warning:
PV.TextBlockIcon = "&#xe61f;";
PV.TextBlockForeground = Brushes.Yellow;
PV.infoType.Text = "警告:";
//PV.Cancel.Visibility = Visibility.Collapsed;
break;
case DialogType.Error:
PV.TextBlockIcon = "&#xed1a;";
PV.TextBlockForeground = Brushes.Red;
PV.infoType.Text = "错误:";
//PV.Cancel.Visibility = Visibility.Collapsed;
break;
case DialogType.Information:
PV.TextBlockIcon = "&#xe657;";
PV.TextBlockForeground = Brushes.DeepSkyBlue;
PV.infoType.Text = "提示:";
//PV.Cancel.Visibility = Visibility.Visible;
break;
default:
break;
}
PV.infoType.Foreground = PV.TextBlockForeground;

var res = PV.ShowDialog();
result = res == null ? false : (bool)res;
});
return result;
}
}



+ 72
- 1
BPASmartClient.CustomResource/Pages/View/MainView.xaml View File

@@ -21,7 +21,7 @@
</Window.DataContext>

<Window.Resources>

<!--#region 静态资源-->
<ImageBrush x:Key="leftImage" ImageSource="../../Image/leftImage.png" />
@@ -365,6 +365,70 @@
</Setter.Value>
</Setter>
</Style>
<Style x:Key="StatusBtnStyle告警" TargetType="ToggleButton">
<Style.Setters>
<Setter Property="Width" Value="30" />
<Setter Property="Height" Value="19" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="IsChecked" Value="{Binding IsCheck, Mode=TwoWay}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToggleButton">
<Grid Cursor="Hand">
<Border
x:Name="bd1"
Width="25"
Height="13"
Margin="0,-10,-5,0"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Panel.ZIndex="100"
Background="#2600CAFF"
CornerRadius="3"
Cursor="Hand"
Visibility="Collapsed">
<TextBlock
HorizontalAlignment="Center"
FontSize="8"
Foreground="#FF00E6F7"
Text="{Binding ListNum, Mode=TwoWay}" />
<!-- -->
</Border>
<Image
x:Name="image1"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
Panel.ZIndex="0"
RenderOptions.BitmapScalingMode="HighQuality"
SnapsToDevicePixels="True"
Source="/BPASmartClient.CustomResource;component/Image/告警/无告警.png"
UseLayoutRounding="True" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="true">
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/告警/严重告警.png" />
<Setter TargetName="bd1" Property="Visibility" Value="Visible" />
</Trigger>
<Trigger Property="IsChecked" Value="False">
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/告警/无告警.png" />
<Setter TargetName="bd1" Property="Visibility" Value="Collapsed" />
</Trigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding IsCheck}" Value="true" />
<Condition Binding="{Binding IsAlarm}" Value="true" />
</MultiDataTrigger.Conditions>
<MultiDataTrigger.Setters>
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/告警/严重告警.png" />
<Setter TargetName="bd1" Property="Visibility" Value="Visible" />
</MultiDataTrigger.Setters>
</MultiDataTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style.Setters>
</Style>
</Window.Resources>

<Grid Background="#103153">
@@ -516,6 +580,13 @@
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<ToggleButton
HorizontalAlignment="Center"
VerticalAlignment="Center"
Cursor="Hand"
IsChecked="{Binding IsAlarm}"
Style="{DynamicResource StatusBtnStyle告警}"
ToolTip="心跳检测报警" Margin="0,0,8,0"/>
<CheckBox
Margin="5,0,8,0"
Content="开机启动"


+ 1
- 1
BPASmartClient.CustomResource/Pages/View/RunLogView.xaml View File

@@ -234,7 +234,7 @@
<ScrollViewer
Grid.Row="2"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
VerticalScrollBarVisibility="Visible">

<Grid>
<!--#region 实时报警信息-->


+ 1
- 1
BPASmartClient.CustomResource/Pages/View/UserLogView.xaml View File

@@ -310,7 +310,7 @@
<ScrollViewer
Grid.Row="2"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
VerticalScrollBarVisibility="Visible">

<Grid>
<!--#region 实时报警信息-->


+ 16
- 0
BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using System.Security.Cryptography.Xml;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@@ -94,6 +95,12 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
{
PermissionChange();
}), "PermissionChange");

ActionManage.GetInstance.Register(new Action<object>((c) =>
{
if(c!=null)
IsAlarm = Convert.ToBoolean(c);
}),"HeartBeatCheck");
}

private void PermissionChange()
@@ -153,6 +160,15 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
OnPropertyChanged();
}
}
private bool _isAlarm=true;
/// <summary>
/// 心跳检测报警
/// </summary>
public bool IsAlarm
{
get { return _isAlarm; }
set { _isAlarm = value;OnPropertyChanged(); }
}
/// <summary>
/// 开机自启
/// </summary>


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

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

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.84" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
</ItemGroup>

<ItemGroup>


+ 6
- 5
BPASmartClient.Device/BaseDevice.cs View File

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

protected
protected

/// <summary>
/// 外设设备集合
@@ -145,7 +145,7 @@ namespace BPASmartClient.Device
/// </summary>
/// <param name="address"></param>
/// <param name="value"></param>
public void WriteControlExact(string address, object value,int i)
public void WriteControlExact(string address, object value, int i)
{
if (peripherals != null)
{
@@ -205,7 +205,7 @@ namespace BPASmartClient.Device
Status.Update($"{TypeName}.{key}", peripheral.GetAllStatus()[key]);
}
}
if(dicPort2peripheralStatus.ContainsKey(i))
if (dicPort2peripheralStatus.ContainsKey(i))
{
dicPort2peripheralStatus[i] = newPeripheralStatus;
}
@@ -284,7 +284,7 @@ namespace BPASmartClient.Device
foreach (var faces in res)
{
if (faces.Name == "IStatus")
{
{
InterfaceStatus = item.GetValue(this) as IStatus;
GetMonitorData(InterfaceStatus);
}
@@ -361,6 +361,7 @@ namespace BPASmartClient.Device
{
ThreadManage.GetInstance().StopTask($"GvlStatusMonitor:{DeviceId}", new Action(() =>
{
ActionManage.GetInstance.Send("ClearOrders");
ResetProgram();
ResetStatus();
InitTask();
@@ -380,7 +381,7 @@ namespace BPASmartClient.Device
{
ReadData();
Thread.Sleep(10);
}), $"ReadData:{DeviceId}",true);
}), $"ReadData:{DeviceId}", true);
#endregion

#region 任务流程


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

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

<ItemGroup>
<PackageReference Include="BPA.Helper" Version="1.0.33" />
<PackageReference Include="BPA.Message" Version="1.0.84" />
<PackageReference Include="BPA.Helper" Version="1.0.54" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>



+ 120
- 0
BPASmartClient.Helper/ExpandMethod.cs View File

@@ -185,6 +185,126 @@ namespace BPASmartClient.Helper

return false;
}
public static string ToBinString(this object value)
{
int num = 0;
int num2 = 0;
int num3 = 0;
string text = "";
long num4 = 0L;
try
{
if (value.GetType().Name.IndexOf("[]") < 0)
{
string a = value.GetType().Name;
switch (a)
{
case "Byte":
num3 = 7;
num4 = (byte)value;
break;
case "UInt16":
num3 = 15;
num4 = (ushort)value;
break;
case "Int16":
num3 = 15;
num4 = (short)value;
break;
case "UInt32":
num3 = 31;
num4 = (uint)value;
break;
case "Int32":
num3 = 31;
num4 = (int)value;
break;
case "Int64":
num3 = 63;
num4 = (long)value;
break;
default:
throw new Exception();
}

for (num = num3; num >= 0; num += -1)
{
if ((num + 1) % 4 == 0) text = text + " ";
text = (((num4 & (long)Math.Pow(2.0, num)) <= 0) ? (text + "0") : (text + "1"));
}
}
else
{
switch (value.GetType().Name)
{
case "Byte[]":
{
num3 = 7;
byte[] array4 = (byte[])value;
for (num2 = 0; num2 <= array4.Length - 1; num2++)
{
for (num = num3; num >= 0; num += -1)
{
text = (((array4[num2] & (byte)Math.Pow(2.0, num)) <= 0) ? (text + "0") : (text + "1"));
}
}

break;
}
case "Int16[]":
{
num3 = 15;
short[] array2 = (short[])value;
for (num2 = 0; num2 <= array2.Length - 1; num2++)
{
for (num = num3; num >= 0; num += -1)
{
text = (((array2[num2] & (byte)Math.Pow(2.0, num)) <= 0) ? (text + "0") : (text + "1"));
}
}

break;
}
case "Int32[]":
{
num3 = 31;
int[] array3 = (int[])value;
for (num2 = 0; num2 <= array3.Length - 1; num2++)
{
for (num = num3; num >= 0; num += -1)
{
text = (((array3[num2] & (byte)Math.Pow(2.0, num)) <= 0) ? (text + "0") : (text + "1"));
}
}

break;
}
case "Int64[]":
{
num3 = 63;
byte[] array = (byte[])value;
for (num2 = 0; num2 <= array.Length - 1; num2++)
{
for (num = num3; num >= 0; num += -1)
{
text = (((array[num2] & (byte)Math.Pow(2.0, num)) <= 0) ? (text + "0") : (text + "1"));
}
}

break;
}
default:
throw new Exception();
}
}

return text;
}
catch
{
return "";
}
}





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

@@ -201,5 +201,4 @@ namespace BPASmartClient.Helper
return false;
}
}

}

+ 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/App.config View File

@@ -3,5 +3,7 @@
<appSettings>
<add key="HKPlc_IP" value="107.107.2.17"/>
<add key="Siemens_IP" value="107.107.2.200"/>
<add key="HKPlc_Connect" value="false"/>
<add key="Siemens_Connect" value="false"/>
</appSettings>
</configuration>

+ 16
- 1
BPASmartClient.JXJFoodBigStation/App.xaml.cs View File

@@ -13,6 +13,7 @@ using BPASmartClient.CustomResource.Pages.View;
using BPASmartClient.CustomResource.Pages.ViewModel;
using BPASmartClient.Helper;
using BPASmartClient.JXJFoodBigStation.Model;
using BPASmartClient.JXJFoodBigStation.Model.Siemens;

namespace BPASmartClient.JXJFoodBigStation
{
@@ -53,6 +54,10 @@ namespace BPASmartClient.JXJFoodBigStation

protected override void OnExit(ExitEventArgs e)
{
Json<LocalRecipe>.Save();
Json<RemoteRecipe>.Save();
Json<RawMaterialData>.Save();
Json<BomMaterial>.Save();
base.OnExit(e);
MessageNotify.GetInstance.LogSave();
ThreadManage.GetInstance().Dispose();
@@ -100,6 +105,13 @@ namespace BPASmartClient.JXJFoodBigStation
AssemblyName = "BPASmartClient.JXJFoodBigStation",
ToggleWindowPath = "View.StockBinRawMaterialView"
});
StockBinManage.Add(new SubMenumodel()
{
SubMenuName = "MES原料数据",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.JXJFoodBigStation",
ToggleWindowPath = "View.BomOfMaterialView"
});
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe683;",
@@ -137,7 +149,7 @@ namespace BPASmartClient.JXJFoodBigStation
InfoLog.Add(new SubMenumodel()
{
SubMenuName = "调试日志",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员, Permission.技术员 },
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.DebugLogView"
});
@@ -217,6 +229,9 @@ namespace BPASmartClient.JXJFoodBigStation
//Config.GetInstance.Init();
//Json<LocaPar>.Read();
Json<LocalRecipe>.Read();
Json<RemoteRecipe>.Read();
Json<RawMaterialData>.Read();
Json<BomMaterial>.Read();
}

}


+ 8
- 0
BPASmartClient.JXJFoodBigStation/BPASmartClient.JXJFoodBigStation.csproj View File

@@ -5,6 +5,7 @@
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<ApplicationIcon>hbl.ico</ApplicationIcon>
</PropertyGroup>

<ItemGroup>
@@ -31,6 +32,9 @@
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Update="View\BomOfMaterialView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="View\StockBinRawMaterialView.xaml.cs">
<SubType>Code</SubType>
</Compile>
@@ -51,6 +55,10 @@
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\BomOfMaterialView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\StockBinRawMaterialView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>


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

@@ -16,8 +16,32 @@ namespace BPASmartClient.JXJFoodBigStation.Model
/// plc心跳上传
/// </summary>
public static bool HeartBeatFromPlc { get; set; }
/// <summary>
/// 订单取消的状态位
/// </summary>
public static bool Order_Cancel { get; set; }
/// <summary>
/// 订单取消的配方号
/// </summary>
public static string Order_CancelRecipeCode { get; set; } = "";
public static int Order_CancelStep { get; set; }
/// <summary>
/// 第一个配方的配料时间
/// </summary>
public static DateTime DosingRecipe1Time { get; set; }
/// <summary>
/// 第二个配方的配料时间
/// </summary>
public static DateTime DosingRecipe2Time { get; set; }
/// <summary>
/// 第三个配方的配料时间
/// </summary>
public static DateTime DosingRecipe3Time { get; set; }
/// <summary>
/// 第四个配方的配料时间
/// </summary>
public static DateTime DosingRecipe4Time { get; set; }

public static DateTime DosingTime { get; set; }
/// <summary>
/// plc心跳下发
/// </summary>
@@ -38,17 +62,44 @@ namespace BPASmartClient.JXJFoodBigStation.Model
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方
/// </summary>
public static int Recipe4DosingStatus { get; set; }


public static int[] RecipeDosingStatus { get; set; } = new int[4] { 0, 0, 0, 0 };
public static bool[] AllowIssueRecipe { get; set; } = new bool[4] { false, false, false, false };
public static bool[] ReceviceFinishRecipe { get; set; } = new bool[4] { false, false, false, false };
public static bool[] DosingFinishRecipe { get; set; } = new bool[4] { false, false, false, false };

public static bool[] IsTrayArrive { get; set; } = new bool[5] { false, false, false, false,false };
public static DateTime[] RecipeDosingTime { get; set; } = new DateTime[4] { DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now };

/// <summary>
/// 是否处于手动下发配方
/// </summary>
public static bool IsUseLocalRecipe { get; set; } = false;

/// <summary>
/// 洗桶的标识符
/// </summary>
public static bool BarrelWasherSign { get; set; }
/// <summary>
/// 订单请求
/// </summary>
public static bool Order_Request { get; set; } = false;
/// <summary>
/// 下发配方的状态位
/// </summary>
public static int SiemensSendRecipeStatus { get; set; } = 0;

/// <summary>
/// 大料站最大的料仓数目
/// </summary>
public const int Max_DosingSotckBinNum = 14;
public static StockBinName stockBinName { get; set; } = new StockBinName();

/// <summary>
/// 原料的名称和原料编号对应,Mes提供的信息
/// </summary>
public static Dictionary<string, string> RawMaterialsNameCode { get; set; } = new Dictionary<string, string>();

public static ushort AGVPutTray { get; set; }
public static ushort AGVGetTray { get; set; }
@@ -57,6 +108,37 @@ namespace BPASmartClient.JXJFoodBigStation.Model
public static ushort TrayCylinder { get; set; }

public static DB_Read HKPlc_Read = new DB_Read();
public static bool IsUseLocalName { get; set; } = true;

/// <summary>
/// 是否连接海科PLC
/// </summary>
public static bool IsAllowHKPlcConnect { get; set; }
/// <summary>
/// 是否连接西门子PLC
/// </summary>
public static bool IsAllowSiemensConnect { get; set; }

/// <summary>
/// 配方1配料完成
/// </summary>
public static bool Recipe1DosingFinish { get; set; } = false;
/// <summary>
/// 配方2配料完成
/// </summary>
public static bool Recipe2DosingFinish { get; set; } = false;
/// <summary>
/// 配方3配料完成
/// </summary>
public static bool Recipe3DosingFinish { get; set; } = false;
/// <summary>
/// 配方4配料完成
/// </summary>
public static bool Recipe4DosingFinish { get; set; } = false;

/// <summary>
/// 订单是否是洗桶
/// </summary>
public static bool Order_IsWashingBarrel { get; set; } = false;
public static int TrayEnable { get; set; } = 15;
}
}

+ 23
- 1
BPASmartClient.JXJFoodBigStation/Model/HK_PLC/DB_Write.cs View File

@@ -1,4 +1,5 @@
using System;
using BPASmartClient.S7Net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -57,6 +58,25 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
/// </summary>
public bool Tray5InPlace { get; set; }
/// <summary>
/// 配方1配料完成
/// </summary>
public bool Recipe1DoisngFinish { get; set; }

/// <summary>
/// 配方2配料完成
/// </summary>
public bool Recipe2DoisngFinish { get; set; }

/// <summary>
/// 配方3配料完成
/// </summary>
public bool Recipe3DoisngFinish { get; set; }

/// <summary>
/// 配方4配料完成
/// </summary>
public bool Recipe4DoisngFinish { get; set; }
/// <summary>
/// 配方编码
/// </summary>
public short RecipeCode { get; set; }
@@ -123,5 +143,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
public float Bareel5Bin12SetWeight { get; set; }
public float Bareel5Bin13SetWeight { get; set; }
public float Bareel5Bin14SetWeight { get; set; }
public bool OrderCancel_Sign { get; set; }
public short OrderCancel_TrayCode { get; set; }
}
}

+ 18
- 7
BPASmartClient.JXJFoodBigStation/Model/HK_PLC/HKDeviceStatus.cs View File

@@ -18,17 +18,27 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
public bool IsConnected => HK_PLC_S7.IsConnected;
public DB_Read PlcRead = new DB_Read();
public DL_DataColl_DB DataColl =new DL_DataColl_DB();
public StockBinName StockBinName = new StockBinName();
public void Init()
{
DB_Write PlcWrite = new DB_Write();
HK_PLC_S7.WriteClass<DB_Write>(PlcWrite, 99);
ThreadManage.GetInstance().StartLong(new Action(() =>
try
{
DB_Write PlcWrite = new DB_Write();
HK_PLC_S7.WriteClass<DB_Write>(PlcWrite, 99);
}
catch (Exception ex) {
MessageNotify.GetInstance.ShowRunLog("DB99块初始化值 失败");
}
ThreadManage.GetInstance().StartLong(new Action(() =>
{/*
var res = HK_PLC_S7.ReadClass<StockBinName>(97);//料仓里原料的编码
if (res != null && res is StockBinName data9)
{
GVL_BigStation.stockBinName = data9;
}*/
if (IsConnected)
{
var res1 = HK_PLC_S7.ReadClass<DB_Read>(98);
var res2 = HK_PLC_S7.ReadClass<StockBinName>(97);
var res2 = HK_PLC_S7.ReadClass<StockBinName>(97);//料仓里原料的编码
if (res1 != null && res1 is DB_Read data1)
{
PlcRead = data1;
@@ -36,7 +46,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
}
if (res2 != null && res2 is StockBinName data2)
{
StockBinName = data2;
GVL_BigStation.stockBinName = data2;
}
var res3 = HK_PLC_S7.ReadClass<DL_DataColl_DB>(48);
if (res3 != null && res3 is DL_DataColl_DB data)
@@ -45,7 +55,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
}
}
Thread.Sleep(10);
}),"信号收发处理",true);
}),"海科数据交互",true);
}
/// <summary>
/// 下发配方数据
@@ -58,6 +68,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号桶


+ 14
- 14
BPASmartClient.JXJFoodBigStation/Model/HK_PLC/StockBinName.cs View File

@@ -9,33 +9,33 @@ namespace BPASmartClient.JXJFoodBigStation.Model.HK_PLC
{
public class StockBinName
{
[Siemens(6)]
[Siemens(4)]
public string RawMaterialName1 { get; set; } = "";
[Siemens(6)]
[Siemens(4)]
public string RawMaterialName2 { get; set; } = "";
[Siemens(6)]
[Siemens(4)]
public string RawMaterialName3 { get; set; } = "";
[Siemens(6)]
[Siemens(4)]
public string RawMaterialName4 { get; set; } = "";
[Siemens(6)]
[Siemens(4)]
public string RawMaterialName5 { get; set; } = "";
[Siemens(6)]
[Siemens(4)]
public string RawMaterialName6 { get; set; } = "";
[Siemens(6)]
[Siemens(4)]
public string RawMaterialName7 { get; set; } = "";
[Siemens(6)]
[Siemens(4)]
public string RawMaterialName8 { get; set; } = "";
[Siemens(6)]
[Siemens(4)]
public string RawMaterialName9 { get; set; } = "";
[Siemens(6)]
[Siemens(4)]
public string RawMaterialName10 { get; set; } = "";
[Siemens(6)]
[Siemens(4)]
public string RawMaterialName11 { get; set; } = "";
[Siemens(6)]
[Siemens(4)]
public string RawMaterialName12 { get; set; } = "";
[Siemens(6)]
[Siemens(4)]
public string RawMaterialName13 { get; set; } = "";
[Siemens(6)]
[Siemens(4)]
public string RawMaterialName14 { get; set; } = "";
}
}

+ 16
- 0
BPASmartClient.JXJFoodBigStation/Model/HardWare/BomMaterial.cs View File

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

namespace BPASmartClient.JXJFoodBigStation.Model
{
public class BomMaterial
{
public ObservableCollection<RawMaterial> RawMaterials { get; set; } = new ObservableCollection<RawMaterial>();

}
}

+ 1487
- 621
BPASmartClient.JXJFoodBigStation/Model/ProcessControl.cs
File diff suppressed because it is too large
View File


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

@@ -10,10 +10,16 @@ namespace BPASmartClient.JXJFoodBigStation.Model
public class RawMaterial :ObservableObject
{
private int _mIp;
public int DeviceIp { get { return _mIp; } set { _mIp = value; }}
public int DeviceIp { get { return _mIp; } set { _mIp = value; OnPropertyChanged(); } }

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

/// <summary>
/// 原料中文名
/// </summary>
public string RawMaterialChineseName { get { return _mRawMaterialChineseName; } set { _mRawMaterialChineseName = value; OnPropertyChanged(); } }
private string _mRawMaterialChineseName;

/// <summary>
/// 原料名称
@@ -36,7 +42,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model
/// <summary>
/// 实际的下料中重量
/// </summary>
public float Laying_Off_Weight { get { return _mLaying_Off_Weight; } set { _mLaying_Off_Weight = value; } }
public float Laying_Off_Weight { get { return _mLaying_Off_Weight; } set { _mLaying_Off_Weight = value; OnPropertyChanged(); } }
private float _mLaying_Off_Weight;

/// <summary>


+ 16
- 0
BPASmartClient.JXJFoodBigStation/Model/RawMaterial/RawMaterialData.cs View File

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

namespace BPASmartClient.JXJFoodBigStation.Model
{
public class RawMaterialData
{
public ObservableCollection<RawMaterial> RawMaterial { get; set; } = new ObservableCollection<RawMaterial>();

}
}

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

@@ -28,9 +28,29 @@ 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>
public ObservableCollection<RawMaterial> RawMaterial { get; set; } = new ObservableCollection<RawMaterial>();

public RecipeSource RecipesSource { get { return _mRecipesSource; } set { _mRecipesSource = value; OnPropertyChanged(); } }
private RecipeSource _mRecipesSource = RecipeSource.远程;
}
public enum RecipeSource
{
本地,
远程
}
}

+ 25
- 0
BPASmartClient.JXJFoodBigStation/Model/RecipeDosing.cs View File

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

namespace BPASmartClient.JXJFoodBigStation.Model
{
public class RecipeDosing
{
public string RecipeCode { get; set; }
public int RecipeTray { get; set; }
public int DosingStatus { get; set; }


public bool IsAllowIssue { get; set; }
public bool IsAGVArrive { get; set; }
public bool IsReceviceFinish { get; set; }
public bool IsDosingFinish { get; set; }

public DateTime DosingStartTime { get; set; }

}
}

+ 8
- 0
BPASmartClient.JXJFoodBigStation/Model/Siemens/DL_Start_DB.cs View File

@@ -40,6 +40,10 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
/// </summary>
public bool Order_Request_Ack { get; set; }
/// <summary>
/// 订单取消
/// </summary>
public bool Order_Cancel { get; set; }
/// <summary>
/// 备用
/// </summary>
public short[] Standby { get; set; } = new short[4];
@@ -48,6 +52,10 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
/// </summary>
public bool Order_Request { get; set; }
/// <summary>
/// 订单取消回复
/// </summary>
public bool Order_Cancel_Ack { get; set; }
/// <summary>
/// 备用
/// </summary>
public short[] Standby1 { get; set; } = new short[4];


+ 19
- 6
BPASmartClient.JXJFoodBigStation/Model/Siemens/SiemensDeviceStatus.cs View File

@@ -7,6 +7,7 @@ using System.Text;
using System.Threading.Tasks;
using BPASmartClient.S7Net;
using System.Threading;
using BPASmartClient.CustomResource.Pages.Model;

namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
{
@@ -31,19 +32,28 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
{
if (GVL_BigStation.Order_Request && GVL_BigStation.SiemensSendRecipeStatus == 0)
{
GVL_BigStation.SiemensSendRecipeStatus = 1;
this.Siemens_PLC_S7.Write("DB2301.DBX330.0", true);
MessageNotify.GetInstance.ShowRunLog($"向西门子请求订单");
GVL_BigStation.SiemensSendRecipeStatus = 1;
}
if (RTrig.GetInstance("Order_Request_Ack").Start(start.Order_Request_Ack) && GVL_BigStation.SiemensSendRecipeStatus == 1)
{
GVL_BigStation.SiemensSendRecipeStatus = 2;
ActionManage.GetInstance.Send("SiemensSendRecipe", start);
this.Siemens_PLC_S7.Write("DB2301.DBX330.0", false);
MessageNotify.GetInstance.ShowRunLog($"西门子下发订单:{start.RecipeCode}");
GVL_BigStation.SiemensSendRecipeStatus = 2;
}
if (TTrig.GetInstance("Order_Request_Ack").Start(start.Order_Request_Ack) && GVL_BigStation.SiemensSendRecipeStatus == 2)
{
GVL_BigStation.SiemensSendRecipeStatus = 3;
GVL_BigStation.Order_Request = false;
MessageNotify.GetInstance.ShowRunLog($"西门子确认上位机接收到订单:{start.RecipeName}");
GVL_BigStation.SiemensSendRecipeStatus = 3;
}
if (RTrig.GetInstance("Order_Cancel").Start(start.Order_Cancel)) //订单取消
{
GVL_BigStation.Order_Cancel = true;
GVL_BigStation.Order_CancelRecipeCode = start.RecipeCode;
MessageNotify.GetInstance.ShowRunLog($"西门子下发取消工单指令:{start.RecipeName}");
}
}
if (res1 != null && res1 is DL_Status_DB status)
@@ -52,7 +62,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
}
if (res2 != null && res2 is DL_Finish_DB finish)
{
if (RTrig.GetInstance("Ask_For_Finish_PLC").Start(finish.Ask_For_Finish_PLC) && GVL_BigStation.SiemensSendRecipeStatus == 7)
if (finish.Ask_For_Finish_PLC &&(GVL_BigStation.Recipe1DosingFinish || GVL_BigStation.Recipe2DosingFinish || GVL_BigStation.Recipe3DosingFinish || GVL_BigStation.Recipe4DosingFinish))
{
finish.Order_No = "";
finish.Product_Code = "";
@@ -61,10 +71,13 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
{
finish.Material[i] = new UDT1();
}
GVL_BigStation.SiemensSendRecipeStatus = 0;
finish.Ask_For_Finish = false;
finish.ProcessTime = 0;
this.Siemens_PLC_S7.WriteClass<DL_Finish_DB>(finish, 2361);
if (GVL_BigStation.Recipe1DosingFinish) GVL_BigStation.Recipe1DosingFinish = false;
if (GVL_BigStation.Recipe2DosingFinish) GVL_BigStation.Recipe2DosingFinish = false;
if (GVL_BigStation.Recipe3DosingFinish) GVL_BigStation.Recipe3DosingFinish = false;
if (GVL_BigStation.Recipe4DosingFinish) GVL_BigStation.Recipe4DosingFinish = false;
}
}
Thread.Sleep(10);
@@ -75,7 +88,7 @@ namespace BPASmartClient.JXJFoodBigStation.Model.Siemens
}
}
Thread.Sleep(10);
}), "监听服务数据");
}), "西门子数据交互",true);
}
}
}

+ 122
- 0
BPASmartClient.JXJFoodBigStation/View/BomOfMaterialView.xaml View File

@@ -0,0 +1,122 @@
<UserControl x:Class="BPASmartClient.JXJFoodBigStation.View.BomOfMaterialView"
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.JXJFoodBigStation.ViewModel"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl.DataContext>
<vm:BomOfMaterialViewModel />
</UserControl.DataContext>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<!--#region 表格标题栏设置-->
<Grid>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
<pry:IcoButton
Margin="5"
Command="{Binding AddMaterial}"
Content="新增数据"
FontSize="28"
Foreground="Aqua"
Style="{StaticResource IcoButtonStyle}" />
<pry:IcoButton
Margin="5"
Command="{Binding SaveMaterials}"
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,1,1,1" 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="Visible" >
<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}" />
</Grid>
<Grid Grid.Column="1" Margin="5">
<TextBox
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding RawMaterialName}" />
</Grid>
<Grid Grid.Column="2">
<TextBox
Width="200"
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding RawMaterialChineseName}" />
</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 RawMaterialCount}"
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.JXJFoodBigStation/View/BomOfMaterialView.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.JXJFoodBigStation.View
{
/// <summary>
/// HKPlcCommMonitor.xaml 的交互逻辑
/// </summary>
public partial class BomOfMaterialView : UserControl
{
public BomOfMaterialView()
{
InitializeComponent();
}
}
}

+ 8
- 9
BPASmartClient.JXJFoodBigStation/View/HardwareStatusView.xaml View File

@@ -374,7 +374,7 @@
<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="6"
Columns="7"
Rows="1" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
@@ -386,7 +386,7 @@
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
<!--<RowDefinition />-->
<!--<RowDefinition Height="0.1*"/>-->
</Grid.RowDefinitions>
<!--<TextBox
@@ -465,7 +465,7 @@
Text=" 号仓" />
</StackPanel>

<Button Grid.Row="2"
<!--<Button Grid.Row="2"
Width="200"
Height="40"
Margin="5,0,5,0"
@@ -474,7 +474,7 @@
Content="修改原料名称"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
Style="{StaticResource ImageButtonStyle}"></Button>-->


<Image
@@ -536,7 +536,7 @@
Height="{Binding ElementName=gr, Path=ActualHeight}"
Margin="10,0,30,0"
ConveyorBeltWidth="70"
Direction="2"
Direction="0"
StrokeBrush="#00BEFA"
StrokeDashArray="1.5 1.5"
StrokeFillBrush="#00BEFA"
@@ -558,7 +558,7 @@
<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="6"
Columns="7"
Rows="1" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>
@@ -568,7 +568,6 @@
<Border Margin="5" Background="Transparent">
<Grid Height="220">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<!--<RowDefinition Height="0.1*"/>-->
@@ -637,7 +636,7 @@
Foreground="#FF0084FF"
Text=" 号仓" />
</StackPanel>
<Button Grid.Row="2"
<!--<Button Grid.Row="2"
Width="200"
Height="40"
Margin="5,0,5,0"
@@ -645,7 +644,7 @@
CommandParameter="{Binding DeviceName}"
Content="修改原料名称"
FontSize="20"
Style="{StaticResource ImageButtonStyle}"></Button>
Style="{StaticResource ImageButtonStyle}"></Button>-->
<Image
Grid.RowSpan="2"
Source="/BPASmartClient.CustomResource;component/Image/光柱.png"


+ 160
- 14
BPASmartClient.JXJFoodBigStation/View/ManualFlowView.xaml View File

@@ -13,6 +13,8 @@
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition Height="50" />
<RowDefinition Height="100" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
@@ -23,7 +25,8 @@
Width="200"
Height="40"
Margin="5,0,5,0"
Command="{Binding Tray1InPlace}"
Command="{Binding TrayInPlace}"
CommandParameter="1"
Content="AGV到达工位1"
FontSize="20"
Panel.ZIndex="0"
@@ -32,7 +35,8 @@
Width="200"
Height="40"
Margin="5,0,5,0"
Command="{Binding Tray2InPlace}"
Command="{Binding TrayInPlace}"
CommandParameter="2"
Content="AGV到达工位2"
FontSize="20"
Panel.ZIndex="0"
@@ -41,7 +45,8 @@
Width="200"
Height="40"
Margin="5,0,5,0"
Command="{Binding Tray3InPlace}"
Command="{Binding TrayInPlace}"
CommandParameter="3"
Content="AGV到达工位3"
FontSize="20"
Panel.ZIndex="0"
@@ -50,7 +55,8 @@
Width="200"
Height="40"
Margin="5,0,5,0"
Command="{Binding Tray4InPlace}"
Command="{Binding TrayInPlace}"
CommandParameter="4"
Content="AGV到达工位4"
FontSize="20"
Panel.ZIndex="0"
@@ -59,30 +65,170 @@
Width="200"
Height="40"
Margin="5,0,5,0"
Command="{Binding Tray5InPlace}"
Command="{Binding TrayInPlace}"
CommandParameter="5"
Content="AGV到达工位5"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
</StackPanel>
</Grid>
<Grid Grid.Row="1">
<StackPanel Orientation="Horizontal" HorizontalAlignment="left" VerticalAlignment="Center">
<Button
Width="200"
Height="40"
Margin="5,0,5,0"
Command="{Binding TrayLeave}"
CommandParameter="1"
Content="AGV离开工位1"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
<Button
Width="200"
Height="40"
Margin="5,0,5,0"
Command="{Binding TrayLeave}"
CommandParameter="2"
Content="AGV离开工位2"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
<Button
Width="200"
Height="40"
Margin="5,0,5,0"
Command="{Binding TrayLeave}"
CommandParameter="3"
Content="AGV离开工位3"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
<Button
Width="200"
Height="40"
Margin="5,0,5,0"
Command="{Binding TrayLeave}"
CommandParameter="4"
Content="AGV离开工位4"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
<Button
Width="200"
Height="40"
Margin="5,0,5,0"
Command="{Binding TrayLeave}"
CommandParameter="5"
Content="AGV离开工位5"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
</StackPanel>
</Grid>

<Grid Grid.Row="2">
<StackPanel Orientation="Horizontal" HorizontalAlignment="left" VerticalAlignment="Center">
<Button
Width="200"
Height="40"
Margin="5,0,5,0"
Command="{Binding ClearTrayInPlace}"
Content="清楚AGV到位信号"
Content="清除AGV到位信号"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
<Button
Width="200"
Height="40"
Margin="5,0,5,0"
Command="{Binding ClearAllRecipe}"
Content="清除西门子所有配方"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
</StackPanel>
</Grid>
<Grid Grid.Row="1">
<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.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<StackPanel>
<WrapPanel>
<TextBlock Text="plc心跳:" 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>
<TextBlock Text="订单号:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBox Width="300" Margin="5" Text="{Binding CancelRecipeCode}" FontSize="24" VerticalAlignment="Center"></TextBox>
<Button Style="{StaticResource ImageButtonStyle}" Width="120" Height="40" FontSize="20" Content="取消订单" Margin="5" Command="{Binding CancelRecipeCommand}"></Button>
</WrapPanel>
</StackPanel>
<StackPanel Grid.Column="3">
<WrapPanel>
<TextBlock Text="料仓名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding StockBinName}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Text="料仓1名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding StockBin1Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Text="料仓2名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding StockBin2Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Text="料仓3名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding StockBin3Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Text="料仓4名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding StockBin4Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Text="料仓5名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding StockBin5Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Text="料仓6名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding StockBin6Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Text="料仓7名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding StockBin7Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Text="料仓8名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding StockBin8Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Text="料仓9名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding StockBin9Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Text="料仓10名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding StockBin10Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Text="料仓11名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding StockBin11Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Text="料仓12名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding StockBin12Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Text="料仓13名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding StockBin13Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Text="料仓14名称:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding StockBin14Name}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="5"></TextBlock>
</WrapPanel>
</StackPanel>
</Grid>
</Grid>
</UserControl>

+ 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>


+ 110
- 18
BPASmartClient.JXJFoodBigStation/View/RecipeReceiveView.xaml View File

@@ -159,11 +159,23 @@
<CheckBox
x:Name="IsUseLocalRecipe"
Margin="0,0,10,0"
Content="本地配方"
Content="使用本地配方配料"
FontFamily="楷体"
VerticalAlignment="Center"
Foreground="Aqua"
IsChecked="{Binding IsUseLocalRecipe}" />

<!--<pry:IcoButton
Width="140"
Margin="10"
HorizontalAlignment="Left"
Command="{Binding RefreshRecipe}"
Content="刷新配方"
FontSize="16"
Foreground="Aqua"
IcoText="&#xe626;"
Style="{StaticResource IcoButtonStyle}" />-->
<pry:IcoButton
Width="140"
Margin="10"
@@ -226,36 +238,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 +391,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 +404,8 @@

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


+ 109
- 27
BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml View File

@@ -419,7 +419,6 @@

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

<Grid Name="ggr" Margin="10">
@@ -448,34 +447,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 +599,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 +613,8 @@

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

</Grid>

<Grid
<!--<Grid
Name="gr"
Grid.Column="1"
Margin="10">
@@ -841,11 +923,11 @@
</ItemsControl>

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

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

<TreeView
x:Name="repiceList"
@@ -862,6 +944,6 @@
</Grid>
</Border>
</ScrollViewer>
</Grid>
</Grid>-->
</Grid>
</UserControl>

+ 8
- 8
BPASmartClient.JXJFoodBigStation/View/RecipeSendDownView.xaml.cs View File

@@ -28,24 +28,24 @@ namespace BPASmartClient.JXJFoodBigStation.View

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


}

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

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

}
}


+ 3
- 3
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
@@ -529,7 +529,7 @@
VerticalAlignment="Top"
Background="Transparent"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
VerticalScrollBarVisibility="Visible">
<ItemsControl ItemsSource="{Binding RawMaterial}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>


+ 20
- 27
BPASmartClient.JXJFoodBigStation/View/StockBinRawMaterialView.xaml View File

@@ -13,17 +13,16 @@
<Grid Margin="10">
<Grid.RowDefinitions>
<!--<RowDefinition Height="60" />-->
<RowDefinition Height="60" />
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<!--#region 表格标题栏设置-->
<Grid>
<!--<Grid>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Center" Orientation="Horizontal">
<pry:IcoButton
Margin="10"
Command="{Binding UpdateRawMaterial}"
IcoText="&#xe68e;"
Content="新增数据"
FontSize="28"
Foreground="Aqua"
@@ -37,12 +36,11 @@
Style="{StaticResource IcoButtonStyle}" />
</StackPanel>
</Grid>
</Grid>-->
<Grid
Grid.Row="1"
Grid.Row="0"
Margin="0,10,0,0"
Background="#ff0C255F">

<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
@@ -51,19 +49,18 @@
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBlock Text="序号" FontSize="24" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"/>
<Border BorderThickness="1,0,1,0" Cursor="SizeWE" />
<Border BorderThickness="1,1,1,1" 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" />
<TextBlock Grid.Column="3" FontSize="24" Text="原料名称" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" />
</Grid>
<Grid Grid.Row="2">
<Grid Grid.Row="1">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" >
<ItemsControl ItemsSource="{Binding RawMaterialInfo}" Foreground="Aqua">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="gr" >
<Grid Name="gr" Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
@@ -84,6 +81,7 @@
<Grid Grid.Column="1" Margin="5">
<TextBlock
FontSize="16"
TextAlignment="Center"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding RawMaterialLocation}" />
@@ -103,34 +101,29 @@
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="3">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<pry:IcoButton
Margin="3,4,4,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Background="#112AB2E7"
BorderThickness="0"
Command="{Binding DataContext.DetailsCommand, RelativeSource={RelativeSource AncestorType=ListBox, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialLocation}"
Content="编辑"
EnterBackground="#222AB2E7"
Foreground="#FF2AB2E7"
IcoText="&#xe636;"
Style="{StaticResource IcoButtonStyle}" />
<TextBlock
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding RawMaterialChineseName}" />
<Border
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
<!--<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=ListBox, Mode=FindAncestor}}"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RawMaterialLocation}"
Content="删除"
EnterBackground="#22F53F62"
Foreground="#FFF53F62"
IcoText="&#xe68e;"
Style="{StaticResource IcoButtonStyle}" />
</StackPanel>
</StackPanel>-->
</Grid>
</Grid>


+ 75
- 0
BPASmartClient.JXJFoodBigStation/ViewModel/BomOfMaterialViewModel.cs View File

@@ -0,0 +1,75 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.Helper;
using BPASmartClient.JXJFoodBigStation.Model;
using BPASmartClient.JXJFoodBigStation.Model.HK_PLC;
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.JXJFoodBigStation.ViewModel
{
public class BomOfMaterialViewModel : ObservableObject
{
public BomOfMaterialViewModel()
{
RawMaterialInfo = Json<BomMaterial>.Data.RawMaterials;
/*if (RawMaterialInfo.Count ==0)
{
Json<BomMaterial>.Data.RawMaterials.Clear();
ProcessControl.GetInstance.RawMaterialNameWithCode();//原料的名称和编码对应 :西门子mes定义的物料编码
foreach (var item in GVL_BigStation.RawMaterialsNameCode)
{
Json<BomMaterial>.Data.RawMaterials.Add(new RawMaterial() { RawMaterialCount = Json<BomMaterial>.Data.RawMaterials.Count + 1, RawMaterialName = item.Key, RawMaterialChineseName = item.Value });
}
RawMaterialInfo = Json<BomMaterial>.Data.RawMaterials;
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"读取程序的Bom清单");
}*/
AddMaterial = new RelayCommand(() =>
{
RawMaterialInfo.Add(new RawMaterial()
{
RawMaterialCount = Json<BomMaterial>.Data.RawMaterials.Count +1 ,
});
});
SaveMaterials = new RelayCommand(() =>
{
if (MessageNotify.GetInstance.ShowDialog("请确认是否保存!") == true)
{
Json<BomMaterial>.Save();
MessageNotify.GetInstance.ShowUserLog($"Mes物料清单保存成功");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"原料与料仓对应关系保存成功");
}
});
RemoveCommand = new RelayCommand<int>((Count) =>
{
if (Count is int cnt)
{
var res = RawMaterialInfo.FirstOrDefault(p => p.RawMaterialCount == cnt);
if (res != null)
{
if (MessageNotify.GetInstance.ShowDialog("请确认是否删除!") == true)
{
RawMaterialInfo.Remove(res);
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"删除成功");
}
}
}
});
}
public ObservableCollection<RawMaterial> RawMaterialInfo { get; set; } = new ObservableCollection<RawMaterial>();
public RelayCommand AddMaterial { get; set; }
public RelayCommand SaveMaterials { get; set; }
public RelayCommand<int> RemoveCommand { get; set; }

}
}

+ 2
- 2
BPASmartClient.JXJFoodBigStation/ViewModel/HKPlcCommMonitorViewModel.cs View File

@@ -110,7 +110,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
int index = Array.FindIndex(PlcInfo.ToArray(), p => p.Address == address);
if (index != -1)
{
if(ProcessControl.GetInstance.HKDevice.IsConnected) ProcessControl.GetInstance.HKDevice.HK_PLC_S7.Write(address , PlcInfo.ElementAt(index).SetValue);
if (ProcessControl.GetInstance.HKDevice.IsConnected) ProcessControl.GetInstance.HKDevice.HK_PLC_S7.Write(address, PlcInfo.ElementAt(index).SetValue);
}
}*/
});
@@ -121,7 +121,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
Type type = typeof(T);

}*/
public ObservableCollection<PlcVarMonitor> PlcInfo { get; set; } = new ObservableCollection<PlcVarMonitor>();
public static ObservableCollection<PlcVarMonitor> PlcInfo { get; set; } = new ObservableCollection<PlcVarMonitor>();

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


+ 19
- 89
BPASmartClient.JXJFoodBigStation/ViewModel/HardwareStatusViewModel.cs View File

@@ -12,6 +12,8 @@ using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.JXJFoodBigStation.Model;
using BPASmartClient.JXJFoodBigStation.View;
using System.Windows.Forms;
using BPASmartClient.JXJFoodBigStation.Model.HK_PLC;
using System.Reflection;

namespace BPASmartClient.JXJFoodBigStation.ViewModel
{
@@ -19,102 +21,30 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
{
public HardwareStatusViewModel()
{

for (int i = 6; i > 0; i--)
{
TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus()
{
DeviceName = i.ToString(),
DeviceNum = i,
RunStatus = true,
Weight = new Random().Next(0, 100)
});
}
for (int i = 7; i < 13; i++)
foreach (PropertyInfo mi in typeof(StockBinName).GetProperties())
{
BottomDeviceCurrentStatuses.Add(new DeviceCurrentStatus()
object ab = GVL_BigStation.stockBinName.GetType().GetProperty(mi.Name).GetValue(GVL_BigStation.stockBinName, null);
if (mi.Name=="RawMaterialName1" || mi.Name == "RawMaterialName2" || mi.Name == "RawMaterialName3" || mi.Name == "RawMaterialName4" || mi.Name == "RawMaterialName5" || mi.Name == "RawMaterialName6" || mi.Name == "RawMaterialName7")
{
DeviceName = i.ToString(),
DeviceNum = i,
RunStatus = false,
Weight = new Random().Next(0, 100)
});
}
StartCommand = new RelayCommand<string>((deviceName) =>
{
if (deviceName != null)
{
var top = TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName);
if (top != null)
{
ActionManage.GetInstance.Send("StartTopDevice", deviceName);
}
var bottom = BottomDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName);
if (bottom != null)
TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus()
{
ActionManage.GetInstance.Send("StartBottomDevice", deviceName);
}
DeviceName = ab.ToString(),
DeviceNum = TopDeviceCurrentStatuses.Count + 1,
RunStatus = true,
Weight = new Random().Next(0, 100)
});
}
});
StopCommand = new RelayCommand<string>((deviceName) =>
{
if (deviceName != null)
else
{
var top = TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName);
if (top != null)
{
ActionManage.GetInstance.Send("StopTopDevice", deviceName);
}
var bottom = BottomDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName);
if (bottom != null)
BottomDeviceCurrentStatuses.Add(new DeviceCurrentStatus()
{
ActionManage.GetInstance.Send("StopBottomDevice", deviceName);
}
DeviceName = ab.ToString(),
DeviceNum = BottomDeviceCurrentStatuses.Count + 8,
RunStatus = false,
Weight = new Random().Next(0, 100)
});
}
});

UpdateRawMaterName = new RelayCommand<string>((deviceName) =>
{
ActionManage.GetInstance.CancelRegister("UpdateDeviceName");
ActionManage.GetInstance.Register(new Action<object>((res) =>
{
if (res != null && res is string newName)
{
int cnt = Array.FindIndex(TopDeviceCurrentStatuses.ToArray(), p => p.DeviceName == deviceName);
if (cnt >= 0)
{

int index = Array.FindIndex(BottomDeviceCurrentStatuses.ToArray(), p => p.DeviceName == newName);
int index1 = Array.FindIndex(TopDeviceCurrentStatuses.ToArray(), p => p.DeviceName == newName);
if (index == -1 && index1 == -1)
{
var obj = TopDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName);
obj.DeviceName = newName;
}
else
{
System.Windows.Forms.MessageBox.Show("设备名称与其他名称冲突", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
else
{
int index = Array.FindIndex(TopDeviceCurrentStatuses.ToArray(), p => p.DeviceName == newName);
int index1 = Array.FindIndex(BottomDeviceCurrentStatuses.ToArray(), p => p.DeviceName == newName);
if (index == -1 && index1 == -1)
{
var obj = BottomDeviceCurrentStatuses.FirstOrDefault(p => p.DeviceName == deviceName);
obj.DeviceName = newName;
}
else
{
System.Windows.Forms.MessageBox.Show("设备名称与其他名称冲突", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}), "UpdateDeviceName");
ChangeDeviceNameView view = new ChangeDeviceNameView();
view.ShowDialog();
});
}
}
public ObservableCollection<DeviceCurrentStatus> TopDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>();
public ObservableCollection<DeviceCurrentStatus> BottomDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>();


+ 87
- 21
BPASmartClient.JXJFoodBigStation/ViewModel/ManualFlowViewModel.cs View File

@@ -1,6 +1,7 @@
using BPASmartClient.Helper;
using BPASmartClient.JXJFoodBigStation.Model;
using BPASmartClient.JXJFoodBigStation.Model.HK_PLC;
using BPASmartClient.JXJFoodBigStation.Model.Siemens;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
@@ -9,6 +10,7 @@ using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -19,43 +21,107 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
{
public ManualFlowViewModel()
{
Tray1InPlace = new RelayCommand(() =>
TrayInPlace = new RelayCommand<object>((o) =>
{
GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(1, true);
if (o != null)
{
byte loc = Convert.ToByte(o);
GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(loc, true);
}
});
Tray2InPlace = new RelayCommand(() =>
TrayLeave = new RelayCommand<object>((o) =>
{
GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(2, true);
if (o!=null)
{
byte loc = Convert.ToByte(o);
GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(loc, false);
}
});
Tray3InPlace = new RelayCommand(() =>
{
GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(3, true);
});
Tray4InPlace = new RelayCommand(() =>
ClearTrayInPlace = new RelayCommand(() =>
{
GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(4, true);
GVL_BigStation.AGVPutTray = 0;
});
Tray5InPlace = new RelayCommand(() =>
ClearAllRecipe = new RelayCommand(() =>
{
GVL_BigStation.AGVPutTray = GVL_BigStation.AGVPutTray.SetBitValue(5, true);
Json<RemoteRecipe>.Data.Recipes.Clear();
GVL_BigStation.SiemensSendRecipeStatus = 0;
});
ClearTrayInPlace = new RelayCommand(() =>
CancelRecipeCommand = new RelayCommand(() =>
{
GVL_BigStation.AGVPutTray = 0;
if (Json<RemoteRecipe>.Data.Recipes != null)
{
int index = Array.FindIndex(Json<RemoteRecipe>.Data.Recipes.ToArray(), p => p.RecipeCode == CancelRecipeCode);
if (index >= 0)
{
GVL_BigStation.Order_Cancel = true;
GVL_BigStation.Order_CancelRecipeCode = CancelRecipeCode;
}
}
});
ThreadManage.GetInstance().StartLong(new Action(() =>
{
Heartbeat = GVL_BigStation.HeartBeatFromPlc;
Thread.Sleep(100);
StockBin1Name = GVL_BigStation.stockBinName.RawMaterialName1;
StockBin2Name = GVL_BigStation.stockBinName.RawMaterialName2;
StockBin3Name = GVL_BigStation.stockBinName.RawMaterialName3;
StockBin4Name = GVL_BigStation.stockBinName.RawMaterialName4;
StockBin5Name = GVL_BigStation.stockBinName.RawMaterialName5;
StockBin6Name = GVL_BigStation.stockBinName.RawMaterialName6;
StockBin7Name = GVL_BigStation.stockBinName.RawMaterialName7;
StockBin8Name = GVL_BigStation.stockBinName.RawMaterialName8;
StockBin9Name = GVL_BigStation.stockBinName.RawMaterialName9;
StockBin10Name = GVL_BigStation.stockBinName.RawMaterialName10;
StockBin11Name = GVL_BigStation.stockBinName.RawMaterialName11;
StockBin12Name = GVL_BigStation.stockBinName.RawMaterialName12;
StockBin13Name = GVL_BigStation.stockBinName.RawMaterialName13;
StockBin14Name = GVL_BigStation.stockBinName.RawMaterialName14;
}), "设备状态读取",true);
}
public RelayCommand Tray1InPlace { get; set; }
public RelayCommand Tray2InPlace { get; set; }
public RelayCommand Tray3InPlace { get; set; }
public RelayCommand Tray4InPlace { get; set; }
public RelayCommand Tray5InPlace { get; set; }
public RelayCommand<object> TrayInPlace { get; set; }
public RelayCommand<object> TrayLeave { get; set; }
public RelayCommand ClearTrayInPlace { get; set; }
public bool Heartbeat { get { return _mHeartbeat; } set { _mHeartbeat = value; OnPropertyChanged(); } }
private bool _mHeartbeat;
public RelayCommand ClearAllRecipe { get; set; }
public static bool Heartbeat { get { return _mHeartbeat; } set { _mHeartbeat = value; OnStaticPropertyChanged(); } }
private static bool _mHeartbeat;

public string CancelRecipeCode { get { return _CancelRecipeCode; } set { _CancelRecipeCode = value; OnPropertyChanged(); } }
public string _CancelRecipeCode { get; set; }

public static string StockBin1Name { get { return _StockBin1Name; } set { _StockBin1Name = value; OnStaticPropertyChanged(); } }
private static string _StockBin1Name { get; set; }
public static string StockBin2Name { get { return _StockBin2Name; } set { _StockBin2Name = value; OnStaticPropertyChanged(); } }
private static string _StockBin2Name { get; set; }
public static string StockBin3Name { get { return _StockBin3Name; } set { _StockBin3Name = value; OnStaticPropertyChanged(); } }
private static string _StockBin3Name { get; set; }
public static string StockBin4Name { get { return _StockBin4Name; } set { _StockBin4Name = value; OnStaticPropertyChanged(); } }
private static string _StockBin4Name { get; set; }
public static string StockBin5Name { get { return _StockBin5Name; } set { _StockBin5Name = value; OnStaticPropertyChanged(); } }
private static string _StockBin5Name { get; set; }
public static string StockBin6Name { get { return _StockBin6Name; } set { _StockBin6Name = value; OnStaticPropertyChanged(); } }
private static string _StockBin6Name { get; set; }
public static string StockBin7Name { get { return _StockBin7Name; } set { _StockBin7Name = value; OnStaticPropertyChanged(); } }
private static string _StockBin7Name { get; set; }
public static string StockBin8Name { get { return _StockBin8Name; } set { _StockBin8Name = value; OnStaticPropertyChanged(); } }
private static string _StockBin8Name { get; set; }
public static string StockBin9Name { get { return _StockBin9Name; } set { _StockBin9Name = value; OnStaticPropertyChanged(); } }
private static string _StockBin9Name { get; set; }
public static string StockBin10Name { get { return _StockBin10Name; } set { _StockBin10Name = value; OnStaticPropertyChanged(); } }
private static string _StockBin10Name { get; set; }
public static string StockBin11Name { get { return _StockBin11Name; } set { _StockBin11Name = value; OnStaticPropertyChanged(); } }
private static string _StockBin11Name { get; set; }
public static string StockBin12Name { get { return _StockBin12Name; } set { _StockBin12Name = value; OnStaticPropertyChanged(); } }
private static string _StockBin12Name { get; set; }
public static string StockBin13Name { get { return _StockBin13Name; } set { _StockBin13Name = value; OnStaticPropertyChanged(); } }
private static string _StockBin13Name { get; set; }
public static string StockBin14Name { get { return _StockBin14Name; } set { _StockBin14Name = value; OnStaticPropertyChanged(); } }
private static string _StockBin14Name { get; set; }
public RelayCommand CancelRecipeCommand { get; set; }

public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged;
public static void OnStaticPropertyChanged([CallerMemberName] string PropName = "")
{
StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(PropName));
}
}
}

+ 25
- 12
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,10 +31,10 @@ 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);
item.RawMaterialCount = Array.FindIndex(ProcessControl.GetInstance.RawMaterialsInfo.ToArray(), p => p.RawMaterialName == item.RawMaterialName);
RawMaterialsInfo.Add(item);
}
}
@@ -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, OrderType="洗桶" });
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, OrderType = "配料" });
}
Json<LocalRecipe>.Save();
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"配方保存完成");
}
else
{
@@ -88,16 +100,17 @@ 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) => {
RemoveRecipe = new RelayCommand<int>((index) => {
var res = RawMaterialsInfo.FirstOrDefault(p => p.RawMaterialCount == index);
if (res != null)
RawMaterialsInfo.Remove(res);
@@ -114,17 +127,17 @@ 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 RelayCommand<int> RemoveRecipe { get; set; }

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



+ 24
- 0
BPASmartClient.JXJFoodBigStation/ViewModel/RecipeReceiveViewModel.cs View File

@@ -46,6 +46,27 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
RecipeInfosView nrv = new RecipeInfosView();
nrv.ShowDialog();
});

//RefreshRecipe = new RelayCommand(() =>
//{
// foreach (var item in ProcessControl.GetInstance.RawMaterialsInfo)
// {
// RawMaterialNames.Add(item.RawMaterialName);
// }

// foreach (var item in Json<LocalRecipe>.Data.Recipes)
// {
// foreach (var tep in item.RawMaterial)
// {
// if (RawMaterialNames.Contains(tep.RawMaterialName))
// {
// int index = Array.FindIndex(ProcessControl.GetInstance.RawMaterialsInfo.ToArray(), p => p.RawMaterialName == tep.RawMaterialName);
// tep.RawMaterialLocation = ProcessControl.GetInstance.RawMaterialsInfo.ElementAt(index).RawMaterialLocation;
// }
// }
// }
//});

//模拟配方
//NewSimulateRecipe = new RelayCommand(() =>
//{
@@ -104,9 +125,12 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
// public RelayCommand NewSimulateRecipe { get; set; }
public RelayCommand ClearAllRecipe { get; set; }
public RelayCommand NewRecipe { get; set; }
public RelayCommand RefreshRecipe { get; set; }
public bool IsUseLocalRecipe { get { return _isUseLocalRecipe; } set { _isUseLocalRecipe = value; OnPropertyChanged(); } }
public bool _isUseLocalRecipe { get; set; }
public RelayCommand<string> RemoveCommand { get; set; }
public ObservableCollection<RecipeData> Recipes { get; set; } = new ObservableCollection<RecipeData>();

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

+ 5
- 3
BPASmartClient.JXJFoodBigStation/ViewModel/RecipeSendDownViewModel.cs View File

@@ -3,6 +3,7 @@ using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.Helper;
using BPASmartClient.JXJFoodBigStation.Model;
using BPASmartClient.JXJFoodBigStation.Model.Siemens;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using System;
@@ -44,10 +45,11 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
var res = Recipes.FirstOrDefault(p => p.RecipeName == recipeName);
if (res != null)
{
if (!ProcessControl.GetInstance.LocalRecipes.Contains(res))
if (!Json<RemoteRecipe>.Data.Recipes.Contains(res))
{
ProcessControl.GetInstance.LocalRecipes.Add(res);
MessageNotify.GetInstance.ShowAlarmLog($"手动下发配方:{recipeName}完成");
res.RecipesSource = RecipeSource.本地;
Json<RemoteRecipe>.Data.Recipes.Add(res);
MessageNotify.GetInstance.ShowRunLog($"手动下发配方:{recipeName}完成");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"配方下发完成");
}
}


+ 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()
{
}
}
}

+ 5
- 19
BPASmartClient.JXJFoodBigStation/ViewModel/StockBinRawMaterialViewModel.cs View File

@@ -1,4 +1,7 @@
using BPASmartClient.Helper;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.Helper;
using BPASmartClient.JXJFoodBigStation.Model;
using BPASmartClient.JXJFoodBigStation.Model.HK_PLC;
using Microsoft.Toolkit.Mvvm.ComponentModel;
@@ -19,24 +22,7 @@ namespace BPASmartClient.JXJFoodBigStation.ViewModel
{
public StockBinRawMaterialViewModel()
{
RawMaterialInfo = ProcessControl.GetInstance.RawMaterialsInfo;
int serialNum = 0;
foreach (var rawMaterialInfo in RawMaterialInfo)
{
serialNum = serialNum + 1;
rawMaterialInfo.RawMaterialCount = (short)serialNum;
}
RemoveCommand = new RelayCommand<int>((loc) =>
{
var res = RawMaterialInfo.FirstOrDefault(p => p.RawMaterialLocation == loc);
if(res!= null) RawMaterialInfo.Remove(res);
});
}
public ObservableCollection<RawMaterial> RawMaterialInfo { get; set; } = new ObservableCollection<RawMaterial>();

public RelayCommand<int> DetailsCommand { get; set; }
public RelayCommand<int> RemoveCommand { get; set; }
public RelayCommand SaveRawMaterialPara { get; set; }
public RelayCommand UpdateMaterial { get; set; }
public ObservableCollection<RawMaterial> RawMaterialInfo => ProcessControl.GetInstance.HardWareRawMaterialInfo;
}
}

+ 62
- 19
BPASmartClient.JXJFoodSmallStation/App.xaml.cs View File

@@ -37,11 +37,11 @@ namespace BPASmartClient.JXJFoodSmallStation
}
BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut();
base.OnStartup(e);
MenuInit();
DataInit();
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化
Init();
MainView mv = new MainView();
ProcessControl.GetInstance.Init();
LoginView lv = new LoginView();
var res = lv.ShowDialog();
if (res != null && res == true)
@@ -53,6 +53,14 @@ namespace BPASmartClient.JXJFoodSmallStation
mv.Close();
MainWindow = mv;
}
private async void Init()
{
await Task.Run(new Action(() =>
{
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化
ProcessControl.GetInstance.Init();
}));
}

protected override void OnExit(ExitEventArgs e)
{
@@ -70,21 +78,21 @@ namespace BPASmartClient.JXJFoodSmallStation

#region 配方管理菜单
ObservableCollection<SubMenumodel> RecipeManage = new ObservableCollection<SubMenumodel>();
RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "味魔方配方管理",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.RecipeSettingsView"
});
//RecipeManage.Add(new SubMenumodel()
//{
// SubMenuName = "味魔方配方管理",
// SubMenuPermission = new Permission[] { Permission.管理员 },
// AssemblyName = "BPASmartClient.JXJFoodSmallStation",
// ToggleWindowPath = "View.RecipeSettingsView"
//});

RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "味魔方配方下发",
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员 },
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.RecipeControlView"
});
//RecipeManage.Add(new SubMenumodel()
//{
// SubMenuName = "味魔方配方下发",
// SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员 },
// AssemblyName = "BPASmartClient.JXJFoodSmallStation",
// ToggleWindowPath = "View.RecipeControlView"
//});
RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "本地配方管理",
@@ -112,7 +120,7 @@ namespace BPASmartClient.JXJFoodSmallStation
ObservableCollection<SubMenumodel> ParSet = new ObservableCollection<SubMenumodel>();
ParSet.Add(new SubMenumodel()
{
SubMenuName = "柔性味魔方参数设置",
SubMenuName = "味魔方参数设置",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.DeviceMaterialParView"
@@ -131,6 +139,20 @@ namespace BPASmartClient.JXJFoodSmallStation
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.SystemParView"
});
ParSet.Add(new SubMenumodel()
{
SubMenuName = "原料与料仓管理",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.StockBinRawMaterialView"
});
ParSet.Add(new SubMenumodel()
{
SubMenuName = "西门子物料管理",
SubMenuPermission = new Permission[] { Permission.管理员 },
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.BomOfMaterialView"
});
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
@@ -165,8 +187,16 @@ namespace BPASmartClient.JXJFoodSmallStation
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.ManualFlowView"

});
ManualControl.Add(new SubMenumodel()
{
SubMenuName = "机器人设备控制",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.RobotView"

});
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe622;",
@@ -228,7 +258,20 @@ namespace BPASmartClient.JXJFoodSmallStation
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.DeviceListView"
});

DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "Plc变量监控",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.PlcVarMonitorView"
});
DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "流程变量监控",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.JXJFoodSmallStation",
ToggleWindowPath = "View.ProcessMonitorView"
});
DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "设备状态",


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

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

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.84" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
@@ -26,12 +26,25 @@
</ItemGroup>

<ItemGroup>
<Compile Update="View\BomOfMaterialView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="View\RobotView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="View\ManualFlowView.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="View\StockBinRawMaterialView.xaml.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>

<ItemGroup>
<Page Update="View\BomOfMaterialView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\ChangeDeviceNameView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
</Page>
@@ -42,6 +55,10 @@
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\RobotView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
</Page>
<Page Update="View\ManualFlowView.xaml">
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
<SubType>Designer</SubType>
@@ -50,6 +67,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>


+ 21
- 0
BPASmartClient.JXJFoodSmallStation/Model/Bom/BomMaterial.cs View File

@@ -0,0 +1,21 @@
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.Bom
{
public class BomMaterial:ObservableObject
{
public int Count { get { return _count; } set { _count = value; OnPropertyChanged(); } }
public int _count { get; set; }
public string MaterialCode { get { return _materialCode; }set { _materialCode = value;OnPropertyChanged(); } }
private string _materialCode="";

public string MaterialName { get { return _materialName; } set { _materialName = value; OnPropertyChanged(); } }
private string _materialName="";
}
}

+ 16
- 0
BPASmartClient.JXJFoodSmallStation/Model/Bom/BomMaterialData.cs View File

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

namespace BPASmartClient.JXJFoodSmallStation.Model.Bom
{
public class BomMaterialData
{
public ObservableCollection<BomMaterial> Materials { get; set; } = new ObservableCollection<BomMaterial>();

}
}

+ 27
- 0
BPASmartClient.JXJFoodSmallStation/Model/GVL/PlcInfos.cs View File

@@ -0,0 +1,27 @@
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.GVL
{
public class PlcInfos: ObservableObject
{
public int Count { get { return _Count; } set { _Count = value;OnPropertyChanged(); } }
private int _Count { get; set; }

public string Name { get { return _Name; } set { _Name = value; OnPropertyChanged(); } }
private string _Name { get; set; }
public string Address { get { return _Address; } set { _Address = value; OnPropertyChanged(); } }
private string _Address { get; set; }
public string Type { get { return _Type; } set { _Type = value; OnPropertyChanged(); } }
private string _Type { get; set; }
public string Describe { get { return _Describe; } set { _Describe = value; OnPropertyChanged(); } }
private string _Describe { get; set; }
public string Value { get { return _Value; } set { _Value = value; OnPropertyChanged(); } }
private string _Value { get; set; }

}
}

+ 20
- 0
BPASmartClient.JXJFoodSmallStation/Model/GVL/VarCommAttribute.cs View File

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

namespace BPASmartClient.JXJFoodSmallStation.Model.GVL
{
[AttributeUsage(AttributeTargets.Property)]
public sealed class VarCommAttribute:Attribute
{
public VarCommAttribute(string address,string des)
{
Address = address;
Describe = des;
}
public string Describe { get; set; }
public string Address { get; set; }
}
}

+ 203
- 54
BPASmartClient.JXJFoodSmallStation/Model/GVL_SmallStation.cs View File

@@ -1,4 +1,6 @@
using BPASmartClient.JXJFoodSmallStation.Model.Siemens;
using BPASmartClient.JXJFoodSmallStation.Model.GVL;
using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC;
using BPASmartClient.JXJFoodSmallStation.Model.Siemens;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -14,131 +16,278 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
private volatile static GVL_SmallStation SmallStation;
public static GVL_SmallStation GetInstance => SmallStation ?? (SmallStation = new GVL_SmallStation());
private GVL_SmallStation() { }

public PlcReadAddressDB3 plcReadDataDB3 { get; set; } = new PlcReadAddressDB3();
/// <summary>
/// 配料站料仓数目
/// </summary>
public const int Max_DosingSotckBinNum = 15;
/// <summary>
/// 风送料仓数目
/// </summary>
public const int Max_PowderSotckBinNum = 5;

[VarComm("Global", "订单取消")]
/// <summary>
/// 订单取消
/// </summary>
public bool Order_Cancel { get; set; }

[VarComm("Global", "订单取消的配方编号")]
/// <summary>
/// 订单取消的配方编号
/// </summary>
public string Order_CancelRecipeCode { get; set; } = "";


[VarComm("Global", "柔性配料料仓配料情况")]
/// <summary>
/// 料仓配料情况
/// </summary>
public ushort StockBinDosing { get; set; } = 0;

[VarComm("Global", "托盘1托盘到位情况0:未到位,1=AGV到位,2=托盘有货架,3=AGV取托盘完成")]
/// <summary>
/// 托盘1托盘到位情况
/// </summary>
public int Tray1LogicFinish { get; set; } = 0;

[VarComm("Global", "托盘2托盘到位情况0:未到位,1=AGV到位,2=托盘有货架,3=AGV取托盘完成")]
/// <summary>
/// 托盘1托盘到位 逻辑完成
/// 托盘2托盘到位 逻辑完成
/// </summary>
public static bool TrayLogicFinish { get; set; } = false;
public int Tray2LogicFinish { get; set; } = 0;

[VarComm("Global", "托盘1有货架")]
/// <summary>
/// 托盘1有货架
/// </summary>
public static bool Station1HaveTray { get; set; }
public bool Station1HaveTray { get; set; }


[VarComm("Global", "托盘2有货架")]
/// <summary>
/// 托盘2有货架
/// </summary>
public static bool Station2HaveTray { get; set; }
public bool Station2HaveTray { get; set; }


[VarComm("Global", "托盘1传感器信号")]
/// <summary>
/// 托盘1传感器信号
/// </summary>
public bool Station1Sensor { get; set; }

public static bool Station1Sensor { get; set; }
[VarComm("Global", "托盘2传感器信号")]
/// <summary>
/// 托盘2传感器信号
/// </summary>
public static bool Station2Sensor { get; set; }
public static bool Station1Cylinder { get; set; }
public bool Station2Sensor { get; set; }


[VarComm("Global", "托盘1气缸信号")]
/// <summary>
/// 托盘1气缸信号
/// </summary>
public bool Station1Cylinder { get; set; }

[VarComm("Global", "托盘2气缸信号")]
/// <summary>
/// 托盘2气缸信号
/// </summary>
public static bool Station2Cylinder { get; set; }
public bool Station2Cylinder { get; set; }

public static bool AGV_PutTray1Finish { get; set; }
public static bool AGV_GetTray1Finish { get; set; }
public static bool CylinderReset { get; set; }
[VarComm("Global", "AGV放托盘1完成")]
/// <summary>
/// 配料站料仓数目
/// AGV放托盘1完成
/// </summary>
public const int Max_DosingSotckBinNum = 15;
public bool AGV_PutTray1Finish { get; set; }

[VarComm("Global", "AGV取托盘1完成")]
/// <summary>
/// 风送料仓数目
/// AGV取托盘1完成
/// </summary>
public const int Max_PowderSotckBinNum = 5;
public bool HeartBeatToPlc { get; set; } = false;
public bool HeartBeatFromPlc { get; set; } = false;
public bool AGV_GetTray1Finish { get; set; }
[VarComm("Global", "AGV放托盘2完成")]
/// <summary>
/// 是否允许西门子下发配方
/// AGV放托盘1完成
/// </summary>
public static bool IsAllowSiemensSendRecipe { get; set; } = false;
public bool AGV_PutTray2Finish { get; set; }

[VarComm("Global", "AGV取托盘2完成")]
/// <summary>
/// 西门子下发配方状态 0:等待下发配方 1:请求下发配方 2:上位机接收配方 3:配方接收完成 4:请求配料 5:西门子开始配料确认 6:配方配料完成 7:配料完成确认
/// AGV取托盘2完成
/// </summary>
public static int SiemensSendRecipeStatus { get; set; } = 0;
public bool AGV_GetTray2Finish { get; set; }

[VarComm("Global", "托盘1气缸复位")]
/// <summary>
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方
/// 托盘1气缸复位
/// </summary>
public int RecipeStatusID { get; set; } = 0;
public bool CylinderReset { get; set; }

[VarComm("Global", "发送给plc的心跳")]
/// <summary>
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方
/// 发送给plc的心跳
/// </summary>
public int RecipeStatusIDTray2 { get; set; } = 0;
public bool HeartBeatToPlc { get; set; } = false;

[VarComm("Global", "来自plc的心跳")]
/// <summary>
/// Tray1的柔性味魔方配料标志(下发配方时,若柔性味魔方的状态=3,复位该状态)
/// 来自plc的心跳
/// </summary>
public bool DosingTray1 { get; set; } = false;//默认为true,初始时,判断柔性味魔方的状态。
public bool HeartBeatFromPlc { get; set; } = false;

[VarComm("Global", "是否允许西门子下发配方")]
/// <summary>
/// Tray2的柔性味魔方配料标志
/// 是否允许西门子下发配方
/// </summary>
public bool DosingTray2 { get; set; } = false;
public bool IsAllowSiemensSendRecipe { get; set; } = false;

public int DosingTray1Loc { get; set; } = 0;
public int DosingTray2Loc { get; set; } = 0;
[VarComm("Global", "西门子下发配方状态0=等待下发配方 1=请求下发配方 2=接收配方 3=配方接收配方完成 4=请求配料 5=西门子确认开始配料 6=西门子确认开始配料信号复位")]
/// <summary>
/// 当前料仓的位置
/// 西门子下发配方状态 0:等待下发配方 1:请求下发配方 2:上位机接收配方 3:配方接收配方完成 4:上位机向西门子请求配料 5:西门子确认开始配料 6:西门子确认开始配料 信号复位
/// </summary>
public int StockInIsWork { get; set; } = 0;
public int SiemensSendRecipeStatus { get; set; } = 0;
[VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
/// <summary>
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料
/// </summary>
public int RecipeStatusIDTray1 { get; set; } = 0;

[VarComm("Global", "配方1下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
/// <summary>
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料
/// </summary>
public int[] RecipeProcessStatus { get; set; } = new int[5] { 0, 0, 0, 0, 0 };


[VarComm("Global", "配方2下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料")]
/// <summary>
/// 记录AGV进站送货的指令顺序
/// 配方下发状态 =0:配方未下发 ,1:配方下发给plc ,2:plc成功接收配方,正在配料
/// </summary>
public int AgvDeliveryPosition { get; set; }= 0;
public int RecipeStatusIDTray2 { get; set; } = 0;

[VarComm("Global", "当前配方正在配料位置")]
/// <summary>
/// 记录AGV进站取货的指令顺序
/// 当前料仓的位置
/// </summary>
public int AgvPickUpPosition { get; set; } = 0;
public int StockInIsWork { get; set; } = 0;


[VarComm("Global", "是否使用粉仓配料")]
/// <summary>
/// 是否使用粉仓
/// 是否使用粉仓配料
/// </summary>
public bool IsUseWindSend { get; set; } = false;

[VarComm("Global", "粉仓正在配料")]
/// <summary>
/// 风送配料完成标志
/// 粉仓正在配料
/// </summary>
public bool WindSendDosingFinish { get; set; } = false;
public bool WindSendDosing { get; set; } = false;


/// <summary>
/// 顶升气缸的信号
/// 所有气缸的信号
/// </summary>
public bool[] Cylinder_JackInfo = new bool[15];
public bool[] Cylinder_JackInfo { get; set; } = new bool[30];

#region 本地模拟配方

[VarComm("Global", "是否使用本地模拟配方")]
/// <summary>
/// 是否使用本地模拟配方
/// </summary>
public bool IsUseLocalRecipe { get; set; }

/// <summary>
/// 是否使用本地模拟订单+风送配方
/// 配料时间
/// </summary>
public bool IsUseWindSendDosing { get; set; }
public static int test1 = 1;
public DateTime time1;

/// <summary>
/// 原料的名称和原料编号对应,Mes提供的信息
/// </summary>
public ConcurrentDictionary<string, string> RawMaterialsNameCode { get; set; } = new ConcurrentDictionary<string, string>();
[VarComm("Global", "风送是否允许AGV到工站")]
/// <summary>
/// 风送是否允许AGV到工站
/// </summary>
public static bool WindSendAllowAGVPutGet { get; set; } = false;
public bool WindSendAllowAGVPutGet { get; set; } = false;

[VarComm("Global", "粉料仓配料完成")]
/// <summary>
/// 粉料仓配料完成
/// </summary>
public static bool WindSendDosingComple { get; set; } = false;
public bool WindSendDosingComple { get; set; } = false;

[VarComm("Global", "PLC的系统模式 DB44.DBX0.1")]
/// <summary>
/// PLC的系统模式 DB44.DBX0.1
/// </summary>
public bool PlcSystemMode { get; set; } = false;

[VarComm("Global", "PLC的系统模式 DB44.DBX0.1")]
/// <summary>
/// 不使用15个料仓报警
/// </summary>
public bool DisEnableStockBinAlarm { get; set; } = false;

[VarComm("Global", "PLC的系统自动启停 DB44.DBX0.0")]
/// <summary>
/// 系统模式
/// PLC的系统自动启停 DB44.DBX0.0
/// </summary>
public static bool SystemMode { get; set; } = false;
public bool PlcSystemIsAutoRun { get; set; } = false;

[VarComm("Global", "PLC的系统自动暂停/开始 DB44.DBX0.2")]
/// <summary>
/// 系统状态
/// PLC的系统自动暂停/开始 DB44.DBX0.2
/// </summary>
public static bool SystemStatus { get; set; } = false;
public bool PlcSystemIsPause { get; set; } = false;

[VarComm("Global", "延迟采集料仓的配料完成重量")]
/// <summary>
/// 系统运行状态
/// 延迟采集料仓的配料完成重量
/// </summary>
public static bool SystemRunStatus { get; set; } = false;
public int Time { get; set; } = 1000;

[VarComm("Global", "取消订单的步骤号")]
/// <summary>
/// 取消订单的步骤: 1-9:配料过程中配方1取消配方 10-19:配料过程中配方2取消配方 20-29:下发订单的过程中取消订单(订单未到达上位机) 30-39:下发订单的过程中取消订单(订单未到达PLC)
/// </summary>
public int OrderCancelStep { get; set; } = 0;

[VarComm("Global", "机器人的状态")]
/// <summary>
/// 机器人的状态
/// </summary>
public ushort RobotStatus { get; set; } = 0;

[VarComm("Global", "机器人的程序号")]
/// <summary>
/// 机器人的程序号
/// </summary>
public byte RobotProgramNum { get; set; } = 0;
#endregion
}
public enum IssueRecipeCondition
{
等待小料站PLC允许下配方,
等待西门子下发配方,
等待西门子下发配方信号复位,
等待上位机请求配料,
等待西门子确认配料,
等待西门子确认配料信号复位,
}
public enum ProcessCondition
{
等待AGV到位,
等待小料站PLC接受配方完成,
等待配方配料完成,
等待AGV取托盘完成
}
}

+ 0
- 41
BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/DataComm.cs View File

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

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

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

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

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

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

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

+ 16
- 0
BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceRead.cs View File

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

namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
public class HKDeviceRead
{
public bool HeartBeat { get; set; }
public bool SystemMode { get; set; }
public bool SystemStart { get; set; }
public bool SystemPause { get; set; }
}
}

+ 77
- 34
BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceStatus.cs View File

@@ -8,6 +8,7 @@ using System.Threading.Tasks;
using BPASmartClient.S7Net;
using BPASmartClient.CustomResource.Pages.Model;
using System.Threading;
using System.Collections.ObjectModel;

namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
@@ -27,42 +28,48 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
DeviceStatus = data;
}
var res1 = this.HK_PLC_S7.ReadClass<PlcReadAddressDB3>(3);
if (res1 != null && res1 is PlcReadAddressDB3 data1)
{
GVL_SmallStation.GetInstance.plcReadDataDB3 = data1;
}
}
Thread.Sleep(10);
}),"海科PLC设备状态",true);
}
/// <summary>
/// 单个配料机配料完成
/// </summary>
/// <param name="value"></param>
public void SingleDosing(uint value)
{
if (IsConnected)
{
HK_PLC_S7.Write(HKPlcCommAddress.SingleStockBinLocationToPLC, value);
HK_PLC_S7.Write(HKPlcCommAddress.SingleDosingFinishToPLC, (ushort)1);
}
}
/// <summary>
/// 复位plc允许接料信号
/// </summary>
public void AllowDosingSignReset()
{
HK_PLC_S7.Write(HKPlcCommAddress.IsAllowDosing,(ushort)0);
}
/// <summary>
/// 复位plc到达某料仓信号
/// </summary>
public void StockStateSignReset()
{
HK_PLC_S7.Write(HKPlcCommAddress.StockState, (ushort)0);
}
/// <summary>
/// 复位一个配方配料完成信号
/// </summary>
public void RecipeDosingFinishReset()
{
HK_PLC_S7.Write(HKPlcCommAddress.RecipeDosingFinish, (ushort)0);
}
///// <summary>
///// 单个配料机配料完成
///// </summary>
///// <param name="value"></param>
//public void SingleDosing(uint value)
//{
// if (IsConnected)
// {
// HK_PLC_S7.Write(HKPlcCommAddress.SingleStockBinLocationToPLC, value);
// HK_PLC_S7.Write(HKPlcCommAddress.SingleDosingFinishToPLC, (ushort)1);
// }
//}
///// <summary>
///// 复位plc允许接料信号
///// </summary>
//public void AllowDosingSignReset()
//{
// HK_PLC_S7.Write(HKPlcCommAddress.IsAllowDosing,(ushort)0);
//}
///// <summary>
///// 复位plc到达某料仓信号
///// </summary>
//public void StockStateSignReset()
//{
// HK_PLC_S7.Write(HKPlcCommAddress.StockState, (ushort)0);
//}
///// <summary>
///// 复位一个配方配料完成信号
///// </summary>
//public void RecipeDosingFinishReset()
//{
// HK_PLC_S7.Write(HKPlcCommAddress.RecipeDosingFinish, (ushort)0);
//}
/// <summary>
/// 下发配方数据
/// </summary>
@@ -182,5 +189,41 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
}
}
}

public void IssueRecipeToPlc(ObservableCollection<RemoteRecipeRawMaterial> rawMaterials,int recipeLoction)
{
if (IsConnected)
{
ushort barrel1 = 0;
ushort barrel2 = 0;
ushort barrel3 = 0;
foreach (var item in rawMaterials)
{
switch (item.RawMaterialBarrelNum)
{
case 1:
barrel1 = barrel1.SetBitValue((byte)item.RawMaterialLocation, true);
break;
case 2:
barrel2 = barrel2.SetBitValue((byte)item.RawMaterialLocation, true);
break;
case 3:
barrel3 = barrel3.SetBitValue((byte)item.RawMaterialLocation, true);
break;
default:
break;
}
}
string AddresBarrel1 = "DB4.DBW" + (12 + (recipeLoction - 1) * 6);
string AddresBarrel2 = "DB4.DBW" + (14 + (recipeLoction - 1) * 6);
string AddresBarrel3 = "DB4.DBW" + (16 + (recipeLoction - 1) * 6);
HK_PLC_S7.Write<ushort>(AddresBarrel1, barrel1);
HK_PLC_S7.Write<ushort>(AddresBarrel2, barrel2);
HK_PLC_S7.Write<ushort>(AddresBarrel3, barrel3);
MessageNotify.GetInstance.ShowRunLog($"配方下发,plc配方位置{recipeLoction},桶1料仓配料{barrel1.ToBinString}");
MessageNotify.GetInstance.ShowRunLog($"配方下发,plc配方位置{recipeLoction},桶2料仓配料{barrel1.ToBinString}");
MessageNotify.GetInstance.ShowRunLog($"配方下发,plc配方位置{recipeLoction},桶3料仓配料{barrel1.ToBinString}");
}
}
}
}
}

+ 23
- 0
BPASmartClient.JXJFoodSmallStation/Model/HK_PLC/HKDeviceWrite.cs View File

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

namespace BPASmartClient.JXJFoodSmallStation.Model.HK_PLC
{
public class HKDeviceWrite
{
public string Address { get; set; }
public PlcVarType PlcVarType { get; set; } = PlcVarType.Bool;
public object Value { get; set; }
}
public enum PlcVarType
{
Bool,
Byte,
Int,
Dint,
Real,
}
}

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

@@ -0,0 +1,178 @@
using BPASmartClient.JXJFoodSmallStation.Model.GVL;
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
{
[VarComm("DB3.DBX0.0","心跳")]
public bool HeartBeat { get; set; }
[VarComm("DB3.DBX0.1", "备用1")]
public bool Standby1 { get; set; }
[VarComm("DB3.DBX0.2", "备用2")]
public bool Standby2 { get; set; }
[VarComm("DB3.DBX0.3", "备用3")]
public bool Standby3 { get; set; }
[VarComm("DB3.DBX0.4", "备用4")]
public bool Standby4 { get; set; }
[VarComm("DB3.DBX0.5", "备用5")]
public bool Standby5 { get; set; }
[VarComm("DB3.DBX0.6", "备用6")]
public bool Standby6 { get; set; }
[VarComm("DB3.DBX0.7", "工站1有托盘")]
public bool WorkStation1HaveTray { get; set; }

[VarComm("DB3.DBX1.0", "工站2有托盘")]
public bool WorkStation2HaveTray { get; set; }
[VarComm("DB3.DBX1.1", "工站1配料完成")]
public bool WorkStation1DosingComplete { get; set; }
[VarComm("DB3.DBX1.2", "工站2配料完成")]
public bool WorkStation2DosingComplete { get; set; }
[VarComm("DB3.DBX1.3", "工站1接收配方完成")]
public bool WorkStation1ReceviceRecipeComplete { get; set; }
[VarComm("DB3.DBX1.4", "工站2接收配方完成")]
public bool WorkStation2ReceviceRecipeComplete { get; set; }
[VarComm("DB3.DBX1.5", "工站1气缸报警")]
public bool WorkStation1CylinderAlarm { get; set; }
[VarComm("DB3.DBX1.6", "工站2气缸报警")]
public bool WorkStation2CylinderAlarm { get; set; }
[VarComm("DB3.DBX1.7", "允许配方1下发配方")]
public bool AllowRecipe1Issue { get; set; }

[VarComm("DB3.DBX2.0", "允许配方2下发配方")]
public bool AllowRecipe2Issue { get; set; }
[VarComm("DB3.DBX2.1", "工站1传感器信号")]
public bool WorkStation1Sensor { get; set; }
[VarComm("DB3.DBX2.2", "工站2传感器信号")]
public bool WorkStation2Sensor { get; set; }
[VarComm("DB3.DBX2.3", "工站1气缸信号,false=伸出")]
public bool WorkStation1Cylinder { get; set; }
[VarComm("DB3.DBX2.4", "工站2气缸信号,false=伸出")]
public bool WorkStation2Cylinder { get; set; }
[VarComm("DB3.DBX2.5", "工站1取消订单")]
public bool WorkStation1OrderCancel { get; set; }
[VarComm("DB3.DBX2.6", "工站2取消订单")]
public bool WorkStation2OrderCancel { get; set; }
[VarComm("DB3.DBX2.7", "备用7")]
public bool Standby7 { get; set; }
[VarComm("DB3.DBB3", "备用")]
public byte Standby81 { get; set; }
[VarComm("DB3.DBB4", "备用")]
public byte Standby82 { get; set; }
[VarComm("DB3.DBB5", "备用")]
public byte Standby83 { get; set; }
[VarComm("DB3.DBW6", "备用")]
public int Standby9 { get; set; }

[VarComm("DB3.DBD10", "工站1_1号桶的位置")]
public float WorkStation1Barrel1Pos { get; set; }
[VarComm("DB3.DBD14", "工站1_2号桶的位置")]
public float WorkStation1Barrel2Pos { get; set; }
[VarComm("DB3.DBD18", "工站1_3号桶的位置")]
public float WorkStation1Barrel3Pos { get; set; }
[VarComm("DB3.DBD22", "工站1_4号桶的位置")]
public float WorkStation1Barrel4Pos { get; set; }
[VarComm("DB3.DBD26", "工站2_1号桶的位置")]
public float WorkStation2Barrel1Pos { get; set; }
[VarComm("DB3.DBD30", "工站2_2号桶的位置")]
public float WorkStation2Barrel2Pos { get; set; }
[VarComm("DB3.DBD34", "工站2_3号桶的位置")]
public float WorkStation2Barrel3Pos { get; set; }
[VarComm("DB3.DBD38", "工站2_4号桶的位置")]
public float WorkStation2Barrel4Pos { get; set; }

[VarComm("DB3.DBD42", "备用")]
public int StandBy42 { get; set; }
[VarComm("DB3.DBD46", "备用")]
public int StandBy46 { get; set; }

[VarComm("DB3.DBX50.0", "工站1_1号桶允许配料")]
public bool WorkStation1Barrel1AllowDosing { get; set; }
[VarComm("DB3.DB50.1", "工站1_2号桶允许配料")]
public bool WorkStation1Barrel2AllowDosing { get; set; }
[VarComm("DB3.DB50.2", "工站1_3号桶允许配料")]
public bool WorkStation1Barrel3AllowDosing { get; set; }
[VarComm("DB3.DB50.3", "工站1_4号桶允许配料")]
public bool WorkStation1Barrel4AllowDosing { get; set; }
[VarComm("DB3.DB50.4", "工站2_1号桶允许配料")]
public bool WorkStation2Barrel1AllowDosing { get; set; }
[VarComm("DB3.DB50.5", "工站2_2号桶允许配料")]
public bool WorkStation2Barrel2AllowDosing { get; set; }
[VarComm("DB3.DB50.6", "工站2_3号桶允许配料")]
public bool WorkStation2Barrel3AllowDosing { get; set; }
[VarComm("DB3.DB50.7", "工站2_4号桶允许配料")]
public bool WorkStation2Barrel4AllowDosing { get; set; }

[VarComm("DB3.DBD52", "备用")]
public int Standby15 { get; set; }
[VarComm("DB3.DBD56", "备用")]
public int Standby16 { get; set; }
[VarComm("DB3.DBD60", "备用")]
public int Standby17 { get; set; }
[VarComm("DB3.DBD64", "备用")]
public int Standby18 { get; set; }
[VarComm("DB3.DBD68", "备用")]
public int Standby19 { get; set; }
[VarComm("DB3.DBD72", "备用")]
public int Standby20 { get; set; }
[VarComm("DB3.DBD76", "备用")]
public int Standby21 { get; set; }
[VarComm("DB3.DBD80", "备用")]
public int Standby22 { get; set; }
[VarComm("DB3.DBD84", "备用")]
public int Standby23 { get; set; }
[VarComm("DB3.DBD88", "备用")]
public int Standby24 { get; set; }
[VarComm("DB3.DBD92", "备用")]
public int Standby25 { get; set; }
[VarComm("DB3.DBD96", "备用")]
public int Standby26 { get; set; }

[VarComm("DB3.DBX100.0", "机器人运行模式")]
public bool RobotRunMode { get; set; }
[VarComm("DB3.DBX100.1", "机器人自动运行")]
public bool RobotAutoRun { get; set; }
[VarComm("DB3.DBX100.2", "机器人停止")]
public bool RobotStop { get; set; }
[VarComm("DB3.DBX100.3", "机器人运行")]
public bool RobotRun { get; set; }
[VarComm("DB3.DBX100.4", "机器人运行报警")]
public bool RobotRunAlarm { get; set; }
[VarComm("DB3.DBX100.5", "机器人在原点")]
public bool RobotInHomed { get; set; }
[VarComm("DB3.DBX100.6", "机器人备用")]
public bool Standby30 { get; set; }
[VarComm("DB3.DBX100.7", "机器人取空桶完成")]
public bool RobotGetEmptyBarrelComplete { get; set; }

[VarComm("DB3.DBX101.0", "机器人放空桶完成")]
public bool RobotPutEmptyBarrelComplete { get; set; }
[VarComm("DB3.DBX101.1", "机器人取满桶完成")]
public bool RobotGetFullBarrelComplete { get; set; }
[VarComm("DB3.DBX101.2", "机器人放满桶完成")]
public bool RobotPutFullBarrelComplete { get; set; }
[VarComm("DB3.DBX101.3", "备用")]
public bool Standby31 { get; set; }
[VarComm("DB3.DBX101.4", "备用")]
public bool Standby32 { get; set; }
[VarComm("DB3.DBX101.5", "备用")]
public bool Standby33 { get; set; }
[VarComm("DB3.DBX101.6", "备用")]
public bool Standby34 { get; set; }
[VarComm("DB3.DBX101.7", "备用")]
public bool Standby35 { get; set; }

[VarComm("DB3.DBB102", "机器人运行的程序号")]
public byte RobotProgramNum { get; set; }
[VarComm("DB3.DBB103", "备用")]
public byte Standby36 { get; set; }
[VarComm("DB3.DBB104", "备用")]
public byte Standby37 { get; set; }
[VarComm("DB3.DBB105", "备用")]
public byte Standby38 { get; set; }
}
}

+ 2122
- 963
BPASmartClient.JXJFoodSmallStation/Model/ProcessControl.cs
File diff suppressed because it is too large
View File


+ 7
- 4
BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceInquire.cs View File

@@ -52,7 +52,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
BottomDeviceCurrentStatuses.ElementAt(BottomIndex).DeviceNum = DeviceLists.ElementAt(i).Value.deviceStatus.DeviceNum;
BottomDeviceCurrentStatuses.ElementAt(BottomIndex).RunStatus = DeviceLists.ElementAt(i).Value.deviceStatus.RunStatus;
}

int deviceIndex = Array.FindIndex(devices.ToArray(), p => p.IpAddress == DeviceLists.ElementAt(i).Key && p.DeviceName != DeviceLists.ElementAt(i).Value.DeviceName);
if (deviceIndex >= 0 && deviceIndex < devices.Count)
{
@@ -60,7 +59,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
}
Thread.Sleep(200);
}), "设备状态监听");
}), "设备状态监听",true);
}
private void TestData()
{
@@ -177,7 +176,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model

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))
@@ -280,7 +279,11 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
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());
}
}
}



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

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

namespace BPASmartClient.JXJFoodSmallStation.Model
{
@@ -14,5 +16,9 @@ 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>();
public ObservableCollection<WindSendRawMaterial> windSendRawMaterial { get; set; } = new ObservableCollection<WindSendRawMaterial>();
public ObservableCollection<BomMaterial> BomMaterial { get; set; } = new ObservableCollection<BomMaterial>();

}
}

+ 3
- 0
BPASmartClient.JXJFoodSmallStation/Model/RawMaterial/DeviceParModel.cs View File

@@ -64,6 +64,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
public int StirringSpeed { get { return _mStirringSpeed; } set { _mStirringSpeed = value; OnPropertyChanged(); } }
private int _mStirringSpeed;

public float ErrorRange { get { return _mErrorRange; } set { _mErrorRange = value; OnPropertyChanged(); } }
private float _mErrorRange;

/// <summary>
/// 是否重复
/// </summary>


+ 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;
}
}

+ 1
- 0
BPASmartClient.JXJFoodSmallStation/Model/Siemens/RemoteRecipeData.cs View File

@@ -38,5 +38,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
/// </summary>
public ObservableCollection<WindSendRawMaterial> WindSend { get; set; } = new ObservableCollection<WindSendRawMaterial>();


}
}

+ 2
- 0
BPASmartClient.JXJFoodSmallStation/Model/Siemens/RemoteRecipeDataColl.cs View File

@@ -10,5 +10,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
public class RemoteRecipeDataColl
{
public ObservableCollection<RemoteRecipeData> Recipes { get; set; } = new ObservableCollection<RemoteRecipeData>();
public int RecipesStatus { get; set; }

}
}

+ 39
- 17
BPASmartClient.JXJFoodSmallStation/Model/Siemens/SiemensDeviceStatus.cs View File

@@ -7,6 +7,7 @@ using System.Text;
using System.Threading.Tasks;
using BPASmartClient.S7Net;
using System.Threading;
using BPASmartClient.CustomResource.Pages.Model;

namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
{
@@ -28,29 +29,52 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
//var DataColl = this.Siemens_PLC_S7.ReadClass<XL_DataColl_DB>(2291);
if (Start != null && Start is XL_Start_DB st)
{
if (GVL_SmallStation.IsAllowSiemensSendRecipe && GVL_SmallStation.SiemensSendRecipeStatus == 0)
switch (GVL_SmallStation.GetInstance.SiemensSendRecipeStatus)
{
GVL_SmallStation.SiemensSendRecipeStatus = 1;
this.Siemens_PLC_S7.Write("DB2201.DBX450.0", true);
case 0:
if (GVL_SmallStation.GetInstance.IsAllowSiemensSendRecipe)
{
this.Siemens_PLC_S7.Write("DB2201.DBX450.0", true);
GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 1;
}
break;
case 1:
if (Start.Order_Request_ACK)
{
if (!string.IsNullOrEmpty(st.RecipeCode))
{
GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 2;
ActionManage.GetInstance.Send("SiemensRecipeRecive", st);
this.Siemens_PLC_S7.Write("DB2201.DBX450.0", false);
}
}
break;
case 2:
if (Start.Order_Request_ACK == false)
{
GVL_SmallStation.GetInstance.IsAllowSiemensSendRecipe = false;
GVL_SmallStation.GetInstance.SiemensSendRecipeStatus = 3;
}
break;
}
if (Start.Order_Request_ACK && GVL_SmallStation.SiemensSendRecipeStatus == 1)
if (RTrig.GetInstance("Order_Cancel").Start(st.Order_Cancel)) //订单取消
{
if (!string.IsNullOrEmpty(st.RecipeCode))
if (GVL_SmallStation.GetInstance.Order_Cancel == false)
{
GVL_SmallStation.SiemensSendRecipeStatus = 2;
ActionManage.GetInstance.Send("SiemensRecipeRecive", st);
this.Siemens_PLC_S7.Write("DB2201.DBX450.0", false);
GVL_SmallStation.GetInstance.Order_Cancel = true;
GVL_SmallStation.GetInstance.Order_CancelRecipeCode = st.RecipeCode;
GVL_SmallStation.GetInstance.OrderCancelStep = 0;
MessageNotify.GetInstance.ShowRunLog($"西门子下发取消工单指令:{st.RecipeName}");
}
else
{
MessageNotify.GetInstance.ShowRunLog($"订单正在取消,请等待订单{ GVL_SmallStation.GetInstance.Order_CancelRecipeCode}取消完成,再取消订单:{st.RecipeName}");
}
}
if (Start.Order_Request_ACK == false && GVL_SmallStation.SiemensSendRecipeStatus == 2)
{
GVL_SmallStation.IsAllowSiemensSendRecipe = false;
GVL_SmallStation.SiemensSendRecipeStatus = 3;
}
}
if (Finish != null && Finish is XL_Finish_DB FinishData)
{
if (FinishData.Ask_For_Finish_PLC && GVL_SmallStation.SiemensSendRecipeStatus == 7)
if (FinishData.Ask_For_Finish_PLC)
{
FinishData.Order_No = "";
FinishData.Product_Code = "";
@@ -63,7 +87,6 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
{
FinishData.Powder[i] = new UDT2();
}
GVL_SmallStation.SiemensSendRecipeStatus = 0;
FinishData.Ask_For_Finish = false;
FinishData.DosingTime = 0;
this.Siemens_PLC_S7.WriteClass<XL_Finish_DB>(FinishData, 2261);
@@ -76,10 +99,9 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
XL_Status.Powder[i] = new PowderStatus();
}
XL_Status = state;


}

//从海科plc的数采 发送给西门子plc
var res = ProcessControl.GetInstance.HKDevice.DeviceStatus;
if (res != null)
{


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

@@ -37,11 +37,13 @@ namespace BPASmartClient.JXJFoodSmallStation.Model.Siemens
/// 西门子下发订单
/// </summary>
public bool Order_Request_ACK { get; set; }
public bool Order_Cancel { get; set; }
public short[] Standby { get; set; } = new short[4];
/// <summary>
/// 上位机订单请求
/// </summary>
public bool Order_Request { get; set; }
public bool Order_Cancel_ACK { get; set; }
public short[] Standby1 { get; set; } = new short[4];

}


+ 32
- 0
BPASmartClient.JXJFoodSmallStation/Model/VarMonitor.cs View File

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

namespace BPASmartClient.JXJFoodSmallStation.Model
{
public class VarMonitor
{
/// <summary>
/// 序号
/// </summary>
public int SerialNum { get; set; }
/// <summary>
/// 变量地址
/// </summary>
public string Address { get; set; }
/// <summary>
/// 变量描述
/// </summary>
public string Describe { get; set; }
/// <summary>
/// 变量值当前值
/// </summary>
public string NowValue { get; set; }
/// <summary>
/// 变量值设定值
/// </summary>
public string SetValue { get; set; }
}
}

+ 4
- 3
BPASmartClient.JXJFoodSmallStation/Model/WindSend/WindSendDeviceStatus.cs View File

@@ -27,15 +27,15 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
var res1 = this.Siemens_PLC_S7.ReadClass<WindSend_Read>(94);
if (res1 != null && res1 is WindSend_Read readData)
{
GVL_SmallStation.WindSendAllowAGVPutGet = readData.HoodLiftInPlace;
Siemens_PLC_S7.Write<bool>("DB95.DBX38.2", GVL_SmallStation.Station1HaveTray);//工站1有托盘
GVL_SmallStation.GetInstance.WindSendAllowAGVPutGet = readData.HoodLiftInPlace;
Siemens_PLC_S7.Write<bool>("DB95.DBX38.2", GVL_SmallStation.GetInstance.Station1HaveTray);//工站1有托盘
if (res1.RecipeReceiveFinish)
{
Siemens_PLC_S7.Write<bool>("DB95.DBX38.0", false);
}
if (RTrig.GetInstance("CurrentCompleteSign").Start(readData.CurrentCompleteSign))
{
GVL_SmallStation.WindSendDosingComple = true;
GVL_SmallStation.GetInstance.WindSendDosingComple = true;
Siemens_PLC_S7.Write("DB95.DBX38.1", true);
}
if (TTrig.GetInstance("CurrentCompleteSign").Start(readData.CurrentCompleteSign))
@@ -108,6 +108,7 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
}
Thread.Sleep(10);*/
}
Thread.Sleep(10);
}),"监听粉料数据",true);
}


+ 7
- 1
BPASmartClient.JXJFoodSmallStation/Model/WindSend/WindSendRawMaterial.cs View File

@@ -12,8 +12,14 @@ namespace BPASmartClient.JXJFoodSmallStation.Model
public int DeviceIp { get { return _mIp; } set { _mIp = value; }}
private int _mIp;

public int Location { get { return _mLocation; } set { _mLocation = value; OnPropertyChanged(); } }
private int _mLocation;

public string RawMaterialChineseName { get { return _mRawMaterialChineseName; } set { _mRawMaterialChineseName = value; OnPropertyChanged(); } }
private string _mRawMaterialChineseName = "";

public string RawMaterialName { get { return _mRawMaterialName; } set { _mRawMaterialName = value; OnPropertyChanged(); } }
private string _mRawMaterialName;
private string _mRawMaterialName = "";
/// <summary>
/// 需要原料重量
/// </summary>


+ 250
- 0
BPASmartClient.JXJFoodSmallStation/View/BomOfMaterialView.xaml View File

@@ -0,0 +1,250 @@
<UserControl x:Class="BPASmartClient.JXJFoodSmallStation.View.BomOfMaterialView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:con="clr-namespace:BPASmartClient.JXJFoodSmallStation.Converter"
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:BomOfMaterialViewModel />
</UserControl.DataContext>
<UserControl.Resources>
<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" />
<!--<SolidColorBrush x:Key="bordColor" Color="#33ffffff" />-->
<SolidColorBrush x:Key="bordColor" Color="#332AB2E7" />
<con:DataTableRedundantConverter x:Key="tabConvert" />

<Style x:Key="RowRadioButtonStyle" TargetType="{x:Type RadioButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Border
x:Name="NvaBor"
Background="Transparent"
BorderBrush="#FF2AB2E7"
BorderThickness="0">
<ContentControl
Margin="10,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding Content}"
FontSize="16" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
<Setter TargetName="NvaBor" Property="BorderThickness" Value="0" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="false" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
</MultiTrigger.Setters>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="InputTextboxStyle" TargetType="TextBox">
<Setter Property="Margin" Value="5,0,0,0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Width" Value="150" />
<Setter Property="Height" Value="40" />
<Setter Property="CaretBrush" Value="{StaticResource TitleBorderColor}" />
<Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<Style x:Key="ControlButtonStyle" TargetType="Button">
<Setter Property="Margin" Value="0" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="#FFF53F62" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
Name="TitleBarBr"
BorderBrush="#00c2f4"
BorderThickness="0"
CornerRadius="0"
Opacity="0.8">

<ContentPresenter
Margin="{TemplateBinding Margin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<Border.Background>
<ImageBrush
ImageSource="/BPASmartClient.CustomResource;component/Image/组合边框1.1.png"
Opacity="0.8"
Stretch="Fill" />
</Border.Background>

</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="TitleBarBr" Property="Opacity" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="TitleTextblockStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="16" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Foreground" Value="{StaticResource tabColor}" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontWeight" Value="SemiBold" />
</Style>

</UserControl.Resources>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition Height="40" />
<RowDefinition />
</Grid.RowDefinitions>
<!--#region 表格标题栏设置-->
<Grid>
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<Button
Height="50"
Margin="5"
Command="{Binding GetBomMaterialData}"
Content="拉取本地数据"
FontSize="28"
Foreground="Aqua"
Style="{StaticResource ImageButtonStyle}" />
<Button
Height="50"
Margin="5"
Command="{Binding DeleteAllMaterial}"
Content="删除所有数据"
FontSize="28"
Foreground="Aqua"
Style="{StaticResource ImageButtonStyle}" />
<Button
Height="50"
Margin="5"
Command="{Binding AddMaterial}"
Content="新增数据"
FontSize="28"
Foreground="Aqua"
Style="{StaticResource ImageButtonStyle}" />
<Button
Height="50"
Margin="5"
Command="{Binding SaveMaterials}"
Content="保存参数"
FontSize="28"
Foreground="Aqua"
Style="{StaticResource ImageButtonStyle}" />
</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,1,1,1" Cursor="SizeWE"
BorderBrush="{StaticResource bordColor}" />-->
</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="Visible" >
<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 Count}" />
</Grid>
<Grid Grid.Column="1" Margin="5">
<TextBox
Width="50"
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding MaterialCode}" />
</Grid>
<Grid Grid.Column="2" Margin="5">
<TextBox
Width="200"
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding MaterialName}" />
</Grid>
<Grid Grid.Column="3" Margin="5">
<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 Count}"
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/BomOfMaterialView.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 BomOfMaterialView : UserControl
{
public BomOfMaterialView()
{
InitializeComponent();
}
}
}

+ 23
- 10
BPASmartClient.JXJFoodSmallStation/View/DeviceMaterialParView.xaml View File

@@ -166,6 +166,7 @@
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>


@@ -227,15 +228,21 @@
Text="搅拌速度" />

<Grid Grid.Column="9">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="精度误差阈值(±g)" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="10">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="功能操作" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Border
Grid.ColumnSpan="10"
Grid.ColumnSpan="11"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />

@@ -259,6 +266,7 @@
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBox
@@ -334,22 +342,27 @@
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding StirringSpeed}" />
<Grid Grid.Column="9">
<Button
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding MaterialName}"
Content="删除"
FontSize="16"
Style="{StaticResource ControlButtonStyle}" />
<TextBox
Foreground="Red"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding ErrorRange}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Button Grid.Column="10"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding MaterialName}"
Content="删除"
FontSize="16"
Style="{StaticResource ControlButtonStyle}" />
<Border
Grid.ColumnSpan="10"
Grid.ColumnSpan="11"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,1" />



+ 13
- 12
BPASmartClient.JXJFoodSmallStation/View/ManualCommView.xaml View File

@@ -66,11 +66,11 @@

<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBlock Text="序号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"/>
@@ -96,12 +96,12 @@
<DataTemplate>
<Grid Name="gr" >
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="3*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="2*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<TextBlock
@@ -142,7 +142,8 @@
</Grid>
<Grid Grid.Column="5">
<pry:IcoButton
Command="{Binding EStopCommand}"
Command="{Binding DataContext.SetParCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding Address}"
Grid.Column="0"
Margin="40,5,40,5"
Content="设置"


+ 71
- 15
BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml View File

@@ -9,8 +9,9 @@
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl.DataContext>
<vm:ManualFlowViewModel />

</UserControl.DataContext>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="100" />
@@ -23,7 +24,7 @@
<Button
Width="200"
Height="40"
Margin="5,0,5,0"
Margin="5"
Command="{Binding Test1Command}"
Content="AGV送托盘完成"
FontSize="20"
@@ -32,7 +33,7 @@
<Button
Width="200"
Height="40"
Margin="5,0,5,0"
Margin="5"
Command="{Binding Test2Command}"
Content="粉料仓配料完成"
FontSize="20"
@@ -41,7 +42,7 @@
<Button
Width="200"
Height="40"
Margin="5,0,5,0"
Margin="5"
Command="{Binding Test3Command}"
Content="AGV取托盘完成"
FontSize="20"
@@ -50,7 +51,7 @@
<Button
Width="200"
Height="40"
Margin="5,0,5,0"
Margin="5"
Command="{Binding Test4Command}"
Content="气缸收紧错位复位"
FontSize="20"
@@ -59,7 +60,7 @@
<Button
Width="200"
Height="40"
Margin="5,0,5,0"
Margin="5"
Command="{Binding Test5Command}"
Content="粉料仓提升到位"
FontSize="20"
@@ -68,15 +69,21 @@
<Button
Width="200"
Height="40"
Margin="5,0,5,0"
Margin="5"
Command="{Binding Test6Command}"
Content="AGV放货架流程完成"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
<Button
Width="200"
Height="40"
Margin="5"
Command="{Binding BPAResetCommand}"
Content="上位机初始化"
FontSize="20"
Style="{StaticResource ImageButtonStyle}"></Button>
</StackPanel>
</Grid>
<Grid Grid.Row="1">
<StackPanel Orientation="Horizontal" HorizontalAlignment="left" VerticalAlignment="Center">
@@ -85,7 +92,7 @@
Height="40"
Margin="5,0,5,0"
Command="{Binding SystemReset}"
Content="系统复位"
Content="PLC系统复位"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
@@ -94,7 +101,7 @@
Height="40"
Margin="5,0,5,0"
Command="{Binding CLearRecipeInfo}"
Content="配方清零"
Content="PLC配方清零"
FontSize="20"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
@@ -103,10 +110,59 @@

</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 />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>

<WrapPanel Grid.Column="1">
<TextBlock Text="海科plc心跳:" 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="0">
<TextBlock Text="西门子 连接状态:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding SiemensIsConnect}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock Text="海科plc连接状态:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding HKPlcIsConnect}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock Text="风送plc连接状态:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding WindSendIsConnect}" 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>
<TextBlock Text="{Binding OrderStatus}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
<TextBlock Text="当前配料状态:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding OrderDosingStatus}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
</WrapPanel>
<WrapPanel Grid.Row="4">
<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>

<WrapPanel Grid.Column="1" Grid.Row="2">
<TextBlock Text="配料情况:" Foreground="#FF2AB2E7" FontSize="25" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBlock Text="{Binding DosingComplete}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="#FF2AB2E7" FontSize="25" Margin="10"></TextBlock>
</WrapPanel>
</Grid>
</Grid>
</Grid>
</UserControl>

+ 5
- 0
BPASmartClient.JXJFoodSmallStation/View/ManualFlowView.xaml.cs View File

@@ -24,5 +24,10 @@ namespace BPASmartClient.JXJFoodSmallStation.View
{
InitializeComponent();
}

private void Button_Click(object sender, RoutedEventArgs e)
{

}
}
}

+ 104
- 0
BPASmartClient.JXJFoodSmallStation/View/PlcVarMonitorView.xaml View File

@@ -0,0 +1,104 @@
<UserControl x:Class="BPASmartClient.JXJFoodSmallStation.View.PlcVarMonitorView"
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.JXJFoodSmallStation.ViewModel"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl.DataContext>
<vm:PlcVarMonitorViewModel />
</UserControl.DataContext>
<Border BorderThickness="0" BorderBrush="{StaticResource bordColor}">
<Grid Margin="0,10">
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"></ColumnDefinition>
<ColumnDefinition Width="8*"></ColumnDefinition>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="10*"></ColumnDefinition>
<ColumnDefinition Width="3*"></ColumnDefinition>
<ColumnDefinition Width="17"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid>
<TextBlock Text="序号" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</Grid>
<Grid Grid.Column="1">
<TextBlock Text="名称" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</Grid>
<Grid Grid.Column="2">
<TextBlock Text="地址" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</Grid>
<Grid Grid.Column="3">
<TextBlock Text="类型" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</Grid>
<Grid Grid.Column="4">
<TextBlock Text="描述" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</Grid>
<Grid Grid.Column="5">
<TextBlock Text="当前值" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</Grid>
</Grid>
<Grid Grid.Row="1">
<ScrollViewer>
<ItemsControl ItemsSource="{Binding plcInfos}" Foreground="Aqua">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="gr">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3*"></ColumnDefinition>
<ColumnDefinition Width="8*"></ColumnDefinition>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="10*"></ColumnDefinition>
<ColumnDefinition Width="3*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid>
<TextBlock Text="{Binding Count}" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</Grid>
<Grid Grid.Column="1">
<TextBlock Text="{Binding Name}" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</Grid>
<Grid Grid.Column="2">
<TextBlock Text="{Binding Address}" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</Grid>
<Grid Grid.Column="3">
<TextBlock Text="{Binding Type}" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</Grid>
<Grid Grid.Column="4">
<TextBlock Text="{Binding Describe}" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</Grid>
<Grid Grid.Column="5">
<TextBlock Text="{Binding Value}" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</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>
</Border>
</UserControl>

+ 28
- 0
BPASmartClient.JXJFoodSmallStation/View/PlcVarMonitorView.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>
/// PlcVarMonitor.xaml 的交互逻辑
/// </summary>
public partial class PlcVarMonitorView : UserControl
{
public PlcVarMonitorView()
{
InitializeComponent();
}
}
}

+ 90
- 0
BPASmartClient.JXJFoodSmallStation/View/ProcessMonitorView.xaml View File

@@ -0,0 +1,90 @@
<UserControl x:Class="BPASmartClient.JXJFoodSmallStation.View.ProcessMonitorView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.JXJFoodSmallStation.View"
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl.DataContext>
<vm:ProcessMonitorViewModel />
</UserControl.DataContext>
<Border BorderThickness="0" BorderBrush="{StaticResource bordColor}">
<Grid Margin="0,10">
<Grid.RowDefinitions>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="14*"></ColumnDefinition>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="17"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid>
<TextBlock Text="序号" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</Grid>
<Grid Grid.Column="1">
<TextBlock Text="名称" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</Grid>
<Grid Grid.Column="2">
<TextBlock Text="类型" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</Grid>
<Grid Grid.Column="3">
<TextBlock Text="描述" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</Grid>
<Grid Grid.Column="4">
<TextBlock Text="当前值" FontSize="32" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1,1,0,0" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</Grid>
</Grid>
<Grid Grid.Row="1">
<ScrollViewer>
<ItemsControl ItemsSource="{Binding plcInfos}" Foreground="Aqua">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="2*"></ColumnDefinition>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="4*"></ColumnDefinition>
<ColumnDefinition Width="14*"></ColumnDefinition>
<ColumnDefinition Width="4*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid>
<TextBlock Margin="5" Text="{Binding Count}" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</Grid>
<Grid Grid.Column="1">
<TextBlock Margin="5" Text="{Binding Name}" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</Grid>
<Grid Grid.Column="2">
<TextBlock Margin="5" Text="{Binding Type}" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</Grid>
<Grid Grid.Column="3">
<TextBlock Margin="5" Text="{Binding Describe}" FontSize="14" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</Grid>
<Grid Grid.Column="4">
<TextBlock Margin="5" Text="{Binding Value}" FontSize="16" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua"></TextBlock>
<Border BorderThickness="1" Cursor="SizeWE" BorderBrush="{StaticResource bordColor}"></Border>
</Grid>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</Grid>
</Grid>
</Border>
</UserControl>

+ 28
- 0
BPASmartClient.JXJFoodSmallStation/View/ProcessMonitorView.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>
/// ProcessMonitorView.xaml 的交互逻辑
/// </summary>
public partial class ProcessMonitorView : UserControl
{
public ProcessMonitorView()
{
InitializeComponent();
}
}
}

+ 2
- 2
BPASmartClient.JXJFoodSmallStation/View/RecipeReceiveView.xaml View File

@@ -52,14 +52,14 @@
<CheckBox
x:Name="IsUseWindSend"
Margin="0,0,10,0"
Content="使用粉料仓配料模拟"
Content="使用粉料仓配料"
FontFamily="楷体"
VerticalAlignment="Center"
Foreground="Aqua"
IsChecked="{Binding IsUseWindSendDosing}" />
<CheckBox
x:Name="IsUseStockBin"
Content="本地小料仓配方模拟"
Content="本地小料仓配方配料"
FontFamily="楷体"
VerticalAlignment="Center"
Foreground="Aqua"


+ 304
- 0
BPASmartClient.JXJFoodSmallStation/View/RobotView.xaml View File

@@ -0,0 +1,304 @@
<UserControl x:Class="BPASmartClient.JXJFoodSmallStation.View.RobotView"
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.Resources>
<Style x:Key="radioButtonStyle" TargetType="RadioButton">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Grid Name="gr" Opacity="0.8">
<ContentControl
Margin="{TemplateBinding Margin}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding Content}"
FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding Foreground}" />
<Image
Name="image"
Source="/BPASmartClient.CustomResource;component/Image/边框线.png"
Stretch="Fill" />

</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="False">
<Setter TargetName="image" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/边框线.png" />
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="image" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/透明背景.png" />
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="gr" Property="Opacity" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<UserControl.DataContext>
<vm:RobotViewModel/>
</UserControl.DataContext>

<Grid Margin="10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="4*"/>
<ColumnDefinition Width="4*"/>
</Grid.ColumnDefinitions>
<!--#region 表格标题栏设置-->
<Grid>
<StackPanel>
<WrapPanel>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="机器人自动运行模式:"></TextBlock>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="{Binding RobotIsAutoMode}"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="机器人正在自动运行:"></TextBlock>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="{Binding RobotIsAutoRun}"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="机器人停止状态:"></TextBlock>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="{Binding RobotIsStop}"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="机器人运行正常:"></TextBlock>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="{Binding RobotIsRun}"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="机器人运行故障:"></TextBlock>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="{Binding RobotIsAlarm}"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="机器人在Home点:"></TextBlock>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="{Binding RobotIsHomed}"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="抓空桶完成:"></TextBlock>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="{Binding RobotGetEmptyBarrelComplete}"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="放空桶完成:"></TextBlock>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="{Binding RobotPutEmptyBarrelComplete}"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="抓满桶完成:"></TextBlock>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="{Binding RobotGetFullBarrelComplete}"></TextBlock>
</WrapPanel>
<WrapPanel>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="放满桶完成:"></TextBlock>
<TextBlock Margin="5" FontSize="22" Foreground="Aqua" Text="{Binding RobotPutFullBarrelComplete}"></TextBlock>
</WrapPanel>
</StackPanel>
</Grid>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="1*"></RowDefinition>
<RowDefinition Height="7*"></RowDefinition>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button
Margin="20,15"
Command="{Binding SystemStart}"
Content="启动"
FontSize="40"
Background="LightGreen"></Button>
<Button
Grid.Column="1"
Margin="20,15"
Command="{Binding SystemStop}"
Content="停止"
FontSize="40"
Background="OrangeRed"></Button>
<Button
Grid.Column="2"
Grid.ColumnSpan="2"
Margin="20,15"
Command="{Binding EStopReset}"
Content="急停复位"
FontSize="40"
Background="DodgerBlue"></Button>
</Grid>
</Grid>
<Grid Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Button
Margin="20,5"
Command="{Binding AutoMode}"
Content="自动模式"
FontSize="32"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
<Button
Grid.Column="1"
Margin="20,5"
Command="{Binding TestMode}"
Content="测试模式"
FontSize="32"
Panel.ZIndex="0"
Style="{StaticResource ImageButtonStyle}"></Button>
<Grid Grid.Row="1" Grid.ColumnSpan="2">
<StackPanel Orientation="Vertical">
<WrapPanel Orientation="Horizontal">
<TextBlock Text="机器人正在运行程序号:" Foreground="#FF2AB2E7" FontSize="25" Margin="10" HorizontalAlignment="Left"></TextBlock>
<TextBlock Text="{Binding IsRunProgramNum}" Foreground="#FF2AB2E7" FontSize="25" Margin="10" HorizontalAlignment="Left" TextAlignment="Center"></TextBlock>
</WrapPanel>
<WrapPanel Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="机器人需要运行程序号:" Foreground="#FF2AB2E7" FontSize="25" Margin="10" HorizontalAlignment="Left"></TextBlock>
<TextBox Text="{Binding SetProgramNum}" Width="50" Foreground="#FF2AB2E7" FontSize="25" Margin="10" HorizontalAlignment="Left" TextAlignment="Center"></TextBox>
<Button FontSize="20" Height="40" Command="{Binding SetProgramNumCommand}" Content="设置" Style="{StaticResource ImageButtonStyle}"></Button>
</WrapPanel>
</StackPanel>
</Grid>
<Button
Grid.Row="2"
Margin="20,5"
Command="{Binding TestRobotRun}"
Content="测试抓桶程序"
FontSize="32"
Style="{StaticResource ImageButtonStyle}"></Button>
</Grid>
<!--<ListView
Grid.Row="1"
Background="Transparent"
BorderBrush="#00BEFA"
BorderThickness="0"
ItemsSource="{Binding cylinderModels}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="8" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>

<ListView.ItemTemplate>
<DataTemplate>
<Grid
Width="200"
Height="100"
Margin="0,0,0,15"
Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.5*" />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBlock
Grid.Column="1"
Grid.ColumnSpan="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="Aqua"
Text="{Binding Name}" />

<pry:Cylinder
Grid.Row="1"
Grid.ColumnSpan="3"
Width="200"
Height="50"
HorizontalAlignment="Center"
VerticalAlignment="Center"
LeftTogIsChecked="{Binding LeftTog}"
RightTogIsChecked="{Binding RightTog}" />

<RadioButton
Grid.Row="2"
Grid.Column="1"
Command="{Binding DataContext.Open, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding Name}"
Content="伸出"
Foreground="Aqua"
IsChecked="True"
Style="{StaticResource radioButtonStyle}" />

<RadioButton
Grid.Row="2"
Grid.Column="2"
Command="{Binding DataContext.Close, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding Name}"
Content="缩回"
Foreground="Aqua"
IsChecked="False"
Style="{StaticResource radioButtonStyle}" />
</Grid>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>-->
<Grid Grid.Row="1" Visibility="Hidden">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Button
Margin="20,5"
Command="{Binding RobotGetEmptyBarrel}"
Content="允许机器人抓空桶"
Style="{StaticResource ImageButtonStyle}"></Button>
</Grid>
<Grid Grid.Column="1">
<Button
Margin="20,5"
Command="{Binding RobotPutEmptyBarrel}"
Content="允许机器人放空桶"
Style="{StaticResource ImageButtonStyle}"></Button>
</Grid>
<Grid Grid.Row="1">
<Button
Margin="20,5"
Command="{Binding RobotGetFullBarrel}"
Content="允许机器人抓满桶"
Style="{StaticResource ImageButtonStyle}"></Button>
</Grid>
<Grid Grid.Row="1" Grid.Column="1">
<Button
Margin="20,5"
Command="{Binding RobotPutFullBarrel}"
Content="允许机器人放满桶"
Style="{StaticResource ImageButtonStyle}"></Button>
</Grid>
</Grid>
</Grid>
</Grid>
</UserControl>

+ 28
- 0
BPASmartClient.JXJFoodSmallStation/View/RobotView.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 RobotView : UserControl
{
public RobotView()
{
InitializeComponent();
}
}
}

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

@@ -0,0 +1,140 @@
<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">
<Button
Height="50"
Margin="5"
Command="{Binding UpdateRawMaterial}"
Content="新增数据"
FontSize="28"
Foreground="Aqua"
Style="{StaticResource ImageButtonStyle}" />
<Button
Height="50"
Margin="5"
Command="{Binding SaveRawMaterialPara}"
Content="保存参数"
FontSize="28"
Foreground="Aqua"
Style="{StaticResource ImageButtonStyle}"/>
</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();
}
}
}

+ 64
- 240
BPASmartClient.JXJFoodSmallStation/View/WindSendParView.xaml View File

@@ -7,6 +7,7 @@
xmlns:local="clr-namespace:BPASmartClient.JXJFoodSmallStation.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.JXJFoodSmallStation.ViewModel"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
d:DesignHeight="1080"
d:DesignWidth="1920"
mc:Ignorable="d">
@@ -15,286 +16,111 @@
<vm:WindSendParViewModel />
</UserControl.DataContext>

<UserControl.Resources>
<SolidColorBrush x:Key="tabColor" Color="#FF2AB2E7" />
<!--<SolidColorBrush x:Key="bordColor" Color="#33ffffff" />-->
<SolidColorBrush x:Key="bordColor" Color="#332AB2E7" />
<con:DataTableRedundantConverter x:Key="tabConvert" />

<Style x:Key="RowRadioButtonStyle" TargetType="{x:Type RadioButton}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Border
x:Name="NvaBor"
Background="Transparent"
BorderBrush="#FF2AB2E7"
BorderThickness="0">
<ContentControl
Margin="10,4"
HorizontalAlignment="Center"
VerticalAlignment="Center"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="{TemplateBinding Content}"
FontSize="16" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
<Setter TargetName="NvaBor" Property="BorderThickness" Value="0" />
</Trigger>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="false" />
<Condition Property="IsMouseOver" Value="True" />
</MultiTrigger.Conditions>
<MultiTrigger.Setters>
<Setter TargetName="NvaBor" Property="Background" Value="#22ffffff" />
</MultiTrigger.Setters>
</MultiTrigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="InputTextboxStyle" TargetType="TextBox">
<Setter Property="Margin" Value="5,0,0,0" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Width" Value="150" />
<Setter Property="Height" Value="40" />
<Setter Property="CaretBrush" Value="{StaticResource TitleBorderColor}" />
<Setter Property="Foreground" Value="{StaticResource TitleBorderColor}" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<Style x:Key="ControlButtonStyle" TargetType="Button">
<Setter Property="Margin" Value="0" />
<Setter Property="FontSize" Value="18" />
<Setter Property="Foreground" Value="#FFF53F62" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border
Name="TitleBarBr"
BorderBrush="#00c2f4"
BorderThickness="0"
CornerRadius="0"
Opacity="0.8">

<ContentPresenter
Margin="{TemplateBinding Margin}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<Border.Background>
<ImageBrush
ImageSource="/BPASmartClient.CustomResource;component/Image/组合边框1.1.png"
Opacity="0.8"
Stretch="Fill" />
</Border.Background>

</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="TitleBarBr" Property="Opacity" Value="1" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

<Style x:Key="TitleTextblockStyle" TargetType="TextBlock">
<Setter Property="FontSize" Value="16" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Foreground" Value="{StaticResource tabColor}" />
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontWeight" Value="SemiBold" />
</Style>

</UserControl.Resources>

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

<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<Button
Width="150"
Height="40"
Margin="10,0,10,0"
Command="{Binding AddCommand}"
Content="添加原料参数"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Button
Width="150"
Height="40"
Margin="10,0,10,0"
Command="{Binding SaveCommand}"
Content="保存参数"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
</StackPanel>

<!--#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 />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>


<TextBlock
Grid.Column="0"
Style="{StaticResource TitleTextblockStyle}"
Text="原料名称" />

<Grid Grid.Column="1">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="料仓上限重量" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
<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" />

<Grid Grid.Column="2">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="料仓下限重量" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Grid Grid.Column="3">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="上限重量报警阈值" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>
<TextBlock
Grid.Column="4"
Style="{StaticResource TitleTextblockStyle}"
Text="下限重量报警阈值" />
<Grid Grid.Column="5">
<TextBlock Style="{StaticResource TitleTextblockStyle}" Text="功能操作" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Border
Grid.ColumnSpan="10"
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0" />
<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>
<!--#endregion-->

<Grid Grid.Row="2">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding deviceParModels}">
<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" >
<ItemsControl ItemsSource="{Binding WindSendRawMaterial}" Foreground="Aqua">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Name="gr" Height="30">
<Grid Name="gr" >
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<TextBox
Grid.Column="0"
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding MaterialName}" />
<Grid Grid.Column="1">
<TextBox
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding UpperLimitWeight}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="2">
<TextBox
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding LowerLimitWeight}" />
<Grid Grid.Column="0" Margin="5">
<TextBlock
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding Location}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />

</Grid>
<Grid Grid.Column="3">
<TextBox
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding UpperLimitWeightOffset}" />
<Grid Grid.Column="1" Margin="5">
<TextBlock
Width="50"
FontSize="16"
TextAlignment="Center"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding Location}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
</Grid>

<Grid Grid.Column="4">
</Grid>
<Grid Grid.Column="2" Margin="5">
<TextBox
Foreground="{Binding IsRedundant, Converter={StaticResource tabConvert}}"
Style="{StaticResource InputTextboxStyle}"
Text="{Binding LowerLimitWeightOffset}" />
Name="name"
Width="50"
FontSize="16"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding RawMaterialName}"/>
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
Cursor="SizeWE" />
</Grid>
<Grid Grid.Column="5">
<Button
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding MaterialName}"
Content="删除"
<Grid Grid.Column="3" Margin="5">
<TextBlock
FontSize="16"
Style="{StaticResource ControlButtonStyle}" />
HorizontalAlignment="Center"
VerticalAlignment="Center"
Text="{Binding RawMaterialChineseName}" />
<Border
BorderBrush="{StaticResource bordColor}"
BorderThickness="1,0,1,0"
Cursor="SizeWE" />
Cursor="SizeWE" />
</Grid>

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

</Grid>
<DataTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
@@ -306,7 +132,5 @@
</ItemsControl>
</ScrollViewer>
</Grid>


</Grid>
</UserControl>

+ 2
- 1
BPASmartClient.JXJFoodSmallStation/View/WindSendParView.xaml.cs View File

@@ -1,4 +1,5 @@
using System;
using BPASmartClient.JXJFoodSmallStation.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


+ 85
- 0
BPASmartClient.JXJFoodSmallStation/ViewModel/BomOfMaterialViewModel.cs View File

@@ -0,0 +1,85 @@
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.Bom;
using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC;
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 BomOfMaterialViewModel : ObservableObject
{
public BomOfMaterialViewModel()
{
RawMaterialInfo = Json<DevicePar>.Data.BomMaterial;
AddMaterial = new RelayCommand(() =>
{
RawMaterialInfo.Add(new BomMaterial()
{
Count = Json<DevicePar>.Data.BomMaterial.Count +1 ,
});
});
SaveMaterials = new RelayCommand(() =>
{
if (MessageNotify.GetInstance.ShowDialog("请确认是否保存!") == true)
{
Json<DevicePar>.Save();
MessageNotify.GetInstance.ShowUserLog($"西门子物料清单保存成功");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"原料与料仓对应关系保存成功");
}
});
GetBomMaterialData = new RelayCommand(() =>
{
Json<DevicePar>.Data.BomMaterial.Clear();
ProcessControl.GetInstance.RawMaterialNameWithCode();//原料的名称和编码对应 :西门子mes定义的物料编码
foreach (var item in GVL_SmallStation.GetInstance.RawMaterialsNameCode)
{
Json<DevicePar>.Data.BomMaterial.Add(new BomMaterial() { Count = Json<DevicePar>.Data.BomMaterial.Count + 1, MaterialCode = item.Key, MaterialName = item.Value });
}
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"读取程序的Bom清单");
});
DeleteAllMaterial = new RelayCommand(() =>
{
if (MessageNotify.GetInstance.ShowDialog("请确认是否删除所有原料数据!") == true)
{
Json<DevicePar>.Data.BomMaterial.Clear();
MessageNotify.GetInstance.ShowUserLog($"西门子物料清单删除完成");
}
});
RemoveCommand = new RelayCommand<int>((Count) =>
{
if (Count is int cnt)
{
var res = RawMaterialInfo.FirstOrDefault(p => p.Count == cnt);
if (res != null)
{
if (MessageNotify.GetInstance.ShowDialog($"请确认是否删除[{res.MaterialCode}],[{res.MaterialName}]!") == true)
{
RawMaterialInfo.Remove(res);
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"删除成功");
}
}
}
});
}
public ObservableCollection<BomMaterial> RawMaterialInfo { get; set; } = new ObservableCollection<BomMaterial>();
public RelayCommand AddMaterial { get; set; }
public RelayCommand SaveMaterials { get; set; }
public RelayCommand<int> RemoveCommand { get; set; }
public RelayCommand GetBomMaterialData { get; set; }
public RelayCommand DeleteAllMaterial { get; set; }
}
}

+ 2
- 2
BPASmartClient.JXJFoodSmallStation/ViewModel/HardwareStatusViewModel.cs View File

@@ -21,9 +21,9 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel

BottomDeviceCurrentStatuses = DeviceInquire.GetInstance.BottomDeviceCurrentStatuses;

TopDeviceCurrentStatuses = new ObservableCollection<DeviceCurrentStatus>(TopDeviceCurrentStatuses.OrderByDescending(item => item.DeviceNum));
/*TopDeviceCurrentStatuses = new ObservableCollection<DeviceCurrentStatus>(TopDeviceCurrentStatuses.OrderByDescending(item => item.DeviceNum));

BottomDeviceCurrentStatuses = new ObservableCollection<DeviceCurrentStatus>(BottomDeviceCurrentStatuses.OrderBy(item => item.DeviceNum));
BottomDeviceCurrentStatuses = new ObservableCollection<DeviceCurrentStatus>(BottomDeviceCurrentStatuses.OrderBy(item => item.DeviceNum));*/
}

public ObservableCollection<DeviceCurrentStatus> TopDeviceCurrentStatuses { get; set; }


+ 5
- 23
BPASmartClient.JXJFoodSmallStation/ViewModel/ManualCommViewModel.cs View File

@@ -20,36 +20,18 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
public ManualCommViewModel()
{
for (int i = 0; i < 8; i++)
PlcDataColl.Add(new VarMonitor() { SerialNum = PlcDataColl.Count , Address="",});
SetParCommand = new RelayCommand<object>((o) =>
{
if (i < 4)
{
PlcInfo.Add(new PlcManualComm()
{
SerialNum = PlcInfo.Count + 1,
Address = "DB3.DBD" + (10 + 4 * i),
Describe = $"托盘1_{i + 1}#桶位置反馈",
});
}
else
if (o != null && o is string address)
{
PlcInfo.Add(new PlcManualComm()
{
SerialNum = PlcInfo.Count + 1,
Address = "DB3.DBD" + (10 + 4 * i),
Describe = $"托盘2_{i-3}#桶位置反馈",
});
var res = PlcDataColl.FirstOrDefault(p =>p.Address == address);
}
}
SetParCommand = new RelayCommand<object>((o) =>
{
});
}
public ObservableCollection<PlcManualComm> PlcInfo { get; set; } = new ObservableCollection<PlcManualComm>();
public static ObservableCollection<VarMonitor> PlcDataColl { get; set; } = new ObservableCollection<VarMonitor>();

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

public RelayCommand Connect { get; set; }



+ 174
- 42
BPASmartClient.JXJFoodSmallStation/ViewModel/ManualControlViewModel.cs View File

@@ -11,6 +11,8 @@ using BPASmartClient.JXJFoodSmallStation.Model;
using System.Threading;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.CustomResource.UserControls;

namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
@@ -20,10 +22,10 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
ThreadManage.GetInstance().StartLong(new Action(() =>
{
SystemMode = GVL_SmallStation.SystemMode ? "自动" : "手动";
if (GVL_SmallStation.SystemStatus)
SystemMode = GVL_SmallStation.GetInstance.PlcSystemMode ? "手动" : "自动";
if (GVL_SmallStation.GetInstance.PlcSystemIsAutoRun)
{
if (GVL_SmallStation.SystemRunStatus)
if (GVL_SmallStation.GetInstance.PlcSystemIsPause)
{
SystemStatus = "暂停";
}
@@ -36,56 +38,182 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
SystemStatus = "停止";
}
for (int i = 0; i < 15; i++)
{
if (GVL_SmallStation.GetInstance.Cylinder_JackInfo[i])
{
cylinderModels.ElementAt(i).LeftTog = true;
cylinderModels.ElementAt(i).RightTog = false;
}
else
{
cylinderModels.ElementAt(i).LeftTog = false;
cylinderModels.ElementAt(i).RightTog = true;
}
}
foreach (var item in PalletCylinders)
{
if (item.Name == "进料桶顶升气缸")
{
if (GVL_SmallStation.GetInstance.Cylinder_JackInfo[20])
{
item.LeftTog = true;
item.RightTog = false;
}
else
{
item.LeftTog = false;
item.RightTog = true;
}
}
if (item.Name == "出料桶顶升气缸1")
{
if (GVL_SmallStation.GetInstance.Cylinder_JackInfo[21])
{
item.LeftTog = true;
item.RightTog = false;
}
else
{
item.LeftTog = false;
item.RightTog = true;
}
}
if (item.Name == "出料桶顶升气缸2")
{
if (GVL_SmallStation.GetInstance.Cylinder_JackInfo[22])
{
item.LeftTog = true;
item.RightTog = false;
}
else
{
item.LeftTog = false;
item.RightTog = true;
}
}
if (item.Name == "出料桶顶升气缸3")
{
if (GVL_SmallStation.GetInstance.Cylinder_JackInfo[23])
{
item.LeftTog = true;
item.RightTog = false;
}
else
{
item.LeftTog = false;
item.RightTog = true;
}
}
if (item.Name == "托盘气缸1_1")
{
if (GVL_SmallStation.GetInstance.Cylinder_JackInfo[24])
{
item.LeftTog = false;
item.RightTog = true;
}
else
{
item.LeftTog = true;
item.RightTog = false;
}
}
if (item.Name == "托盘气缸1_2")
{
if (GVL_SmallStation.GetInstance.Cylinder_JackInfo[25])
{
item.LeftTog = false;
item.RightTog = true;
}
else
{
item.LeftTog = true;
item.RightTog = false;
}
}
if (item.Name == "托盘气缸2_1")
{
if (GVL_SmallStation.GetInstance.Cylinder_JackInfo[26])
{
item.LeftTog = false;
item.RightTog = true;
}
else
{
item.LeftTog = true;
item.RightTog = false;
}
}
if (item.Name == "托盘气缸2_2")
{
if (GVL_SmallStation.GetInstance.Cylinder_JackInfo[27])
{
item.LeftTog = false;
item.RightTog = true;
}
else
{
item.LeftTog = true;
item.RightTog = false;
}
}
}
Thread.Sleep(200);
}), "获取系统状态", true);
for (int i = 0; i < 15; i++)
if (cylinderModels.Count < 15)
{
cylinderModels.Add(new CylinderModel()
for (int i = 0; i < 15; i++)
{
Name = $"升降气缸 {i + 1}",
LeftTog = false,
RightTog = false,
});
cylinderModels.Add(new CylinderModel()
{
Name = $"升降气缸 {i + 1}",
LeftTog = false,
RightTog = false,
});

BlockCylinders.Add(new CylinderModel()
{
Name = $"阻挡气缸 {i + 1}",
LeftTog = false,
RightTog = false,
});
BlockCylinders.Add(new CylinderModel()
{
Name = $"阻挡气缸 {i + 1}",
LeftTog = false,
RightTog = false,
});
}
}
for (int i = 1; i < 3; i++)
if (PalletCylinders.Count < 8)
{
PalletCylinders.Add(new CylinderModel()
for (int i = 1; i < 3; i++)
{
Name = $"托盘气缸1_{(i + 1)%2 +1}",
LeftTog = false,
RightTog = false,
});
}
for (int i = 1; i < 3; i++)
{
PalletCylinders.Add(new CylinderModel()
PalletCylinders.Add(new CylinderModel()
{
Name = $"托盘气缸1_{(i + 1) % 2 + 1}",
LeftTog = false,
RightTog = false,
});
}
for (int i = 1; i < 3; i++)
{
Name = $"托盘气缸2_{(i + 1) % 2 + 1}",
LeftTog = false,
RightTog = false,
});
}
PalletCylinders.Add(new CylinderModel()
{
Name = $"进料桶顶升气缸",
LeftTog = false,
RightTog = false,
});
for (int i = 0; i < 3; i++)
{
PalletCylinders.Add(new CylinderModel()
{
Name = $"托盘气缸2_{(i + 1) % 2 + 1}",
LeftTog = false,
RightTog = false,
});
}
PalletCylinders.Add(new CylinderModel()
{
Name = $"出料桶顶升气缸{i+1}",
Name = $"进料桶顶升气缸",
LeftTog = false,
RightTog = false,
});
for (int i = 0; i < 3; i++)
{
PalletCylinders.Add(new CylinderModel()
{
Name = $"出料桶顶升气缸{i + 1}",
LeftTog = false,
RightTog = false,
});
}
}
Open = new RelayCommand<object>((o) =>
{
@@ -139,18 +267,22 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
SystemStartCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("SystemStart");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"系统启动!");
});
SystemStopCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("SystemStop");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"系统停止!");
});
SystemPauseCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("SystemPause");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"系统暂停!");
});
SystemResetCommand = new RelayCommand(() =>
{
ActionManage.GetInstance.Send("SystemReset");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"系统暂停后复位!");
});
DebugMode = new RelayCommand(() =>
{
@@ -165,17 +297,17 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
/// <summary>
/// 升降气缸
/// </summary>
public ObservableCollection<CylinderModel> cylinderModels { get; set; } = new ObservableCollection<CylinderModel>();
public static ObservableCollection<CylinderModel> cylinderModels { get; set; } = new ObservableCollection<CylinderModel>();

/// <summary>
/// 阻挡气缸
/// </summary>
public ObservableCollection<CylinderModel> BlockCylinders { get; set; } = new ObservableCollection<CylinderModel>();
public static ObservableCollection<CylinderModel> BlockCylinders { get; set; } = new ObservableCollection<CylinderModel>();

/// <summary>
/// 托盘气缸
/// </summary>
public ObservableCollection<CylinderModel> PalletCylinders { get; set; } = new ObservableCollection<CylinderModel>();
public static ObservableCollection<CylinderModel> PalletCylinders { get; set; } = new ObservableCollection<CylinderModel>();
public static string SystemMode { get { return _mSystemMode; } set { _mSystemMode = value; OnStaticPropertyChanged(); } }
private static string _mSystemMode =String.Empty;



+ 97
- 7
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,54 +24,133 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
public ManualFlowViewModel()
{
time = GVL_SmallStation.GetInstance.Time;
Test1Command = new RelayCommand(() =>
{
GVL_SmallStation.AGV_PutTray1Finish = true;
ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX0.7", PlcVarType = PlcVarType.Bool, Value = true });
//GVL_SmallStation.GetInstance.AGV_PutTray1Finish = true;
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,AGV送托盘完成");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"手动点击按钮,AGV送托盘完成");
});
Test2Command = new RelayCommand(() =>
{
GVL_SmallStation.WindSendDosingComple = true;
ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX1.7", PlcVarType = PlcVarType.Bool, Value = true });
//GVL_SmallStation.GetInstance.WindSendDosingComple = true;
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,粉料仓配料完成");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"手动点击按钮,粉料仓配料完成");
});
Test3Command = new RelayCommand(() =>
{
GVL_SmallStation.AGV_GetTray1Finish = true;
ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX1.1", PlcVarType = PlcVarType.Bool, Value = true });
//GVL_SmallStation.GetInstance.AGV_GetTray1Finish = true;
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,AGV取托盘完成");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"手动点击按钮,AGV取托盘完成");
});
Test4Command = new RelayCommand(() =>
{
GVL_SmallStation.CylinderReset = true;
ActionManage.GetInstance.Send("PLCWrite", new HKDeviceWrite() { Address = "DB4.DBX1.5", PlcVarType = PlcVarType.Bool, Value = true });
//GVL_SmallStation.GetInstance.CylinderReset = true;
MessageNotify.GetInstance.ShowUserLog("手动点击按钮,气缸收紧错位复位");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"手动点击按钮,气缸收紧错位复位");
});
Test5Command = new RelayCommand(() =>
{
GVL_SmallStation.WindSendAllowAGVPutGet = true;
GVL_SmallStation.GetInstance.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(() =>
{
DosingComplete = GVL_SmallStation.GetInstance.StockBinDosing.ToBinString();
Heartbeat = GVL_SmallStation.GetInstance.HeartBeatFromPlc;
switch (GVL_SmallStation.GetInstance.SiemensSendRecipeStatus)
{
case 0:
OrderStatus = IssueRecipeCondition.等待小料站PLC允许下配方.ToString();
break;
case 1:
OrderStatus = IssueRecipeCondition.等待西门子下发配方.ToString();
break;
case 2:
OrderStatus = IssueRecipeCondition.等待西门子下发配方信号复位.ToString();
break;
case 3:
OrderStatus = IssueRecipeCondition.等待上位机请求配料.ToString();
break;
case 4:
OrderStatus = IssueRecipeCondition.等待西门子确认配料.ToString();
break;
case 5:
OrderStatus = IssueRecipeCondition.等待西门子确认配料信号复位.ToString();
break;
case 6:
OrderStatus = "上位机将配方添加到队列中";
break;
default:
OrderStatus = "无意义";
break;
}
switch (GVL_SmallStation.GetInstance.RecipeStatusIDTray1)
{
case 0:
OrderDosingStatus = ProcessCondition.等待AGV到位.ToString();
break;
case 1:
OrderDosingStatus = ProcessCondition.等待小料站PLC接受配方完成.ToString();
break;
case 2:
OrderDosingStatus = ProcessCondition.等待配方配料完成.ToString();
break;
default:
break;
}
Thread.Sleep(100);
}), "流程手动设备状态读取",true);
TimeSet = new RelayCommand(() =>
{
GVL_SmallStation.GetInstance.Time = time;
MessageNotify.GetInstance.ShowUserLog($"设置柔性味魔方复位时间:{time}s");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"{time.ToString()}:设置成功!");
});
SiemensIsConnect = ProcessControl.GetInstance.SiemensDevice.IsConnected;
HKPlcIsConnect = ProcessControl.GetInstance.HKDevice.IsConnected;
WindSendIsConnect = ProcessControl.GetInstance.WindSendDevice.IsConnected;
}
public RelayCommand Test1Command { get; set; }
public RelayCommand Test2Command { get; set; }
public RelayCommand Test3Command { get; set; }
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 string OrderDosingStatus { get { return _mOrderDosingStatus; } set { _mOrderDosingStatus = value; OnStaticPropertyChanged(); } }
private static string _mOrderDosingStatus = "无意义";
public static event EventHandler<PropertyChangedEventArgs> StaticPropertyChanged;
public static void OnStaticPropertyChanged([CallerMemberName] string PropName = "")
{
@@ -78,5 +158,15 @@ namespace BPASmartClient.JXJFoodSmallStation.ViewModel
}
public RelayCommand CLearRecipeInfo { get; set; }
public RelayCommand SystemReset { get; set; }
public RelayCommand BPAResetCommand { get; set; }
private bool _SiemensIsConnect { get; set; }
public bool SiemensIsConnect { get { return _SiemensIsConnect; } set { _SiemensIsConnect = value; OnPropertyChanged(); } }
private bool _HKPlcIsConnect { get; set; }
public bool HKPlcIsConnect { get { return _HKPlcIsConnect; } set { _HKPlcIsConnect = value; OnPropertyChanged(); } }
private bool _WindSendIsConnect { get; set; }
public bool WindSendIsConnect { get { return _WindSendIsConnect; } set { _WindSendIsConnect = value; OnPropertyChanged(); } }

private static string _DosingComplete { get; set; }
public static string DosingComplete { get { return _DosingComplete; } set { _DosingComplete = value; OnStaticPropertyChanged(); } }
}
}

+ 23
- 0
BPASmartClient.JXJFoodSmallStation/ViewModel/PlcVarMonitorViewModel.cs View File

@@ -0,0 +1,23 @@
using BPASmartClient.JXJFoodSmallStation.Model;
using BPASmartClient.JXJFoodSmallStation.Model.GVL;
using BPASmartClient.JXJFoodSmallStation.Model.HK_PLC;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.JXJFoodSmallStation.ViewModel
{
public class PlcVarMonitorViewModel : ObservableObject
{
public PlcVarMonitorViewModel()
{
}
public ObservableCollection<PlcInfos> plcInfos => ProcessControl.GetInstance.CommData;
}
}

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

Loading…
Cancel
Save