Compare commits

...

136 Commits

Author SHA1 Message Date
  ZhaoGang 30a9851683 1 1 year ago
  ZhaoGang 92f767f027 1 1 year ago
  ZhaoGang 70ea1d70be Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  ZhaoGang ba8fffe3f0 1Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  ZhaoGang 9167417d40 Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  ZhaoGang 88014f7cf2 1. 代码格式化。2.恢复注释。 1 year ago
  Mr_z f2a16ec1ad 增加料仓在线状态属性上报 1 year ago
  Mr_z 84fb2cfd6c Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  Mr_z 8079a30c82 柔性配料系统接入阿里云Iot 1 year ago
  ZhaoGang b89c5f2d03 1. 修改数据库初始化。 1 year ago
  ZhaoGang 2ac2bb56cf Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  ZhaoGang c1cea78eef 1. 优化手动调试系界面代码。2. 完善报警变量及赋值。 1 year ago
  Mr_z 912e73f769 冲突更新 1 year ago
  Mr_z a418a36a31 更新 1 year ago
  ZhaoGang 56c1023501 1. 修改入库程序到Control_MorkCL里。2. 配方编辑界面添加上移下移功能。 1 year ago
  ZhaoGang 1cd8119b09 修改手动调试炒锅界面代码。 1 year ago
  ZhaoGang c0af685c3d 1. 完善手动调试界面。2. 修改入库条件判断。 1 year ago
  ZhaoGang 96480deff6 海科调试。 1 year ago
  pry 9a14ec46c4 从站设置 1 year ago
  pry 64fc2d20d4 Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  ZhaoGang dc34d54028 恢复注释。 1 year ago
  ZhaoGang 937e5b140a 下发配方时添加物料查找验证。 1 year ago
  pry b0a1aece7e Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  pry 678c9099e3 测试项目添加 1 year ago
  ZhaoGang 3d6149a7d6 添加手动调试界面。 1 year ago
  ZhaoGang 3d3dfcce1c 修改入库界面库位显示。 1 year ago
  ZhaoGang e99a352a6c 修改配方分配逻辑。 1 year ago
  ZhaoGang 85b638fd9e 1. 添加修改变量。2. 修改配方功能。 1 year ago
  ZhaoGang db149553ba 海科调试修改。 1 year ago
  ZhaoGang e5d89c9254 Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  ZhaoGang a72757c144 1 1 year ago
  ZhaoGang b384e0e54a 1. 添加日志输出,测试订单下发。2. 读取变量程序更新。 1 year ago
  Mr_z 78cdd8c5d5 柔性配料调试更新 1 year ago
  Mr_z c3d46b40f0 更新 1 year ago
  Mr_z 8e7aec3c18 配料状态更新 1 year ago
  Mr_z 3b9e68d0f1 Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  Mr_z e89c847747 调试更新 1 year ago
  ZhaoGang 7ad95a23f2 1 1 year ago
  ZhaoGang f216983a7d Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  ZhaoGang e037129464 修复加载Json文件多添加参数的问题。以及代码格式化。 1 year ago
  ZhaoGang 310f8e6582 配方功能参数编辑框调整为部分参数使用ComboBox选择。 1 year ago
  Mr_z e8fa48765a Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  Mr_z 5d9c288879 配方执行逻辑更新 1 year ago
  Nah a94953e850 1 1 year ago
  ZhaoGang 70e6844d9e 成都旅游学院项目修改所在文件夹名称。 1 year ago
  ZhaoGang 5f343e3671 Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  ZhaoGang ad732e6d30 新增全局流程变量监控页面。 1 year ago
  pry b692557aa6 Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  pry 70b008a545 1 1 year ago
  Mr_z 0aafdb6434 Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  Mr_z a2dc345f4a 多桶配料 1 year ago
  pry c8f3eece23 Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  pry 347fedfd0f 1 1 year ago
  Mr_z f9ee456b27 冲突解决 1 year ago
  Mr_z 12627e7fbf 调试更新 1 year ago
  ZhaoGang 8e1e6b47e7 配方ID改为自动生成。 1 year ago
  ZhaoGang 504ab28c9c Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  ZhaoGang 5bad282b21 修改配方数据,新增配方下发。 1 year ago
  pry 5d34b83083 包管理更新 1 year ago
  pry c44d1bffb0 Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  pry 40cf72d7bc 模拟配方提添加 1 year ago
  ZhaoGang 3c21143479 Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  ZhaoGang 66c36ec461 修改配方Model类命名。 1 year ago
  pry 449897d2ac 模拟工艺添加 1 year ago
  pry c9a7ab810f 1 1 year ago
  pry 427d4bf586 1 1 year ago
  pry b1fed931f6 Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  pry 99a6ee5665 通讯组件修改 1 year ago
  ZhaoGang 4097d8467e Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  ZhaoGang 9b2e950537 Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  pry f4f1942a4a 包更新 1 year ago
  ZhaoGang 9180d06f96 新增物料信息编辑弹框。 1 year ago
  pry c529755e85 包更新 1 year ago
  pry e5d441d1a9 1 1 year ago
  Mr_z 32f1fe0610 1 1 year ago
  Mr_z dce9473191 冲突解决 1 year ago
  pry 80e2fe8717 Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  pry 8aab8e3ef7 调整修改 1 year ago
  ZhaoGang 9868bee14f Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  ZhaoGang 636e629590 配方管理页面添加命令并做基本测试。 1 year ago
  pry 3fe73c2ca0 配料系统调试 1 year ago
  pry 9728ceb17f 1 1 year ago
  pry acdb8baaba 包更新 1 year ago
  Mr_z 66bd28605a 冲突解决 1 year ago
  pry d3055b8843 变量监控添加 1 year ago
  pry 694604c4f0 通讯库验证更新 1 year ago
  pry 0e0636890e Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  pry 75089fd056 机器人模型添加 1 year ago
  ZhaoGang ca33e181bc Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  ZhaoGang ed15d6ce45 修改功能编辑页面。 1 year ago
  pry 3cddfb6317 炒锅通讯添加 1 year ago
  pry cea0a5938f Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  pry 1227494131 控制修改 1 year ago
  ZhaoGang 4fddadf09d Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  ZhaoGang df6984415e 修改配方管理界面。 1 year ago
  pry 34ad8dc9a3 原料管理 1 year ago
  Nah 8639cbf8ad 1 1 year ago
  ZhaoGang 37c1a5233e 修改命名空间 1 year ago
  ZhaoGang 4c11e4b2e8 Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  ZhaoGang 2c7dbd78d5 调整添加原料页面 1 year ago
  pry 63e4cac92c 1 1 year ago
  pry 794c948e66 Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  pry 8b7d0947fb 基础配置 1 year ago
  ZhaoGang 3f25e86d5c Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  ZhaoGang d95a182dcc 添加页面 1 year ago
  pry c9b2be01e1 物料信息添加 1 year ago
  pry 11fea40c27 Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  pry 72913d6a55 框架搭建 1 year ago
  ZhaoGang 5a1414b09e 添加依赖 1 year ago
  ZhaoGang 4f58ecaa3c 新增页面 1 year ago
  ZhaoGang 6a6b515f8b 新增页面 1 year ago
  pry b0784c0873 1 1 year ago
  ZhaoGang 5bb2b54c95 旅游学院修改为单机设备框架。 1 year ago
  ZhaoGang cff11e553d 1 1 year ago
  ZhaoGang a9adfffb50 新增页面 1 year ago
  pry 70aba46ed1 1 1 year ago
  pry d007bcd0e0 1 1 year ago
  pry 0973051ff3 Merge branch 'reconfiguration' of http://111.9.47.105:10244/bpa/BPASmartClient into reconfiguration 1 year ago
  pry 04f275ff32 同步更新 1 year ago
  ZhaoGang 03d0215060 修改大料站原料厂显示顺序。 1 year ago
  pry 03d5d98f53 1 1 year ago
  pry e16afc9d10 分支调整合并 1 year ago
  pry 26eb67ee22 1 1 year ago
  pry 7af9b8718c 1 1 year ago
  pry 3b2a26493f 1 1 year ago
  pry 746fe78e5b 1 1 year ago
  pry 8bfe9b27c8 1 1 year ago
  pry 8d95c34a50 1 1 year ago
  pry a97d4951d2 1 1 year ago
  pry 23bedc9078 1 1 year ago
  pry 6af72a3522 1 1 year ago
  pry c8c0f36f13 1 1 year ago
  pry 4a1540a10f 1 1 year ago
  pry 06321117c7 1 1 year ago
  pry 70ca161975 1 1 year ago
  pry d3b20a58a4 1 1 year ago
100 changed files with 627 additions and 684 deletions
Split View
  1. +1
    -3
      BPASmartClient.Business/BPASmartClient.Business.csproj
  2. +2
    -2
      BPASmartClient.Business/InternetInfo.cs
  3. +15
    -8
      BPASmartClient.Business/LocalMqtt.cs
  4. +1
    -2
      BPASmartClient.Business/MainConsole.cs
  5. +3
    -4
      BPASmartClient.Business/Plugin/ConfigMgr.cs
  6. +5
    -6
      BPASmartClient.Business/Plugin/DeviceMgr.cs
  7. +27
    -22
      BPASmartClient.Business/Plugin/MQTTMgr.cs
  8. +10
    -10
      BPASmartClient.Business/Plugin/OrderProxy.cs
  9. +1
    -1
      BPASmartClient.Business/Plugin/Plugin.cs
  10. +6
    -6
      BPASmartClient.Business/Plugin/StatusMgr.cs
  11. +1
    -1
      BPASmartClient.Business/TopicDefine.cs
  12. +5
    -7
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  13. +14
    -137
      BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
  14. +7
    -7
      BPASmartClient.CustomResource/Pages/Model/AlarmTest.cs
  15. +4
    -4
      BPASmartClient.CustomResource/Pages/Model/MenuManage.cs
  16. +16
    -8
      BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs
  17. +4
    -3
      BPASmartClient.CustomResource/Pages/Model/NfcServer.cs
  18. +2
    -2
      BPASmartClient.CustomResource/Pages/Model/PlcVariableInfoManage.cs
  19. +2
    -2
      BPASmartClient.CustomResource/Pages/Model/PlcVariableInfoModel.cs
  20. +1
    -1
      BPASmartClient.CustomResource/Pages/Model/ProductionDataHelper.cs
  21. +2
    -2
      BPASmartClient.CustomResource/Pages/Model/RecipeCompleteLog.cs
  22. +2
    -2
      BPASmartClient.CustomResource/Pages/Model/ReportBase.cs
  23. +1
    -1
      BPASmartClient.CustomResource/Pages/Model/ReportHelper.cs
  24. +1
    -1
      BPASmartClient.CustomResource/Pages/Model/ReportTestModel.cs
  25. +2
    -2
      BPASmartClient.CustomResource/Pages/Model/RunLog.cs
  26. +2
    -2
      BPASmartClient.CustomResource/Pages/Model/UserInfo.cs
  27. +2
    -2
      BPASmartClient.CustomResource/Pages/Model/UserLog.cs
  28. +2
    -2
      BPASmartClient.CustomResource/Pages/Model/UserTreeViewModel.cs
  29. +3
    -2
      BPASmartClient.CustomResource/Pages/Model/VoiceAPI.cs
  30. +1
    -1
      BPASmartClient.CustomResource/Pages/View/AddNewUser.xaml.cs
  31. +1
    -1
      BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs
  32. +1
    -1
      BPASmartClient.CustomResource/Pages/View/NfcSetView.xaml.cs
  33. +1
    -1
      BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml.cs
  34. +1
    -1
      BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml.cs
  35. +1
    -1
      BPASmartClient.CustomResource/Pages/View/UserConfigView.xaml.cs
  36. +9
    -11
      BPASmartClient.CustomResource/Pages/ViewModel/AddNewUserViewModel.cs
  37. +10
    -11
      BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs
  38. +3
    -3
      BPASmartClient.CustomResource/Pages/ViewModel/DebugLogViewModel.cs
  39. +8
    -8
      BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs
  40. +42
    -34
      BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs
  41. +11
    -11
      BPASmartClient.CustomResource/Pages/ViewModel/NfcSetViewModel.cs
  42. +8
    -8
      BPASmartClient.CustomResource/Pages/ViewModel/PasswordChangeViewModel.cs
  43. +2
    -2
      BPASmartClient.CustomResource/Pages/ViewModel/PermissionConfigurationViewModel.cs
  44. +2
    -2
      BPASmartClient.CustomResource/Pages/ViewModel/ProductionDataViewModel.cs
  45. +8
    -8
      BPASmartClient.CustomResource/Pages/ViewModel/RecipeCompleteViewModel.cs
  46. +8
    -8
      BPASmartClient.CustomResource/Pages/ViewModel/ReportViewModel.cs
  47. +8
    -8
      BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs
  48. +26
    -26
      BPASmartClient.CustomResource/Pages/ViewModel/UserConfigViewModel.cs
  49. +8
    -8
      BPASmartClient.CustomResource/Pages/ViewModel/UserLogViewModel.cs
  50. +11
    -11
      BPASmartClient.CustomResource/Pages/ViewModel/UserManageViewModel.cs
  51. +13
    -13
      BPASmartClient.CustomResource/Pages/ViewModel/UserManagerViewModel.cs
  52. +6
    -6
      BPASmartClient.CustomResource/Pages/ViewModel/VariableViewModel.cs
  53. +42
    -43
      BPASmartClient.DRCoffee/CoffeeMachine.cs
  54. +8
    -7
      BPASmartClient.DRCoffee/CommandHandler.cs
  55. +2
    -2
      BPASmartClient.DRCoffee/MorkCStatus.cs
  56. +6
    -7
      BPASmartClient.Device/AlarmHelper.cs
  57. +0
    -1
      BPASmartClient.Device/BPASmartClient.Device.csproj
  58. +12
    -14
      BPASmartClient.Device/BaseDevice.cs
  59. +1
    -1
      BPASmartClient.Device/IDevice.cs
  60. +2
    -2
      BPASmartClient.Device/VariableMonitor.cs
  61. +55
    -1
      BPASmartClient.Device/VariableMonitorAttribute.cs
  62. +3
    -3
      BPASmartClient.DosingSystemSingle/App.xaml.cs
  63. +1
    -1
      BPASmartClient.DosingSystemSingle/BPASmartClient.DosingSystemSingle.csproj
  64. +4
    -4
      BPASmartClient.DosingSystemSingle/Model/DeviceInquire.cs
  65. +2
    -2
      BPASmartClient.DosingSystemSingle/Service/SiemensDevice.cs
  66. +1
    -1
      BPASmartClient.DosingSystemSingle/View/HardwareStatusView.xaml.cs
  67. +1
    -1
      BPASmartClient.DosingSystemSingle/View/ManualControlView.xaml.cs
  68. +1
    -1
      BPASmartClient.DosingSystemSingle/View/NewMaterialView.xaml.cs
  69. +1
    -1
      BPASmartClient.DosingSystemSingle/ViewModel/HardwareStatusViewModel.cs
  70. +1
    -1
      BPASmartClient.DosingSystemSingle/ViewModel/ManualControlViewModel.cs
  71. +2
    -2
      BPASmartClient.DosingSystemSingle/ViewModel/RecipeControlViewModel.cs
  72. +0
    -4
      BPASmartClient.EventBus/BPASmartClient.EventBus.csproj
  73. +3
    -3
      BPASmartClient.FoodStationTest/App.xaml.cs
  74. +1
    -1
      BPASmartClient.FoodStationTest/BPASmartClient.FoodStationTest.csproj
  75. +2
    -2
      BPASmartClient.FoodStationTest/Model/Bom/BomMaterial.cs
  76. +2
    -2
      BPASmartClient.FoodStationTest/Model/GVL/PlcInfos.cs
  77. +2
    -2
      BPASmartClient.FoodStationTest/Model/HK_PLC/HKDeviceStatus.cs
  78. +2
    -2
      BPASmartClient.FoodStationTest/Model/Par/ConnectParMode.cs
  79. +9
    -9
      BPASmartClient.FoodStationTest/Model/ProcessControl.cs
  80. +2
    -2
      BPASmartClient.FoodStationTest/Model/RawMaterial/DeviceCurrentStatus.cs
  81. +14
    -14
      BPASmartClient.FoodStationTest/Model/RawMaterial/DeviceInquire.cs
  82. +2
    -2
      BPASmartClient.FoodStationTest/Model/RawMaterial/DevicePar.cs
  83. +2
    -2
      BPASmartClient.FoodStationTest/Model/RawMaterial/DeviceParModel.cs
  84. +2
    -2
      BPASmartClient.FoodStationTest/Model/RawMaterial/RawMaterialColl.cs
  85. +2
    -2
      BPASmartClient.FoodStationTest/Model/RawMaterial/RawMaterialStockBin.cs
  86. +2
    -2
      BPASmartClient.FoodStationTest/Model/RawMaterial/RecipeModel.cs
  87. +2
    -2
      BPASmartClient.FoodStationTest/Model/Recipe/RemoteRecipeData.cs
  88. +2
    -2
      BPASmartClient.FoodStationTest/Model/Recipe/RemoteRecipeRawMaterial.cs
  89. +1
    -1
      BPASmartClient.FoodStationTest/View/ChangeDeviceNameView.xaml.cs
  90. +1
    -1
      BPASmartClient.FoodStationTest/View/NewLocalRecipeView.xaml.cs
  91. +1
    -1
      BPASmartClient.FoodStationTest/View/NewRecipeView.xaml.cs
  92. +1
    -1
      BPASmartClient.FoodStationTest/View/RecipeInfosView.xaml.cs
  93. +1
    -1
      BPASmartClient.FoodStationTest/View/SelectRecipesView.xaml.cs
  94. +14
    -14
      BPASmartClient.FoodStationTest/ViewModel/BomOfMaterialViewModel.cs
  95. +8
    -8
      BPASmartClient.FoodStationTest/ViewModel/ChangeDeviceNameViewModel.cs
  96. +11
    -11
      BPASmartClient.FoodStationTest/ViewModel/DeviceListViewModel.cs
  97. +10
    -10
      BPASmartClient.FoodStationTest/ViewModel/DeviceMaterialParViewModel.cs
  98. +2
    -2
      BPASmartClient.FoodStationTest/ViewModel/HardwareStatusViewModel.cs
  99. +6
    -6
      BPASmartClient.FoodStationTest/ViewModel/ManualCommViewModel.cs
  100. +42
    -42
      BPASmartClient.FoodStationTest/ViewModel/ManualControlViewModel.cs

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

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

<ItemGroup>
<PackageReference Include="BPA.ApolloClient" Version="1.0.12" />
<PackageReference Include="BPA.Helper" Version="1.0.54" />
<PackageReference Include="BPA.Communication" Version="1.0.116" />
<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" />
@@ -17,10 +17,8 @@

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Device\BPASmartClient.Device.csproj" />
<ProjectReference Include="..\BPASmartClient.Helper\BPASmartClient.Helper.csproj" />
<ProjectReference Include="..\BPASmartClient.Http\BPASmartClient.Http.csproj" />
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.MQTT\BPASmartClient.MQTT.csproj" />
</ItemGroup>

</Project>

+ 2
- 2
BPASmartClient.Business/InternetInfo.cs View File

@@ -7,8 +7,8 @@ using System.Configuration;
using System.IO;
using Microsoft.Extensions.Configuration;
using System.Threading;
using BPASmartClient.Helper;
using BPASmartClient.Message;
using BPA.Helper;
using BPA.ApolloClient;
using BPA.ApolloClient.Options;
using Com.Ctrip.Framework.Apollo;


+ 15
- 8
BPASmartClient.Business/LocalMqtt.cs View File

@@ -1,5 +1,5 @@
using BPA.Message;
using BPASmartClient.MQTT;
using BPA.Communication;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
@@ -9,7 +9,7 @@ using System.Threading.Tasks;

namespace BPASmartClient.Business
{
public class LocalMqtt
public class LocalMqtt
{
private volatile static LocalMqtt _Instance;
public static LocalMqtt GetInstance => _Instance ?? (_Instance = new LocalMqtt());
@@ -20,7 +20,7 @@ namespace BPASmartClient.Business
/// </summary>
SendScreenDataModel MqttPushs = new SendScreenDataModel();

MQTTProxy mQTTProxy = new MQTTProxy();
MqttHelper mQTTProxy = new MqttHelper();

ScreenDeviceType LocDeviceType;

@@ -35,23 +35,30 @@ namespace BPASmartClient.Business
LocDeviceType = DeviceType;
mQTTProxy.Connected = new Action(() =>
{
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(DeviceType)) ;
mQTTProxy.Subscrib(ScreenTOPIC.GetInstance.GetTopic(DeviceType));
});
MQTT_IP = System.Configuration.ConfigurationManager.AppSettings["MQTT_DevieScreem_IP"].ToString();
MQTT_PORT = System.Configuration.ConfigurationManager.AppSettings["MQTT_DevieScreem_Port"].ToString();
MQTT_USERNAME = System.Configuration.ConfigurationManager.AppSettings["MQTT_DevieScreem_User"].ToString();
MQTT_PASSWORD = System.Configuration.ConfigurationManager.AppSettings["MQTT_DevieScreem_Password"].ToString();

mQTTProxy.Connect(MQTT_USERNAME, MQTT_PASSWORD, MQTT_IP, int.Parse(MQTT_PORT), $"{DeviceType}_设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");//"10.2.1.254""admin", "public"
mQTTProxy.Connect(new BPA.Communication.Base.ConfigurationOptions()
{
UserName = MQTT_USERNAME,
Password = MQTT_PASSWORD,
IpAddress = MQTT_IP,
Port = int.Parse(MQTT_PORT),
ClientId = $"{DeviceType}_设备监听数据{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}"
});
}

public void Start()
{
}


/// <summary>
/// MQTT消息推送


+ 1
- 2
BPASmartClient.Business/MainConsole.cs View File

@@ -1,5 +1,4 @@
using BPASmartClient.Message;
using HBLConsole.Communication;

using System;
using System.Collections.Generic;
using System.Linq;


+ 3
- 4
BPASmartClient.Business/Plugin/ConfigMgr.cs View File

@@ -1,7 +1,6 @@
using BPA.ApolloClient;
using BPA.Message;
using BPASmartClient.Helper;
using BPASmartClient.Message;
using BPA.Helper;

using BPASmartClient.Model;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
@@ -45,7 +44,7 @@ namespace BPASmartClient.Business
public void Initialize()
{
var text = TextHelper.GetInstance.ReadTextInfo("StartShop", "DeviceConfig");
string path = $"{LocaPath.GetInstance().GetDeviceConfigPath}{text}.json";
string path = $"{LocaPath.GetDeviceConfigPath}{text}.json";
if (File.Exists(path))
{
string JsonString = File.ReadAllText(path);


+ 5
- 6
BPASmartClient.Business/Plugin/DeviceMgr.cs View File

@@ -1,9 +1,8 @@
using BPA.Message;
using BPASmartClient.Device;
using BPASmartClient.EventBus;
using BPASmartClient.Helper;
using BPASmartClient.Http;
using BPASmartClient.Message;

using BPA.Helper;

using BPASmartClient.Model;
using BPASmartClient.Model.小炒机;
using BPASmartClient.Model.调酒机;
@@ -52,7 +51,7 @@ namespace BPASmartClient.Business
{
var result = Plugin.GetInstance().GetPlugin<ConfigMgr>()?.deviceConfigModelJsons;
//var text = TextHelper.GetInstance.ReadTextInfo("StartShop", "DeviceConfig");
//string path = $"{LocaPath.GetInstance().GetDeviceConfigPath}{text}.json";
//string path = $"{LocaPath.GetDeviceConfigPath}{text}.json";
//if (File.Exists(path))
//{
//string JsonString = File.ReadAllText(path);
@@ -105,7 +104,7 @@ namespace BPASmartClient.Business
var jsondata = new { clientId, PushType };
string header = $"[/stock/GetItemInfo]_[{DateTime.Now.Ticks}]".AESEncrypt();
string url = $"{InternetInfo.StockServer}GetItemInfo";
result = APIHelper.GetInstance.HttpRequest(url, header, jsondata, RequestType.POST);
result = APIHelper.GetInstance.HttpRequest(url, jsondata, header, RequestType.POST);

if (PushType == 1)
{


+ 27
- 22
BPASmartClient.Business/Plugin/MQTTMgr.cs View File

@@ -1,8 +1,7 @@
using BPA.Message;
using BPASmartClient.Helper;
using BPASmartClient.Message;
using BPASmartClient.MQTT;
using HBLConsole.Communication;
using BPA.Helper;

using BPA.Communication;
using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Concurrent;
@@ -29,7 +28,8 @@ namespace BPASmartClient.Business
//消息缓存
private ConcurrentQueue<string> msg = new ConcurrentQueue<string>();
//MQTT 代理
private MQTTProxy mqttProxy = new MQTTProxy();
private MqttHelper mqttProxy = new MqttHelper();

//消息处理者
private List<RecivedHandle> messageRecives = new List<RecivedHandle>();

@@ -43,30 +43,35 @@ namespace BPASmartClient.Business
running = true;
//主题初始化
TopicDefine.GetInstance().Initialize(Plugin.GetInstance().GetPlugin<DeviceMgr>().GetDevices());
//MQTT 连接成功
mqttProxy.Connected = new Action(() =>
{
mqttProxy.Subscrib(TopicDefine.GetInstance().SubscribTopics.ToArray());
});
//MQTT 连接成功
mqttProxy.LostConnect = new Action(() =>

mqttProxy.Connected = () =>
{
mqttProxy.Subscrib(TopicDefine.GetInstance().SubscribTopics.ToArray());
});
};

//MQTT 数据接收
mqttProxy.MessageRecive = new Action<string>((message) =>
{
msg.Enqueue(message);
});
mqttProxy.MessageRecive = s => { msg.Enqueue(s); };

var MqttServerConfig = Plugin.GetInstance().GetPlugin<ConfigMgr>().MQTT_Config;
var MqttServerAccount = Plugin.GetInstance().GetPlugin<ConfigMgr>().Mqtt_Account;
var deviceConfig = Plugin.GetInstance().GetPlugin<ConfigMgr>().deviceConfigModelJsons;
string deviceId = deviceConfig[0].deviceModels[0].DeviceId;
string deviceId = "";
if (deviceConfig.Count > 0 && deviceConfig[0].deviceModels.Count > 0)
{
deviceId = deviceConfig[0].deviceModels[0].DeviceId;
}
clientId = Plugin.GetInstance().GetPlugin<ConfigMgr>().ClientId;
//MQTT 初始化
mqttProxy.Connect(MqttServerAccount.UserName, MqttServerAccount.Password, MqttServerConfig.Host, MqttServerConfig.Port, "ClientId:" + clientId + "DeviceId:" + deviceId + Guid.NewGuid().ToString());
mqttProxy.Connect(new BPA.Communication.Base.ConfigurationOptions()
{
UserName = MqttServerAccount.UserName,
Password = MqttServerAccount.Password,
IpAddress = MqttServerConfig.Host,
Port = MqttServerConfig.Port,
ClientId = $"ClientId-[{clientId}]-DeviceId-[{deviceId}]-{Guid.NewGuid()}"
});

ThreadManage.GetInstance().Start(() =>
TaskManage.GetInstance.Start(() =>
{
while (running)
{
@@ -88,7 +93,7 @@ namespace BPASmartClient.Business
}
Thread.Sleep(50);
}
}, "MQTT 消息处理", true);
}, "MQTT 消息处理", isRestart: true);
}

/// <summary>
@@ -115,7 +120,7 @@ namespace BPASmartClient.Business
public void Dispose()
{
running = false;
mqttProxy.CloseConnect();
mqttProxy.Dispose();
messageRecives.Clear();
}



+ 10
- 10
BPASmartClient.Business/Plugin/OrderProxy.cs View File

@@ -3,10 +3,10 @@ using BPA.Message;
using BPA.Message.Enum;
using BPA.Models;
using BPASmartClient.Device;
using BPASmartClient.EventBus;
using BPASmartClient.Helper;
using BPASmartClient.Http;
using BPASmartClient.Message;
using BPA.Helper;
using BPASmartClient.Model;
using BPASmartClient.Model.小炒机;
using BPASmartClient.Model.调酒机;
@@ -18,7 +18,7 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static BPASmartClient.EventBus.EventBus;
using static BPA.Helper.EventBus;

namespace BPASmartClient.Business
{
@@ -44,7 +44,7 @@ namespace BPASmartClient.Business
deviceMgr = Plugin.GetInstance().GetPlugin<DeviceMgr>();
if (InternetInfo.IsEnableTest)
{
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
while (morkOrderPushes.Count > 0)
{
@@ -136,12 +136,12 @@ namespace BPASmartClient.Business
}
});

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

private void StartTargetDeviceOrderJob(int deviceId)
{
ThreadManage.GetInstance().Start(() =>
TaskManage.GetInstance.Start(() =>
{
var device = deviceMgr.GetDevices().FirstOrDefault(p => p.DeviceId == deviceId);
while (running)
@@ -164,7 +164,7 @@ namespace BPASmartClient.Business
}
Thread.Sleep(50);
}
}, $"MQTT 订单接收处理-设备[{deviceId}]", true);
}, $"MQTT 订单接收处理-设备[{deviceId}]", isRestart: true);
}

public void OrderStatusChangedHandle(IEvent @event, EventCallBackHandle callBack)
@@ -186,7 +186,7 @@ namespace BPASmartClient.Business
{
string header = $"[{InternetInfo.OrderServer}/order/robotstatuschange]_[{DateTime.Now.Ticks}]".AESEncrypt();
string url = $"{InternetInfo.OrderServer}order/robotstatuschange";
result = APIHelper.GetInstance.HttpRequest(url, header, orderStatusChange, RequestType.POST);
result = APIHelper.GetInstance.HttpRequest(url, orderStatusChange, header, RequestType.POST);
}
catch (Exception ex)
{


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

@@ -1,4 +1,4 @@
using BPASmartClient.Helper;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;


+ 6
- 6
BPASmartClient.Business/Plugin/StatusMgr.cs View File

@@ -1,5 +1,5 @@
using BPA.Message;
using BPASmartClient.Helper;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -33,7 +33,7 @@ namespace BPASmartClient.Business
public void Start()
{
running = true;
ThreadManage.GetInstance().Start(() =>
TaskManage.GetInstance.Start(() =>
{
while (running)
{
@@ -44,11 +44,11 @@ namespace BPASmartClient.Business
}
Thread.Sleep(50);
}
}, "设备状态收集", true);
}, "设备状态收集", isRestart: true);

deviceStatus.BatchingInfo = new List<BPA.Models.BatchingInfo>();

ThreadManage.GetInstance().Start(() =>
TaskManage.GetInstance.Start(() =>
{
while (running)
{
@@ -59,13 +59,13 @@ namespace BPASmartClient.Business

deviceStatus.Healthy = device.IsHealth ? BPA.Message.Enum.DeviceHealthy.Health : BPA.Message.Enum.DeviceHealthy.UnHealth;
deviceStatus.DeviceType = device.DeviceType;
deviceStatus.BatchingInfo = device.BatchingInfos;
deviceStatus.BatchingInfo = device.BatchingInfos;
var msg = BPAPackage.Make(deviceStatus, device.DeviceId, device.DeviceType);
mqttMgr.Publish(TopicDefine.GetInstance().PushHeartbeatTopics[device.DeviceType], msg.Serialize());
}
Thread.Sleep(1000);
}
}, "设备心跳上报", true);
}, "设备心跳上报", isRestart: true);
}

public void Dispose()


+ 1
- 1
BPASmartClient.Business/TopicDefine.cs View File

@@ -1,7 +1,7 @@
using BPA.Message;
using BPA.Message.Enum;
using BPASmartClient.Device;
using BPASmartClient.Helper;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;


+ 5
- 7
BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj View File

@@ -9,9 +9,13 @@

<ItemGroup>
<Compile Remove="Fonts\Debug\**" />
<Compile Remove="Resources\**" />
<EmbeddedResource Remove="Fonts\Debug\**" />
<EmbeddedResource Remove="Resources\**" />
<None Remove="Fonts\Debug\**" />
<None Remove="Resources\**" />
<Page Remove="Fonts\Debug\**" />
<Page Remove="Resources\**" />
</ItemGroup>

<ItemGroup>
@@ -459,14 +463,12 @@
</ItemGroup>

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

<ItemGroup>
<ProjectReference Include="..\BPASmartClient.Helper\BPASmartClient.Helper.csproj" />
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" />
<ProjectReference Include="..\BPASmartClient.Nfc\BPASmartClient.Nfc.csproj" />
</ItemGroup>
@@ -638,8 +640,4 @@
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>

</Project>

+ 14
- 137
BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs View File

@@ -1,5 +1,5 @@
using BPASmartClient.CustomResource.Pages.ViewModel;
using BPASmartClient.Helper;
using BPA.Helper;
using BPASmartClient.Model;
using System;
using System.Collections.Concurrent;
@@ -31,8 +31,8 @@ namespace BPASmartClient.CustomResource.Pages.Model
private AlarmHelper() { }


public static ObservableCollection<Alarm> Alarms { get; set; } = new ObservableCollection<Alarm>();
public static List<Alarm> HistoryAlarms { get; set; } = new List<Alarm>();
public static ObservableCollection<BPASmartClient.Model.Alarm> Alarms { get; set; } = new ObservableCollection<BPASmartClient.Model.Alarm>();
public static List<BPASmartClient.Model.Alarm> HistoryAlarms { get; set; } = new List<BPASmartClient.Model.Alarm>();
static ConcurrentDictionary<string, bool> flagbit = new ConcurrentDictionary<string, bool>();
static ConcurrentDictionary<string, Delay> delays = new ConcurrentDictionary<string, Delay>();
public static Action<string> AddAction { get; set; }
@@ -44,7 +44,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
public static void Init()
{
AlarmViewModel.AlarmInfos = Alarms;
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
if (_Instance != null)
{
@@ -97,7 +97,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
/// <param name="AlarmInfo">报警信息</param>
private static void AddAlarm(object value, string AlarmInfo, AlarmLevel alarmLevel)
{
Alarm tempAlarm = new Alarm()
BPASmartClient.Model.Alarm tempAlarm = new BPASmartClient.Model.Alarm()
{
NumId = Alarms.Count + 1,
Date = DateTime.Now.ToString("yyyy/MM/dd"),
@@ -106,9 +106,16 @@ namespace BPASmartClient.CustomResource.Pages.Model
Value = value.ToString(),
Time = DateTime.Now.ToString("HH:mm:ss"),
};
try
{
var res = Sqlite<BPASmartClient.Model.Alarm>.GetInstance.Base.Add(tempAlarm);
Sqlite<BPASmartClient.Model.Alarm>.GetInstance.Save();
}
catch (Exception)
{
}

var res = Sqlite<Alarm>.GetInstance.Base.Add(tempAlarm);
Sqlite<Alarm>.GetInstance.Save();

if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null)
{
@@ -145,134 +152,4 @@ namespace BPASmartClient.CustomResource.Pages.Model

}

//public class AlarmHelper<AlarmT> where AlarmT : class, new()
//{


// //private volatile static ConcurrentDictionary<string, AlarmT> _Instance;
// //public static AlarmT GetInstance(string name)
// //{
// // if (_Instance == null) _Instance = new ConcurrentDictionary<string, AlarmT>();
// // if (!_Instance.ContainsKey(name)) _Instance.TryAdd(name, new AlarmT());
// // return _Instance[name];
// //}
// //private AlarmHelper() { }


// public static ObservableCollection<Alarm> Alarms { get; set; } = new ObservableCollection<Alarm>();
// public static List<Alarm> HistoryAlarms { get; set; } = new List<Alarm>();
// static ConcurrentDictionary<string, bool> flagbit = new ConcurrentDictionary<string, bool>();
// static ConcurrentDictionary<string, Delay> delays = new ConcurrentDictionary<string, Delay>();
// public static Action<string> AddAction { get; set; }
// public static Action<string> RemoveAction { get; set; }
// public static Action ChangeAction { get; set; }

// public static AlarmT Alarm { get; set; } = new AlarmT();

// public static void Init()
// {
// AlarmViewModel.AlarmInfos = Alarms;
// ThreadManage.GetInstance().StartLong(new Action(() =>
// {
// foreach (var item in Alarm.GetType().GetProperties())
// {
// if (item.CustomAttributes.Count() > 0)
// {
// var AlarmModel = item.GetCustomAttribute<AlarmAttribute>();
// if (AlarmModel != null)
// {
// bool value = Convert.ToBoolean(Alarm.GetType().GetProperty(item.Name)?.GetValue(Alarm));
// EdgeAlarm(value, AlarmModel.AlarmInfo, 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType);
// }
// }
// }
// Thread.Sleep(100);
// }), $"{typeof(AlarmT).Name},报警通用模块监听");

// }


// //public static void AnalogAlarm(dynamic Trigger, string info, dynamic HH = null, dynamic H = 0, dynamic L = 0, dynamic LL = 0)
// //{

// //}




// /// <summary>
// /// 沿报警检测
// /// </summary>
// /// <param name="Trigger">触发变量</param>
// /// <param name="text">报警信息</param>
// /// <param name="edgeType">触发类型,上升沿 或 下降沿</param>
// private static void EdgeAlarm(bool Trigger, string text, int delay = 2, AlarmLevel alarmLevel = AlarmLevel.一般报警, AlarmTriggerType edgeType = AlarmTriggerType.Rising)
// {
// if (!flagbit.ContainsKey(text)) flagbit.TryAdd(text, false);
// if (!delays.ContainsKey(text)) delays.TryAdd(text, Delay.GetInstance(text));
// if (edgeType == AlarmTriggerType.Rising ? delays[text].Start(Trigger, delay) : delays[text].Start(!Trigger, delay))
// {
// if (edgeType == AlarmTriggerType.Rising ? !flagbit[text] : flagbit[text])
// {
// AddAlarm(Trigger, text, alarmLevel);
// flagbit[text] = edgeType == AlarmTriggerType.Rising ? true : false;
// }
// }
// else RemoveAlarm(text);
// if (edgeType == AlarmTriggerType.Rising ? flagbit[text] : !flagbit[text]) flagbit[text] = Trigger;
// }

// /// <summary>
// /// 添加报警信息
// /// </summary>
// /// <param name="AlarmInfo">报警信息</param>
// private static void AddAlarm(object value, string AlarmInfo, AlarmLevel alarmLevel)
// {
// Alarm tempAlarm = new Alarm()
// {
// NumId = Alarms.Count + 1,
// Date = DateTime.Now.ToString("yyyy/MM/dd"),
// Grade = alarmLevel.ToString(),
// Info = AlarmInfo,
// Value = value.ToString(),
// Time = DateTime.Now.ToString("HH:mm:ss"),
// };

// var res = Sqlite<Alarm>.GetInstance.Base.Add(tempAlarm);
// Sqlite<Alarm>.GetInstance.Save();

// if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null)
// {
// Application.Current.Dispatcher.Invoke(new Action(() =>
// {
// Alarms.Insert(0, tempAlarm);
// for (int i = 0; i < Alarms.Count; i++) { Alarms.ElementAt(i).NumId = i + 1; }
// }));

// AddAction?.Invoke(AlarmInfo);//添加报警通知
// ChangeAction?.Invoke();//更改报警通知
// }
// }

// /// <summary>
// /// 移除报警信息
// /// </summary>
// /// <param name="AlarmInfo">报警信息</param>
// private static void RemoveAlarm(string AlarmInfo)
// {
// var result = Alarms.FirstOrDefault(p => p.Info == AlarmInfo);
// if (result != null)
// {
// Application.Current.Dispatcher.Invoke(new Action(() =>
// {
// Alarms.Remove(result);
// for (int i = 0; i < Alarms.Count; i++) { Alarms.ElementAt(i).NumId = i + 1; }
// }));

// if (RemoveAction != null) RemoveAction(AlarmInfo);
// if (ChangeAction != null) ChangeAction();
// }
// }

//}
}

+ 7
- 7
BPASmartClient.CustomResource/Pages/Model/AlarmTest.cs View File

@@ -1,5 +1,5 @@
using BPASmartClient.CustomResource.Pages.ViewModel;
using BPASmartClient.Helper;
using BPA.Helper;
using BPASmartClient.Model;
using System;
using System.Collections.Concurrent;
@@ -28,8 +28,8 @@ namespace BPASmartClient.CustomResource.Pages.Model
private AlarmTest() { }


public static ObservableCollection<Alarm> Alarms { get; set; } = new ObservableCollection<Alarm>();
public static List<Alarm> HistoryAlarms { get; set; } = new List<Alarm>();
public static ObservableCollection<BPASmartClient.Model.Alarm> Alarms { get; set; } = new();
public static List<BPASmartClient.Model.Alarm> HistoryAlarms { get; set; } = new();
static ConcurrentDictionary<string, bool> flagbit = new ConcurrentDictionary<string, bool>();
static ConcurrentDictionary<string, Delay> delays = new ConcurrentDictionary<string, Delay>();
public static Action<string> AddAction { get; set; }
@@ -41,7 +41,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
public static void Init()
{
AlarmViewModel.AlarmInfos = Alarms;
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
if (_Instance != null)
{
@@ -94,7 +94,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
/// <param name="AlarmInfo">报警信息</param>
private static void AddAlarm(object value, string AlarmInfo, AlarmLevel alarmLevel)
{
Alarm tempAlarm = new Alarm()
BPASmartClient.Model.Alarm tempAlarm = new BPASmartClient.Model.Alarm()
{
NumId = Alarms.Count + 1,
Date = DateTime.Now.ToString("yyyy/MM/dd"),
@@ -104,8 +104,8 @@ namespace BPASmartClient.CustomResource.Pages.Model
Time = DateTime.Now.ToString("HH:mm:ss"),
};

var res = Sqlite<Alarm>.GetInstance.Base.Add(tempAlarm);
Sqlite<Alarm>.GetInstance.Save();
var res = Sqlite<BPASmartClient.Model.Alarm>.GetInstance.Base.Add(tempAlarm);
Sqlite<BPASmartClient.Model.Alarm>.GetInstance.Save();

if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null)
{


+ 4
- 4
BPASmartClient.CustomResource/Pages/Model/MenuManage.cs View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using BPASmartClient.CustomResource.Pages.Enums;
using System.Windows;

@@ -13,7 +13,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
/// <summary>
/// 在启动界面之前设置菜单项
/// </summary>
public class MenuManage : ObservableObject
public class MenuManage : NotifyBase
{
private volatile static MenuManage _Instance;
public static MenuManage GetInstance => _Instance ?? (_Instance = new MenuManage());
@@ -22,7 +22,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
public ObservableCollection<MenuModel> menuModels { get; set; } = new ObservableCollection<MenuModel>();
}

public class MenuModel : ObservableObject
public class MenuModel : NotifyBase
{

private Permission[] pers
@@ -84,7 +84,7 @@ namespace BPASmartClient.CustomResource.Pages.Model

}

public class SubMenumodel : ObservableObject
public class SubMenumodel : NotifyBase
{
/// <summary>
/// 子菜单名称


+ 16
- 8
BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs View File

@@ -1,4 +1,4 @@
using BPASmartClient.Helper;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -35,16 +35,24 @@ namespace BPASmartClient.CustomResource.Pages.Model

public ObservableCollection<UserLog> userLogs { get; set; } = new();

public ObservableCollection<Alarm> alarmLogs { get; set; } = new();
public ObservableCollection<BPASmartClient.Model.Alarm> alarmLogs { get; set; } = new();

public ObservableCollection<RecipeCompleteLog> recipeLogs { get; set; } = new();

public void LogSave()
{
Sqlite<UserLog>.GetInstance.Save();
Sqlite<RunLog>.GetInstance.Save();
Sqlite<Alarm>.GetInstance.Save();
Sqlite<RecipeCompleteLog>.GetInstance.Save();
try
{
Sqlite<UserLog>.GetInstance.Save();
Sqlite<RunLog>.GetInstance.Save();
Sqlite<BPASmartClient.Model.Alarm>.GetInstance.Save();
Sqlite<RecipeCompleteLog>.GetInstance.Save();
}
catch (Exception)
{

// throw;
}
}

public void ShowRecipeLog(string info)
@@ -122,7 +130,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
lock (alarmlock)
{
AlarmID++;
Alarm alarmLog = new Alarm()
BPASmartClient.Model.Alarm alarmLog = new BPASmartClient.Model.Alarm()
{
NumId = AlarmID,
Date = DateTime.Now.ToString("yyyy-MM-dd"),
@@ -131,7 +139,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
Value = AlarmNumber,
Grade = (level) + ""
};
Sqlite<Alarm>.GetInstance.Base.Add(alarmLog);
Sqlite<BPASmartClient.Model.Alarm>.GetInstance.Base.Add(alarmLog);
Application.Current.Dispatcher.Invoke(new Action(() => { alarmLogs.Insert(0, alarmLog); }));
AlarmLog?.Invoke(info);
}


+ 4
- 3
BPASmartClient.CustomResource/Pages/Model/NfcServer.cs View File

@@ -1,4 +1,5 @@
using BPASmartClient.CustomResource.Pages.ViewModel;
using BPA.Helper;
using BPASmartClient.CustomResource.Pages.ViewModel;
using BPASmartClient.Nfc;
using System;
using System.Collections.Generic;
@@ -28,10 +29,10 @@ namespace BPASmartClient.CustomResource.Pages.Model
if (NFCHelper.GetInstance.GetReadResult?.CardNum.Length > 0)
{
string id = NFCHelper.GetInstance.GetReadResult?.CardNum;
var res = Global.userManager.userInfos.FirstOrDefault(p => p.CardId == id) ;
var res = Global.userManager.userInfos.FirstOrDefault(p => p.CardId == id);
if (res != null)
{
BPASmartClient.Message.MessageLog.GetInstance.ShowDebugLog("NFC卡登录");
MessageLog.GetInstance.Show("NFC卡登录");
LoginViewModel.NfcLogin(id);
}
}


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

@@ -1,4 +1,4 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -9,7 +9,7 @@ using System.Threading.Tasks;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class PlcVariableInfoManage:ObservableObject
public class PlcVariableInfoManage:NotifyBase
{
public ConcurrentDictionary<string, ObservableCollection<PlcVariableInfoModel>> VariablesInfo { get; set; } = new ConcurrentDictionary<string, ObservableCollection<PlcVariableInfoModel>>();
}


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

@@ -1,5 +1,5 @@

using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -8,7 +8,7 @@ using System.Threading.Tasks;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class PlcVariableInfoModel : ObservableObject
public class PlcVariableInfoModel : NotifyBase
{
//public int Id { get { return _id; } set { _id = value;OnPropertyChanged(); } }
//private int _id;


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

@@ -6,7 +6,7 @@ using System.Threading.Tasks;
using System.Collections.ObjectModel;
using System.Windows;
using System.IO;
using BPASmartClient.Helper;
using BPA.Helper;

namespace BPASmartClient.CustomResource.Pages.Model
{


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

@@ -1,4 +1,4 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
@@ -8,7 +8,7 @@ using System.Threading.Tasks;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class RecipeCompleteLog : ObservableObject
public class RecipeCompleteLog : NotifyBase
{
[Key]
public int Id { get; set; }


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

@@ -4,12 +4,12 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;

namespace BPASmartClient.CustomResource.Pages.Model
{
[Serializable]
public class ReportBase : ObservableObject
public class ReportBase : NotifyBase
{
}
}

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

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using BPASmartClient.Helper;
using BPA.Helper;


namespace BPASmartClient.CustomResource.Pages.Model


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

@@ -4,7 +4,7 @@ using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;

namespace BPASmartClient.CustomResource.Pages.Model
{


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

@@ -4,11 +4,11 @@ using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class RunLog : ObservableObject
public class RunLog : NotifyBase
{
[Key]
public int Id { get; set; }


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

@@ -1,6 +1,6 @@
using BPASmartClient.CustomResource.Pages.Enums;
using BPASmartClient.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -9,7 +9,7 @@ using System.Threading.Tasks;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class UserInfo : ObservableObject
public class UserInfo : NotifyBase
{
public String LastLogInTime { get; set; } = "无";



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

@@ -4,11 +4,11 @@ using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class UserLog : ObservableObject
public class UserLog : NotifyBase
{
[Key]
public int Id { get; set; }


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

@@ -1,4 +1,4 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -7,7 +7,7 @@ using System.Threading.Tasks;

namespace BPASmartClient.CustomResource.Pages.Model
{
public class UserTreeViewModel: ObservableObject
public class UserTreeViewModel: NotifyBase
{
public string Name { get; set; }



+ 3
- 2
BPASmartClient.CustomResource/Pages/Model/VoiceAPI.cs View File

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

using BPA.Helper;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -19,7 +20,7 @@ namespace BPASmartClient.CustomResource

static VoiceAPI()
{
BPA.Helper.ThreadManage.GetInstance().StartLong(new Action(() =>
BPA.Helper.TaskManage.GetInstance.StartLong(new Action(() =>
{
while (msg.Count > 0)
{


+ 1
- 1
BPASmartClient.CustomResource/Pages/View/AddNewUser.xaml.cs View File

@@ -1,4 +1,4 @@
using BPASmartClient.Helper;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;


+ 1
- 1
BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs View File

@@ -1,5 +1,5 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Diagnostics;


+ 1
- 1
BPASmartClient.CustomResource/Pages/View/NfcSetView.xaml.cs View File

@@ -1,5 +1,5 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;


+ 1
- 1
BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml.cs View File

@@ -1,4 +1,4 @@
using BPASmartClient.Helper;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;


+ 1
- 1
BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml.cs View File

@@ -1,5 +1,5 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;


+ 1
- 1
BPASmartClient.CustomResource/Pages/View/UserConfigView.xaml.cs View File

@@ -1,4 +1,4 @@
using BPASmartClient.Helper;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;


+ 9
- 11
BPASmartClient.CustomResource/Pages/ViewModel/AddNewUserViewModel.cs View File

@@ -1,7 +1,5 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -10,7 +8,7 @@ using System.Threading.Tasks;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class AddNewUserViewModel:ObservableObject
public class AddNewUserViewModel : NotifyBase
{
public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
private string _mErrorInfo;
@@ -26,9 +24,9 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
public string NewPassword2 { get { return _mNewPassword2; } set { _mNewPassword2 = value; OnPropertyChanged(); } }
private string _mNewPassword2;

public RelayCommand ExitCommand { get; set; }
public BPARelayCommand ExitCommand { get; set; }

public RelayCommand ConfirmCommand { get; set; }
public BPARelayCommand ConfirmCommand { get; set; }

private void Confirm()
{
@@ -36,9 +34,9 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
if (NewPassword1 == null) { ErrorInfo = "请输入密码"; return; }
if (NewPassword2 != NewPassword1) { ErrorInfo = "两次密码不一致"; return; }
var res = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == UserName);
if (res != null) { ErrorInfo = "用户名已存在";return; }
if (res != null) { ErrorInfo = "用户名已存在"; return; }
Global.userManager.userInfos.Add(new UserInfo
{
{
UserName = UserName,
Password = NewPassword1,
userTreeViewModels = new List<UserTreeViewModel>()
@@ -49,12 +47,12 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel

public AddNewUserViewModel()
{
ConfirmCommand = new RelayCommand(Confirm);
ConfirmCommand = new BPARelayCommand(Confirm);

ExitCommand = new RelayCommand(() =>
ExitCommand = new BPARelayCommand(() =>
{
ActionManage.GetInstance.Send("AddNewUserViewCancel");
});
}
}


+ 10
- 11
BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs View File

@@ -3,12 +3,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System.Collections.Concurrent;
using System.Collections.ObjectModel;
using System.Windows;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;

using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Model;
using Google.Protobuf.WellKnownTypes;
@@ -16,11 +15,11 @@ using System.Threading;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class AlarmViewModel : ObservableObject
public class AlarmViewModel : NotifyBase
{
public AlarmViewModel()
{
ControlCommand = new RelayCommand(() =>
ControlCommand = new BPARelayCommand(() =>
{
if (ControlButText == "报警复位")
{
@@ -42,7 +41,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel

});

SwitchCommand = new RelayCommand(() =>
SwitchCommand = new BPARelayCommand(() =>
{
if (ButContent == "历史报警")
{
@@ -72,7 +71,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel

private void GetHistoryAlarm()
{
var data = Sqlite<Alarm>.GetInstance.GetData();
var data = Sqlite<BPASmartClient.Model.Alarm>.GetInstance.GetData();
if (data != null)
{
HistoryAlarm.Clear();
@@ -87,9 +86,9 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
}
}

public RelayCommand SwitchCommand { get; set; }
public BPARelayCommand SwitchCommand { get; set; }

public RelayCommand ControlCommand { get; set; }
public BPARelayCommand ControlCommand { get; set; }


public Visibility CurrentDataVis { get { return _mCurrentDataVis; } set { _mCurrentDataVis = value; OnPropertyChanged(); } }
@@ -132,8 +131,8 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
private DateTime _mEndDateTime = DateTime.Now;


public static ObservableCollection<Alarm> AlarmInfos { get; set; }
public ObservableCollection<Alarm> HistoryAlarm { get; set; } = new ObservableCollection<Alarm>();
public static ObservableCollection<BPASmartClient.Model.Alarm> AlarmInfos { get; set; }
public ObservableCollection<BPASmartClient.Model.Alarm> HistoryAlarm { get; set; } = new();

}
}

+ 3
- 3
BPASmartClient.CustomResource/Pages/ViewModel/DebugLogViewModel.cs View File

@@ -5,14 +5,14 @@ using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using BPA.Helper;
using System.Collections.ObjectModel;
using System.Windows.Media;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class DebugLogViewModel : ObservableObject
public class DebugLogViewModel : NotifyBase
{
public DebugLogViewModel()
{
@@ -38,7 +38,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel

}

public class MessageModel : ObservableObject
public class MessageModel : NotifyBase
{
public string LogInfo { get { return _mLogInfo; } set { _mLogInfo = value; OnPropertyChanged(); } }
private string _mLogInfo;


+ 8
- 8
BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs View File

@@ -5,21 +5,21 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;
using BPA.Helper;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class LoginViewModel : ObservableObject
public class LoginViewModel : NotifyBase
{
public LoginViewModel()
{
Config.GetInstance.Init();
ActionManage.GetInstance.Register(new Action(() => { Login(); }), "EnterLogin", true);
LoginCommand = new RelayCommand(() => { Login(); });
LoginCommand = new BPARelayCommand(() => { Login(); });

ExitCommand = new RelayCommand(() =>
ExitCommand = new BPARelayCommand(() =>
{
ActionManage.GetInstance.Send("ExitAction");
});
@@ -188,9 +188,9 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
}
}

public RelayCommand LoginCommand { get; set; }
public BPARelayCommand LoginCommand { get; set; }

public RelayCommand ExitCommand { get; set; }
public BPARelayCommand ExitCommand { get; set; }





+ 42
- 34
BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs View File

@@ -9,44 +9,27 @@ using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using BPA.Helper;
using BPASmartClient.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class MainViewModel : ObservableObject
public class MainViewModel : NotifyBase
{
public MainViewModel()
{
NavChangedCommand = new RelayCommand<object>(DoNavChanged);
BPASmartClient.Message. MessageLog.GetInstance.InfoNotify = new Action<string>((o) =>
{
Application.Current?.Dispatcher?.Invoke(() =>
{
//ff20aefe
var temp = new MessageModel()
{
LogInfo = o,
Forground = new SolidColorBrush(Color.FromArgb(255, 32, 174, 254))
};
if (DebugLogViewModel.MessageModels.Count > 0)
DebugLogViewModel.MessageModels.Insert(0, temp);
else
DebugLogViewModel.MessageModels.Add(temp);
});
});

BPASmartClient.Message.MessageLog.GetInstance.ExInfoNotify = new Action<string>((o) =>
NavChangedCommand = new BPARelayCommand<object>(DoNavChanged);
MessageLog.GetInstance.InfoNotify = new Action<string>((o) =>
{
Application.Current?.Dispatcher?.Invoke(() =>
{
//FFF53F62
//ff20aefe
var temp = new MessageModel()
{
LogInfo = o,
Forground = new SolidColorBrush(Color.FromArgb(255, 245, 63, 98))
Forground = new SolidColorBrush(Color.FromArgb(255, 32, 174, 254))
};
if (DebugLogViewModel.MessageModels.Count > 0)
DebugLogViewModel.MessageModels.Insert(0, temp);
@@ -55,15 +38,15 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
});
});

BPA.Helper.MessageLog.GetInstance.NotifyShow = new Action<string>((o) =>
MessageLog.GetInstance.ExInfoNotify = new Action<string>((o) =>
{
Application.Current?.Dispatcher?.Invoke(() =>
{
//ff20aefe
//FFF53F62
var temp = new MessageModel()
{
LogInfo = o,
Forground = new SolidColorBrush(Color.FromArgb(255, 32, 174, 254))
Forground = new SolidColorBrush(Color.FromArgb(255, 245, 63, 98))
};
if (DebugLogViewModel.MessageModels.Count > 0)
DebugLogViewModel.MessageModels.Insert(0, temp);
@@ -71,6 +54,31 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
DebugLogViewModel.MessageModels.Add(temp);
});
});

BPA.Helper.MessageLog.GetInstance.NotifyShow = new Action<string>((o) =>
{
try
{
Application.Current?.Dispatcher?.Invoke(() =>
{
//ff20aefe
var temp = new MessageModel()
{
LogInfo = o,
Forground = new SolidColorBrush(Color.FromArgb(255, 32, 174, 254))
};
if (DebugLogViewModel.MessageModels.Count > 0)
DebugLogViewModel.MessageModels.Insert(0, temp);
else
DebugLogViewModel.MessageModels.Add(temp);
});
}
catch (Exception)
{

//throw;
}
});
BPA.Helper.MessageLog.GetInstance.NotifyShowEx = new Action<string>((o) =>
{
Application.Current?.Dispatcher?.Invoke(() =>
@@ -98,9 +106,9 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel

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

private void PermissionChange()
@@ -160,20 +168,20 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
OnPropertyChanged();
}
}
private bool _isAlarm=true;
private bool _isAlarm = true;
/// <summary>
/// 心跳检测报警
/// </summary>
public bool IsAlarm
{
get { return _isAlarm; }
set { _isAlarm = value;OnPropertyChanged(); }
set { _isAlarm = value; OnPropertyChanged(); }
}
/// <summary>
/// 开机自启
/// </summary>
public bool AutoStart { get { return SystemHelper.GetInstance.IsAutoStart(); } set { SystemHelper.GetInstance.AutoStart(value); OnPropertyChanged(); } }
public RelayCommand<object> NavChangedCommand { get; set; }
public BPARelayCommand<object> NavChangedCommand { get; set; }

public FrameworkElement MainContent { get { return _mMainContent; } set { _mMainContent = value; OnPropertyChanged(); } }
private FrameworkElement _mMainContent;


+ 11
- 11
BPASmartClient.CustomResource/Pages/ViewModel/NfcSetViewModel.cs View File

@@ -3,18 +3,18 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System.Collections.ObjectModel;
using BPASmartClient.CustomResource.Pages.Enums;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Nfc;
using System.Threading;
using BPASmartClient.Helper;
using BPA.Helper;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class NfcSetViewModel : ObservableObject
public class NfcSetViewModel : NotifyBase
{
public NfcSetViewModel()
{
@@ -25,7 +25,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
if (item != "管理员") permissions.Add(new PermissionSelect() { PermissionName = item });
});

UserAddCommand = new RelayCommand(() =>
UserAddCommand = new BPARelayCommand(() =>
{
if (permissions?.FirstOrDefault(p => p.PermissionSelected == true) == null)
{
@@ -85,7 +85,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
}
});

UserCancelCommand = new RelayCommand(() =>
UserCancelCommand = new BPARelayCommand(() =>
{
if (CardNum != null && CardNum != string.Empty)
{
@@ -151,17 +151,17 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
public string CheckPassword { get { return _checkPassword; } set { _checkPassword = value; OnPropertyChanged(); } }
private string _checkPassword = "888888";

public RelayCommand SavePermission { get; set; }
public BPARelayCommand SavePermission { get; set; }

public RelayCommand DeletePermission { get; set; }
public BPARelayCommand DeletePermission { get; set; }

public RelayCommand UserAddCommand { get; set; }
public BPARelayCommand UserAddCommand { get; set; }

public RelayCommand UserCancelCommand { get; set; }
public BPARelayCommand UserCancelCommand { get; set; }

}

public class PermissionSelect : ObservableObject
public class PermissionSelect : NotifyBase
{

public string PermissionName { get { return _mPermissionName; } set { _mPermissionName = value; OnPropertyChanged(); } }


+ 8
- 8
BPASmartClient.CustomResource/Pages/ViewModel/PasswordChangeViewModel.cs View File

@@ -4,14 +4,14 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;
using BPA.Helper;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{

public class PasswordChangeViewModel : ObservableObject
public class PasswordChangeViewModel : NotifyBase
{
private void CheckPassword(UserInfo userInfo)
{
@@ -40,7 +40,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel

public PasswordChangeViewModel( )
{
LoginCommand = new RelayCommand(() =>
LoginCommand = new BPARelayCommand(() =>
{
if (Global.changeUserInfo == null) CheckPassword(Global.userInfo);
else { CheckPassword(Global.changeUserInfo); }
@@ -48,16 +48,16 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
});

ExitCommand = new RelayCommand(() =>
ExitCommand = new BPARelayCommand(() =>
{
ActionManage.GetInstance.Send("PasswordChangeViewCancel");
Global.changeUserInfo = null;
});
}

public RelayCommand LoginCommand { get; set; }
public BPARelayCommand LoginCommand { get; set; }

public RelayCommand ExitCommand { get; set; }
public BPARelayCommand ExitCommand { get; set; }





+ 2
- 2
BPASmartClient.CustomResource/Pages/ViewModel/PermissionConfigurationViewModel.cs View File

@@ -1,4 +1,4 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -7,7 +7,7 @@ using System.Threading.Tasks;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class PermissionConfigurationViewModel:ObservableObject
public class PermissionConfigurationViewModel:NotifyBase
{
}


+ 2
- 2
BPASmartClient.CustomResource/Pages/ViewModel/ProductionDataViewModel.cs View File

@@ -3,11 +3,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class ProductionDataViewModel : ObservableObject
public class ProductionDataViewModel : NotifyBase
{
public ProductionDataViewModel()
{


+ 8
- 8
BPASmartClient.CustomResource/Pages/ViewModel/RecipeCompleteViewModel.cs View File

@@ -3,21 +3,21 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;
using System.Collections.ObjectModel;
using BPASmartClient.CustomResource.Pages.Model;
using System.Windows;
using BPASmartClient.Helper;
using BPA.Helper;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class RecipeCompleteViewModel : ObservableObject
public class RecipeCompleteViewModel : NotifyBase
{
public RecipeCompleteViewModel()
{
Sqlite<RecipeCompleteLog>.GetInstance.Save();
SwitchCommand = new RelayCommand(() =>
SwitchCommand = new BPARelayCommand(() =>
{
if (ButContent == "历史日志")
{
@@ -41,7 +41,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel

});

ControlCommand = new RelayCommand(() =>
ControlCommand = new BPARelayCommand(() =>
{

if (ControlButText == "报警复位") return;
@@ -79,9 +79,9 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
}
}

public RelayCommand SwitchCommand { get; set; }
public BPARelayCommand SwitchCommand { get; set; }

public RelayCommand ControlCommand { get; set; }
public BPARelayCommand ControlCommand { get; set; }

public Visibility CurrentDataVis { get { return _mCurrentDataVis; } set { _mCurrentDataVis = value; OnPropertyChanged(); } }
private Visibility _mCurrentDataVis = Visibility.Visible;


+ 8
- 8
BPASmartClient.CustomResource/Pages/ViewModel/ReportViewModel.cs View File

@@ -3,10 +3,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System.Collections.ObjectModel;
using BPASmartClient.CustomResource.Pages.Model;
using Microsoft.Toolkit.Mvvm.Input;
using System.Diagnostics;
using System.IO;

@@ -17,7 +17,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
ReportHelper reportHelper = new ReportHelper();
public ReportViewModel()
{
AddCommand = new RelayCommand(() =>
AddCommand = new BPARelayCommand(() =>
{
for (int i = 0; i < 30; i++)
{
@@ -34,12 +34,12 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
//ReportData = reportHelper.Reports;
});

SaveCommand = new RelayCommand(() =>
SaveCommand = new BPARelayCommand(() =>
{
reportHelper.Save($"aa.pry");
});

ReadCommand = new RelayCommand(() =>
ReadCommand = new BPARelayCommand(() =>
{
ReportData.Clear();
var res = reportHelper.GetData($"{AppDomain.CurrentDomain.BaseDirectory}AccessFile\\ProductionData\\aa.pry");
@@ -56,8 +56,8 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel

public ObservableCollection<ReportBase> ReportData { get; set; } = new ObservableCollection<ReportBase>();

public RelayCommand AddCommand { get; set; }
public RelayCommand SaveCommand { get; set; }
public RelayCommand ReadCommand { get; set; }
public BPARelayCommand AddCommand { get; set; }
public BPARelayCommand SaveCommand { get; set; }
public BPARelayCommand ReadCommand { get; set; }
}
}

+ 8
- 8
BPASmartClient.CustomResource/Pages/ViewModel/RunLogViewModel.cs View File

@@ -3,22 +3,22 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;
using System.Collections.ObjectModel;
using BPASmartClient.CustomResource.Pages.Model;
using System.Windows;
using BPASmartClient.Helper;
using BPA.Helper;
using System.Diagnostics;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class RunLogViewModel : ObservableObject
public class RunLogViewModel : NotifyBase
{
public RunLogViewModel()
{
Sqlite<RunLog>.GetInstance.Save();
SwitchCommand = new RelayCommand(() =>
SwitchCommand = new BPARelayCommand(() =>
{
if (ButContent == "历史日志")
{
@@ -42,7 +42,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel

});

ControlCommand = new RelayCommand(() =>
ControlCommand = new BPARelayCommand(() =>
{

if (ControlButText == "报警复位") return;
@@ -88,9 +88,9 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
}
}

public RelayCommand SwitchCommand { get; set; }
public BPARelayCommand SwitchCommand { get; set; }

public RelayCommand ControlCommand { get; set; }
public BPARelayCommand ControlCommand { get; set; }

public Visibility CurrentDataVis { get { return _mCurrentDataVis; } set { _mCurrentDataVis = value; OnPropertyChanged(); } }
private Visibility _mCurrentDataVis = Visibility.Visible;


+ 26
- 26
BPASmartClient.CustomResource/Pages/ViewModel/UserConfigViewModel.cs View File

@@ -1,9 +1,9 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.Pages.View;
using BPASmartClient.Helper;
using BPA.Helper;
using BPASmartClient.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -14,7 +14,7 @@ using System.Windows;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class UserConfigViewModel:ObservableObject
public class UserConfigViewModel:NotifyBase
{
/// <summary>
/// 页面列表集合
@@ -63,27 +63,27 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
public Visibility VisibilityDevice { get { return _visibilityDevice; } set { _visibilityDevice = value; OnPropertyChanged(); } }
private Visibility _visibilityDevice = Visibility.Collapsed;

public RelayCommand<object> AddUserPageCommand { get; set; }
public BPARelayCommand<object> AddUserPageCommand { get; set; }

public RelayCommand<object> DeleteUserPageCommand { get; set; }
public BPARelayCommand<object> DeleteUserPageCommand { get; set; }

public RelayCommand<object> DeleteAllCommand { get; set; }
public BPARelayCommand<object> DeleteAllCommand { get; set; }

public RelayCommand<object> AddAllCommand { get; set; }
public BPARelayCommand<object> AddAllCommand { get; set; }

public RelayCommand<object> ChangeMaterailPageCommand { get; set; }
public BPARelayCommand<object> ChangeMaterailPageCommand { get; set; }

public RelayCommand SaveCommand { get; set; }
public BPARelayCommand SaveCommand { get; set; }

public RelayCommand CancelCommand { get; set; }
public BPARelayCommand CancelCommand { get; set; }

public RelayCommand<object> AddLoaclMaterialCommand { get; set; }
public BPARelayCommand<object> AddLoaclMaterialCommand { get; set; }
public RelayCommand<object> DeleteLoaclMaterialCommand { get; set; }
public BPARelayCommand<object> DeleteLoaclMaterialCommand { get; set; }
public RelayCommand<object> AddDeviceMaterialCommand { get; set; }
public BPARelayCommand<object> AddDeviceMaterialCommand { get; set; }
public RelayCommand<object> DeleteDeviceMaterialCommand { get; set; }
public BPARelayCommand<object> DeleteDeviceMaterialCommand { get; set; }


private void AddUserPage(object o)
@@ -228,19 +228,19 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel

public UserConfigViewModel()
{
AddUserPageCommand = new RelayCommand<object>(AddUserPage);
AddUserPageCommand = new BPARelayCommand<object>(AddUserPage);

DeleteUserPageCommand = new RelayCommand<object>(DeleteUserPage);
DeleteUserPageCommand = new BPARelayCommand<object>(DeleteUserPage);

DeleteAllCommand = new RelayCommand<object>(DeleteAll);
DeleteAllCommand = new BPARelayCommand<object>(DeleteAll);


AddAllCommand = new RelayCommand<object>(AddAll);
AddAllCommand = new BPARelayCommand<object>(AddAll);

ChangeMaterailPageCommand = new RelayCommand<object>(ChangeMaterailPage);
ChangeMaterailPageCommand = new BPARelayCommand<object>(ChangeMaterailPage);

SaveCommand = new RelayCommand(() =>
SaveCommand = new BPARelayCommand(() =>
{
var res = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == Global.changeUserInfo.UserName && p.Password == Global.changeUserInfo.Password);
if(res != null)
@@ -257,19 +257,19 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
ActionManage.GetInstance.Send("UserConfigViewConfirm");
});

CancelCommand = new RelayCommand(() =>
CancelCommand = new BPARelayCommand(() =>
{
Global.changeUserInfo = null;
ActionManage.GetInstance.Send("UserConfigViewCancel");
});

AddLoaclMaterialCommand = new RelayCommand<object>(AddLoaclMaterial);
AddLoaclMaterialCommand = new BPARelayCommand<object>(AddLoaclMaterial);

DeleteLoaclMaterialCommand = new RelayCommand<object>(DeleteLoaclMaterial);
DeleteLoaclMaterialCommand = new BPARelayCommand<object>(DeleteLoaclMaterial);

AddDeviceMaterialCommand = new RelayCommand<object>(AddDeviceMaterial);
AddDeviceMaterialCommand = new BPARelayCommand<object>(AddDeviceMaterial);

DeleteDeviceMaterialCommand = new RelayCommand<object>(DeleteDeviceMaterial);
DeleteDeviceMaterialCommand = new BPARelayCommand<object>(DeleteDeviceMaterial);


foreach (var item in MenuManage.GetInstance.menuModels)


+ 8
- 8
BPASmartClient.CustomResource/Pages/ViewModel/UserLogViewModel.cs View File

@@ -3,22 +3,22 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System.Collections.ObjectModel;
using BPASmartClient.CustomResource.Pages.Model;
using System.Windows;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.Helper;
using BPA.Helper;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class UserLogViewModel : ObservableObject
public class UserLogViewModel : NotifyBase
{
public UserLogViewModel()
{
Sqlite<UserLog>.GetInstance.Save();
UserLogs = MessageNotify.GetInstance.userLogs;
SwitchCommand = new RelayCommand(() =>
SwitchCommand = new BPARelayCommand(() =>
{
if (ButContent == "历史日志")
{
@@ -42,7 +42,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel

});

ControlCommand = new RelayCommand(() =>
ControlCommand = new BPARelayCommand(() =>
{
if (ControlButText == "报警复位") return;
if (ControlButText == "开始查询")
@@ -81,9 +81,9 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
}
}

public RelayCommand SwitchCommand { get; set; }
public BPARelayCommand SwitchCommand { get; set; }

public RelayCommand ControlCommand { get; set; }
public BPARelayCommand ControlCommand { get; set; }

public Visibility CurrentDataVis { get { return _mCurrentDataVis; } set { _mCurrentDataVis = value; OnPropertyChanged(); } }
private Visibility _mCurrentDataVis = Visibility.Visible;


+ 11
- 11
BPASmartClient.CustomResource/Pages/ViewModel/UserManageViewModel.cs View File

@@ -1,8 +1,8 @@
using BPA.Message;
using BPASmartClient.CustomResource.Pages.Enums;
using BPASmartClient.CustomResource.Pages.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
@@ -15,7 +15,7 @@ using System.Windows;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
internal class UserManageViewModel:ObservableObject
internal class UserManageViewModel:NotifyBase
{
//private static UserManageViewModel _instance;
//public static UserManageViewModel GetInstance => _instance ??= new UserManageViewModel();
@@ -23,19 +23,19 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel

//public List<Permission> Authorities { get; set; } = new List<Permission>() { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 };
public List<string> Authorities { get; set; } = new List<string>();
public RelayCommand<string> SaveCommand { get; set; }
public RelayCommand<string> DeleteCommand { get; set; }
public BPARelayCommand<string> SaveCommand { get; set; }
public BPARelayCommand<string> DeleteCommand { get; set; }

public RelayCommand AddUserInfoCommand { get; set; }
public BPARelayCommand AddUserInfoCommand { get; set; }

public RelayCommand SaveDataCommand { get; set; }
public BPARelayCommand SaveDataCommand { get; set; }
public UserManageViewModel()
{
var userManager = JsonConvert.DeserializeObject<UserManager>(File.ReadAllText("up.hbl").AESDecrypt());
usersInfo = userManager.userInfos;
AddAuthorities();

SaveCommand = new RelayCommand<string>((str) =>
SaveCommand = new BPARelayCommand<string>((str) =>
{
if (str != string.Empty && str != null)
{
@@ -62,7 +62,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
MessageBox.Show("保存失败,用户名为空或输入后未回车确认", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
}
});
DeleteCommand = new RelayCommand<string>((str) =>
DeleteCommand = new BPARelayCommand<string>((str) =>
{
if (str != string.Empty && str != null)
{
@@ -89,13 +89,13 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
});


AddUserInfoCommand = new RelayCommand( ()=>
AddUserInfoCommand = new BPARelayCommand( ()=>
{
usersInfo.Add(new UserInfo() { Id=IdProcess()});
});
SaveDataCommand = new RelayCommand(() =>
SaveDataCommand = new BPARelayCommand(() =>
{
Global.userManager.userInfos = usersInfo;
File.WriteAllText("up.hbl", JsonConvert.SerializeObject(Global.userManager).AESEncrypt());


+ 13
- 13
BPASmartClient.CustomResource/Pages/ViewModel/UserManagerViewModel.cs View File

@@ -1,6 +1,6 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.Pages.View;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -15,20 +15,20 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
/// <summary>
/// datagrid绑定
/// </summary>
public ObservableCollection<UserInfo> userManager { get; set; } = Global.userManager.userInfos;
public ObservableCollection<UserInfo> userManager { get; set; } = Global.userManager.userInfos;

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

public RelayCommand AddNewUserCommand { get; set; }
public BPARelayCommand<object> ChangePasswardCommand { get; set; }

public RelayCommand<object> DeleteUserCommand { get; set; }
public BPARelayCommand AddNewUserCommand { get; set; }

public RelayCommand<object> EditUserConfigCommand { get; set; }
public BPARelayCommand<object> DeleteUserCommand { get; set; }

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

private void ChangePassward(object o)
{
if (o != null && o is UserInfo infos)
if (o != null && o is UserInfo infos)
{
Global.changeUserInfo = infos;
PasswordChangeView passwordChangeView = new PasswordChangeView();
@@ -55,22 +55,22 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
UserConfigView userConfigView = new UserConfigView();
userConfigView.ShowDialog();
}
}

public UserManagerViewModel()
{
ChangePasswardCommand = new RelayCommand<object>(ChangePassward);
ChangePasswardCommand = new BPARelayCommand<object>(ChangePassward);

AddNewUserCommand = new RelayCommand(() =>
AddNewUserCommand = new BPARelayCommand(() =>
{
AddNewUser addNewUser = new AddNewUser();
addNewUser.ShowDialog();
});

DeleteUserCommand = new RelayCommand<object>(DeleteUser);
DeleteUserCommand = new BPARelayCommand<object>(DeleteUser);

EditUserConfigCommand = new RelayCommand<object>(EditUserConfig);
EditUserConfigCommand = new BPARelayCommand<object>(EditUserConfig);
}

}


+ 6
- 6
BPASmartClient.CustomResource/Pages/ViewModel/VariableViewModel.cs View File

@@ -1,9 +1,9 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
@@ -14,7 +14,7 @@ using System.Windows;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public class VariableViewModel : ObservableObject
public class VariableViewModel : NotifyBase
{
public ObservableCollection<PlcVariableInfoModel> Variables { get; set; } = new ObservableCollection<PlcVariableInfoModel>();

@@ -25,7 +25,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
public ObservableCollection<PlcVariableInfoModel> FryFiveVariables { get; set; } = new ObservableCollection<PlcVariableInfoModel>();

public List<string> DeviceName { get; set; } = new List<string> { "滚筒输送线", "炒锅1", "炒锅2", "炒锅3", "炒锅4", "炒锅5" };
public RelayCommand SaveDataCommand { get; set; }
public BPARelayCommand SaveDataCommand { get; set; }
public VariableViewModel()
{
@@ -48,7 +48,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel

}
SaveDataCommand = new RelayCommand(() =>
SaveDataCommand = new BPARelayCommand(() =>
{
Json<PlcVariableInfoManage>.Data.VariablesInfo["滚筒输送线"] = Variables;
Json<PlcVariableInfoManage>.Data.VariablesInfo["炒锅1"] = FryOneVariables;


+ 42
- 43
BPASmartClient.DRCoffee/CoffeeMachine.cs View File

@@ -1,7 +1,6 @@
using BPASmartClient.DRCoffee;
using BPASmartClient.EventBus;
using BPASmartClient.Helper;
using BPASmartClient.Message;

using BPA.Helper;
using BPASmartClient.Model;
using BPASmartClient.Model.咖啡机.Enum;
using BPASmartClient.Peripheral;
@@ -9,7 +8,7 @@ using BPASmartClient.SerialPort;
using System;
using System.Collections.Generic;
using System.Threading;
using static BPASmartClient.EventBus.EventBus;
using static BPA.Helper.EventBus;

namespace BPASmartClient.DRCoffee
{
@@ -88,7 +87,7 @@ namespace BPASmartClient.DRCoffee
/// </summary>
private void MainLoop()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
if (!free)
{
@@ -97,7 +96,7 @@ namespace BPASmartClient.DRCoffee
Thread.Sleep(200);
}), "咖啡机询问线程");

ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
List<byte> temp = new List<byte>();
//一系列解包
@@ -147,7 +146,7 @@ namespace BPASmartClient.DRCoffee
if (((DrCoffeeStatus)status["CoffeeStatus"]) == DrCoffeeStatus.Running && package.Status != DrCoffeeStatus.Running)
{
status["CoffeeStatus"] = package.Status;
EventBus.EventBus.GetInstance().Publish(new DRCoffee_CoffeEndCookEvent() { DeviceId = DeviceId });
EventBus.GetInstance().Publish(new DRCoffee_CoffeEndCookEvent() { DeviceId = DeviceId });
}
else status["CoffeeStatus"] = package.Status;
status["CoffeeAppStatus"] = package.ApplicationStatus;
@@ -180,27 +179,27 @@ namespace BPASmartClient.DRCoffee
commProxy.SetDataStorage(dataStorage);

//咖博士咖啡机制作
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_MakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
drinksOrder.CommCmd = DrCoffeeCommCmd.饮品制作指令;
drinksOrder.DrinksCode = ((DRCoffee_MakeCoffeeEvent)@event).DrinkCode;
commProxy.SendData(DrCoffee.Packe(drinksOrder));
Thread.Sleep(200);
free = false;
MessageLog.GetInstance.Show($"咖啡机: 制作咖啡指令");
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.DRCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});
EventBus.GetInstance().Subscribe<DRCoffee_MakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
drinksOrder.CommCmd = DrCoffeeCommCmd.饮品制作指令;
drinksOrder.DrinksCode = ((DRCoffee_MakeCoffeeEvent)@event).DrinkCode;
commProxy.SendData(DrCoffee.Packe(drinksOrder));
Thread.Sleep(200);
free = false;
MessageLog.GetInstance.Show($"咖啡机: 制作咖啡指令");
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.DRCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});

//咖博士咖啡机取消制作咖啡
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CancelMakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
EventBus.GetInstance().Subscribe<DRCoffee_CancelMakeCoffeeEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
try
{
@@ -220,23 +219,23 @@ namespace BPASmartClient.DRCoffee
});

//咖博士咖啡机模式设置
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CoffeeCommCmdEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
drinksOrder.CommCmd = ((DRCoffee_CoffeeCommCmdEvent)@event).CommCmd;
commProxy.SendData(DrCoffee.Packe(drinksOrder));
Thread.Sleep(200);
free = false;
MessageLog.GetInstance.Show($"咖啡机: 咖啡模式设置指令");
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.DRCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});
EventBus.GetInstance().Subscribe<DRCoffee_CoffeeCommCmdEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
try
{
free = true;
Thread.Sleep(200);
drinksOrder.CommCmd = ((DRCoffee_CoffeeCommCmdEvent)@event).CommCmd;
commProxy.SendData(DrCoffee.Packe(drinksOrder));
Thread.Sleep(200);
free = false;
MessageLog.GetInstance.Show($"咖啡机: 咖啡模式设置指令");
}
catch (Exception ex)
{
MessageLog.GetInstance.ShowEx($"BPASmartClient.DRCoffee 中引发错误,CoffeeMachine 类,描述:[{ex.Message}]");
}
});
InitStatus();
//测试
Start();


+ 8
- 7
BPASmartClient.DRCoffee/CommandHandler.cs View File

@@ -1,5 +1,6 @@

using BPASmartClient.EventBus;

using BPA.Helper;
using BPASmartClient.Model;
using BPASmartClient.Model.咖啡机.Enum;
using BPASmartClient.SerialPort;
@@ -9,10 +10,10 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using static BPASmartClient.EventBus.EventBus;
using static BPA.Helper.EventBus;

namespace BPASmartClient.DRCoffee
{
namespace BPASmartClient.DRCoffee
{
/// <summary>
/// 指令封装
/// </summary>
@@ -35,9 +36,9 @@ namespace BPASmartClient.DRCoffee
cmdAsk = DrCoffee.Packe(package);
drinksOrder.CommCmd = DrCoffeeCommCmd.饮品制作指令;

EventBus.EventBus.GetInstance().Subscribe<DRCoffee_MakeCoffeeEvent>(0,MakeCoffeeEventHandle);
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CancelMakeCoffeeEvent>(0, CancelMakeCoffeeEventHandle);
EventBus.EventBus.GetInstance().Subscribe<DRCoffee_CoffeeCommCmdEvent>(0, CoffeeCommCmdEventHandle);
EventBus.GetInstance().Subscribe<DRCoffee_MakeCoffeeEvent>(0, MakeCoffeeEventHandle);
EventBus.GetInstance().Subscribe<DRCoffee_CancelMakeCoffeeEvent>(0, CancelMakeCoffeeEventHandle);
EventBus.GetInstance().Subscribe<DRCoffee_CoffeeCommCmdEvent>(0, CoffeeCommCmdEventHandle);

}



+ 2
- 2
BPASmartClient.DRCoffee/MorkCStatus.cs View File

@@ -1,6 +1,6 @@
using BPASmartClient.DRCoffee;
using BPASmartClient.EventBus;
using BPASmartClient.Helper;
using BPA.Helper;
using BPASmartClient.Model;
using System;
using System.Collections.Generic;


+ 6
- 7
BPASmartClient.Device/AlarmHelper.cs View File

@@ -1,5 +1,4 @@
using BPASmartClient.Helper;
using BPASmartClient.Message;
using BPA.Helper;
using BPASmartClient.Model;
using System;
using System.Collections.Concurrent;
@@ -12,8 +11,8 @@ namespace BPASmartClient.Device
{
public class AlarmHelper
{
public List<Alarm> Alarms { get; set; } = new List<Alarm>();
public List<Alarm> HistoryAlarms { get; set; } = new List<Alarm>();
public List<BPASmartClient.Model.Alarm> Alarms { get; set; } = new();
public List<BPASmartClient.Model.Alarm> HistoryAlarms { get; set; } = new();
ConcurrentDictionary<string, bool> flagbit = new ConcurrentDictionary<string, bool>();
ConcurrentDictionary<string, Delay> delays = new ConcurrentDictionary<string, Delay>();
public Action<string> AddAction { get; set; }
@@ -55,7 +54,7 @@ namespace BPASmartClient.Device
/// <param name="AlarmInfo">报警信息</param>
private void AddAlarm(object value, string AlarmInfo, AlarmLevel alarmLevel)
{
Alarm tempAlarm = new Alarm()
BPASmartClient.Model.Alarm tempAlarm = new BPASmartClient.Model.Alarm()
{
NumId = Alarms.Count + 1,
Date = DateTime.Now.ToString("yyyy/MM/dd"),
@@ -65,8 +64,8 @@ namespace BPASmartClient.Device
Time = DateTime.Now.ToString("HH:mm:ss"),
};

var res = Sqlite<Alarm>.GetInstance.Base.Add(tempAlarm);
Sqlite<Alarm>.GetInstance.Save();
var res = Sqlite<BPASmartClient.Model.Alarm>.GetInstance.Base.Add(tempAlarm);
Sqlite<BPASmartClient.Model.Alarm>.GetInstance.Save();

if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null)
{


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

@@ -12,7 +12,6 @@
</ItemGroup>

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


+ 12
- 14
BPASmartClient.Device/BaseDevice.cs View File

@@ -1,7 +1,5 @@
using BPA.Message;
using BPA.Message.Enum;
using BPASmartClient.Helper;
using BPASmartClient.Message;
using BPASmartClient.Model;
using BPASmartClient.Peripheral;
using System;
@@ -14,8 +12,8 @@ using System.Threading;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using BPASmartClient.Model.单片机;
using BPASmartClient.EventBus;
using BPA.Models;
using BPA.Helper;

namespace BPASmartClient.Device
{
@@ -118,7 +116,7 @@ namespace BPASmartClient.Device

public Action<int, object> AddErrorAction { get; set; }
public Action<int, object> DeleteErrorAction { get; set; }
public List<Alarm> alarms { get; set; } = new List<Alarm>();
public List<BPASmartClient.Model.Alarm> alarms { get; set; } = new List<BPASmartClient.Model.Alarm>();
public IAlarm InterfaceAlarm { get; set; }
public AlarmHelper alarmHelper { get; set; } = new AlarmHelper();
public IStatus InterfaceStatus { get; set; }
@@ -164,7 +162,7 @@ namespace BPASmartClient.Device
/// <param name="info"></param>
public void DeviceProcessLogShow(string info)
{
Log.Insert(0, new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Type = "流程", Text = info });
Log.Insert(0, new { Time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss:fff"), Type = "流程", Text = info });
MessageLog.GetInstance.DeviceProcessLogShow(DeviceId.ToString(), info);
if (Log.Count > 100) { Log.RemoveAt(Log.Count - 1); }
}
@@ -186,7 +184,7 @@ namespace BPASmartClient.Device

public virtual void StartMain()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
int i = 0;
foreach (var peripheral in peripherals)
@@ -316,7 +314,7 @@ namespace BPASmartClient.Device
DeleteErrorAction?.Invoke(DeviceId, res);
}
});
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
AlarmMonitoring();
Thread.Sleep(500);
@@ -352,15 +350,15 @@ namespace BPASmartClient.Device
private void InitResetTask()
{
#region 复位程序
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
if (RTrig.GetInstance($"ResetProgram:{DeviceId}").Start(Initing))
{
ThreadManage.GetInstance().StopTask($"MainTask:{DeviceId}", new Action(() =>
TaskManage.GetInstance.StopTask($"MainTask:{DeviceId}", new Action(() =>
{
ThreadManage.GetInstance().StopTask($"ReadData:{DeviceId}", new Action(() =>
TaskManage.GetInstance.StopTask($"ReadData:{DeviceId}", new Action(() =>
{
ThreadManage.GetInstance().StopTask($"GvlStatusMonitor:{DeviceId}", new Action(() =>
TaskManage.GetInstance.StopTask($"GvlStatusMonitor:{DeviceId}", new Action(() =>
{
ActionManage.GetInstance.Send("ClearOrders");
ResetProgram();
@@ -378,7 +376,7 @@ namespace BPASmartClient.Device
private void InitTask()
{
#region 数据读取
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
ReadData();
Thread.Sleep(10);
@@ -386,7 +384,7 @@ namespace BPASmartClient.Device
#endregion

#region 任务流程
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
MainTask();
Thread.Sleep(10);
@@ -394,7 +392,7 @@ namespace BPASmartClient.Device
#endregion

#region 设备状态监控
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
UpdateValue(InterfaceStatus);
Thread.Sleep(1000);


+ 1
- 1
BPASmartClient.Device/IDevice.cs View File

@@ -67,7 +67,7 @@ namespace BPASmartClient.Device
/// <summary>
/// 设备报警信息集合
/// </summary>
List<Alarm> alarms { get; set; }
List<BPASmartClient.Model.Alarm> alarms { get; set; }

/// <summary>
/// 接口报警对象


+ 2
- 2
BPASmartClient.Device/VariableMonitor.cs View File

@@ -3,11 +3,11 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;

namespace BPASmartClient.Device
{
public class VariableMonitor : ObservableObject
public class VariableMonitor : NotifyBase
{
public int Id { get { return _mId; } set { _mId = value; OnPropertyChanged(); } }
private int _mId;


+ 55
- 1
BPASmartClient.Device/VariableMonitorAttribute.cs View File

@@ -28,7 +28,12 @@ namespace BPASmartClient.Device
if (address.Length > 0)
{
address = address.Trim();
if (address.ToUpper().Contains("M") && address.Length >= 4)
if (address.ToUpper().Contains("GM") && address.Length >= 3)
{
var res = address.Remove(0, 2);
if (res != null && res.Length > 0) return (int.Parse(res) + 4096).ToString();
}
else if (address.ToUpper().Contains("M") && address.Length >= 4)
{
var res = address.Substring(1).Split('.');
if (res != null && res.Length == 2)
@@ -42,6 +47,19 @@ namespace BPASmartClient.Device
}
}
}
else if (address.ToUpper().Contains("GI") && address.Length >= 3)
{
var res = address.Remove(0, 2);
if (res != null && res.Length > 0) return res;
}
else if (address.ToUpper().Contains("LB") && address.Length >= 3)
{
var res = address.Substring(2);
if (res != null && res.Length > 0)
{
if (int.TryParse(res, out int firstAddress)) return firstAddress.ToString();
}
}
else if ((address.ToUpper().Contains("VW") || address.ToUpper().Contains("VD")) && address.Length >= 3)
{
var res = address.Substring(2);
@@ -50,8 +68,44 @@ namespace BPASmartClient.Device
return ((tempAddress / 2) + 100).ToString();
}
}
else if (address.ToUpper().Contains("LW") && address.Length >= 3)
{
var res = address.Substring(2);
if (res != null && int.TryParse(res, out int LwAddress))
{
return LwAddress.ToString();
}
}
}
return "";
//if (address == null) return "";
//if (address.Length > 0)
//{
// address = address.Trim();
// if (address.ToUpper().Contains("M") && address.Length >= 4)
// {
// var res = address.Substring(1).Split('.');
// if (res != null && res.Length == 2)
// {
// if (int.TryParse(res[0], out int firstAddress) && int.TryParse(res[1], out int ExitAddress))
// {
// if (ExitAddress >= 0 && ExitAddress <= 7)
// {
// return ((firstAddress * 8) + 320 + ExitAddress).ToString();
// }
// }
// }
// }
// else if ((address.ToUpper().Contains("VW") || address.ToUpper().Contains("VD")) && address.Length >= 3)
// {
// var res = address.Substring(2);
// if (res != null && int.TryParse(res, out int tempAddress))
// {
// return ((tempAddress / 2) + 100).ToString();
// }
// }
//}
//return "";
}

/// <summary>


+ 3
- 3
BPASmartClient.DosingSystemSingle/App.xaml.cs View File

@@ -35,10 +35,10 @@ namespace BPASmartClient.DosingSystemSingle
Environment.Exit(0);
}
base.OnStartup(e);
BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut();
SystemHelper.GetInstance.CreateDesktopShortcut();
MenuInit();
DataInit();
ThreadManage.GetInstance().Start(new Action(() =>
TaskManage.GetInstance.Start(new Action(() =>
{
DeviceInquire.GetInstance.Init();//配料机设备上线监听,设备列表初始化
}), "设备初始化");
@@ -62,7 +62,7 @@ namespace BPASmartClient.DosingSystemSingle
Json<LocaPar>.Save();
Json<DevicePar>.Save();
BPASmartClient.CustomResource.Pages.Model.MessageNotify.GetInstance.LogSave();
ThreadManage.GetInstance().Dispose();
TaskManage.GetInstance.Dispose();
}

private void MenuInit()


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

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

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


+ 4
- 4
BPASmartClient.DosingSystemSingle/Model/DeviceInquire.cs View File

@@ -32,7 +32,7 @@ namespace BPASmartClient.DosingSystemSingle
public ObservableCollection<Devices> devices { get; set; } = new ObservableCollection<Devices>();
private void DeviceDataInit()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
for (int i = 0; i < DeviceLists.Count; i++)
{
@@ -117,7 +117,7 @@ namespace BPASmartClient.DosingSystemSingle
IpAddressLines();
//SiemensDevice.GetInstance.Connect(Json<DevicePar>.Data.BaseParModel.DeviceAddress);
DeviceDataInit();
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
if (IPQueues.Count >= IPLists.Count)
//IpAddressLines();
@@ -303,7 +303,7 @@ namespace BPASmartClient.DosingSystemSingle
AlarmHelper<AlarmInfo>.Init();
if (modbusTcp.Connected)
{
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
this.DeviceName = modbusTcp.GetString(DeviceAddress.DeviceName, 20)?.Trim()?.Replace(" ", "");
deviceStatus.RunStatus = (ushort)this.modbusTcp.ReadShort(DeviceAddress.RunStatus); //获取设备运行状态
@@ -341,7 +341,7 @@ namespace BPASmartClient.DosingSystemSingle

public void Dispose()
{
ThreadManage.GetInstance().StopTask($"{DeviceName} 开始监听");
TaskManage.GetInstance.StopTask($"{DeviceName} 开始监听");
}

public void Start(float Value)


+ 2
- 2
BPASmartClient.DosingSystemSingle/Service/SiemensDevice.cs View File

@@ -35,14 +35,14 @@ namespace BPASmartClient.DosingSystemSingle
}
IsConnect = MySiemens.IsConnected;
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
if (IsConnect) MySiemens.Write("DB4.DBX0.0", tempValue);//设备心跳
tempValue = !tempValue;
Thread.Sleep(100);
}), "设备心跳", true);

ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
if (IsConnect)
{


+ 1
- 1
BPASmartClient.DosingSystemSingle/View/HardwareStatusView.xaml.cs View File

@@ -24,7 +24,7 @@ namespace BPASmartClient.DosingSystemSingle.View
public HardwareStatusView()
{
InitializeComponent();
this.Unloaded += (o, e) => { ThreadManage.GetInstance().StopTask("输送带料仓状态监控"); };
this.Unloaded += (o, e) => { TaskManage.GetInstance.StopTask("输送带料仓状态监控"); };
}
}
}

+ 1
- 1
BPASmartClient.DosingSystemSingle/View/ManualControlView.xaml.cs View File

@@ -24,7 +24,7 @@ namespace BPASmartClient.DosingSystemSingle.View
public ManualControlView()
{
InitializeComponent();
this.Unloaded += (o, e) => { ThreadManage.GetInstance().StopTask("手动气缸状态监控"); };
this.Unloaded += (o, e) => { TaskManage.GetInstance.StopTask("手动气缸状态监控"); };
this.SizeChanged += ManualControlView_SizeChanged;
this.cy.Height = this.list1.ActualHeight + 40;
this.zd.Height = this.list2.ActualHeight + 40;


+ 1
- 1
BPASmartClient.DosingSystemSingle/View/NewMaterialView.xaml.cs View File

@@ -1,4 +1,4 @@
using BPASmartClient.Helper;
using BPA.Helper;
using System;
using System.Collections.Generic;
using System.Linq;


+ 1
- 1
BPASmartClient.DosingSystemSingle/ViewModel/HardwareStatusViewModel.cs View File

@@ -35,7 +35,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
// }
// }
//});
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
for (int i = 0; i < Json<DevicePar>.Data.OutletInfoModels.Count; i++)
{


+ 1
- 1
BPASmartClient.DosingSystemSingle/ViewModel/ManualControlViewModel.cs View File

@@ -113,7 +113,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
ModelSwitchText = res ? "自动" : "手动";*/
});

ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
for (int i = 0; i < cylinderModels.Count; i++)
{


+ 2
- 2
BPASmartClient.DosingSystemSingle/ViewModel/RecipeControlViewModel.cs View File

@@ -97,7 +97,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
/// </summary>
private void RecipeRun()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
if (RecipeNames.Count > 0)
{
@@ -200,7 +200,7 @@ namespace BPASmartClient.DosingSystemSingle.ViewModel
/// </summary>
private void RecipeStatusInquire()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
for (int i = 0; i < Recipes.Count; i++)
{


+ 0
- 4
BPASmartClient.EventBus/BPASmartClient.EventBus.csproj View File

@@ -6,8 +6,4 @@
<Nullable>enable</Nullable>
</PropertyGroup>

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

</Project>

+ 3
- 3
BPASmartClient.FoodStationTest/App.xaml.cs View File

@@ -2,7 +2,7 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.Pages.View;
using BPASmartClient.FoodStationTest.Model;
using BPASmartClient.Helper;
using BPA.Helper;
using System;
using System.Collections.ObjectModel;
using System.Threading;
@@ -28,7 +28,7 @@ namespace BPASmartClient.FoodStationTest
App.Current.Shutdown();
Environment.Exit(0);
}
BPASmartClient.Helper.SystemHelper.GetInstance.CreateDesktopShortcut();
SystemHelper.GetInstance.CreateDesktopShortcut();
base.OnStartup(e);

MenuInit();
@@ -66,7 +66,7 @@ namespace BPASmartClient.FoodStationTest
Json<LocalRecipeDataColl>.Save();
Json<RemoteRecipeDataColl>.Save();
MessageNotify.GetInstance.LogSave();
ThreadManage.GetInstance().Dispose();
TaskManage.GetInstance.Dispose();
}

private void MenuInit()


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

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

<ItemGroup>
<PackageReference Include="BPA.Communication" Version="1.0.105" />
<PackageReference Include="BPA.Communication" Version="1.0.116" />
</ItemGroup>

<ItemGroup>


+ 2
- 2
BPASmartClient.FoodStationTest/Model/Bom/BomMaterial.cs View File

@@ -1,8 +1,8 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;

namespace BPASmartClient.FoodStationTest.Model.Bom
{
public class BomMaterial : ObservableObject
public class BomMaterial : NotifyBase
{
public int Count { get { return _count; } set { _count = value; OnPropertyChanged(); } }
public int _count { get; set; }


+ 2
- 2
BPASmartClient.FoodStationTest/Model/GVL/PlcInfos.cs View File

@@ -1,11 +1,11 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;

namespace BPASmartClient.FoodStationTest.Model.GVL
{
/// <summary>
/// PLC变量信息
/// </summary>
public class PlcInfos : ObservableObject
public class PlcInfos : NotifyBase
{
/// <summary>
/// 变量序号


+ 2
- 2
BPASmartClient.FoodStationTest/Model/HK_PLC/HKDeviceStatus.cs View File

@@ -1,5 +1,5 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using BPA.Helper;
using System;
using System.Collections.ObjectModel;
using System.Threading;
@@ -13,7 +13,7 @@ namespace BPASmartClient.FoodStationTest.Model.HK_PLC
public PlcReadAddressDB45 DeviceStatus = new PlcReadAddressDB45();
public void Init()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
if (IsConnected)
{


+ 2
- 2
BPASmartClient.FoodStationTest/Model/Par/ConnectParMode.cs View File

@@ -1,11 +1,11 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;

namespace BPASmartClient.FoodStationTest.Model.Par
{
/// <summary>
/// 连接参数设置。
/// </summary>
public class ConnectParMode : ObservableObject
public class ConnectParMode : NotifyBase
{
/// <summary>
/// 海科PLC是否连接


+ 9
- 9
BPASmartClient.FoodStationTest/Model/ProcessControl.cs View File

@@ -3,7 +3,7 @@ using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.FoodStationTest.Model.GVL;
using BPASmartClient.FoodStationTest.Model.HK_PLC;
using BPASmartClient.FoodStationTest.Model.RawMaterial;
using BPASmartClient.Helper;
using BPA.Helper;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -68,7 +68,7 @@ namespace BPASmartClient.FoodStationTest.Model
RegisterInit();
DeviceConnect();
//Json<RemoteRecipeDataColl>.Data.Recipes = TestData.GetInstance.Recipes;//添加测试数据
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
GVL_SmallStation.GetInstance.DisEnableStockAlarm = Json<DevicePar>.Data.deviceConnectPar.ShieldStockbinAlarm;
if (HKDevice.IsConnected)
@@ -91,7 +91,7 @@ namespace BPASmartClient.FoodStationTest.Model
}
Thread.Sleep(200);
}), "海科plc通信心跳", true);
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
if (GVL_SmallStation.GetInstance.Order_Cancel)
{
@@ -104,13 +104,13 @@ namespace BPASmartClient.FoodStationTest.Model
}
Thread.Sleep(10);
}), "小料站流程控制", true);
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
RealTimeData();

Thread.Sleep(10);
}), "西门子PLC和小料站PLC的实时数据交互流程", true);
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
HKPlcRead();
GetStatus();
@@ -586,7 +586,7 @@ namespace BPASmartClient.FoodStationTest.Model
indexArr = Array.FindIndex(GVL_SmallStation.GetInstance.plcReadDataDB3.Recipe5BarrelPosReserve.ToArray(), p => p == i);
break;
}
if (indexArr >= 0 && GVL_SmallStation.GetInstance.StockBinDosingIssue[recipeNum].Get16bitValue((byte)i) == false)
if (indexArr >= 0 && GVL_SmallStation.GetInstance.StockBinDosingIssue[recipeNum].GetBitValue((byte)i) == false)
{
//查找每个料仓对应的重量。
int loc_index = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i);
@@ -626,7 +626,7 @@ namespace BPASmartClient.FoodStationTest.Model
{
//MessageNotify.GetInstance.ShowRunLog($"错误,有允许配料信号,但没有相应的位置 和桶号");
}
if ((DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3) && indexArr >= 0 && GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum].Get16bitValue((byte)i))
if ((DeviceInquire.GetInstance.GetDevice(i).deviceStatus.RunStatus == 3) && indexArr >= 0 && GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum].GetBitValue((byte)i))
{
//配料完成处理。
int res = Array.FindIndex(RemoteRecipes.ElementAt(index).RawMaterial.ToArray(), p => p.RawMaterialLocation == i);
@@ -684,7 +684,7 @@ namespace BPASmartClient.FoodStationTest.Model
{
for (int i = 1; i < 17; i++)
{
if (GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum].Get16bitValue((byte)i))
if (GVL_SmallStation.GetInstance.RecipeStockBinDosing[recipeNum].GetBitValue((byte)i))
{
MessageNotify.GetInstance.ShowRunLog($"料仓配料完成,但存在料仓未配料:{i}号仓");
}
@@ -1176,7 +1176,7 @@ namespace BPASmartClient.FoodStationTest.Model
MessageNotify.GetInstance.ShowRunLog("海科plc初始化完成");
}

ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
try
{


+ 2
- 2
BPASmartClient.FoodStationTest/Model/RawMaterial/DeviceCurrentStatus.cs View File

@@ -1,11 +1,11 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;

namespace BPASmartClient.FoodStationTest.Model
{
/// <summary>
/// 味魔方当前状态。
/// </summary>
public class DeviceCurrentStatus : ObservableObject
public class DeviceCurrentStatus : NotifyBase
{

public double Weight { get { return _mWeight; } set { _mWeight = value; OnPropertyChanged(); } }


+ 14
- 14
BPASmartClient.FoodStationTest/Model/RawMaterial/DeviceInquire.cs View File

@@ -1,7 +1,7 @@
using BPA.Communication;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.FoodStationTest.ViewModel;
using BPASmartClient.Helper;
using BPA.Helper;
using BPASmartClient.Model;
using System;
using System.Collections.Concurrent;
@@ -33,7 +33,7 @@ namespace BPASmartClient.FoodStationTest.Model
public ObservableCollection<Devices> devices { get; set; } = new ObservableCollection<Devices>();
private void DeviceDataInit()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
for (int i = 0; i < DeviceLists.Count; i++)
{
@@ -57,7 +57,7 @@ namespace BPASmartClient.FoodStationTest.Model
{
devices.ElementAt(deviceIndex).DeviceName = DeviceLists.ElementAt(i).Value.DeviceName;
}
if (!ThreadManage.GetInstance().IsContainsKey($"{deviceName} 开始监听"))
if (!TaskManage.GetInstance.IsContainsKey($"{deviceName} 开始监听"))
{
DeviceLists[DeviceLists.ElementAt(i).Key].Init(deviceName);
}
@@ -111,7 +111,7 @@ namespace BPASmartClient.FoodStationTest.Model
//TestData();
IpAddressLines();
DeviceDataInit();
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
if (IPQueues.Count >= IPLists.Count)
IpAddressLines();
@@ -185,7 +185,7 @@ namespace BPASmartClient.FoodStationTest.Model
DeviceStatus DS = new DeviceStatus();
DS.modbusTcp.IsReconnect = false;

DS.modbusTcp.ConnectOk = new Action(() =>
DS.modbusTcp.Connected = new Action(() =>
{
string DeviceName = DS.modbusTcp.Read<string>(DeviceAddress.DeviceName, 20).Content.Trim()?.Replace(" ", "");//读取设备名称
if (DeviceName.Length > 0)
@@ -318,7 +318,7 @@ namespace BPASmartClient.FoodStationTest.Model
/// <summary>
/// ModbusTcp的地址。
/// </summary>
public string IpAddress=> modbusTcp.GetConfigPar().IpAddress;
public string IpAddress => modbusTcp.GetConfigPar().IpAddress;
/// <summary>
/// 设备状态
/// </summary>
@@ -338,7 +338,7 @@ namespace BPASmartClient.FoodStationTest.Model
//AlarmHelper<AlarmInfo>.Init();
if (modbusTcp.IsConnected())
{
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
if (modbusTcp.IsConnected())
{
@@ -347,12 +347,12 @@ namespace BPASmartClient.FoodStationTest.Model
deviceStatus.NowWeightFeedback = this.modbusTcp.Read<float>(DeviceAddress.CutWeightFeedback).Content;//获取下料重量
deviceStatus.DeviceNum = (ushort)this.modbusTcp.Read<ushort>(DeviceAddress.DeviceNum).Content;//获取设备编号
deviceStatus.DeviceAlarmCode = (ushort)this.modbusTcp.Read<ushort>(DeviceAddress.DeviceAlarmCode).Content;//获取设备故障编码
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop1 = deviceStatus.DeviceAlarmCode.Get16bitValue(1);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Servo = deviceStatus.DeviceAlarmCode.Get16bitValue(2);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Inverter = deviceStatus.DeviceAlarmCode.Get16bitValue(3);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop2 = deviceStatus.DeviceAlarmCode.Get16bitValue(7);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloUpperLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(8);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloLowerLimit = deviceStatus.DeviceAlarmCode.Get16bitValue(9);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop1 = deviceStatus.DeviceAlarmCode.GetBitValue(1);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Servo = deviceStatus.DeviceAlarmCode.GetBitValue(2);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).Inverter = deviceStatus.DeviceAlarmCode.GetBitValue(3);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).EStop2 = deviceStatus.DeviceAlarmCode.GetBitValue(7);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloUpperLimit = deviceStatus.DeviceAlarmCode.GetBitValue(8);
AlarmHelper<AlarmInfo>.GetInstance(DeviceName).SiloLowerLimit = deviceStatus.DeviceAlarmCode.GetBitValue(9);
//允许配料即产线气缸抬起,发送给味魔方
if (deviceStatus.DeviceNum >= 1 && deviceStatus.DeviceNum <= 15)
{
@@ -402,7 +402,7 @@ namespace BPASmartClient.FoodStationTest.Model

public void Dispose()
{
ThreadManage.GetInstance().StopTask($"{DeviceName} 开始监听");
TaskManage.GetInstance.StopTask($"{DeviceName} 开始监听");
}

/// <summary>


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

@@ -1,12 +1,12 @@
using BPASmartClient.FoodStationTest.Model.Bom;
using BPASmartClient.FoodStationTest.Model.Par;
using BPASmartClient.FoodStationTest.Model.RawMaterial;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System.Collections.ObjectModel;

namespace BPASmartClient.FoodStationTest.Model
{
public class DevicePar : ObservableObject
public class DevicePar : NotifyBase
{
public ObservableCollection<DeviceParMode> deviceParModels { get; set; } = new ObservableCollection<DeviceParMode>();
public ConnectParMode deviceConnectPar { get { return _mdeviceConnectPar; } set { _mdeviceConnectPar = value; OnPropertyChanged(); } }


+ 2
- 2
BPASmartClient.FoodStationTest/Model/RawMaterial/DeviceParModel.cs View File

@@ -1,8 +1,8 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;

namespace BPASmartClient.FoodStationTest.Model
{
public class DeviceParMode : ObservableObject
public class DeviceParMode : NotifyBase
{

/// <summary>


+ 2
- 2
BPASmartClient.FoodStationTest/Model/RawMaterial/RawMaterialColl.cs View File

@@ -1,8 +1,8 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;

namespace BPASmartClient.FoodStationTest.Model.RawMaterial
{
public class RawMaterialColl : ObservableObject
public class RawMaterialColl : NotifyBase
{
/// <summary>
/// 原料设备IP


+ 2
- 2
BPASmartClient.FoodStationTest/Model/RawMaterial/RawMaterialStockBin.cs View File

@@ -1,8 +1,8 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;

namespace BPASmartClient.FoodStationTest.Model.RawMaterial
{
public class RawMaterialStockBin : ObservableObject
public class RawMaterialStockBin : NotifyBase
{

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


+ 2
- 2
BPASmartClient.FoodStationTest/Model/RawMaterial/RecipeModel.cs View File

@@ -1,5 +1,5 @@
using BPASmartClient.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System.Collections.ObjectModel;
using System.Threading;

@@ -8,7 +8,7 @@ namespace BPASmartClient.FoodStationTest.Model
/// <summary>
/// 配方模块
/// </summary>
public class RecipeModel : ObservableObject
public class RecipeModel : NotifyBase
{
[Newtonsoft.Json.JsonIgnore]
public bool IsEnable { get { return _mIsEnable; } set { _mIsEnable = value; OnPropertyChanged(); } }


+ 2
- 2
BPASmartClient.FoodStationTest/Model/Recipe/RemoteRecipeData.cs View File

@@ -1,4 +1,4 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System.Collections.ObjectModel;

namespace BPASmartClient.FoodStationTest.Model
@@ -7,7 +7,7 @@ namespace BPASmartClient.FoodStationTest.Model
/// <summary>
/// 远程配方数据。
/// </summary>
public class RemoteRecipeData : ObservableObject
public class RemoteRecipeData : NotifyBase
{
/// <summary>
/// 配方名称


+ 2
- 2
BPASmartClient.FoodStationTest/Model/Recipe/RemoteRecipeRawMaterial.cs View File

@@ -1,8 +1,8 @@
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;

namespace BPASmartClient.FoodStationTest.Model
{
public class RemoteRecipeRawMaterial : ObservableObject
public class RemoteRecipeRawMaterial : NotifyBase
{
public int DeviceIp { get { return _mIp; } set { _mIp = value; } }
private int _mIp;


+ 1
- 1
BPASmartClient.FoodStationTest/View/ChangeDeviceNameView.xaml.cs View File

@@ -1,4 +1,4 @@
using BPASmartClient.Helper;
using BPA.Helper;
using System;
using System.Windows;
using System.Windows.Input;


+ 1
- 1
BPASmartClient.FoodStationTest/View/NewLocalRecipeView.xaml.cs View File

@@ -1,4 +1,4 @@
using BPASmartClient.Helper;
using BPA.Helper;
using System;
using System.Windows;
using System.Windows.Input;


+ 1
- 1
BPASmartClient.FoodStationTest/View/NewRecipeView.xaml.cs View File

@@ -1,4 +1,4 @@
using BPASmartClient.Helper;
using BPA.Helper;
using System;
using System.Windows;
using System.Windows.Input;


+ 1
- 1
BPASmartClient.FoodStationTest/View/RecipeInfosView.xaml.cs View File

@@ -1,4 +1,4 @@
using BPASmartClient.Helper;
using BPA.Helper;
using System;
using System.Windows;
using System.Windows.Input;


+ 1
- 1
BPASmartClient.FoodStationTest/View/SelectRecipesView.xaml.cs View File

@@ -1,4 +1,4 @@
using BPASmartClient.Helper;
using BPA.Helper;
using System;
using System.Windows;
using System.Windows.Input;


+ 14
- 14
BPASmartClient.FoodStationTest/ViewModel/BomOfMaterialViewModel.cs View File

@@ -3,27 +3,27 @@ using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.FoodStationTest.Model;
using BPASmartClient.FoodStationTest.Model.Bom;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;
using BPA.Helper;
using System.Collections.ObjectModel;
using System.Linq;

namespace BPASmartClient.FoodStationTest.ViewModel
{
public class BomOfMaterialViewModel : ObservableObject
public class BomOfMaterialViewModel : NotifyBase
{
public BomOfMaterialViewModel()
{
RawMaterialInfo = Json<DevicePar>.Data.BomMaterial;
AddMaterial = new RelayCommand(() =>
AddMaterial = new BPARelayCommand(() =>
{
RawMaterialInfo.Add(new BomMaterial()
{
Count = Json<DevicePar>.Data.BomMaterial.Count + 1,
});
});
SaveMaterials = new RelayCommand(() =>
SaveMaterials = new BPARelayCommand(() =>
{
if (MessageNotify.GetInstance.ShowDialog("请确认是否保存!") == true)
{
@@ -32,7 +32,7 @@ namespace BPASmartClient.FoodStationTest.ViewModel
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"原料与料仓对应关系保存成功");
}
});
GetBomMaterialData = new RelayCommand(() =>
GetBomMaterialData = new BPARelayCommand(() =>
{
Json<DevicePar>.Data.BomMaterial.Clear();
ProcessControl.GetInstance.RawMaterialNameWithCode();//原料的名称和编码对应 :西门子mes定义的物料编码
@@ -42,7 +42,7 @@ namespace BPASmartClient.FoodStationTest.ViewModel
}
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "成功", $"读取程序的Bom清单");
});
DeleteAllMaterial = new RelayCommand(() =>
DeleteAllMaterial = new BPARelayCommand(() =>
{
if (MessageNotify.GetInstance.ShowDialog("请确认是否删除所有原料数据!") == true)
{
@@ -50,7 +50,7 @@ namespace BPASmartClient.FoodStationTest.ViewModel
MessageNotify.GetInstance.ShowUserLog($"西门子物料清单删除完成");
}
});
RemoveCommand = new RelayCommand<int>((Count) =>
RemoveCommand = new BPARelayCommand<int>((Count) =>
{
if (Count is int cnt)
{
@@ -67,11 +67,11 @@ namespace BPASmartClient.FoodStationTest.ViewModel
});
}
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; }
public BPARelayCommand AddMaterial { get; set; }
public BPARelayCommand SaveMaterials { get; set; }
public BPARelayCommand<int> RemoveCommand { get; set; }
public BPARelayCommand GetBomMaterialData { get; set; }
public BPARelayCommand DeleteAllMaterial { get; set; }

}
}

+ 8
- 8
BPASmartClient.FoodStationTest/ViewModel/ChangeDeviceNameViewModel.cs View File

@@ -1,14 +1,14 @@
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.FoodStationTest.Model;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;
using BPA.Helper;
using System;
using System.Linq;

namespace BPASmartClient.FoodStationTest.ViewModel
{
public class ChangeDeviceNameViewModel : ObservableObject
public class ChangeDeviceNameViewModel : NotifyBase
{
public ChangeDeviceNameViewModel()
{
@@ -18,8 +18,8 @@ namespace BPASmartClient.FoodStationTest.ViewModel
IpAddress = str;
}), "ChangeDeviceNameViewOpen");

CancleCommand = new RelayCommand(() => { ActionManage.GetInstance.Send("ChangeDeviceNameViewClose"); });
ConfirmCommand = new RelayCommand(() =>
CancleCommand = new BPARelayCommand(() => { ActionManage.GetInstance.Send("ChangeDeviceNameViewClose"); });
ConfirmCommand = new BPARelayCommand(() =>
{
if (string.IsNullOrEmpty(DeviceName))
{
@@ -56,9 +56,9 @@ namespace BPASmartClient.FoodStationTest.ViewModel

private static string IpAddress = string.Empty;

public RelayCommand ConfirmCommand { get; set; }
public BPARelayCommand ConfirmCommand { get; set; }

public RelayCommand CancleCommand { get; set; }
public BPARelayCommand CancleCommand { get; set; }


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


+ 11
- 11
BPASmartClient.FoodStationTest/ViewModel/DeviceListViewModel.cs View File

@@ -1,17 +1,17 @@
using BPASmartClient.FoodStationTest.Model;
using BPASmartClient.FoodStationTest.View;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;
using BPA.Helper;
using System.Collections.ObjectModel;

namespace BPASmartClient.FoodStationTest.ViewModel
{
public class DeviceListViewModel : ObservableObject
public class DeviceListViewModel : NotifyBase
{
public DeviceListViewModel()
{
ChangeNameCommand = new RelayCommand<object>((o) =>
ChangeNameCommand = new BPARelayCommand<object>((o) =>
{
if (o != null && o is string str)
{
@@ -21,7 +21,7 @@ namespace BPASmartClient.FoodStationTest.ViewModel
}
});

Open = new RelayCommand<object>((o) =>
Open = new BPARelayCommand<object>((o) =>
{
if (o != null && o is string str)
{
@@ -29,7 +29,7 @@ namespace BPASmartClient.FoodStationTest.ViewModel
}
});

Close = new RelayCommand<object>((o) =>
Close = new BPARelayCommand<object>((o) =>
{
if (o != null && o is string str)
{
@@ -45,15 +45,15 @@ namespace BPASmartClient.FoodStationTest.ViewModel
devices = new ObservableCollection<Devices>(devices.OrderBy(item => item.Serial));*/
}

public RelayCommand<object> ChangeNameCommand { get; set; }
public RelayCommand<object> Open { get; set; }
public RelayCommand<object> Close { get; set; }
public BPARelayCommand<object> ChangeNameCommand { get; set; }
public BPARelayCommand<object> Open { get; set; }
public BPARelayCommand<object> Close { get; set; }

//public static ObservableCollection<Devices> devices { get; set; } = new ObservableCollection<Devices>();
public ObservableCollection<Devices> devices { get; set; }
}

public class Devices : ObservableObject
public class Devices : NotifyBase
{
public int Serial { get { return _mSerial; } set { _mSerial = value; OnPropertyChanged(); } }
private int _mSerial;


+ 10
- 10
BPASmartClient.FoodStationTest/ViewModel/DeviceMaterialParViewModel.cs View File

@@ -1,20 +1,20 @@
using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.FoodStationTest.Model;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;
using BPA.Helper;
using System.Collections.ObjectModel;
using System.Linq;

namespace BPASmartClient.FoodStationTest.ViewModel
{
public class DeviceMaterialParViewModel : ObservableObject
public class DeviceMaterialParViewModel : NotifyBase
{
public DeviceMaterialParViewModel()
{
deviceParModels = Json<DevicePar>.Data.deviceParModels;
RemoveCommand = new RelayCommand<object>((o) =>
RemoveCommand = new BPARelayCommand<object>((o) =>
{
var res = deviceParModels.FirstOrDefault(p => p.MaterialName == o?.ToString());
if (res != null)
@@ -22,8 +22,8 @@ namespace BPASmartClient.FoodStationTest.ViewModel
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"{o.ToString()}:原料删除成功!");
});

AddCommand = new RelayCommand(() => { deviceParModels.Add(new DeviceParMode()); });
SaveCommand = new RelayCommand(() =>
AddCommand = new BPARelayCommand(() => { deviceParModels.Add(new DeviceParMode()); });
SaveCommand = new BPARelayCommand(() =>
{
if (deviceParModels == null || deviceParModels.Count <= 0)
{
@@ -56,10 +56,10 @@ namespace BPASmartClient.FoodStationTest.ViewModel

public ObservableCollection<DeviceParMode> deviceParModels { get; set; }

public RelayCommand<object> RemoveCommand { get; set; }
public BPARelayCommand<object> RemoveCommand { get; set; }

public RelayCommand AddCommand { get; set; }
public RelayCommand SaveCommand { get; set; }
public BPARelayCommand AddCommand { get; set; }
public BPARelayCommand SaveCommand { get; set; }

}
}

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

@@ -1,10 +1,10 @@
using BPASmartClient.FoodStationTest.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using BPA.Helper;
using System.Collections.ObjectModel;

namespace BPASmartClient.FoodStationTest.ViewModel
{
public class HardwareStatusViewModel : ObservableObject
public class HardwareStatusViewModel : NotifyBase
{
public HardwareStatusViewModel()
{


+ 6
- 6
BPASmartClient.FoodStationTest/ViewModel/ManualCommViewModel.cs View File

@@ -1,17 +1,17 @@
using BPASmartClient.FoodStationTest.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;
using System.Collections.ObjectModel;
using System.Linq;

namespace BPASmartClient.FoodStationTest.ViewModel
{
public class ManualCommViewModel : ObservableObject
public class ManualCommViewModel : NotifyBase
{
public ManualCommViewModel()
{
PlcDataColl.Add(new VarMonitor() { SerialNum = PlcDataColl.Count, Address = "", });
SetParCommand = new RelayCommand<object>((o) =>
SetParCommand = new BPARelayCommand<object>((o) =>
{
if (o != null && o is string address)
{
@@ -21,9 +21,9 @@ namespace BPASmartClient.FoodStationTest.ViewModel
}
public static ObservableCollection<VarMonitor> PlcDataColl { get; set; } = new ObservableCollection<VarMonitor>();

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

public RelayCommand Connect { get; set; }
public BPARelayCommand Connect { get; set; }

}
}

+ 42
- 42
BPASmartClient.FoodStationTest/ViewModel/ManualControlViewModel.cs View File

@@ -1,9 +1,9 @@
using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.FoodStationTest.Model;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
using BPA.Helper;
using BPA.Helper;
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
@@ -13,11 +13,11 @@ using System.Threading;

namespace BPASmartClient.FoodStationTest.ViewModel
{
public class ManualControlViewModel : ObservableObject
public class ManualControlViewModel : NotifyBase
{
public ManualControlViewModel()
{
ThreadManage.GetInstance().StartLong(new Action(() =>
TaskManage.GetInstance.StartLong(new Action(() =>
{
PlcSystemMode = GVL_SmallStation.GetInstance.PlcSystemMode;
//SystemMode = GVL_SmallStation.GetInstance.PlcSystemMode ? "手动" : "自动";
@@ -216,80 +216,80 @@ namespace BPASmartClient.FoodStationTest.ViewModel
});
}
}
Open = new RelayCommand<object>((o) =>
Open = new BPARelayCommand<object>((o) =>
{
ActionManage.GetInstance.Send("ManualOpen", o);
});
Close = new RelayCommand<object>((o) =>
Close = new BPARelayCommand<object>((o) =>
{
ActionManage.GetInstance.Send("ManualClose", o);
});
StartAxisLoadCommand = new RelayCommand(() =>
StartAxisLoadCommand = new BPARelayCommand(() =>
{
ActionManage.GetInstance.Send("StartAxisLoadCommand");
});
StopAxisLoadCommand = new RelayCommand(() =>
StopAxisLoadCommand = new BPARelayCommand(() =>
{
ActionManage.GetInstance.Send("StopAxisLoadCommand");
});
StartAxisMidCommand = new RelayCommand(() =>
StartAxisMidCommand = new BPARelayCommand(() =>
{
ActionManage.GetInstance.Send("StartAxisMidCommand");
});
StopAxisMidCommand = new RelayCommand(() =>
StopAxisMidCommand = new BPARelayCommand(() =>
{
ActionManage.GetInstance.Send("StopAxisMidCommand");
});
StartAxisUnLoadCommand = new RelayCommand(() =>
StartAxisUnLoadCommand = new BPARelayCommand(() =>
{
ActionManage.GetInstance.Send("StartAxisUnLoadCommand");
});
StopAxisUnLoadCommand = new RelayCommand(() =>
StopAxisUnLoadCommand = new BPARelayCommand(() =>
{
ActionManage.GetInstance.Send("StopAxisUnLoadCommand");
});
StartAxis1Command = new RelayCommand(() =>
StartAxis1Command = new BPARelayCommand(() =>
{
ActionManage.GetInstance.Send("StartAxis1Command");
});
StopAxis1Command = new RelayCommand(() =>
StopAxis1Command = new BPARelayCommand(() =>
{
ActionManage.GetInstance.Send("StopAxis1Command");
});
StartAxis2Command = new RelayCommand(() =>
StartAxis2Command = new BPARelayCommand(() =>
{
ActionManage.GetInstance.Send("StartAxis2Command");
});
StopAxis2Command = new RelayCommand(() =>
StopAxis2Command = new BPARelayCommand(() =>
{
ActionManage.GetInstance.Send("StopAxis2Command");
});

SystemStartCommand = new RelayCommand(() =>
SystemStartCommand = new BPARelayCommand(() =>
{
ActionManage.GetInstance.Send("SystemStart");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"系统启动!");
});
SystemStopCommand = new RelayCommand(() =>
SystemStopCommand = new BPARelayCommand(() =>
{
ActionManage.GetInstance.Send("SystemStop");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"系统停止!");
});
SystemPauseCommand = new RelayCommand(() =>
SystemPauseCommand = new BPARelayCommand(() =>
{
ActionManage.GetInstance.Send("SystemPause");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"系统暂停!");
});
SystemResetCommand = new RelayCommand(() =>
SystemResetCommand = new BPARelayCommand(() =>
{
ActionManage.GetInstance.Send("SystemReset");
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"系统暂停后复位!");
});
DebugMode = new RelayCommand(() =>
DebugMode = new BPARelayCommand(() =>
{
// ActionManage.GetInstance.Send("SystemDebugMode");
});
AutoMode = new RelayCommand(() =>
AutoMode = new BPARelayCommand(() =>
{
// ActionManage.GetInstance.Send("SystemAutoMode");
});
@@ -320,30 +320,30 @@ namespace BPASmartClient.FoodStationTest.ViewModel
{
StaticPropertyChanged?.Invoke(null, new PropertyChangedEventArgs(PropName));
}
public RelayCommand<object> Open { get; set; }
public BPARelayCommand<object> Open { get; set; }

public RelayCommand<object> Close { get; set; }
public BPARelayCommand<object> Close { get; set; }

//五个电机手动控制
public RelayCommand StartAxisLoadCommand { get; set; }
public RelayCommand StopAxisLoadCommand { get; set; }
public RelayCommand StartAxisMidCommand { get; set; }
public RelayCommand StopAxisMidCommand { get; set; }
public RelayCommand StartAxisUnLoadCommand { get; set; }
public RelayCommand StopAxisUnLoadCommand { get; set; }
public RelayCommand StartAxis1Command { get; set; }
public RelayCommand StopAxis1Command { get; set; }
public RelayCommand StartAxis2Command { get; set; }
public RelayCommand StopAxis2Command { get; set; }
public BPARelayCommand StartAxisLoadCommand { get; set; }
public BPARelayCommand StopAxisLoadCommand { get; set; }
public BPARelayCommand StartAxisMidCommand { get; set; }
public BPARelayCommand StopAxisMidCommand { get; set; }
public BPARelayCommand StartAxisUnLoadCommand { get; set; }
public BPARelayCommand StopAxisUnLoadCommand { get; set; }
public BPARelayCommand StartAxis1Command { get; set; }
public BPARelayCommand StopAxis1Command { get; set; }
public BPARelayCommand StartAxis2Command { get; set; }
public BPARelayCommand StopAxis2Command { get; set; }

public RelayCommand SystemStartCommand { get; set; }
public RelayCommand SystemStopCommand { get; set; }
public RelayCommand SystemPauseCommand { get; set; }
public BPARelayCommand SystemStartCommand { get; set; }
public BPARelayCommand SystemStopCommand { get; set; }
public BPARelayCommand SystemPauseCommand { get; set; }

public RelayCommand SystemResetCommand { get; set; }
public BPARelayCommand SystemResetCommand { get; set; }

public RelayCommand AutoMode { get; set; }
public RelayCommand DebugMode { get; set; }
public BPARelayCommand AutoMode { get; set; }
public BPARelayCommand DebugMode { get; set; }

/// <summary>
/// 系统模式改变
@@ -409,7 +409,7 @@ namespace BPASmartClient.FoodStationTest.ViewModel



public class CylinderModel : ObservableObject
public class CylinderModel : NotifyBase
{
public bool LeftTog { get { return _mLeftTog; } set { _mLeftTog = value; OnPropertyChanged(); } }
private bool _mLeftTog;


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

Loading…
Cancel
Save