Browse Source

解决冲突

master
pengliangyang 1 year ago
parent
commit
7b99ad3ea1
41 changed files with 2633 additions and 251 deletions
  1. +30
    -31
      BPASmartClient.AGV/AGVHelper.cs
  2. +1
    -1
      BPASmartClient.Business/BPASmartClient.Business.csproj
  3. +1
    -1
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  4. +1
    -1
      BPASmartClient.Device/BPASmartClient.Device.csproj
  5. +1
    -1
      BPASmartClient.DosingSystemSingle/BPASmartClient.DosingSystemSingle.csproj
  6. +1
    -1
      BPASmartClient.JXJFoodSmallStation/BPASmartClient.JXJFoodSmallStation.csproj
  7. +1
    -1
      BPASmartClient.Model/BPASmartClient.Model.csproj
  8. +1
    -1
      BPASmartClient.MorkF/BPASmartClient.MorkF.csproj
  9. +1
    -1
      BPASmartClient.MorkMW/BPASmartClient.MorkMW.csproj
  10. +1
    -1
      BPASmartClient.MorkS/BPASmartClient.MorkS.csproj
  11. +74
    -0
      BPASmartClient.MorkSUpgradedVer/Alarm.cs
  12. +35
    -0
      BPASmartClient.MorkSUpgradedVer/BPASmartClient.MorkSUpgradedVer.csproj
  13. +779
    -0
      BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs
  14. +51
    -0
      BPASmartClient.MorkSUpgradedVer/DataServer.cs
  15. +193
    -0
      BPASmartClient.MorkSUpgradedVer/DeviceData.cs
  16. +334
    -0
      BPASmartClient.MorkSUpgradedVer/GVL_MorkSUpgradedVer.cs
  17. +26
    -0
      BPASmartClient.MorkSUpgradedVer/GlobalUsing.cs
  18. +13
    -0
      BPASmartClient.MorkSUpgradedVer/Model/Global.cs
  19. +16
    -0
      BPASmartClient.MorkSUpgradedVer/Model/MorksPar.cs
  20. +29
    -0
      BPASmartClient.MorkSUpgradedVer/Model/ParSet.cs
  21. +14
    -0
      BPASmartClient.MorkSUpgradedVer/Model/WritePar.cs
  22. +23
    -0
      BPASmartClient.MorkSUpgradedVer/OrderLocInfo.cs
  23. +117
    -0
      BPASmartClient.MorkSUpgradedVer/View/Debug.xaml
  24. +30
    -0
      BPASmartClient.MorkSUpgradedVer/View/Debug.xaml.cs
  25. +242
    -0
      BPASmartClient.MorkSUpgradedVer/View/Monitor.xaml
  26. +28
    -0
      BPASmartClient.MorkSUpgradedVer/View/Monitor.xaml.cs
  27. +130
    -0
      BPASmartClient.MorkSUpgradedVer/View/ParSet.xaml
  28. +28
    -0
      BPASmartClient.MorkSUpgradedVer/View/ParSet.xaml.cs
  29. +79
    -0
      BPASmartClient.MorkSUpgradedVer/ViewModel/DebugViewModel.cs
  30. +25
    -0
      BPASmartClient.MorkSUpgradedVer/ViewModel/MonitorViewModel.cs
  31. +49
    -0
      BPASmartClient.MorkSUpgradedVer/ViewModel/ParSetViewModel.cs
  32. +194
    -188
      BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml
  33. +7
    -7
      BPASmartClient/App.config
  34. +2
    -1
      BPASmartClient/BPASmartClient.csproj
  35. +1
    -1
      DosingSystem/BPASmartClient.DosingSystem.csproj
  36. +1
    -1
      FryPot_DosingSystem/App.config
  37. +28
    -9
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  38. +3
    -2
      FryPot_DosingSystem/Control/GlobalVariable.cs
  39. +5
    -0
      FryPot_DosingSystem/Model/MaterialType.cs
  40. +15
    -2
      FryPot_DosingSystem/View/NewRecipeView.xaml
  41. +23
    -0
      SmartClient.sln

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

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

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

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


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

@@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Include="BPA.ApolloClient" Version="1.0.12" />
<PackageReference Include="BPA.Helper" Version="1.0.33" />
<PackageReference Include="BPA.Message" Version="1.0.84" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />


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

@@ -410,7 +410,7 @@

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


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

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

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

<ItemGroup>


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

@@ -17,7 +17,7 @@

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



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

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

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


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

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

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



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

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

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

<ItemGroup>


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

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

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.84" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="BPA.Models" Version="1.0.38" />
<PackageReference Include="CommunityToolkit.Common" Version="8.0.0" />
</ItemGroup>


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

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

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


+ 74
- 0
BPASmartClient.MorkSUpgradedVer/Alarm.cs View File

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

namespace BPASmartClient.MorkSUpgradedVer
{
public class Alarm : IAlarm
{
/// <summary>
/// 煮面机温度过低
/// </summary>
[Alarm("煮面机温度过低")]
public bool MachineLowTemperature { get; set; }

/// <summary>
/// 大碗数量不足
/// </summary>
[Alarm("大碗数量不足")]
public bool Supply1_LossBowl { get; set; }

/// <summary>
/// 一次性碗数量不足
/// </summary>
[Alarm("一次性碗数量不足")]
public bool Supply2_LossBowl { get; set; }

/// <summary>
/// 设备未初始化
/// </summary>
[Alarm("设备未初始化")]
public bool DeviceNoInit { get; set; }

/// <summary>
/// 移碗丝杆未初始化
/// </summary>
[Alarm("移碗丝杆未初始化")]
public bool MoveScrewRodNoInit { get; set; }

/// <summary>
/// 供碗1未初始化
/// </summary>
[Alarm("供碗1未初始化")]
public bool SacrificialVesselNoInit { get; set; }

/// <summary>
/// 气缸推杆未初始化
/// </summary>
[Alarm("气缸推杆未初始化")]
public bool CylinderNoInit { get; set; }

/// <summary>
/// 煮面机初未初始化
/// </summary>
[Alarm("煮面机初未初始化")]
public bool NoodleCookerNoInit { get; set; }

/// <summary>
/// 机器人未初始化
/// </summary>
[Alarm("机器人未初始化")]
public bool RobotNoInit { get; set; }

/// <summary>
/// 料仓未初始化
/// </summary>
[Alarm("料仓未初始化")]
public bool SiloNoInit { get; set; }


}
}

+ 35
- 0
BPASmartClient.MorkSUpgradedVer/BPASmartClient.MorkSUpgradedVer.csproj View File

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

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

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

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

<ItemGroup>
<Compile Update="View\Debug.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="View\Monitor.xaml.cs">
<SubType>Code</SubType>
</Compile>
<Compile Update="View\ParSet.xaml.cs">
<SubType>Code</SubType>
</Compile>
</ItemGroup>

</Project>

+ 779
- 0
BPASmartClient.MorkSUpgradedVer/Control_MorkSUpgradedVer.cs View File

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

namespace BPASmartClient.MorkSUpgradedVer
{
public class Control_MorkSUpgradedVer : BaseDevice
{
public override DeviceClientType DeviceType => DeviceClientType.MORKS;
GVL_MorkSUpgradedVer mORKS = new GVL_MorkSUpgradedVer();
Alarm alarm = new Alarm();

public override void DoMain()
{
MonitorViewModel.DeviceId = DeviceId;
ServerInit();
DataParse();
Json<MorksPar>.Read();
Json<OrderStatistics>.Read();
if (Json<MorksPar>.Data.parSets == null) Json<MorksPar>.Data.parSets = new ObservableCollection<ParSet>();
if (Json<MorksPar>.Data.parSets.Count < 6)
{
Json<MorksPar>.Data.parSets.Clear();
for (int i = 0; i < 6; i++)
{
Json<MorksPar>.Data.parSets.Add(new ParSet()
{
CheckBoxContext = $"煮面口{i + 1}屏蔽",
Minute = 1,
Second = 0,
IsShield = false,
TextBlockContext = $"煮面口{i + 1}时间设定"
});
}
}

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

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

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

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

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

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

public override void Stop()
{

}

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

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


}

private void OrderChange(string subid, ORDER_STATUS oRDER_STATUS)
{
var res = mORKS.doOrderEvents.FirstOrDefault(p => p.MorkOrder.SuborderId == subid);
string goodName = string.Empty;
string SortNum = string.Empty;
if (res != null)
{
goodName = res.MorkOrder.GoodsName;
SortNum = res.MorkOrder.SortNum.ToString();
}

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

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

private void GetStatus(string key, Action<object> action)
{
if (peripheralStatus.ContainsKey(key))
{
if (peripheralStatus[key] != null)
{
action?.Invoke(peripheralStatus[key]);
}
}
}

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

GetStatus("M0.1", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 7)
{
Initing = !bools[0];
mORKS.InitComplete = bools[0];
mORKS.MoveScrewRodInitCom = bools[1];
mORKS.SacrificialVesselInitCom = bools[2];
mORKS.CylinderInitCom = bools[3];
mORKS.NoodleCookerInitCom = bools[4];
mORKS.RobotInitCom = bools[5];
mORKS.SiloInitCom = bools[6];

alarm.DeviceNoInit = !mORKS.InitComplete;
alarm.MoveScrewRodNoInit = !mORKS.MoveScrewRodInitCom;
alarm.SacrificialVesselNoInit = !mORKS.SacrificialVesselInitCom;
alarm.CylinderNoInit = !mORKS.CylinderInitCom;
alarm.NoodleCookerNoInit = !mORKS.NoodleCookerInitCom;
alarm.RobotNoInit = !mORKS.RobotInitCom;
alarm.SiloNoInit = !mORKS.SiloInitCom;
}
}));

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

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

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

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

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

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

GetStatus("M18.0", new Action<object>((obj) =>
{
if (obj is bool[] bools && bools.Length > 0 && bools.Length <= 5)
{
mORKS.SmallBowlYesOrNoCheck = bools[0];
mORKS.LargeBowYesOrNoCheck = bools[1];
mORKS.TurntableLowPosition = bools[2];
mORKS.TurntableHighPosition = bools[3];
alarm.Supply2_LossBowl = !mORKS.SmallBowlYesOrNoCheck;
alarm.Supply1_LossBowl = !mORKS.LargeBowYesOrNoCheck;
}
}));

GetStatus("VW17", new Action<object>((obj) =>
{
if (obj is ushort[] ushorts && ushorts.Length > 0 && ushorts.Length <= 1)
{
var tt = ushorts.UshortsToBytes(true).BytesToUshorts();

for (byte i = 0; i < 6; i++)
{
if (RTrig.GetInstance($"CookNoodleCom{i + 1}").Start(tt[0].GetBitValue((byte)(i + 1))))
{
if (!string.IsNullOrEmpty(mORKS.CookNodelId[i]))
mORKS.CookNoodleCom[i] = true;
}
}

//mORKS.CookNoodleCom[0] = tt[0].GetBitValue(1);
//mORKS.CookNoodleCom[1] = tt[0].GetBitValue(2);
//mORKS.CookNoodleCom[2] = tt[0].GetBitValue(3);
//mORKS.CookNoodleCom[3] = tt[0].GetBitValue(4);
//mORKS.CookNoodleCom[4] = tt[0].GetBitValue(5);
//mORKS.CookNoodleCom[5] = tt[0].GetBitValue(6);
mORKS.Heating = ushorts[0].GetBitValue(15);
mORKS.TemperatureReaches = ushorts[0].GetBitValue(16);

alarm.MachineLowTemperature = !mORKS.TemperatureReaches;
}

}));

GetStatus("VW770", new Action<object>((obj) =>
{
if (obj is ushort[] ushorts && ushorts.Length > 0 && ushorts.Length <= 1)
{
mORKS.CurrentFeedbackLoc = ushorts[0];
}

}));

mORKS.TakeBowlTaskCount = mORKS.TakeBowlTask.Count;
mORKS.RBTakeNoodleTaskCount = mORKS.RBTakeNoodleTask.Count;

}

/// <summary>
/// 数据解析
/// </summary>
private void DataParse()
{
EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBackHandle)
{
if (@event == null) return;
if (@event is DoOrderEvent order)
{
mORKS.doOrderEvents.Add(order);
if (order.MorkOrder.GoodBatchings == null) return;
if (mORKS.HistorySuborderId.Contains(order.MorkOrder.SuborderId)) return;
OrderCount++;
if (DateTime.Now.Subtract(Json<OrderStatistics>.Data.StatisticsTime).Days != 0)
Json<OrderStatistics>.Data.Count = 0;
Json<OrderStatistics>.Data.StatisticsTime = DateTime.Now;
Json<OrderStatistics>.Data.Count++;
Json<OrderStatistics>.Save();
OrderChange(order.MorkOrder.SuborderId, ORDER_STATUS.WAIT);
DeviceProcessLogShow($"接收到{OrderCount}次订单,订单ID:{order.MorkOrder.SuborderId}");
mORKS.HistorySuborderId.Add(order.MorkOrder.SuborderId);
foreach (var item in order.MorkOrder.GoodBatchings)
{
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
if (res != null)
{
if (ushort.TryParse(res.BatchingLoc, out ushort loc))
{
if (loc >= 1 && loc <= 5)
{
if (mORKS.RBTakeNoodleTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
mORKS.RBTakeNoodleTask.Enqueue(new OrderLocInfo() { GoodName = order.MorkOrder.GoodsName, Loc = ushort.Parse(res.BatchingLoc), SuborderId = order.MorkOrder.SuborderId, BatchingId = res.BatchingId });
}
else if (loc >= 10 && loc <= 11)
{
int index = 0;
if (recipeBoms != null)
{
index = Array.FindIndex(recipeBoms.RecipeIds?.ToArray(), p => p.RecipeId == order.MorkOrder.RecipeId);
index++;
}
if (mORKS.TakeBowlTask.FirstOrDefault(p => p.SuborderId == order.MorkOrder.SuborderId) == null)
mORKS.TakeBowlTask.Enqueue(new OrderLocInfo()
{
BatchingId = res.BatchingId,
GoodName = order.MorkOrder.GoodsName,
Loc = ushort.Parse(res.BatchingLoc),
SuborderId = order.MorkOrder.SuborderId,
RecipeNumber = (index >= 1 && index <= 10) ? (ushort)index : (ushort)0
});
}
}
}
}
}
});
}

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

TakeBowlTask();

TakeNoodleTask();

OutNoodleTask();

SingleDetect();

TurntableControl();
}

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

/// <summary>
/// 取碗控制
/// </summary>
private void TakeBowlTask()
{
if (mORKS.AllowRun && mORKS.TakeBowlTask.Count > 0 && !mORKS.DropBowlMechanismStatus && !mORKS.TakeBowlInterlock)
{
ushort BowLoc = 0;
var res = orderMaterialDelivery?.BatchingInfo?.Where(p => p.BatchingId == mORKS.TakeBowlTask.ElementAt(0).BatchingId).ToList();
if (res == null || res?.Count == 0)
{
if (mORKS.TakeBowlTask.TryDequeue(out OrderLocInfo orderLocInfo)) BowlControl(orderLocInfo);
}
else
{
foreach (var item in res)
{
if (ushort.TryParse(item.BatchingLoc, out ushort loc))
{
if (loc == 10 && mORKS.SmallBowlYesOrNoCheck)
{
BowLoc = loc;
break;
}
else if (loc == 11 && mORKS.LargeBowYesOrNoCheck)
{
BowLoc = loc;
break;
}
}
}

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

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

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

//转台到位检测
if (RTrig.GetInstance("TurntableInPlace").Start(mORKS.SiloInPlace && mORKS.CurrentLoc == mORKS.CurrentFeedbackLoc))
{

mORKS.TurntableInterlock = false;
DeviceProcessLogShow("转台到位检测");
}

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

}

/// <summary>
/// 取面任务
/// </summary>
private void TakeNoodleTask()
{
//取面控制
if (mORKS.AllowRun && mORKS.RobotStatus && !mORKS.Feeding && !mORKS.RobotTaskInterlock && mORKS.AllowTakeNoodle && mORKS.SiloInPlace && !mORKS.TakeNoodleInterlock && mORKS.RBTakeNoodleTask.Count > 0)
{
if (mORKS.CurrentLoc == mORKS.CurrentFeedbackLoc)
{
int loc = Array.FindIndex(mORKS.NoodleCookerStatus, p => p == false);//查找煮面炉空闲位置
if (loc >= 0 && loc <= 5)
{
if (!Json<MorksPar>.Data.parSets.ElementAt(loc).IsShield)//检查该煮面篮是否被屏蔽
{
if (mORKS.RBTakeNoodleTask.TryDequeue(out OrderLocInfo orderLocInfo))
{
//写入煮面时间
List<ushort> values = new List<ushort>();
values.Add(Json<MorksPar>.Data.parSets.ElementAt(loc).Minute);
values.Add(Json<MorksPar>.Data.parSets.ElementAt(loc).Second);
WriteData($"VW{324 + (loc * 4)}", values.ToArray());

mORKS.CurrentLoc = 0;
mORKS.CookNodelId[loc] = orderLocInfo.SuborderId;
mORKS.NoodleCookerStatus[loc] = true;
SetFallNoodleLoc((ushort)(loc + 1));
//机器人开始取面
OrderChange(orderLocInfo.SuborderId, ORDER_STATUS.COOKING);
DeviceProcessLogShow($"订单【{orderLocInfo.SuborderId}】,机器人倒面至【{loc + 1}】号煮面栏");

mORKS.TakeNoodleInterlock = true;
}
}
}
}
}
}

/// <summary>
/// 出餐控制
/// </summary>
private void OutNoodleTask()
{
if (mORKS.AllowInvertedFace && mORKS.RobotTaskInterlock && !mORKS.TakeNoodleInterlock && mORKS.RobotStatus)
{
int loc = Array.FindIndex(mORKS.CookNodelId, p => p == mORKS.IngredientsCompleteId && p.Length > 0);
if (loc >= 0 && loc <= 5)
{
if (mORKS.CookNoodleCom[loc])
{
SetTakeNoodleLoc((ushort)(loc + 1));
mORKS.NoodleCookerStatus[loc] = false;
WriteData($"VW260", (ushort)0);//设置出汤时间
OrderChange(mORKS.IngredientsCompleteId, ORDER_STATUS.COMPLETED_COOK);
DeviceProcessLogShow($"订单【{mORKS.IngredientsCompleteId}】制作完成");
mORKS.CookCompleteFlatBit = true;
mORKS.OutMealId = mORKS.IngredientsCompleteId;
mORKS.OutMealName = mORKS.IngredientsCompleteName;
mORKS.IngredientsCompleteId = string.Empty;
mORKS.CookNodelId[loc] = string.Empty;
DeviceProcessLogShow($"{loc + 1} 号位置出餐控制,订单ID:{mORKS.OutMealId}");
mORKS.CookNoodleCom[loc] = false;
}
}
}
}

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

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

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

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

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

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


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

#region PLC 控制函数

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

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

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

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

/// <summary>
/// 设置倒面位置
/// </summary>
/// <param name="loc"></param>
private void SetFallNoodleLoc(ushort loc)
{
if (loc >= 1 && loc <= 6)
WriteData($"M14.{loc - 1}", true);
}

/// <summary>
/// 设置取面位置
/// </summary>
/// <param name="loc"></param>
private void SetTakeNoodleLoc(ushort loc)
{
if (loc >= 1 && loc <= 6)
WriteData($"M15.{loc - 1}", true);
}



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

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

}
});
}
#endregion


}
}

+ 51
- 0
BPASmartClient.MorkSUpgradedVer/DataServer.cs View File

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

namespace BPASmartClient.MorkSUpgradedVer
{
public class DataServer
{

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

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

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

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

+ 193
- 0
BPASmartClient.MorkSUpgradedVer/DeviceData.cs View File

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

namespace BPASmartClient.MorkSUpgradedVer
{
public class DeviceData : IStatus
{
/// <summary>
/// 初始化启动
/// </summary>
[VariableMonitor("初始化启动", "M0.0", "320")]
public bool InitStart { get; set; }

/// <summary>
/// 初始化完成
/// </summary>
[VariableMonitor("初始化完成", "M0.1", "321")]
public bool InitComplete { get; set; }

/// <summary>
/// 移碗丝杆初始化完成
/// </summary>
[VariableMonitor("移碗丝杆初始化完成", "M0.2", "322")]
public bool MoveScrewRodInitCom { get; set; }

/// <summary>
/// 供碗1初始化完成
/// </summary>
[VariableMonitor("供碗1初始化完成", "M0.3", "323")]
public bool SacrificialVesselInitCom { get; set; }

/// <summary>
/// 气缸推杆初始化完成
/// </summary>
[VariableMonitor("气缸推杆初始化完成", "M0.4", "324")]
public bool CylinderInitCom { get; set; }

/// <summary>
/// 煮面机初始化完成
/// </summary>
[VariableMonitor("煮面机初始化完成", "M0.5", "325")]
public bool NoodleCookerInitCom { get; set; }

/// <summary>
/// 机器人初始化完成
/// </summary>
[VariableMonitor("机器人初始化完成", "M0.6", "326")]
public bool RobotInitCom { get; set; }

/// <summary>
/// 料仓初始化完成
/// </summary>
[VariableMonitor("料仓初始化完成", "M0.7", "327")]
public bool SiloInitCom { get; set; }

/// <summary>
/// 故障复位/停止
/// </summary>
[VariableMonitor("故障复位/停止", "M1.0", "328")]
public bool FaultResetOrStop { get; set; }

/// <summary>
/// 落碗1,大碗
/// </summary>
[VariableMonitor("落碗1,大碗", "M9.0", "392")]
public bool DropBowlOne { get; set; }

/// <summary>
/// 落碗2,一次性碗
/// </summary>
[VariableMonitor("落碗2,一次性碗", "M9.1", "393")]
public bool DropBowlTow { get; set; }

/// <summary>
/// 允许倒面
/// </summary>
[VariableMonitor("允许倒面", "M10.0", "400")]
public bool AllowInvertedFace { get; set; }

/// <summary>
/// 出餐完成
/// </summary>
[VariableMonitor("出餐完成", "M10.1", "401")]
public bool DiningComplete { get; set; }

/// <summary>
/// 落碗机构状态,1:忙碌 0:空闲
/// </summary>
[VariableMonitor("落碗机构状态,1:忙碌 0:空闲", "M10.4", "404")]
public bool DropBowlMechanismStatus { get; set; }

/// <summary>
/// 定位标志,1:忙碌 0:空闲
/// </summary>
[VariableMonitor("定位标志,1:忙碌 0:空闲", "M12.2", "418")]
public bool FixedFlag { get; set; }

/// <summary>
/// 定位启动
/// </summary>
[VariableMonitor("定位启动", "M12.3", "419")]
public bool FixedStart { get; set; }

/// <summary>
/// 料仓到位
/// </summary>
[VariableMonitor("料仓到位", "M13.5", "429")]
public bool SiloInPlace { get; set; }

/// <summary>
/// 机器人料仓取面完成
/// </summary>
[VariableMonitor("机器人去料仓取面完成", "M16.7", "455")]
public bool RobotTakeNoodleCom { get; set; }

/// <summary>
/// 机器人状态
/// </summary>
[VariableMonitor("机器人状态", "M17.4", "460")]
public bool RobotStatus { get; set; }

/// <summary>
/// 一次性碗有无检测
/// </summary>
[VariableMonitor("一次性碗有无检测", "M18.0", "464")]
public bool SmallBowlYesOrNoCheck { get; set; }

/// <summary>
/// 大碗有无检测
/// </summary>
[VariableMonitor("大碗有无检测", "M18.1", "465")]
public bool LargeBowYesOrNoCheck { get; set; }

/// <summary>
/// 转台高位
/// </summary>
[VariableMonitor("转台高位", "M18.2", "466")]
public bool TurntableHighPosition { get; set; }

/// <summary>
/// 转台低位
/// </summary>
[VariableMonitor("转台低位", "M18.3", "467")]
public bool TurntableLowPosition { get; set; }

/// <summary>
/// 煮面完成
/// </summary>
[VariableMonitor("煮面完成", "V17.0")]
public bool[] CookNoodleCom { get; set; } = new bool[6];

/// <summary>
/// 本地/远程
/// </summary>
[VariableMonitor("本地/远程", "V18.0")]
public bool LocalOrRemote { get; set; }

/// <summary>
/// 温度到达
/// </summary>
[VariableMonitor("温度到达", "V18.7")]
public bool TemperatureReaches { get; set; }

/// <summary>
/// 加热中
/// </summary>
[VariableMonitor("加热中", "V18.6")]
public bool Heating { get; set; }

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

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

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

}
}

+ 334
- 0
BPASmartClient.MorkSUpgradedVer/GVL_MorkSUpgradedVer.cs View File

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

namespace BPASmartClient.MorkSUpgradedVer
{
public class GVL_MorkSUpgradedVer : IStatus
{
#region 临时变量
/// <summary>
/// 允许运行
/// </summary>
[VariableMonitor("允许运行")]
public bool AllowRun { get; set; }

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

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

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

/// <summary>
/// 取面互锁信号
/// </summary>
[VariableMonitor("取面互锁信号")]
public bool TakeNoodleInterlock { get; set; }

/// <summary>
/// 出面中
/// </summary>
[VariableMonitor("出面中")]
public bool OutNoodleing { get; set; }

/// <summary>
/// 允许取面
/// </summary>
[VariableMonitor("允许取面")]
public bool AllowTakeNoodle { get; set; }

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


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

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

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

/// <summary>
/// 取碗任务数量
/// </summary>
[VariableMonitor("取碗任务数量")]
public int TakeBowlTaskCount { get; set; }

/// <summary>
/// 取面任务数量
/// </summary>
[VariableMonitor("取面任务数量")]
public int RBTakeNoodleTaskCount { get; set; }
#endregion

#region 列表数据
/// <summary>
/// 机器人取面位置队列
/// </summary>
public ConcurrentQueue<OrderLocInfo> RBTakeNoodleTask { get; set; } = new ConcurrentQueue<OrderLocInfo>();

/// <summary>
/// 出碗队列
/// </summary>
public ConcurrentQueue<OrderLocInfo> TakeBowlTask { get; set; } = new ConcurrentQueue<OrderLocInfo>();


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

public List<string> HistorySuborderId { get; set; } = new List<string>();
#endregion

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

/// <summary>
/// 允许倒面位置ID
/// </summary>
public string IngredientsCompleteId { get; set; } = string.Empty;
/// <summary>
/// 配料完成订单名称
/// </summary>
public string IngredientsCompleteName { get; set; } = string.Empty;

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

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

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

#endregion

#region device Data
/// <summary>
/// 初始化启动
/// </summary>
[VariableMonitor("初始化启动", "M0.0", "320")]
public bool InitStart { get; set; }

/// <summary>
/// 初始化完成
/// </summary>
[VariableMonitor("初始化完成", "M0.1", "321")]
public bool InitComplete { get; set; }

/// <summary>
/// 移碗丝杆初始化完成
/// </summary>
[VariableMonitor("移碗丝杆初始化完成", "M0.2", "322")]
public bool MoveScrewRodInitCom { get; set; }

/// <summary>
/// 供碗1初始化完成
/// </summary>
[VariableMonitor("供碗1初始化完成", "M0.3", "323")]
public bool SacrificialVesselInitCom { get; set; }

/// <summary>
/// 气缸推杆初始化完成
/// </summary>
[VariableMonitor("气缸推杆初始化完成", "M0.4", "324")]
public bool CylinderInitCom { get; set; }

/// <summary>
/// 煮面机初始化完成
/// </summary>
[VariableMonitor("煮面机初始化完成", "M0.5", "325")]
public bool NoodleCookerInitCom { get; set; }

/// <summary>
/// 机器人初始化完成
/// </summary>
[VariableMonitor("机器人初始化完成", "M0.6", "326")]
public bool RobotInitCom { get; set; }

/// <summary>
/// 料仓初始化完成
/// </summary>
[VariableMonitor("料仓初始化完成", "M0.7", "327")]
public bool SiloInitCom { get; set; }

/// <summary>
/// 故障复位/停止
/// </summary>
[VariableMonitor("故障复位/停止", "M1.0", "328")]
public bool FaultResetOrStop { get; set; }

/// <summary>
/// 落碗1,大碗
/// </summary>
[VariableMonitor("落碗1,大碗", "M9.0", "392")]
public bool DropBowlOne { get; set; }

/// <summary>
/// 落碗2,一次性碗
/// </summary>
[VariableMonitor("落碗2,一次性碗", "M9.1", "393")]
public bool DropBowlTow { get; set; }

/// <summary>
/// 允许倒面
/// </summary>
[VariableMonitor("允许倒面", "M10.0", "400")]
public bool AllowInvertedFace { get; set; }

/// <summary>
/// 出餐完成
/// </summary>
[VariableMonitor("出餐完成", "M10.1", "401")]
public bool DiningComplete { get; set; }

/// <summary>
/// 落碗机构状态,1:忙碌 0:空闲
/// </summary>
[VariableMonitor("落碗机构状态,1:忙碌 0:空闲", "M10.4", "404")]
public bool DropBowlMechanismStatus { get; set; }

/// <summary>
/// 定位标志,1:忙碌 0:空闲
/// </summary>
[VariableMonitor("定位标志,1:忙碌 0:空闲", "M12.2", "418")]
public bool FixedFlag { get; set; }

/// <summary>
/// 定位启动
/// </summary>
[VariableMonitor("定位启动", "M12.3", "419")]
public bool FixedStart { get; set; }

/// <summary>
/// 料仓到位
/// </summary>
[VariableMonitor("料仓到位", "M13.5", "429")]
public bool SiloInPlace { get; set; }

/// <summary>
/// 机器人料仓取面完成
/// </summary>
[VariableMonitor("机器人去料仓取面完成", "M16.7", "455")]
public bool RobotTakeNoodleCom { get; set; }

/// <summary>
/// 机器人状态
/// </summary>
[VariableMonitor("机器人状态", "M17.4", "460")]
public bool RobotStatus { get; set; }

/// <summary>
/// 一次性碗有无检测
/// </summary>
[VariableMonitor("一次性碗有无检测", "M18.0", "464")]
public bool SmallBowlYesOrNoCheck { get; set; }

/// <summary>
/// 大碗有无检测
/// </summary>
[VariableMonitor("大碗有无检测", "M18.1", "465")]
public bool LargeBowYesOrNoCheck { get; set; }

/// <summary>
/// 转台高位
/// </summary>
[VariableMonitor("转台高位", "M18.2", "466")]
public bool TurntableHighPosition { get; set; }

/// <summary>
/// 转台低位
/// </summary>
[VariableMonitor("转台低位", "M18.3", "467")]
public bool TurntableLowPosition { get; set; }

/// <summary>
/// 煮面完成
/// </summary>
[VariableMonitor("煮面完成")]
public bool[] CookNoodleCom { get; set; } = new bool[6];

/// <summary>
/// 本地/远程
/// </summary>
[VariableMonitor("本地/远程")]
public bool LocalOrRemote { get; set; }

/// <summary>
/// 温度到达
/// </summary>
[VariableMonitor("温度到达")]
public bool TemperatureReaches { get; set; }

/// <summary>
/// 加热中
/// </summary>
[VariableMonitor("加热中")]
public bool Heating { get; set; }

/// <summary>
/// 转台当前位置
/// </summary>
[VariableMonitor("转台当前位置", "VW770", "870")]
public ushort CurrentFeedbackLoc { get; set; }

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

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

+ 26
- 0
BPASmartClient.MorkSUpgradedVer/GlobalUsing.cs View File

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



+ 13
- 0
BPASmartClient.MorkSUpgradedVer/Model/Global.cs View File

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

namespace BPASmartClient.MorkSUpgradedVer.Model
{
public class Global
{
public static bool EnableLocalSimOrder { get; set; }
}
}

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

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

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

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

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

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

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


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


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

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

}
}

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

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

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

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

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

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

public int RecipeId { get; set; }

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

}
}

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

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

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

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

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

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

</StackPanel>

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

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



</Grid>
</UserControl>

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

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

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

}
}

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

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

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

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

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

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

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

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

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

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

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


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



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

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

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

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

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

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


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

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

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

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

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

</Grid>

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

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


</Grid>

</UserControl>

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

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

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

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

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

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

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

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

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

</UserControl.Resources>

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

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

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

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


</StackPanel>

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

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

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

</Grid>

</Grid>


</UserControl>

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

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

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

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

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

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

public RelayCommand InitCommand { get; set; }

public RelayCommand SimOrderCommand { get; set; }

public RelayCommand SimOrderRandomCommand { get; set; }

public RelayCommand SimOrderRandomCloseCommand { get; set; }

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


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

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

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

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

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

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

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

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

}

public static int DeviceId { get; set; }

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

}
}

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

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

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

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

public RelayCommand SaveInfoCommand { get; set; }

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

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

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

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

+ 194
- 188
BPASmartClient.ScreenLib/分餐机/ScreenSplitMealsControl1.xaml View File

@@ -1,189 +1,195 @@
<UserControl x:Class="BPASmartClient.ScreenLib.ScreenSplitMealsControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.ScreenLib"
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
xmlns:con="clr-namespace:BPA.CustomResource.UserControls;assembly=BPA.CustomResource"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPA.CustomResource;component/Themes/ProlineStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<StackPanel Margin="0,10,0,0">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="1 号档口" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="设备运行情况" Margin="20,10,0,0"/>
<Grid Height="160" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备工作状态</TextBlock>
</StackPanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="当前操作信息" Margin="20,10,0,0"/>
<Grid Height="160">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">前一位刷卡人</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">当前刷卡人</TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</GroupBox>
<GroupBox Margin="0,20,10,0" Height="480" Width="450" Header="今日菜品列表" Style="{DynamicResource from}" Tag="Start">
<ListBox ItemsSource="{Binding ViewData.SplitMeals_CookType_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel>
<Border Style="{DynamicResource border顶部背景}" Width="370" Height="100" Margin="20,20,0,0" >
<TextBlock HorizontalAlignment="Center" Foreground="{DynamicResource foreground}" VerticalAlignment="Center" Text="{Binding .}" FontSize="60"></TextBlock>
</Border>
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</GroupBox>
</StackPanel>
<StackPanel Grid.Column="1" MouseLeftButtonDown="StackPanel_MouseLeftButtonDown" VerticalAlignment="Bottom" Margin="0,0,0,10">
<GroupBox x:Name="guanggao" Height="600" Width="950" Margin="0,10,0,20" Header="广告区域" HorizontalAlignment="Center" VerticalAlignment="Top" Style="{DynamicResource from}" Tag="Start">
<Grid>
<wv2:WebView2 Name="webView" />
</Grid>
</GroupBox>
<Grid x:Name="diqiu" Height="600" Width="950" Margin="0,10,0,20" > <Image Style="{DynamicResource imagezhu}"></Image> <Image Style="{DynamicResource image中1}" Margin="0,400,0,0"></Image> <GroupBox Margin="600,100,0,500" Header="{Binding ViewData.FailuresCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="累计故障数" Content="次" Width="100"/> <GroupBox Margin="600,400,0,0" Header="0" Style="{DynamicResource GroupStyle圆形}" Tag="故障次数" Content="次" Width="160"/> <GroupBox Margin="-500,100,0,0" Header="{Binding OrderCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="日总接待人数" Content="人" Width="160"/> </Grid>
<GroupBox Margin="0,0,0,0" Height="340" Width="950" Header="信息通知区域" Style="{DynamicResource from}">
<DataGrid Margin="10,10,10,0" ItemsSource="{Binding ViewData.Alarm,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="250">
<DataGridTemplateColumn.Header>
<TextBlock Text="信息时间" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmTime}" Foreground="#a70909" FontSize="16" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="*">
<DataGridTemplateColumn.Header>
<TextBlock Text="详细描述" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmMs}" Foreground="#a70909" FontSize="16" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</GroupBox>
</StackPanel>
<StackPanel Grid.Column="2" Margin="0,10,0,0">
<GroupBox Grid.Row="0" Margin="10,0,10,0" Height="460" Width="450" Header="2 号档口" Style="{DynamicResource from}" Tag="Start">
<StackPanel>
<GroupBox Header="设备运行情况" Margin="20,10,0,0"/>
<Grid Height="160" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock HorizontalAlignment="Center" FontSize="42" Text="{Binding ViewData.WorkStatus_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Foreground" Value="Lime"></Setter>
<Style.Triggers>
<Trigger Property="Text" Value="停止">
<Setter Property="Foreground" Value="Red"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">设备工作状态</TextBlock>
</StackPanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="1">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardCount_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">今日刷卡数</TextBlock>
</StackPanel>
</Grid>
<GroupBox Header="当前操作信息" Margin="20,10,0,0"/>
<Grid Height="160">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Border Grid.ColumnSpan="2" Background="{DynamicResource 竖线}" Height="100" Width="2"></Border>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" FontSize="52" Foreground="#FFD2C106" Text="{Binding ViewData.SplitMeals_CreditCardNameBefore_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">前一位刷卡人</TextBlock>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock Style="{DynamicResource 数码管Text}" Foreground="Lime" FontSize="52" Text="{Binding ViewData.SplitMeals_CreditCardName_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"></TextBlock>
<TextBlock Style="{DynamicResource textms}" Margin="0,10,0,0">当前刷卡人</TextBlock>
</StackPanel>
</Grid>
</StackPanel>
</GroupBox>
<GroupBox Margin="0,20,10,0" Height="480" Width="450" Header="今日菜品列表" Style="{DynamicResource from}" Tag="Start">
<ListBox ItemsSource="{Binding ViewData.SplitMeals_CookType_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel>
<Border Style="{DynamicResource border顶部背景}" Width="370" Height="100" Margin="20,20,0,0" >
<TextBlock HorizontalAlignment="Center" Foreground="{DynamicResource foreground}" VerticalAlignment="Center" Text="{Binding .}" FontSize="60"></TextBlock>
</Border>
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</GroupBox>
</StackPanel>
</Grid>
<UserControl x:Class="BPASmartClient.ScreenLib.ScreenSplitMealsControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.ScreenLib"
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
xmlns:con="clr-namespace:BPA.CustomResource.UserControls;assembly=BPA.CustomResource"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/BPA.CustomResource;component/Themes/ProlineStyle.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="2*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>

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

</GroupBox>
<GroupBox Margin="0,20,10,0" Height="480" Width="450" Header="今日菜品列表" Style="{DynamicResource from}" Tag="Start">
<ListBox ItemsSource="{Binding ViewData.SplitMeals_CookType_1,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel>
<Border Style="{DynamicResource border顶部背景}" Width="370" Height="100" Margin="20,20,0,0" >
<TextBlock HorizontalAlignment="Center" Foreground="{DynamicResource foreground}" VerticalAlignment="Center" Text="{Binding .}" FontSize="60"></TextBlock>
</Border>
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</GroupBox>
</StackPanel>

<StackPanel Grid.Column="1" MouseLeftButtonDown="StackPanel_MouseLeftButtonDown" VerticalAlignment="Bottom" Margin="0,0,0,10">
<GroupBox x:Name="guanggao" Height="600" Width="950" Margin="0,10,0,20" Header="广告区域" HorizontalAlignment="Center" VerticalAlignment="Top" Style="{DynamicResource from}" Tag="Start">
<Grid>
<wv2:WebView2 Name="webView" />
</Grid>
</GroupBox>
<Grid x:Name="diqiu" Height="600" Width="950" Margin="0,10,0,20" >
<Image Style="{DynamicResource imagezhu}"></Image>
<Image Style="{DynamicResource image中1}" Margin="0,400,0,0"></Image>
<GroupBox Margin="600,100,0,500" Header="{Binding ViewData.FailuresCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="累计故障数" Content="次" Width="100"/>
<GroupBox Margin="600,400,0,0" Header="0" Style="{DynamicResource GroupStyle圆形}" Tag="故障次数" Content="次" Width="160"/>
<GroupBox Margin="-500,100,0,0" Header="{Binding OrderCount,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Style="{DynamicResource GroupStyle圆形}" Tag="日总接待人数" Content="人" Width="160"/>
</Grid>
<GroupBox Margin="0,0,0,0" Height="340" Width="950" Header="信息通知区域" Style="{DynamicResource from}">
<DataGrid Margin="10,10,10,0" ItemsSource="{Binding ViewData.Alarm,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<DataGrid.Columns>
<DataGridTemplateColumn Width="250">
<DataGridTemplateColumn.Header>
<TextBlock Text="信息时间" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmTime}" Foreground="#a70909" FontSize="16" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTemplateColumn Width="*">
<DataGridTemplateColumn.Header>
<TextBlock Text="详细描述" Foreground="White"/>
</DataGridTemplateColumn.Header>
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<TextBlock Margin="0,5,0,5" Text="{Binding AlarmMs}" Foreground="#a70909" FontSize="16" HorizontalAlignment="Center"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</GroupBox>
</StackPanel>

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

</GroupBox>
<GroupBox Margin="0,20,10,0" Height="480" Width="450" Header="今日菜品列表" Style="{DynamicResource from}" Tag="Start">
<ListBox ItemsSource="{Binding ViewData.SplitMeals_CookType_2,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<WrapPanel>
<Border Style="{DynamicResource border顶部背景}" Width="370" Height="100" Margin="20,20,0,0" >
<TextBlock HorizontalAlignment="Center" Foreground="{DynamicResource foreground}" VerticalAlignment="Center" Text="{Binding .}" FontSize="60"></TextBlock>
</Border>
</WrapPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</GroupBox>
</StackPanel>
</Grid>

</UserControl>

+ 7
- 7
BPASmartClient/App.config View File

@@ -29,7 +29,7 @@
<add key="DeviceName" value="qsqdzklb"/>
<add key="DeviceSecret" value="e2b300892c3e21469c8dc6c7c5c4430d"/>
<add key="PasswordBox" value="6WrKhYmTIhLV7g24jIH/lg=="/>

<!--外设配置-->
<add key="COM_Coffee" value="COM3"/>
@@ -39,12 +39,12 @@
<add key="IceCream_CXB_Threshold" value="90"/>
<add key="COM_ICChip" value="COM6"/>
<add key="BAUD_IChip" value="9600"/>
<!--大屏MQTT-->
<add key="MQTT_DevieScreem_IP" value="171.221.208.23"/>
<add key="MQTT_DevieScreem_Port" value="11883"/>
<add key="MQTT_DevieScreem_User" value="admin"/>
<add key="MQTT_DevieScreem_Password" value="public1"/>
<!--大屏MQTT-->
<add key="MQTT_DevieScreem_IP" value="171.221.208.23"/>
<add key="MQTT_DevieScreem_Port" value="11883"/>
<add key="MQTT_DevieScreem_User" value="admin"/>
<add key="MQTT_DevieScreem_Password" value="public1"/>


</appSettings>

+ 2
- 1
BPASmartClient/BPASmartClient.csproj View File

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

<ItemGroup>
<PackageReference Include="BPA.Message" Version="1.0.84" />
<PackageReference Include="BPA.Message" Version="1.0.86" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1264.42" />
</ItemGroup>

@@ -35,6 +35,7 @@
<ProjectReference Include="..\BPASmartClient.MorkF\BPASmartClient.MorkF.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkMW\BPASmartClient.MorkMW.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkM\BPASmartClient.MorkM.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkSUpgradedVer\BPASmartClient.MorkSUpgradedVer.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkS\BPASmartClient.MorkS.csproj" />
<ProjectReference Include="..\BPASmartClient.Morkt.JAKA.JC\BPASmartClient.MorkTJAKAJC.csproj" />
<ProjectReference Include="..\BPASmartClient.MorkT.Lebai.JC\BPASmartClient.MorkTLebaiJC.csproj" />


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

@@ -22,7 +22,7 @@

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



+ 1
- 1
FryPot_DosingSystem/App.config View File

@@ -8,7 +8,7 @@
<add key ="version" value="2.7"/>
<add key="warehouseId" value="1"/>
<add key="jobPriority" value="1"/>
<add key="jobPriorityType" value="1"/>
<add key="jobPriorityType" value="0"/>
<add key="jobType" value="POINT_ROLLER_MOVE"/>
<add key="autoLoad" value="true"/>
<add key="enableIOLoad" value="false"/>


+ 28
- 9
FryPot_DosingSystem/Control/DosingLogicControl.cs View File

@@ -34,6 +34,8 @@ namespace FryPot_DosingSystem.Control
public static DosingLogicControl GetInstance => _instance ??= new DosingLogicControl();

public ushort[] RollerNum = new ushort[] { 101, 102, 103, 104, 105, 106, 107, 108, 201, 202, 203, 204, 205, 206, 207, 208, 301, 302, 303, 304, 305, 306, 307, 308, 401, 402, 403, 404, 405, 406, 407, 408, 501, 502, 503, 504, 505, 506, 507, 508 };

/// <summary>
/// 桶净重
/// </summary>r
@@ -173,7 +175,7 @@ namespace FryPot_DosingSystem.Control
public NewRecipeModel potThreeCurrentRecipe = null;
public NewRecipeModel potFourCurrentRecipe = null;
public NewRecipeModel potFiveCurrentRecipe = null;
#endregion
/// <summary>
/// 调试命令注册
@@ -5029,7 +5031,6 @@ namespace FryPot_DosingSystem.Control
DeviceOperate.GetInstance.WritePlcData("D1063", 0);
}
}

FryPotOneOrFourOutEmpetyRollerOperate();
if (OutputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))//空桶出桶后,出料原料队列移除对应原料
{
@@ -5718,6 +5719,9 @@ namespace FryPot_DosingSystem.Control
globalVar.agvArriveUpLoad = false;
globalVar.AgvToFryPot = true;
//原料到位,agv到位,agv自行运料到炒锅

}
}

@@ -5885,7 +5889,6 @@ namespace FryPot_DosingSystem.Control
if (LThreeInputMaterialQuene.TryDequeue(out MaterialInfo materialInfo))
{
MessageNotify.GetInstance.ShowRunLog($"AGV正在装载{materialInfo.materialType.MaterialLoc}号料桶");

// globalVar.LThreeCurrentCookingStep++;
LThreeOutputMaterialQuene.Enqueue(materialInfo);
globalVar.agvArriveLThreeUpLoad = false;
@@ -6064,11 +6067,17 @@ namespace FryPot_DosingSystem.Control
string info;
if (globalVar.LOneFryPotSerial == 1)
{
info = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id);
if (InputMaterialQuene.ElementAt(0).materialType.IsCommonMaterial)
info = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id,2);
else
info = AGVHelper.GetInstance.AgvToLineOneLoadRoller(id);
}
else
{
info = AGVHelper.GetInstance.AgvFromLineOneToFryFourLoadRoller(id);
if (InputMaterialQuene.ElementAt(0).materialType.IsCommonMaterial)
info = AGVHelper.GetInstance.AgvFromLineOneToFryFourLoadRoller(id,2);
else
info = AGVHelper.GetInstance.AgvFromLineOneToFryFourLoadRoller(id);
}
LOnerobotJobId = id;
if (LineCarryTaskErrorCodeAnalysis(info, 1))
@@ -6129,6 +6138,7 @@ namespace FryPot_DosingSystem.Control
{
if (globalVar.rollerLineTwo.StationEight == LTwoInputMaterialQuene.ElementAt(0).materialType.MaterialLoc && !globalVar.rollerLineTwo.IsEpmtyBefore)//工位8上面是配方料桶
{

globalVar.rollerLineTwo.CanRun = false;
e: string id = Guid.NewGuid().ToString("D");
if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
@@ -6136,11 +6146,17 @@ namespace FryPot_DosingSystem.Control
string info;
if (globalVar.LTwoFryPotSerial == 2)
{
info = AGVHelper.GetInstance.AgvToLineTwoLoadRoller(id);
if (LTwoInputMaterialQuene.ElementAt(0).materialType.IsCommonMaterial)
info = AGVHelper.GetInstance.AgvToLineTwoLoadRoller(id, 2);
else
info = AGVHelper.GetInstance.AgvToLineTwoLoadRoller(id);
}
else
{
info = AGVHelper.GetInstance.AgvFromLineTwoToFryFiveLoadRoller(id);
if (LTwoInputMaterialQuene.ElementAt(0).materialType.IsCommonMaterial)
info = AGVHelper.GetInstance.AgvFromLineTwoToFryFiveLoadRoller(id,2);
else
info = AGVHelper.GetInstance.AgvFromLineTwoToFryFiveLoadRoller(id);
}
LTworobotJobId = id;
//Thread.Sleep(500);
@@ -6198,8 +6214,11 @@ namespace FryPot_DosingSystem.Control
e: string id = Guid.NewGuid().ToString("D");
if (id == LOnerobotJobId || id == LTworobotJobId || id == LThreerobotJobId || id == LFourrobotJobId || id == LFiverobotJobId || id == LSixrobotJobId || LSevenrobotJobId.FirstOrDefault(p => p == id) != null || LEightrobotJobId.FirstOrDefault(p => p == id) != null || LNinerobotJobId.FirstOrDefault(p => p == id) != null || LTenrobotJobId.FirstOrDefault(p => p == id) != null)
goto e;

string info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id);
string info = string.Empty;
if (LThreeInputMaterialQuene.ElementAt(0).materialType.IsCommonMaterial)
info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id,2);
else
info = AGVHelper.GetInstance.AgvToLineThreeLoadRoller(id);
LThreerobotJobId = id;
//Thread.Sleep(500);
if (LineCarryTaskErrorCodeAnalysis(info, 3))


+ 3
- 2
FryPot_DosingSystem/Control/GlobalVariable.cs View File

@@ -397,8 +397,7 @@ namespace FryPot_DosingSystem.Control
/// 洗桶就位信号
/// </summary>
public ushort WashRollerArriveSignal { get; set; }


}
/// <summary>
@@ -504,6 +503,7 @@ namespace FryPot_DosingSystem.Control
/// 洗桶就位信号
/// </summary>
public ushort WashRollerArriveSignal { get; set; }
}
/// <summary>
/// 滚筒线3相关变量
@@ -608,6 +608,7 @@ namespace FryPot_DosingSystem.Control
/// 洗桶就位信号
/// </summary>
public ushort WashRollerArriveSignal { get; set; }

}
/// <summary>


+ 5
- 0
FryPot_DosingSystem/Model/MaterialType.cs View File

@@ -35,6 +35,11 @@ namespace FryPot_DosingSystem.Model
/// </summary>
private ushort _materialLoc;
public ushort MaterialLoc { get { return _materialLoc; } set { _materialLoc = value; OnPropertyChanged(); } }
/// <summary>
/// 是否有多桶相同物料
/// </summary>
private bool _isCommonMaterial;
public bool IsCommonMaterial { get { return _isCommonMaterial; }set { _isCommonMaterial = value;OnPropertyChanged(); } }

public object Clone()
{


+ 15
- 2
FryPot_DosingSystem/View/NewRecipeView.xaml View File

@@ -425,7 +425,20 @@
BorderBrush="#e69519" Foreground="LightGray" Width="140" Margin="5,0,0,10" ></TextBox>
<TextBlock VerticalAlignment="Center" FontSize="14" Margin="4,0,0,10" Text="Kg" Foreground="#e69519" ></TextBlock>
</StackPanel>
<Button Grid.Column="4"
<StackPanel Orientation="Horizontal" Grid.Column="4">
<CheckBox IsChecked="{Binding IsCommonMaterial}" VerticalAlignment="Center" Margin="20,0,0,10"/>
<Button
Content="删除"
Width="70"
Height="30"
FontSize="14"
Margin="10,0,20,10"
Background="Transparent"
BorderBrush="#e69519" Foreground="LightGray" HorizontalAlignment="Center"
Command="{Binding DataContext.RemoveRecipe,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}"
CommandParameter="{Binding MaterialCode}"></Button>
</StackPanel>
<!--<Button Grid.Column="4"
Content="删除"
Width="100"
Height="30"
@@ -434,7 +447,7 @@
Background="Transparent"
BorderBrush="#e69519" Foreground="LightGray" HorizontalAlignment="Center"
Command="{Binding DataContext.RemoveRecipe,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}"
CommandParameter="{Binding MaterialCode}"></Button>
CommandParameter="{Binding MaterialCode}"></Button>-->
</Grid>
</ControlTemplate>
</RadioButton.Template>


+ 23
- 0
SmartClient.sln View File

@@ -204,6 +204,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "设备监控", "设备监
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MaxWokControl", "BPASmartClient.MaxWokControl\BPASmartClient.MaxWokControl.csproj", "{888382C0-6750-4E81-BED3-0F38775DCCCB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkSUpgradedVer", "BPASmartClient.MorkSUpgradedVer\BPASmartClient.MorkSUpgradedVer.csproj", "{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkS3", "BPASmartClient.MorkS3\BPASmartClient.MorkS3.csproj", "{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.RobotGripper", "BPASmartClient.RobotGripper\BPASmartClient.RobotGripper.csproj", "{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F}"
@@ -1904,6 +1906,26 @@ Global
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|x64.Build.0 = Release|Any CPU
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|x86.ActiveCfg = Release|Any CPU
{888382C0-6750-4E81-BED3-0F38775DCCCB}.Release|x86.Build.0 = Release|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|ARM.ActiveCfg = Debug|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|ARM.Build.0 = Debug|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|ARM64.Build.0 = Debug|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|x64.ActiveCfg = Debug|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|x64.Build.0 = Debug|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|x86.ActiveCfg = Debug|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Debug|x86.Build.0 = Debug|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|Any CPU.Build.0 = Release|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|ARM.ActiveCfg = Release|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|ARM.Build.0 = Release|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|ARM64.ActiveCfg = Release|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|ARM64.Build.0 = Release|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|x64.ActiveCfg = Release|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|x64.Build.0 = Release|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|x86.ActiveCfg = Release|Any CPU
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3}.Release|x86.Build.0 = Release|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02}.Debug|ARM.ActiveCfg = Debug|Any CPU
@@ -2058,6 +2080,7 @@ Global
{B79914B9-3A81-426B-88FF-8ABAF5C92AB5} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{106E84C1-CAC5-4F14-9E31-201D3202C9FD} = {7BE13E55-D8B1-4232-AE63-8BF122633297}
{888382C0-6750-4E81-BED3-0F38775DCCCB} = {106E84C1-CAC5-4F14-9E31-201D3202C9FD}
{C467ACE0-1BB4-44F0-9B5E-AFFFB58846D3} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{B38F72AE-3C15-4C4E-A47E-DB2B9B318F02} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{5EBC34EB-4EE8-4C70-BAAA-C7F637D5E10F} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD}
{915F0718-B7AC-428D-ACD5-7DAACC28539F} = {666CB1A9-562E-453A-A2C7-FD9D77CFDFDD}


Loading…
Cancel
Save