Browse Source

环球咖乐美咖啡单机程序更新

样式分支
pengliangyang 2 years ago
parent
commit
2fc8b59652
90 changed files with 9308 additions and 1207 deletions
  1. +357
    -315
      BPASmartClient.AGV/AGVHelper.cs
  2. +12
    -0
      BPASmartClient.AgvApi/.config/dotnet-tools.json
  3. +2
    -2
      BPASmartClient.AgvApi/Factory.cs
  4. +3
    -0
      BPASmartClient.AgvApi/PersonHub.cs
  5. +1
    -1
      BPASmartClient.AgvApi/Program.cs
  6. +1
    -1
      BPASmartClient.Business/Plugin/ConfigMgr.cs
  7. +9
    -0
      BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
  8. +76
    -0
      BPASmartClient.CustomResource/Converters/ToastIconConverter.cs
  9. BIN
     
  10. BIN
     
  11. BIN
     
  12. BIN
     
  13. BIN
     
  14. +3
    -5
      BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
  15. +56
    -0
      BPASmartClient.CustomResource/Pages/Model/AlarmInfo.cs
  16. +28
    -19
      BPASmartClient.CustomResource/Pages/Model/MessageLog.cs
  17. +27
    -0
      BPASmartClient.CustomResource/Pages/Model/TextToImage.cs
  18. +2
    -1
      BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs
  19. +2
    -2
      BPASmartClient.CustomResource/Pages/View/MainView.xaml
  20. +1
    -0
      BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs
  21. +5
    -6
      BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs
  22. +1
    -0
      BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs
  23. +2
    -2
      BPASmartClient.CustomResource/RecDictionarys/RecIcoButtonStyle.xaml
  24. +1
    -1
      BPASmartClient.CustomResource/Themes/Generic.xaml
  25. +134
    -75
      BPASmartClient.CustomResource/Themes/MyStyle.xaml
  26. +69
    -0
      BPASmartClient.CustomResource/UserControls/Bottle.xaml
  27. +94
    -0
      BPASmartClient.CustomResource/UserControls/Bottle.xaml.cs
  28. +81
    -0
      BPASmartClient.CustomResource/UserControls/ConveyorBelt.xaml
  29. +137
    -0
      BPASmartClient.CustomResource/UserControls/ConveyorBelt.xaml.cs
  30. +1133
    -0
      BPASmartClient.CustomResource/UserControls/DosingSystem.xaml
  31. +28
    -0
      BPASmartClient.CustomResource/UserControls/DosingSystem.xaml.cs
  32. +17
    -0
      BPASmartClient.CustomResource/UserControls/Enum/ToastIcons.cs
  33. +31
    -0
      BPASmartClient.CustomResource/UserControls/Enum/ToastLocation.cs
  34. +27
    -27
      BPASmartClient.CustomResource/UserControls/IcoButton.cs
  35. +39
    -0
      BPASmartClient.CustomResource/UserControls/Model/ToastOptions.cs
  36. +67
    -0
      BPASmartClient.CustomResource/UserControls/MotorBottle.xaml
  37. +69
    -0
      BPASmartClient.CustomResource/UserControls/MotorBottle.xaml.cs
  38. +63
    -0
      BPASmartClient.CustomResource/UserControls/Pipeline.xaml
  39. +59
    -0
      BPASmartClient.CustomResource/UserControls/Pipeline.xaml.cs
  40. +68
    -0
      BPASmartClient.CustomResource/UserControls/Toast.xaml
  41. +480
    -0
      BPASmartClient.CustomResource/UserControls/Toast.xaml.cs
  42. +0
    -4
      BPASmartClient.Helper/ThreadManage.cs
  43. +5
    -3
      BPASmartClient.HubHelper/HubHelper.cs
  44. +23
    -5
      BPASmartClient.Modbus/ModbusTcp.cs
  45. +3
    -1
      BPASmartClient.MorkS/View/Debug.xaml.cs
  46. +1
    -1
      BPASmartClient.MorkS/View/ParSet.xaml
  47. +14
    -14
      BPASmartClient.MorkT/Control_MorkT.cs
  48. +175
    -0
      BPASmartClient.MorkTM/Control_MorkTM.cs
  49. +40
    -0
      BPASmartClient.MorkTM/PolymerBatching.cs
  50. +40
    -0
      BPASmartClient.MorkTM/ViewModel/DebugViewModel.cs
  51. +9
    -4
      BPASmartClient/App.config
  52. +2
    -2
      BPASmartClient/Control/ShopDeviceConfigView.xaml
  53. +1
    -1
      BPASmartClient/MainWindow.xaml
  54. +10
    -8
      DosingSystem/App.xaml.cs
  55. +2
    -1
      DosingSystem/BPASmartClient.DosingSystem.csproj
  56. +27
    -0
      DosingSystem/Model/DeviceCurrentStatus.cs
  57. +8
    -0
      DosingSystem/View/DeviceListView.xaml
  58. +294
    -7
      DosingSystem/View/HardwareStatusView.xaml
  59. +4
    -2
      DosingSystem/View/NewRecipeView.xaml
  60. +81
    -7
      DosingSystem/View/RecipeControlView.xaml
  61. +161
    -7
      DosingSystem/View/RecipeSettingsView.xaml
  62. +20
    -0
      DosingSystem/View/RecipeSettingsView.xaml.cs
  63. +16
    -0
      DosingSystem/ViewModel/HardwareStatusViewModel.cs
  64. +16
    -0
      DosingSystem/ViewModel/NewRecipeViewModel.cs
  65. +3
    -1
      DosingSystem/ViewModel/RecipeControlViewModel.cs
  66. +13
    -4
      DosingSystem/ViewModel/RecipeSettingsViewModel.cs
  67. +0
    -79
      DosingSystem/app.manifest
  68. +75
    -0
      FryPot_DosingSystem/AGV/WhichCart.cs
  69. +31
    -11
      FryPot_DosingSystem/App.xaml.cs
  70. +7
    -4
      FryPot_DosingSystem/Control/DeviceOperate.cs
  71. +1703
    -319
      FryPot_DosingSystem/Control/DosingLogicControl.cs
  72. +100
    -2
      FryPot_DosingSystem/Control/GlobalVariable.cs
  73. +17
    -0
      FryPot_DosingSystem/Model/MaterialNames.cs
  74. +1
    -1
      FryPot_DosingSystem/Model/RecipeModel.cs
  75. +1350
    -127
      FryPot_DosingSystem/View/AgvView.xaml
  76. +162
    -32
      FryPot_DosingSystem/View/AgvView.xaml.cs
  77. +96
    -0
      FryPot_DosingSystem/View/DebugView.xaml
  78. +62
    -0
      FryPot_DosingSystem/View/DebugView.xaml.cs
  79. +7
    -7
      FryPot_DosingSystem/View/DeviceListVIew.xaml
  80. +48
    -14
      FryPot_DosingSystem/View/NewRecipeView.xaml
  81. +53
    -0
      FryPot_DosingSystem/View/NewRecipeView.xaml.cs
  82. +2
    -1
      FryPot_DosingSystem/View/RecipeSendDownView.xaml
  83. +37
    -23
      FryPot_DosingSystem/View/RecipeSetView.xaml
  84. +1109
    -2
      FryPot_DosingSystem/ViewModel/AgvViewModel.cs
  85. +165
    -0
      FryPot_DosingSystem/ViewModel/DebugViewModel.cs
  86. +74
    -21
      FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs
  87. +10
    -9
      FryPot_DosingSystem/ViewModel/RecipeSetDownViewModel.cs
  88. +22
    -2
      FryPot_DosingSystem/ViewModel/RecipeSetViewModel.cs
  89. +22
    -22
      SmartClient.sln
  90. +2
    -2
      TestDemo/Form1.cs

+ 357
- 315
BPASmartClient.AGV/AGVHelper.cs View File

@@ -8,6 +8,7 @@ using System.Web;
using Newtonsoft.Json;
using System.Net.Http;
using System.Configuration;
using System.Security.Cryptography;

namespace BPASmartClient.AGV
{
@@ -15,10 +16,10 @@ namespace BPASmartClient.AGV
{
public static AGVHelper _Instance { get; set; }
public static AGVHelper GetInstance => _Instance ?? (_Instance = new AGVHelper());
public AGVHelper()
public AGVHelper()
{
}
/// <summary>
/// 获取配置文件信息
@@ -39,7 +40,7 @@ namespace BPASmartClient.AGV
return null;
}
public string HttpRequest(string url, string head, string body)
{
{
return PostData(url, head, body);
}
public string PostData(string url, string head, string body)
@@ -71,51 +72,72 @@ namespace BPASmartClient.AGV
return retString;//返回响应报文
}
/// <summary>
/// AGV去1号线体装桶
/// MD5哈希摘要转16进制
/// </summary>
/// <param name="body"></param>
/// <returns></returns>
public string AgvToLineOneLoadRoller(string robotJobId)
public string MD5Deal(string body)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId =robotJobId ;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
// string newBody = String.Join(",\r\n", bodyData.Split(','));//格式处理,看需求
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
//如果启用签名 用MD5 哈希摘要 再转16进制
MD5 md5 = MD5.Create();
byte[] bte = md5.ComputeHash(Encoding.UTF8.GetBytes(body));
StringBuilder build = new StringBuilder();
for (int i = 0; i < bte.Length; i++)
{
return response.Body?.code;
build.Append(bte[i].ToString("X"));
}
return build.ToString();
}
/// <summary>
/// AGV去1号线体装桶
/// </summary>
/// <returns></returns>
public string AgvToLineOneLoadRoller(string robotJobId)
{
//string url = AGVRequestUrl.GetInstance.TaskSendUrl;
////请求报文头
//HttpRequestHeaderModel.GetInstance.appKey = "";
//HttpRequestHeaderModel.GetInstance.appSecret = "";
//HttpRequestHeaderModel.GetInstance.requestId = "";
//HttpRequestHeaderModel.GetInstance.timestamp = "";
//HttpRequestHeaderModel.GetInstance.version = "2.8";
//string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
////请求报文体
//AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
//AGVModel.GetInstance.warehouseId = 123; //仓库编号
//AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
//AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
//AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
////详细任务数据
////点到点
//AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
//AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
//AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
//AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//// string newBody = String.Join(",\r\n", body.Split(','));//格式处理,看需求

////货位到货位
////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
////AGV_SlotRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
////AGV_SlotRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
////string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
////启用签名
////url = url + "?sign=" + MD5Deal(body);
//string data = HttpRequest(url, head, body);
//object objData = JsonConvert.DeserializeObject(data);
//if (objData != null && objData is HttpResponseModel response)
//{
// return response.Body?.code;
//}
return "Analysis Error";
}
/// <summary>
@@ -124,45 +146,47 @@ namespace BPASmartClient.AGV
/// <returns></returns>
public string AgvToLineTwoLoadRoller(string robotJobId)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string url = AGVRequestUrl.GetInstance.TaskSendUrl;
////请求报文头
//HttpRequestHeaderModel.GetInstance.appKey = "";
//HttpRequestHeaderModel.GetInstance.appSecret = "";
//HttpRequestHeaderModel.GetInstance.requestId = "";
//HttpRequestHeaderModel.GetInstance.timestamp = "";
//HttpRequestHeaderModel.GetInstance.version = "2.8";
//string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
////请求报文体
//AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
//AGVModel.GetInstance.warehouseId = 123; //仓库编号
//AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
//AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
//AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
////详细任务数据
////点到点
//AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
//AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
//AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
//AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data= HttpRequest(url, head, body);
object objData= JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
////货位到货位
////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
////string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
////启用签名
////url = url + "?sign=" + MD5Deal(body);
//string data= HttpRequest(url, head, body);
//object objData= JsonConvert.DeserializeObject(data);
//if (objData != null && objData is HttpResponseModel response)
//{
// return response.Body?.code;
//}
return "Analysis Error";
}
/// <summary>
@@ -171,45 +195,47 @@ namespace BPASmartClient.AGV
/// <returns></returns>
public string AgvToLineThreeLoadRoller(string robotJobId)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string url = AGVRequestUrl.GetInstance.TaskSendUrl;
////请求报文头
//HttpRequestHeaderModel.GetInstance.appKey = "";
//HttpRequestHeaderModel.GetInstance.appSecret = "";
//HttpRequestHeaderModel.GetInstance.requestId = "";
//HttpRequestHeaderModel.GetInstance.timestamp = "";
//HttpRequestHeaderModel.GetInstance.version = "2.8";
//string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
////请求报文体
//AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
//AGVModel.GetInstance.warehouseId = 123; //仓库编号
//AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
//AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
//AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
////详细任务数据
////点到点
//AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
//AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
//AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
//AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
////货位到货位
////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
////string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
////启用签名
////url = url + "?sign=" + MD5Deal(body);
//string data = HttpRequest(url, head, body);
//object objData = JsonConvert.DeserializeObject(data);
//if (objData != null && objData is HttpResponseModel response)
//{
// return response.Body?.code;
//}
return "Analysis Error";
}
/// <summary>
@@ -218,45 +244,47 @@ namespace BPASmartClient.AGV
/// <returns></returns>
public string AgvLeaveFryPotOne(string robotJobId)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string url = AGVRequestUrl.GetInstance.TaskSendUrl;
////请求报文头
//HttpRequestHeaderModel.GetInstance.appKey = "";
//HttpRequestHeaderModel.GetInstance.appSecret = "";
//HttpRequestHeaderModel.GetInstance.requestId = "";
//HttpRequestHeaderModel.GetInstance.timestamp = "";
//HttpRequestHeaderModel.GetInstance.version = "2.8";
//string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
////请求报文体
//AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
//AGVModel.GetInstance.warehouseId = 123; //仓库编号
//AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
//AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
//AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
////详细任务数据
////点到点
//AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
//AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
//AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
//AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
////货位到货位
////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
////string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
////启用签名
////url = url + "?sign=" + MD5Deal(body);
//string data = HttpRequest(url, head, body);
//object objData = JsonConvert.DeserializeObject(data);
//if (objData != null && objData is HttpResponseModel response)
//{
// return response.Body?.code;
//}
return "Analysis Error";
}
/// <summary>
@@ -265,45 +293,47 @@ namespace BPASmartClient.AGV
/// <returns></returns>
public string AgvLeaveFryPotTwo(string robotJobId)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string url = AGVRequestUrl.GetInstance.TaskSendUrl;
////请求报文头
//HttpRequestHeaderModel.GetInstance.appKey = "";
//HttpRequestHeaderModel.GetInstance.appSecret = "";
//HttpRequestHeaderModel.GetInstance.requestId = "";
//HttpRequestHeaderModel.GetInstance.timestamp = "";
//HttpRequestHeaderModel.GetInstance.version = "2.8";
//string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
////请求报文体
//AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
//AGVModel.GetInstance.warehouseId = 123; //仓库编号
//AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
//AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
//AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
////详细任务数据
////点到点
//AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
//AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
//AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
//AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
////货位到货位
////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
////string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
////启用签名
////url = url + "?sign=" + MD5Deal(body);
//string data = HttpRequest(url, head, body);
//object objData = JsonConvert.DeserializeObject(data);
//if (objData != null && objData is HttpResponseModel response)
//{
// return response.Body?.code;
//}
return "Analysis Error";
}
/// <summary>
@@ -312,45 +342,47 @@ namespace BPASmartClient.AGV
/// <returns></returns>
public string AgvLeaveFryPotThree(string robotJobId)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string url = AGVRequestUrl.GetInstance.TaskSendUrl;
////请求报文头
//HttpRequestHeaderModel.GetInstance.appKey = "";
//HttpRequestHeaderModel.GetInstance.appSecret = "";
//HttpRequestHeaderModel.GetInstance.requestId = "";
//HttpRequestHeaderModel.GetInstance.timestamp = "";
//HttpRequestHeaderModel.GetInstance.version = "2.8";
//string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
////请求报文体
//AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
//AGVModel.GetInstance.warehouseId = 123; //仓库编号
//AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
//AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
//AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
////详细任务数据
////点到点
//AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
//AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
//AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
//AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
////货位到货位
////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
////string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
////启用签名
////url = url + "?sign=" + MD5Deal(body);
//string data = HttpRequest(url, head, body);
//object objData = JsonConvert.DeserializeObject(data);
//if (objData != null && objData is HttpResponseModel response)
//{
// return response.Body?.code;
//}
return "Analysis Error";
}
/// <summary>
@@ -359,45 +391,47 @@ namespace BPASmartClient.AGV
/// <returns></returns>
public string AgvLeaveFryPotFour(string robotJobId)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string url = AGVRequestUrl.GetInstance.TaskSendUrl;
////请求报文头
//HttpRequestHeaderModel.GetInstance.appKey = "";
//HttpRequestHeaderModel.GetInstance.appSecret = "";
//HttpRequestHeaderModel.GetInstance.requestId = "";
//HttpRequestHeaderModel.GetInstance.timestamp = "";
//HttpRequestHeaderModel.GetInstance.version = "2.8";
//string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
////请求报文体
//AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
//AGVModel.GetInstance.warehouseId = 123; //仓库编号
//AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
//AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
//AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
////详细任务数据
////点到点
//AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
//AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
//AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
//AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
////货位到货位
////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
////string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
////启用签名
////url = url + "?sign=" + MD5Deal(body);
//string data = HttpRequest(url, head, body);
//object objData = JsonConvert.DeserializeObject(data);
//if (objData != null && objData is HttpResponseModel response)
//{
// return response.Body?.code;
//}
return "Analysis Error";
}
/// <summary>
@@ -406,45 +440,47 @@ namespace BPASmartClient.AGV
/// <returns></returns>
public string AgvLeaveFryPotFive(string robotJobId)
{
string url = AGVRequestUrl.GetInstance.TaskSendUrl;
//请求报文头
HttpRequestHeaderModel.GetInstance.appKey = "";
HttpRequestHeaderModel.GetInstance.appSecret = "";
HttpRequestHeaderModel.GetInstance.requestId = "";
HttpRequestHeaderModel.GetInstance.timestamp = "";
HttpRequestHeaderModel.GetInstance.version = "2.8";
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
AGVModel.GetInstance.warehouseId = 123; //仓库编号
AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
//详细任务数据
//点到点
AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
//货位到货位
//AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
//AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
//AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
//AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
//string url = AGVRequestUrl.GetInstance.TaskSendUrl;
////请求报文头
//HttpRequestHeaderModel.GetInstance.appKey = "";
//HttpRequestHeaderModel.GetInstance.appSecret = "";
//HttpRequestHeaderModel.GetInstance.requestId = "";
//HttpRequestHeaderModel.GetInstance.timestamp = "";
//HttpRequestHeaderModel.GetInstance.version = "2.8";
//string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
////请求报文体
//AGVModel.GetInstance.robotJobId = robotJobId;//上游提供
//AGVModel.GetInstance.warehouseId = 123; //仓库编号
//AGVModel.GetInstance.jobPriority = 1;//任务执行的优先级
//AGVModel.GetInstance.jobPriorityType = 1;//0:根据优先级来执行,1:强制执行
//AGVModel.GetInstance.jobType = "POINT_ROLLER_MOVE"; //SLOT_ROLLER_MOVE / POINT_ROLLER_MOVE
////详细任务数据
////点到点
//AGV_PointRollerJobData.GetInstance.startPoint = "";//起点点位
//AGV_PointRollerJobData.GetInstance.endPoint = "";//目的点位
//AGV_PointRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
//AGV_PointRollerJobData.GetInstance.enableIOLoad = true;//上料交互方式 false:接口交互 true:光电交互
//AGV_PointRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
//AGV_PointRollerJobData.GetInstance.enableIOUnload = true;//下料交互方式 false:接口交互 true:光电交互
//AGVModel.GetInstance.jobData = AGV_PointRollerJobData.GetInstance;
//string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
{
return response.Body?.code;
}
////货位到货位
////AGV_SlotRollerJobData.GetInstance.startSlotCode = "";//起点槽位编号
////AGV_SlotRollerJobData.GetInstance.endSlotCode = "";//目的槽位编号
////AGV_SlotRollerJobData.GetInstance.autoLoad = true;//是否自动上料 true:自动上料 false:人工上料
////AGV_SlotRollerJobData.GetInstance.enableIOLoad=true;//上料交互方式 false:接口交互 true:光电交互
////AGV_SlotRollerJobData.GetInstance.autoUnload = true;//是否自动下料 true:自动下料 false:人工下料
////AGV_SlotRollerJobData.GetInstance.enableIOUnload=true;//下料交互方式 false:接口交互 true:光电交互
////AGVModel.GetInstance.jobData = AGV_SlotRollerJobData.GetInstance;
////string body = JsonConvert.SerializeObject(AGVModel.GetInstance);
////启用签名
////url = url + "?sign=" + MD5Deal(body);
//string data = HttpRequest(url, head, body);
//object objData = JsonConvert.DeserializeObject(data);
//if (objData != null && objData is HttpResponseModel response)
//{
// return response.Body?.code;
//}
return "Analysis Error";
}
/// <summary>
@@ -465,6 +501,8 @@ namespace BPASmartClient.AGV
AGVTaskCancelModel.GetInstance.robotJobId = robotJobId;
AGVTaskCancelModel.GetInstance.warehouseId = 123;//仓库编号
string body = JsonConvert.SerializeObject(AGVTaskCancelModel.GetInstance);
//启用签名
//url = url + "?sign=" + MD5Deal(body);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
@@ -490,7 +528,9 @@ namespace BPASmartClient.AGV
//请求报文体
AGVTaskCompleteNotifyModel.GetInstance.robotJobId = robotJobId;
AGVTaskCompleteNotifyModel.GetInstance.warehouseId = 123;//仓库编号
string body=JsonConvert.SerializeObject(AGVTaskCompleteNotifyModel.GetInstance);
string body = JsonConvert.SerializeObject(AGVTaskCompleteNotifyModel.GetInstance);
//启用签名
//url = url + "?sign=" + MD5Deal(body);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)
@@ -506,7 +546,7 @@ namespace BPASmartClient.AGV
/// <param name="jobId">任务编号</param>
/// <param name="msgId">消息编号</param>
/// <returns></returns>
public string UpDownFeedBack(string agvCode,string jobId,string msgId)
public string UpDownFeedBack(string agvCode, string jobId, string msgId)
{
string url = AGVRequestUrl.GetInstance.TaskCompleteUrl;
//请求报文头
@@ -518,9 +558,11 @@ namespace BPASmartClient.AGV
string head = JsonConvert.SerializeObject(HttpRequestHeaderModel.GetInstance);
//请求报文体
AGVLoadInteracteModel.GetInstance.agvCode = agvCode;
AGVLoadInteracteModel.GetInstance.jobId = jobId;
AGVLoadInteracteModel.GetInstance.msgId= msgId;
string body=JsonConvert.SerializeObject(AGVLoadInteracteModel.GetInstance);
AGVLoadInteracteModel.GetInstance.jobId = jobId;
AGVLoadInteracteModel.GetInstance.msgId = msgId;
string body = JsonConvert.SerializeObject(AGVLoadInteracteModel.GetInstance);
//启用签名
//url = url + "?sign=" + MD5Deal(body);
string data = HttpRequest(url, head, body);
object objData = JsonConvert.DeserializeObject(data);
if (objData != null && objData is HttpResponseModel response)


+ 12
- 0
BPASmartClient.AgvApi/.config/dotnet-tools.json View File

@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "6.0.6",
"commands": [
"dotnet-ef"
]
}
}
}

+ 2
- 2
BPASmartClient.AgvApi/Factory.cs View File

@@ -13,12 +13,12 @@ namespace BPASmartClient.AgvApi

public Task SendReport(object obj)
{
return HubCallerClient?.Caller.SendAsync("Report", obj);
return HubCallerClient?.Caller.SendAsync("Report", obj);//Invoke客户端Report名称的方法
}

public Task SendUpstreamrequest(object obj)
{
return HubCallerClient?.Caller.SendAsync("Upstreamrequest", obj);
return HubCallerClient?.Caller.SendAsync("Upstreamrequest", obj);//Invoke客户端Upstreamrequest名称的方法
}

}


+ 3
- 0
BPASmartClient.AgvApi/PersonHub.cs View File

@@ -2,6 +2,9 @@

namespace BPASmartClient.AgvApi
{
/// <summary>
/// 服务端
/// </summary>
public class PersonHub : Hub
{



+ 1
- 1
BPASmartClient.AgvApi/Program.cs View File

@@ -11,7 +11,7 @@ builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
builder.Services.AddSignalR();
builder.Services.AddSignalR();//×¢²áSignalR×é¼þ
var app = builder.Build();

// Configure the HTTP request pipeline.


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

@@ -84,7 +84,7 @@ namespace BPASmartClient.Business
IConfigurationBuilder configurationBuilder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory());
configurationBuilder.AddApolloConfiguration(p =>
{
p.AppId = "HostComputer";
p.AppId = apoid;
p.MetaServer = apolloUri;
p.Namespaces = new List<string>() { "application", namespa };
});


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

@@ -22,11 +22,15 @@
<None Remove="Fonts\80号-萌趣小鱼体.ttf" />
<None Remove="Fonts\iconfont.ttf" />
<None Remove="Fonts\Quartz Regular.ttf" />
<None Remove="Image\AGV\agv.png" />
<None Remove="Image\AGV\AGV小车.png" />
<None Remove="Image\AGV\AGV炒锅.png" />
<None Remove="Image\AGV\停车位.png" />
<None Remove="Image\AGV\充电桩.png" />
<None Remove="Image\AGV\墙.png" />
<None Remove="Image\AGV\汤碗.png" />
<None Remove="Image\AGV\炒锅.png" />
<None Remove="Image\AGV\炒锅2.png" />
<None Remove="Image\AGV\物流车.png" />
<None Remove="Image\AGV\砖块.png" />
<None Remove="Image\AGV\蔬菜.png" />
@@ -223,11 +227,15 @@
<Resource Include="Fonts\80号-萌趣小鱼体.ttf" />
<Resource Include="Fonts\iconfont.ttf" />
<Resource Include="Fonts\Quartz Regular.ttf" />
<Resource Include="Image\AGV\agv.png" />
<Resource Include="Image\AGV\AGV小车.png" />
<Resource Include="Image\AGV\AGV炒锅.png" />
<Resource Include="Image\AGV\停车位.png" />
<Resource Include="Image\AGV\充电桩.png" />
<Resource Include="Image\AGV\墙.png" />
<Resource Include="Image\AGV\汤碗.png" />
<Resource Include="Image\AGV\炒锅.png" />
<Resource Include="Image\AGV\炒锅2.png" />
<Resource Include="Image\AGV\物流车.png" />
<Resource Include="Image\AGV\砖块.png" />
<Resource Include="Image\AGV\蔬菜.png" />
@@ -284,6 +292,7 @@

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



+ 76
- 0
BPASmartClient.CustomResource/Converters/ToastIconConverter.cs View File

@@ -0,0 +1,76 @@
using BPASmartClient.CustomResource.UserControls.Enum;
using MahApps.Metro.IconPacks;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;

namespace BPASmartClient.CustomResource.Converters
{
public class ToastIconConverter : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
object value = values[0];
object grid = values[1];
object txt = values[2];
Grid _grid = grid as Grid;
TextBlock _txt = txt as TextBlock;

void WithoutIcon()
{
if (_grid != null)
{
_grid.ColumnDefinitions.RemoveAt(0);
}

if (_txt != null)
{
_txt.HorizontalAlignment = HorizontalAlignment.Center;
}
}

if (value == null)
{
WithoutIcon();
return PackIconFontAwesomeKind.None;
}

ToastIcons _value;
try
{
_value = (ToastIcons)value;
}
catch
{
WithoutIcon();
return PackIconFontAwesomeKind.None;
}

switch (_value)
{
case ToastIcons.Information:
return PackIconFontAwesomeKind.CheckCircleSolid;
case ToastIcons.Error:
return PackIconFontAwesomeKind.TimesSolid;
case ToastIcons.Warning:
return PackIconFontAwesomeKind.ExclamationSolid;
case ToastIcons.Busy:
return PackIconFontAwesomeKind.ClockSolid;
}

WithoutIcon();
return PackIconFontAwesomeKind.None;
}

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

BIN
View File


BIN
View File


BIN
View File


BIN
View File


BIN
View File


+ 3
- 5
BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs View File

@@ -4,12 +4,10 @@ using BPASmartClient.Model;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using System.Windows;

namespace BPASmartClient.CustomResource.Pages.Model
@@ -39,7 +37,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
{
bool value = Convert.ToBoolean(Alarm.GetType().GetProperty(item.Name)?.GetValue(Alarm));
EdgeAlarm(value, AlarmModel.AlarmInfo, 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType);
}
}
}
}
Thread.Sleep(100);
@@ -59,7 +57,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
if (!delays.ContainsKey(text)) delays.TryAdd(text, Delay.GetInstance(text));
if (edgeType == AlarmTriggerType.Rising ? delays[text].Start(Trigger, delay) : delays[text].Start(!Trigger, delay))
{
if (edgeType == AlarmTriggerType.Rising ? !flagbit[text] : flagbit[text])
if (edgeType == AlarmTriggerType.Rising ? !flagbit[text] :flagbit[text])
{
AddAlarm(Trigger, text, alarmLevel);
flagbit[text] = edgeType == AlarmTriggerType.Rising ? true : false;


+ 56
- 0
BPASmartClient.CustomResource/Pages/Model/AlarmInfo.cs View File

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

namespace BPASmartClient.CustomResource.Pages.Model
{
public class AlarmInfo
{
public AlarmInfo()
{

}
/// <summary>
/// 1 号滚筒线故障
/// </summary>
[Alarm("【1】号滚筒线运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)]
public ushort LOneRollerTrouble { get; set; }
/// <summary>
/// 2 号滚筒线故障
/// </summary>
[Alarm("【2】号滚筒线运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)]
public ushort LTwoRollerTrouble { get; set; }
/// <summary>
/// 3 号滚筒线故障
/// </summary>
[Alarm("【3】号滚筒线运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)]
public ushort LThreeRollerTrouble { get; set; }
/// <summary>
/// 1 号炒锅滚筒运行故障
/// </summary>
[Alarm("【1】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)]
public ushort FryPotOneRollerTrouble { get; set; }
/// <summary>
/// 2 号炒锅滚筒运行故障
/// </summary>
[Alarm("【2】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)]
public ushort FryPotTwoRollerTrouble { get; set; }
/// <summary>
/// 3 号炒锅滚筒运行故障
/// </summary>
[Alarm("【3】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)]
public ushort FryPotThreeRollerTrouble { get; set; }
/// <summary>
/// 4 号炒锅滚筒运行故障
/// </summary>
[Alarm("【4】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)]
public ushort FryPotFourRollerTrouble { get; set; }
/// <summary>
/// 5 号炒锅滚筒运行故障
/// </summary>
[Alarm("【5】号炒锅滚筒运行故障", AlarmTriggerType.Rising, AlarmLevel.一般报警)]
public ushort FryPotFiveRollerTrouble { get; set; }
}
}

+ 28
- 19
BPASmartClient.CustomResource/Pages/Model/MessageLog.cs View File

@@ -12,7 +12,10 @@ namespace BPASmartClient.CustomResource.Pages.Model
public class MessageLog
{
private volatile static MessageLog _Instance;
public static MessageLog GetInstance => _Instance ?? (_Instance = new MessageLog());
public static MessageLog GetInstance => _Instance ??= new MessageLog();

public static readonly object runLock = new object();
public static readonly object userlock = new object();
private MessageLog() { }

public Action<string> UserLog { get; set; }
@@ -37,30 +40,36 @@ namespace BPASmartClient.CustomResource.Pages.Model

public void ShowUserLog(string info)
{
UserLog userLog = new UserLog()
lock (userlock)
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
Permission = Global.userInfo.permission.ToString(),
UserName = Global.userInfo.UserName,
LogInfo = info
};
Sqlite<UserLog>.GetInstance.Base.Add(userLog);
Application.Current.Dispatcher.Invoke(new Action(() => { userLogs.Insert(0, userLog); }));
UserLog?.Invoke(info);
UserLog userLog = new UserLog()
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
Permission = Global.userInfo.permission.ToString(),
UserName = Global.userInfo.UserName,
LogInfo = info
};
Sqlite<UserLog>.GetInstance.Base.Add(userLog);
Application.Current.Dispatcher.Invoke(new Action(() => { userLogs.Insert(0, userLog); }));
UserLog?.Invoke(info);
}
}

public void ShowRunLog(string info)
{
RunLog runLog = new RunLog()
lock (runLock)
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
RunLogInfo = info
};
Sqlite<RunLog>.GetInstance.Base.Add(runLog);
Application.Current.Dispatcher.Invoke(new Action(() => { runLogs.Insert(0, runLog); }));
RunLog?.Invoke(info);
RunLog runLog = new RunLog()
{
Date = DateTime.Now.ToString("yyyy-MM-dd"),
Time = DateTime.Now.ToString("HH:mm:ss"),
RunLogInfo = info
};
Sqlite<RunLog>.GetInstance.Base.Add(runLog);
Application.Current.Dispatcher.Invoke(new Action(() => { runLogs.Insert(0, runLog); }));
RunLog?.Invoke(info);
}
}




+ 27
- 0
BPASmartClient.CustomResource/Pages/Model/TextToImage.cs View File

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

namespace BPASmartClient.CustomResource.Pages.Model
{
internal class TextToImage
{
public Image CreateTextImage(string text, Font font, Color backgroundColor, Color foreColor, int margin = 5, RotateFlipType rotate = RotateFlipType.RotateNoneFlipNone)
{
SizeF sizeF = Graphics.FromImage(new Bitmap(1, 1)).MeasureString(text, font);
Bitmap bitmap = new Bitmap((int)sizeF.Width + margin * 2, (int)sizeF.Height + margin * 2);
Graphics g = Graphics.FromImage(bitmap);
g = Graphics.FromImage(bitmap);
g.SmoothingMode = SmoothingMode.HighQuality;
g.FillRegion(new SolidBrush(backgroundColor), g.Clip);
g.DrawString(text, font, new SolidBrush(foreColor), margin, margin);
g.Dispose();
bitmap.RotateFlip(rotate);
return bitmap;
}
}
}

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

@@ -27,7 +27,7 @@ namespace BPASmartClient.CustomResource.Pages.View
{
InitializeComponent();
grid.Visibility = Visibility.Collapsed;
Username.Focus();
Username.SelectionStart = Username.Text.Trim().Length;
this.Loaded += LoginView_Loaded;
ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = true; this.Close(); }), "LoginOk", true);
@@ -52,6 +52,7 @@ namespace BPASmartClient.CustomResource.Pages.View
private void Player_MediaOpened(object sender, RoutedEventArgs e)
{
grid.Visibility = Visibility.Visible;
Username.Focus();
}

private void media_Loaded(object sender, RoutedEventArgs e)


+ 2
- 2
BPASmartClient.CustomResource/Pages/View/MainView.xaml View File

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

<Window.Resources>

<!--#region 静态资源-->
<ImageBrush x:Key="leftImage" ImageSource="../../Image/leftImage.png" />
@@ -511,7 +511,7 @@
</Grid.Background>

<Grid.RowDefinitions>
<RowDefinition Height="60" />
<RowDefinition Height="80" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">


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

@@ -39,5 +39,6 @@ namespace BPASmartClient.CustomResource.Pages.View
if (e.LeftButton == MouseButtonState.Pressed) this.DragMove();
};
}

}
}

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

@@ -9,8 +9,8 @@ using System.Collections.ObjectModel;
using System.Windows;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.Model;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Model;

namespace BPASmartClient.CustomResource.Pages.ViewModel
{
@@ -26,7 +26,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
}
if (ControlButText == "开始查询")
{
var lists = Sqlite<Alarm>.GetInstance.GetData();
var lists = Sqlite<BPASmartClient.Model.Alarm>.GetInstance.GetData();
var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList();
if (res != null)
{
@@ -64,13 +64,13 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
}
});

//AlarmInfos = AlarmHelper<tt>.Alarms;
//AlarmHelper<tt>.Init();
AlarmInfos = AlarmHelper<AlarmInfo>.Alarms;
}

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


public ObservableCollection<Alarm> AlarmInfos { get; set; }

public ObservableCollection<Alarm> HistoryAlarm { get; set; } = new ObservableCollection<Alarm>();




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

@@ -44,6 +44,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel

private void DoNavChanged(object obj)
{
ActionManage.GetInstance.Send("RecipeIsChange");
for (int i = 0; i < menuModels.Count; i++)
{
var res = menuModels.ElementAt(i).subMenumodels.FirstOrDefault(p => p.ToggleWindowPath == obj.ToString());


+ 2
- 2
BPASmartClient.CustomResource/RecDictionarys/RecIcoButtonStyle.xaml View File

@@ -33,10 +33,10 @@
</ControlTemplate.Triggers>
</ControlTemplate>

<Style x:Key="NewButtonStyle" TargetType="local:IcoButton">
<Style x:Key="IcoButtonStyle" TargetType="local:IcoButton">
<Setter Property="FontFamily" Value="../Fonts/#iconfont" />
<Setter Property="FontSize" Value="14" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Background" Value="#2219b7ec" />
<Setter Property="BorderBrush" Value="#ff19b7ec" />
<Setter Property="BorderThickness" Value="2" />
<Setter Property="EnterBackground" Value="#2219b7ec" />


+ 1
- 1
BPASmartClient.CustomResource/Themes/Generic.xaml View File

@@ -8,7 +8,7 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:IcoButton}">
<Grid Name="PART_gr">
<Grid Name="PART_gr" Background="{TemplateBinding Background}">
<Border
Name="PART_br"
Background="{TemplateBinding Background}"


+ 134
- 75
BPASmartClient.CustomResource/Themes/MyStyle.xaml View File

@@ -172,15 +172,22 @@
<ImageBrush x:Key="imageBJ" ImageSource="/BPASmartClient.CustomResource;component/Image/图层1.png" />
<ImageBrush x:Key="image1" ImageSource="/BPASmartClient.CustomResource;component/Image/shape.png" />
<ImageBrush x:Key="image2" ImageSource="/BPASmartClient.CustomResource;component/Image/shape1.png" />
<Style x:Key="image完成" TargetType="Image">
<Style.Setters>
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Source" Value="/BPASmartClient.CustomResource;component/Image/Cb_Checked.png" />
</Style.Setters>
</Style>

<Style x:Key="image墙" TargetType="Image">
<Style.Setters>
<Setter Property="VerticalAlignment" Value="Stretch" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Source" Value="/BPASmartClient.CustomResource;component/Image/AGV/墙.png" />
<Setter Property="Source" Value="/BPASmartClient.CustomResource;component/Image/AGV/墙.png" />
</Style.Setters>
</Style>
<Style TargetType="Image">
<Style.Setters>
<Setter Property="UseLayoutRounding" Value="True" />
@@ -366,22 +373,22 @@
<!--#region Border-->
<Style x:Key="border车" TargetType="Border">
<Style.Setters>
<Setter Property="Height" Value="80"/>
<Setter Property="Width" Value="80"/>
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
<Setter Property="RenderTransform" >
<Setter Property="Height" Value="80" />
<Setter Property="Width" Value="80" />
<Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
<Setter Property="RenderTransform">
<Setter.Value>
<TransformGroup>
<ScaleTransform ScaleY="-0.6" ScaleX="0.8"/>
<SkewTransform AngleY="0"/>
<RotateTransform Angle="180"/>
<TranslateTransform X="1" Y="0.5"/>
</TransformGroup>
<ScaleTransform ScaleX="0.8" ScaleY="-0.6" />
<SkewTransform AngleY="0" />
<RotateTransform Angle="180" />
<TranslateTransform X="1" Y="0.5" />
</TransformGroup>
</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/物流车.png" />
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/agv.png" />
</Setter.Value>
</Setter>
</Style.Setters>
@@ -389,16 +396,16 @@

<Style x:Key="border停车位" TargetType="Border">
<Style.Setters>
<Setter Property="Height" Value="80"/>
<Setter Property="Width" Value="80"/>
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
<Setter Property="RenderTransform" >
<Setter Property="Height" Value="80" />
<Setter Property="Width" Value="80" />
<Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
<Setter Property="RenderTransform">
<Setter.Value>
<TransformGroup>
<ScaleTransform/>
<SkewTransform AngleY="20"/>
<RotateTransform/>
<TranslateTransform/>
<ScaleTransform />
<SkewTransform AngleY="20" />
<RotateTransform />
<TranslateTransform />
</TransformGroup>
</Setter.Value>
</Setter>
@@ -412,23 +419,23 @@

<Style x:Key="border充电桩" TargetType="Border">
<Style.Setters>
<Setter Property="Height" Value="60"/>
<Setter Property="Width" Value="60"/>
<Setter Property="Margin" Value="0,20,0,0"/>
<Setter Property="RenderTransformOrigin" Value="0.5,0.5"/>
<Setter Property="RenderTransform" >
<Setter Property="Height" Value="60" />
<Setter Property="Width" Value="60" />
<Setter Property="Margin" Value="0,20,0,0" />
<Setter Property="RenderTransformOrigin" Value="0.5,0.5" />
<Setter Property="RenderTransform">
<Setter.Value>
<TransformGroup>
<ScaleTransform/>
<SkewTransform AngleY="20"/>
<RotateTransform/>
<TranslateTransform/>
<ScaleTransform />
<SkewTransform AngleY="20" />
<RotateTransform />
<TranslateTransform />
</TransformGroup>
</Setter.Value>
</Setter>
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/充电桩.png" />
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/充电桩.png" />
</Setter.Value>
</Setter>
</Style.Setters>
@@ -437,13 +444,26 @@

<Style x:Key="border炒锅" TargetType="Border">
<Style.Setters>
<Setter Property="Margin" Value="60,0,0,20"/>
<Setter Property="Height" Value="80"/>
<Setter Property="Width" Value="80"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="Margin" Value="60,0,0,20" />
<Setter Property="Height" Value="80" />
<Setter Property="Width" Value="80" />
<Setter Property="VerticalAlignment" Value="Bottom" />
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/炒锅.png" />
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/炒锅.png" />
</Setter.Value>
</Setter>
</Style.Setters>
</Style>

<Style x:Key="border炒锅2" TargetType="Border">
<Style.Setters>
<Setter Property="Height" Value="100" />
<Setter Property="Width" Value="100" />
<Setter Property="VerticalAlignment" Value="Bottom" />
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/炒锅2.png" />
</Setter.Value>
</Setter>
</Style.Setters>
@@ -451,12 +471,13 @@

<Style x:Key="border碗" TargetType="Border">
<Style.Setters>
<Setter Property="Height" Value="50"/>
<Setter Property="Width" Value="40"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="Height" Value="80" />
<Setter Property="Width" Value="40" />
<Setter Property="Margin" Value="0,-20,0,-20" />
<Setter Property="VerticalAlignment" Value="Bottom" />
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/汤碗.png" />
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/汤碗.png" />
</Setter.Value>
</Setter>
</Style.Setters>
@@ -464,13 +485,13 @@

<Style x:Key="border菜" TargetType="Border">
<Style.Setters>
<Setter Property="Margin" Value="0,3,0,0"/>
<Setter Property="Height" Value="25"/>
<Setter Property="Width" Value="33"/>
<Setter Property="VerticalAlignment" Value="Top"/>
<Setter Property="Margin" Value="0,-17,0,0" />
<Setter Property="Height" Value="30" />
<Setter Property="Width" Value="35" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/蔬菜.png" />
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/蔬菜.png" />
</Setter.Value>
</Setter>
</Style.Setters>
@@ -480,7 +501,12 @@
<Style.Setters>
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/砖块.png" Viewport="0, 0, 1, 0.03" TileMode="FlipY" Stretch="UniformToFill" ViewportUnits="RelativeToBoundingBox" />
<ImageBrush
ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/砖块.png"
Stretch="UniformToFill"
TileMode="FlipY"
Viewport="0, 0, 1, 0.03"
ViewportUnits="RelativeToBoundingBox" />
</Setter.Value>
</Setter>
</Style.Setters>
@@ -490,27 +516,42 @@
<Style.Setters>
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/砖块.png" Viewport="0, 0, 0.02, 1" TileMode="FlipY" Stretch="UniformToFill" ViewportUnits="RelativeToBoundingBox" />
<ImageBrush
ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/砖块.png"
Stretch="UniformToFill"
TileMode="FlipY"
Viewport="0, 0, 0.02, 1"
ViewportUnits="RelativeToBoundingBox" />
</Setter.Value>
</Setter>
</Style.Setters>
</Style>
<Style x:Key="border垂直墙1" TargetType="Border">
<Style.Setters>
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/砖块.png" Viewport="0, 0, 1, 0.1" TileMode="FlipY" Stretch="UniformToFill" ViewportUnits="RelativeToBoundingBox" />
<ImageBrush
ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/砖块.png"
Stretch="UniformToFill"
TileMode="FlipY"
Viewport="0, 0, 1, 0.1"
ViewportUnits="RelativeToBoundingBox" />
</Setter.Value>
</Setter>
</Style.Setters>
</Style>
<Style x:Key="border水平墙1" TargetType="Border">
<Style.Setters>
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/砖块.png" Viewport="0, 0, 0.1, 1" TileMode="FlipY" Stretch="UniformToFill" ViewportUnits="RelativeToBoundingBox" />
<ImageBrush
ImageSource="/BPASmartClient.CustomResource;component/Image/AGV/砖块.png"
Stretch="UniformToFill"
TileMode="FlipY"
Viewport="0, 0, 0.1, 1"
ViewportUnits="RelativeToBoundingBox" />
</Setter.Value>
</Setter>
</Style.Setters>
@@ -947,7 +988,7 @@
</Style.Setters>
</Style>
<!--#endregion-->
<!--#region Button-->
<Style x:Key="TitleBarStyle" TargetType="Button">
<Setter Property="Foreground" Value="White" />
@@ -1823,12 +1864,13 @@

<!--#region TextBlock-->
<Style x:Key="80号字体样式" TargetType="TextBlock">
<Setter Property="FontSize" Value="16" />
<Setter Property="TextWrapping" Value="Wrap" />
<Setter Property="FontFamily" Value="/BPASmartClient.CustomResource;Component/Fonts/#zihun80hao-mengquxiaoyuti"/>
<Setter Property="Foreground" Value="#FFC6AE82" />
<Setter Property="FontFamily" Value="/BPASmartClient.CustomResource;Component/Fonts/#zihun80hao-mengquxiaoyuti" />
<Setter Property="Foreground" Value="#FFFCD5B5" />
</Style>

<Style TargetType="TextBlock">
<Style.Setters>
@@ -1937,10 +1979,10 @@
</Setter>
</Style>
<!--#endregion-->
<!--#region dataGrid-->
<Style TargetType="DataGrid" x:Key="dataGrid_Style">
<!--网格线颜色-->
<Style x:Key="dataGrid_Style" TargetType="DataGrid">
<!-- 网格线颜色 -->
<Setter Property="CanUserResizeColumns" Value="false" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="BorderBrush" Value="#a2c2e8" />
@@ -1960,7 +2002,7 @@
<Style x:Key="DatagridRow_Style" TargetType="DataGridRow">
<Setter Property="Background" Value="#3afdff" />
<Setter Property="Foreground" Value="White" />
<Setter Property="Height" Value="20"/>
<Setter Property="Height" Value="20" />
<Style.Triggers>
<!-- 隔行换色 -->
<Trigger Property="AlternationIndex" Value="0">
@@ -1981,9 +2023,9 @@
</Style.Triggers>
</Style>
<!--#endregion-->
<!--#region dataGridHeader-->
<Style TargetType="DataGridColumnHeader" x:Key="dataGridHeader_Style">
<!--#region dataGridHeader-->
<Style x:Key="dataGridHeader_Style" TargetType="DataGridColumnHeader">
<Setter Property="SnapsToDevicePixels" Value="True" />
<Setter Property="MinWidth" Value="0" />
<Setter Property="MinHeight" Value="30" />
@@ -1993,19 +2035,36 @@
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridColumnHeader">
<Border x:Name="BackgroundBorder" BorderThickness="0,1,0,1"
BorderBrush="#e6dbba"
Width="Auto">
<Border
x:Name="BackgroundBorder"
Width="Auto"
BorderBrush="#e6dbba"
BorderThickness="0,1,0,1">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ContentPresenter Margin="0,0,0,0" VerticalAlignment="Center"
HorizontalAlignment="Center" />
<Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill"
Grid.Column="0" Width="8" Height="6" Fill="White" Margin="0,0,50,0"
VerticalAlignment="Center" RenderTransformOrigin="1,1" />
<Rectangle Width="1" Fill="#d6c79b" HorizontalAlignment="Right" Grid.ColumnSpan="1" />
<ContentPresenter
Margin="0,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center" />
<Path
x:Name="SortArrow"
Grid.Column="0"
Width="8"
Height="6"
Margin="0,0,50,0"
VerticalAlignment="Center"
Data="M0,0 L1,0 0.5,1 z"
Fill="White"
RenderTransformOrigin="1,1"
Stretch="Fill"
Visibility="Collapsed" />
<Rectangle
Grid.ColumnSpan="1"
Width="1"
HorizontalAlignment="Right"
Fill="#d6c79b" />
</Grid>
</Border>
</ControlTemplate>
@@ -2015,10 +2074,10 @@
</Style>
<!--#endregion-->
<!--#region dataGridCell-->
<Style TargetType="DataGridCell" x:Key="dataGridCell_Style">
<Setter Property="Height" Value="20"/>
<Setter Property="FontSize" Value="14"/>
<Style x:Key="dataGridCell_Style" TargetType="DataGridCell">
<Setter Property="Height" Value="20" />
<Setter Property="FontSize" Value="14" />
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="White" />


+ 69
- 0
BPASmartClient.CustomResource/UserControls/Bottle.xaml View File

@@ -0,0 +1,69 @@
<UserControl
x:Class="BPASmartClient.CustomResource.UserControls.Bottle"
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.CustomResource.UserControls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="200"
d:DesignWidth="70"
mc:Ignorable="d">
<Border Name="mainBr" BorderThickness="0">
<Viewbox Width="auto" Height="auto">
<Canvas
Name="cv"
Width="{Binding ElementName=mainBr, Path=ActualWidth}"
Height="{Binding ElementName=mainBr, Path=ActualHeight}">
<Rectangle
Name="r1"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Stroke="Black"
StrokeThickness="0">
<Rectangle.Fill>
<LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
<GradientStop Color="#FF97E8F4" />
<GradientStop Offset="1" Color="#FF97E8F4" />
<GradientStop Offset="0.45" Color="#FEFFFFFF" />
<GradientStop Offset="0.55" Color="#FEF9F9F9" />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Border
Name="bd"
HorizontalAlignment="Center"
VerticalAlignment="Bottom"
Background="DimGray"
BorderThickness="0" />
<Path
Name="pa"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Fill="#FFD8D35B"
Stretch="Fill"
StrokeThickness="0" />
<Ellipse
Name="e2"
HorizontalAlignment="Left"
VerticalAlignment="Top"
Fill="#FFD8D35B"
Stroke="#FF636242"
StrokeThickness="0.5" />
<Rectangle
Name="refile"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Fill="#FFD8D35B"
Stroke="Black"
StrokeThickness="0" />
<Ellipse
x:Name="e1"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Fill="#97e8f4"
StrokeThickness="0" />

</Canvas>
</Viewbox>
</Border>
</UserControl>

+ 94
- 0
BPASmartClient.CustomResource/UserControls/Bottle.xaml.cs View File

@@ -0,0 +1,94 @@
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.CustomResource.UserControls
{
/// <summary>
/// Bottle.xaml 的交互逻辑
/// </summary>
public partial class Bottle : UserControl
{
public Bottle()
{
InitializeComponent();
this.SizeChanged += Bottle_SizeChanged;
}

private void Bottle_SizeChanged(object sender, SizeChangedEventArgs e)
{
e1.Width = this.Width;
e1.Height = this.Height * 0.09;

r1.Width = this.Width;
r1.Height = this.Height * 0.8;
Canvas.SetTop(r1, e1.Height / 2);

bd.Width = this.Width * 0.6;
bd.Height = this.Height * 0.06;
Canvas.SetLeft(bd, (this.Width - bd.Width) / 2);
Canvas.SetBottom(bd, 0);

e2.Width = this.Width;
e2.Height = this.Height * 0.09;
Canvas.SetTop(e2, r1.Height);
Canvas.SetLeft(e2, 0);


PathGeometry geometry = new PathGeometry();
PathFigure pathFigure = new PathFigure();
pathFigure.StartPoint = new Point(0, r1.Height + (e1.Height / 2));
pathFigure.Segments.Add(new LineSegment(new Point(Canvas.GetLeft(bd), this.Height - bd.Height), true));
pathFigure.Segments.Add(new LineSegment(new Point(Canvas.GetLeft(bd) + bd.Width, this.Height - bd.Height), true));
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, r1.Height + (e1.Height / 2)), true));
pathFigure.Segments.Add(new LineSegment(new Point(0, r1.Height + (e1.Height / 2)), true));
geometry.Figures.Add(pathFigure);
this.pa.Data = geometry;
Canvas.SetTop(this.pa, r1.Height + (e1.Height / 2));
Canvas.SetLeft(this.pa, 0);

refile.Width = this.Width;
Canvas.SetBottom(refile, this.Height - r1.Height - (e1.Height / 2));
Refresh();
}

private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as Bottle)?.Refresh();
}

private void Refresh()
{
double height = LinearConvert(CurrentValue, r1.Height, 0F, 100F, 0F);
refile.Height = height;
}

private double LinearConvert(double IntputValue, double OSH, double OSL, double ISH, double ISL)
{
if (IntputValue >= ISH) return OSH;
if (IntputValue <= ISL) return OSL;
return (IntputValue - ISL) * (OSH - OSL) / (ISH - ISL) + OSL;
}

public double CurrentValue
{
get { return (double)GetValue(CurrentValueProperty); }
set { SetValue(CurrentValueProperty, value); }
}
public static readonly DependencyProperty CurrentValueProperty =
DependencyProperty.Register("CurrentValue", typeof(double), typeof(Bottle),
new PropertyMetadata(0.0, new PropertyChangedCallback(OnPropertyChanged)));

}
}

+ 81
- 0
BPASmartClient.CustomResource/UserControls/ConveyorBelt.xaml View File

@@ -0,0 +1,81 @@
<UserControl
x:Class="BPASmartClient.CustomResource.UserControls.ConveyorBelt"
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.CustomResource.UserControls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="300"
d:DesignWidth="800"
mc:Ignorable="d">

<UserControl.Resources>
<Storyboard x:Key="Left" RepeatBehavior="Forever">
<DoubleAnimation
Storyboard.TargetName="mp"
Storyboard.TargetProperty="StrokeDashOffset"
From="0"
To="100"
Duration="0:0:20" />
</Storyboard>

<Storyboard x:Key="Right" RepeatBehavior="Forever">
<DoubleAnimation
Storyboard.TargetName="mp"
Storyboard.TargetProperty="StrokeDashOffset"
From="0"
To="-100"
Duration="0:0:20" />
</Storyboard>

</UserControl.Resources>

<Grid Name="cav">
<Viewbox Width="auto" Height="auto">
<Canvas Width="{Binding ElementName=cav, Path=ActualWidth}" Height="{Binding ElementName=cav, Path=ActualHeight}">
<Path
Name="mp"
Margin="0"
Stroke="{Binding StrokeFillBrush, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}"
StrokeDashArray="{Binding StrokeDashArray, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}"
StrokeThickness="{Binding ConveyorBeltWidth, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}" />

<Path
Name="cb"
Fill="Transparent"
Stroke="{Binding StrokeBrush, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}"
StrokeThickness="{Binding StrokeThickness, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}" />

</Canvas>
</Viewbox>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>

<VisualState Name="Left">
<Storyboard x:Name="sb" RepeatBehavior="Forever">
<DoubleAnimation
Storyboard.TargetName="mp"
Storyboard.TargetProperty="StrokeDashOffset"
From="0"
To="100"
Duration="0:0:20" />
</Storyboard>
</VisualState>

<VisualState Name="Right">
<Storyboard RepeatBehavior="Forever">
<DoubleAnimation
Storyboard.TargetName="mp"
Storyboard.TargetProperty="StrokeDashOffset"
From="0"
To="-100"
Duration="0:0:20" />
</Storyboard>
</VisualState>

<VisualState Name="Stop" />

</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</UserControl>

+ 137
- 0
BPASmartClient.CustomResource/UserControls/ConveyorBelt.xaml.cs View File

@@ -0,0 +1,137 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
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.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.CustomResource.UserControls
{
/// <summary>
/// ConveyorBelt.xaml 的交互逻辑
/// </summary>
public partial class ConveyorBelt : UserControl
{
public ConveyorBelt()
{
InitializeComponent();
this.SizeChanged += ConveyorBelt_SizeChanged;
}

private void ConveyorBelt_SizeChanged(object sender, SizeChangedEventArgs e)
{
//传送带外边框绘制
PathGeometry geometry = new PathGeometry();
PathFigure pathFigure = new PathFigure();
pathFigure.StartPoint = new Point(this.Height / 2, 0);
pathFigure.Segments.Add(new ArcSegment(new Point(this.Height / 2, this.Height), new Size(this.Height / 2, this.Height / 2), 0, false, SweepDirection.Counterclockwise, true));
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, this.Height), true));
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, this.Height - ConveyorBeltWidth), true));
double innerCircle = (this.Height - (ConveyorBeltWidth * 2)) / 2;//内圆半径
pathFigure.Segments.Add(new LineSegment(new Point(ConveyorBeltWidth + innerCircle, this.Height - ConveyorBeltWidth), true));
pathFigure.Segments.Add(new ArcSegment(new Point(ConveyorBeltWidth + innerCircle, ConveyorBeltWidth), new Size(innerCircle, innerCircle), 0, false, SweepDirection.Clockwise, true));
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, ConveyorBeltWidth), true));
pathFigure.Segments.Add(new LineSegment(new Point(this.Width, 0), true));
pathFigure.Segments.Add(new LineSegment(new Point(this.Height / 2, 0), true));
geometry.Figures.Add(pathFigure);
this.cb.Data = geometry;

//传送带内部皮带绘制
PathGeometry geometry1 = new PathGeometry();
PathFigure pathFigure1 = new PathFigure();
pathFigure1.StartPoint = new Point(this.Width, ConveyorBeltWidth / 2);
double innerCircle1 = (this.Height - ConveyorBeltWidth) / 2;//内圆半径
pathFigure1.Segments.Add(new LineSegment(new Point(innerCircle1 + ConveyorBeltWidth / 2, ConveyorBeltWidth / 2), true));
pathFigure1.Segments.Add(new ArcSegment(new Point(innerCircle1 + ConveyorBeltWidth / 2, this.Height - ConveyorBeltWidth / 2), new Size(innerCircle1, innerCircle1), 0, false, SweepDirection.Counterclockwise, true));
pathFigure1.Segments.Add(new LineSegment(new Point(this.Width, this.Height - ConveyorBeltWidth / 2), true));
geometry1.Figures.Add(pathFigure1);
this.mp.Data = geometry1;

}

private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as ConveyorBelt)?.Refursh();
}

private void Refursh()
{
if (Direction == 1) VisualStateManager.GoToState(this, "Left", false);
else if (Direction == 2) VisualStateManager.GoToState(this, "Right", false);
else VisualStateManager.GoToState(this, "Stop", false);
}


public DoubleCollection StrokeDashArray
{
get { return (DoubleCollection)GetValue(StrokeDashArrayProperty); }
set { SetValue(StrokeDashArrayProperty, value); }
}
public static readonly DependencyProperty StrokeDashArrayProperty =
DependencyProperty.Register("StrokeDashArray", typeof(DoubleCollection), typeof(ConveyorBelt),
new PropertyMetadata(default, new PropertyChangedCallback(OnPropertyChanged)));


public double ConveyorBeltWidth
{
get { return (double)GetValue(ConveyorBeltWidthProperty); }
set { SetValue(ConveyorBeltWidthProperty, value); }
}
public static readonly DependencyProperty ConveyorBeltWidthProperty =
DependencyProperty.Register("ConveyorBeltWidth", typeof(double), typeof(ConveyorBelt),
new PropertyMetadata(50.0, new PropertyChangedCallback(OnPropertyChanged)));


public Brush StrokeFillBrush
{
get { return (Brush)GetValue(StrokeFillBrushProperty); }
set { SetValue(StrokeFillBrushProperty, value); }
}
public static readonly DependencyProperty StrokeFillBrushProperty =
DependencyProperty.Register("StrokeFillBrush", typeof(Brush), typeof(ConveyorBelt),
new PropertyMetadata(Brushes.LightBlue, new PropertyChangedCallback(OnPropertyChanged)));



public Brush StrokeBrush
{
get { return (Brush)GetValue(StrokeBrushProperty); }
set { SetValue(StrokeBrushProperty, value); }
}
public static readonly DependencyProperty StrokeBrushProperty =
DependencyProperty.Register("StrokeBrush", typeof(Brush), typeof(ConveyorBelt),
new PropertyMetadata(Brushes.LightBlue, new PropertyChangedCallback(OnPropertyChanged)));


public double StrokeThickness
{
get { return (double)GetValue(StrokeThicknessProperty); }
set { SetValue(StrokeThicknessProperty, value); }
}
public static readonly DependencyProperty StrokeThicknessProperty =
DependencyProperty.Register("StrokeThickness", typeof(double), typeof(ConveyorBelt),
new PropertyMetadata(1.0, new PropertyChangedCallback(OnPropertyChanged)));


public int Direction
{
get { return (int)GetValue(DirectionProperty); }
set { SetValue(DirectionProperty, value); }
}
public static readonly DependencyProperty DirectionProperty =
DependencyProperty.Register("Direction", typeof(int), typeof(ConveyorBelt),
new PropertyMetadata(0, new PropertyChangedCallback(OnPropertyChanged)));


}
}

+ 1133
- 0
BPASmartClient.CustomResource/UserControls/DosingSystem.xaml
File diff suppressed because it is too large
View File


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

+ 17
- 0
BPASmartClient.CustomResource/UserControls/Enum/ToastIcons.cs View File

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

namespace BPASmartClient.CustomResource.UserControls.Enum
{
public enum ToastIcons
{
None,
Information,//CheckSolid
Error,//TimesSolid
Warning,//ExclamationSolid
Busy//ClockSolid
}
}

+ 31
- 0
BPASmartClient.CustomResource/UserControls/Enum/ToastLocation.cs View File

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

namespace BPASmartClient.CustomResource.UserControls.Enum
{
public enum ToastLocation
{
OwnerCenter,
OwnerLeft,
OwnerRight,
OwnerTopLeft,
OwnerTopCenter,
OwnerTopRight,
OwnerBottomLeft,
OwnerBottomCenter,
OwnerBottomRight,
ScreenCenter,
ScreenLeft,
ScreenRight,
ScreenTopLeft,
ScreenTopCenter,
ScreenTopRight,
ScreenBottomLeft,
ScreenBottomCenter,
ScreenBottomRight,
Default//OwnerCenter
}
}

+ 27
- 27
BPASmartClient.CustomResource/UserControls/IcoButton.cs View File

@@ -44,7 +44,7 @@ namespace BPASmartClient.CustomResource.UserControls
/// <MyNamespace:IcoButton/>
///
/// </summary>
public class IcoButton : Control
public class IcoButton : Button
{
static IcoButton()
{
@@ -63,24 +63,24 @@ namespace BPASmartClient.CustomResource.UserControls
tempBackground = this.Background;
}

public Action Command
{
get { return (Action)GetValue(CommandProperty); }
set { SetValue(CommandProperty, value); }
}
public static readonly DependencyProperty CommandProperty =
DependencyProperty.Register("Command", typeof(Action), typeof(IcoButton),
new PropertyMetadata(default, new PropertyChangedCallback(OnPropertyChanged)));
//public Action Command
//{
// get { return (Action)GetValue(CommandProperty); }
// set { SetValue(CommandProperty, value); }
//}
//public static readonly DependencyProperty CommandProperty =
// DependencyProperty.Register("Command", typeof(Action), typeof(IcoButton),
// new PropertyMetadata(default, new PropertyChangedCallback(OnPropertyChanged)));


public Action<object> CommandObj
{
get { return (Action<object>)GetValue(CommandObjProperty); }
set { SetValue(CommandObjProperty, value); }
}
public static readonly DependencyProperty CommandObjProperty =
DependencyProperty.Register("CommandObj", typeof(Action<object>), typeof(IcoButton),
new PropertyMetadata(default, new PropertyChangedCallback(OnPropertyChanged)));
//public Action<object> CommandObj
//{
// get { return (Action<object>)GetValue(CommandObjProperty); }
// set { SetValue(CommandObjProperty, value); }
//}
//public static readonly DependencyProperty CommandObjProperty =
// DependencyProperty.Register("CommandObj", typeof(Action<object>), typeof(IcoButton),
// new PropertyMetadata(default, new PropertyChangedCallback(OnPropertyChanged)));


//public object CommandPar
@@ -94,14 +94,14 @@ namespace BPASmartClient.CustomResource.UserControls



public string Content
{
get { return (string)GetValue(ContentProperty); }
set { SetValue(ContentProperty, value); }
}
public static readonly DependencyProperty ContentProperty =
DependencyProperty.Register("Content", typeof(string), typeof(IcoButton),
new PropertyMetadata(string.Empty, new PropertyChangedCallback(OnPropertyChanged)));
//public string Content
//{
// get { return (string)GetValue(ContentProperty); }
// set { SetValue(ContentProperty, value); }
//}
//public static readonly DependencyProperty ContentProperty =
// DependencyProperty.Register("Content", typeof(string), typeof(IcoButton),
// new PropertyMetadata(string.Empty, new PropertyChangedCallback(OnPropertyChanged)));

public string IcoText
{
@@ -212,8 +212,8 @@ namespace BPASmartClient.CustomResource.UserControls

private void Gr_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
if (Command != null) Command();
this.Background = PressedBackground;
//Command?.Invoke();
//this.Background = PressedBackground;
}

}


+ 39
- 0
BPASmartClient.CustomResource/UserControls/Model/ToastOptions.cs View File

@@ -0,0 +1,39 @@
using BPASmartClient.CustomResource.UserControls.Enum;
using System;
using System.Globalization;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Threading;

namespace BPASmartClient.CustomResource.UserControls.Model
{
public class ToastOptions
{
public double ToastWidth { get; set; }
public double ToastHeight { get; set; }
public double TextWidth { get; set; }
public int Time { get; set; } = 2000;
public ToastIcons Icon { get; set; } = ToastIcons.None;
public ToastLocation Location { get; set; } = ToastLocation.Default;
public Brush Foreground { get; set; } = (Brush)new BrushConverter().ConvertFromString("#031D38");
public Brush IconForeground { get; set; } = (Brush)new BrushConverter().ConvertFromString("#00D91A");
public FontStyle FontStyle { get; set; } = SystemFonts.MessageFontStyle;
public FontStretch FontStretch { get; set; } = FontStretches.Normal;
public double FontSize { get; set; } = SystemFonts.MessageFontSize;
public FontFamily FontFamily { get; set; } = SystemFonts.MessageFontFamily;
public FontWeight FontWeight { get; set; } = SystemFonts.MenuFontWeight;
public double IconSize { get; set; } = 26;
public CornerRadius CornerRadius { get; set; } = new CornerRadius(5);
public Brush BorderBrush { get; set; } = (Brush)new BrushConverter().ConvertFromString("#CECECE");
public Thickness BorderThickness { get; set; } = new Thickness(0);
public Brush Background { get; set; } = (Brush)new BrushConverter().ConvertFromString("#FFFFFF");
public HorizontalAlignment HorizontalContentAlignment { get; set; } = HorizontalAlignment.Center;
public VerticalAlignment VerticalContentAlignment { get; set; } = VerticalAlignment.Center;
public EventHandler<EventArgs> Closed { get; internal set; }
public EventHandler<EventArgs> Click { get; internal set; }
public Thickness ToastMargin { get; set; } = new Thickness(2);
}
}

+ 67
- 0
BPASmartClient.CustomResource/UserControls/MotorBottle.xaml View File

@@ -0,0 +1,67 @@
<UserControl
x:Class="BPASmartClient.CustomResource.UserControls.MotorBottle"
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.CustomResource.UserControls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="500"
d:DesignWidth="700"
mc:Ignorable="d">
<Grid Name="gr">
<Viewbox >
<Canvas Width="700" Height="500">
<local:Bottle
x:Name="bottle"
Canvas.Left="608"
Width="84"
Height="257" HorizontalAlignment="Center" VerticalAlignment="Top" Canvas.Top="10" />
<local:DosingSystem
Height="386"
Width="827"
VerticalAlignment="Center" Canvas.Left="-66" Canvas.Top="186" HorizontalAlignment="Left" />

<Ellipse
Name="ep"
Canvas.Left="630"
Canvas.Top="339"
Width="40"
Height="40"
Fill="Red" HorizontalAlignment="Center" VerticalAlignment="Top" />

</Canvas>
</Viewbox>

<VisualStateManager.VisualStateGroups>
<VisualStateGroup>

<VisualState Name="Start">
<Storyboard AutoReverse="True" x:Name="sb" RepeatBehavior="Forever">
<DoubleAnimation
Storyboard.TargetName="ep"
Storyboard.TargetProperty="Opacity"
From="0"
To="1"
Duration="0:0:1" />

<ColorAnimation Storyboard.TargetName="ep" Storyboard.TargetProperty="(Ellipse.Fill).(SolidColorBrush.Color)" From="Green" To="Green"/>
</Storyboard>
</VisualState>

<VisualState Name="Stop">
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="ep"
Storyboard.TargetProperty="Opacity"
To="1"
Duration="0:0:1" />
<ColorAnimation Storyboard.TargetName="ep" Storyboard.TargetProperty="(Ellipse.Fill).(SolidColorBrush.Color)" To="Red" From="Red"/>
</Storyboard>
</VisualState>



</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</UserControl>

+ 69
- 0
BPASmartClient.CustomResource/UserControls/MotorBottle.xaml.cs View File

@@ -0,0 +1,69 @@
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.CustomResource.UserControls
{
/// <summary>
/// MotorBottle.xaml 的交互逻辑
/// </summary>
public partial class MotorBottle : UserControl
{
public MotorBottle()
{
InitializeComponent();
}

private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
(d as MotorBottle)?.Refresh();
}

private void Refresh()
{
bottle.CurrentValue = this.CurrentValue;
VisualStateManager.GoToState(this, IsRun ? "Start" : "Stop", false);
}


public bool IsRun
{
get { return (bool)GetValue(IsRunProperty); }
set { SetValue(IsRunProperty, value); }
}
public static readonly DependencyProperty IsRunProperty =
DependencyProperty.Register("IsRun", typeof(bool), typeof(MotorBottle),
new PropertyMetadata(false, new PropertyChangedCallback(OnPropertyChanged)));

//public bool IsRun
//{
// get { return (bool)GetValue(IsRunProperty); }
// set { SetValue(IsRunProperty, value); }
//}
//public static readonly DependencyProperty IsRunProperty =
// DependencyProperty.Register("IsRun", typeof(bool), typeof(MotorBottle),
// new PropertyMetadata(0, new PropertyChangedCallback(OnPropertyChanged)));


public double CurrentValue
{
get { return (double)GetValue(CurrentValueProperty); }
set { SetValue(CurrentValueProperty, value); }
}
public static readonly DependencyProperty CurrentValueProperty =
DependencyProperty.Register("CurrentValue", typeof(double), typeof(MotorBottle),
new PropertyMetadata(0.0, new PropertyChangedCallback(OnPropertyChanged)));

}
}

+ 63
- 0
BPASmartClient.CustomResource/UserControls/Pipeline.xaml View File

@@ -0,0 +1,63 @@
<UserControl
x:Class="BPASmartClient.CustomResource.UserControls.Pipeline"
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.CustomResource.UserControls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="30"
d:DesignWidth="800"
mc:Ignorable="d">
<Grid>
<Border CornerRadius="{Binding CapRadius, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}">
<Border.Background>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Offset="0.8" Color="#FFCBCBCB" />
<GradientStop Offset="0.5" Color="White" />
<GradientStop Offset="0.1" Color="#FFCBCBCB" />
</LinearGradientBrush>
</Border.Background>
<Border Name="border" Margin="3">
<Line
Name="liquidLine"
VerticalAlignment="Center"
Opacity="0.3"
Stretch="Fill"
Stroke="{Binding LiquidColor, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}"
StrokeDashArray="2,3"
StrokeDashCap="Round"
StrokeEndLineCap="Round"
StrokeStartLineCap="Round"
StrokeThickness="{Binding ElementName=border, Path=ActualHeight}"
X1="0"
X2="{Binding RelativeSource={RelativeSource Self}, Path=ActualWidth}"
Y1="0"
Y2="0" />
</Border>
</Border>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState Name="WEFlowState">
<Storyboard RepeatBehavior="Forever">
<DoubleAnimation
Storyboard.TargetName="liquidLine"
Storyboard.TargetProperty="StrokeDashOffset"
From="0"
To="5"
Duration="0:0:1" />
</Storyboard>
</VisualState>
<VisualState Name="EWFlowState">
<Storyboard RepeatBehavior="Forever">
<DoubleAnimation
Storyboard.TargetName="liquidLine"
Storyboard.TargetProperty="StrokeDashOffset"
From="0"
To="-5"
Duration="0:0:1" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</UserControl>

+ 59
- 0
BPASmartClient.CustomResource/UserControls/Pipeline.xaml.cs View File

@@ -0,0 +1,59 @@
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.CustomResource.UserControls
{
/// <summary>
/// Pipeline.xaml 的交互逻辑
/// </summary>
public partial class Pipeline : UserControl
{
public Pipeline()
{
InitializeComponent();
}

private int _direction = 1;
/// <summary>
/// 液体流向,接受1和2两个值
/// </summary>
public int Direction
{
get { return _direction; }
set
{
_direction = value;

VisualStateManager.GoToState(this, value == 1 ? "WEFlowState" : "EWFlowState", false);
}
}

public Brush LiquidColor
{
get { return (Brush)GetValue(LiquidColorProperty); }
set { SetValue(LiquidColorProperty, value); }
}
public static readonly DependencyProperty LiquidColorProperty =
DependencyProperty.Register("LiquidColor", typeof(Brush), typeof(Pipeline), new PropertyMetadata(Brushes.Orange));

public int CapRadius
{
get { return (int)GetValue(CapRadiusProperty); }
set { SetValue(CapRadiusProperty, value); }
}
public static readonly DependencyProperty CapRadiusProperty =
DependencyProperty.Register("CapRadius", typeof(int), typeof(Pipeline), new PropertyMetadata(5));
}
}

+ 68
- 0
BPASmartClient.CustomResource/UserControls/Toast.xaml View File

@@ -0,0 +1,68 @@
<UserControl
x:Class="BPASmartClient.CustomResource.UserControls.Toast"
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:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
xmlns:local="clr-namespace:BPASmartClient.CustomResource.UserControls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:con="clr-namespace:BPASmartClient.CustomResource.Converters"
Width="Auto"
Height="Auto"
MinWidth="100"
MinHeight="50"
MaxWidth="1500"
MaxHeight="500"
d:DesignHeight="48"
d:DesignWidth="200"
Focusable="False"
MouseLeftButtonDown="UserControl_MouseLeftButtonDown"
mc:Ignorable="d">

<UserControl.Resources>
<con:ToastIconConverter x:Key="IconConverter"></con:ToastIconConverter>
</UserControl.Resources>

<Border CornerRadius="{Binding CornerRadius}"
BorderThickness="{Binding BorderThickness}"
Background="{Binding Background}"
BorderBrush="{Binding BorderBrush}"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="1">
<Border.Effect>
<DropShadowEffect Color="#D1D1D1" BlurRadius="10" ShadowDepth="0" Opacity="0.5" />
</Border.Effect>

<Grid x:Name="grid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>

<iconPacks:PackIconFontAwesome x:Name="icon_toast" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="10 0 0 0"
Foreground="{Binding IconForeground}"
Width="{Binding IconSize}"
Height="{Binding IconSize}">
<iconPacks:PackIconFontAwesome.Kind>
<MultiBinding Converter="{StaticResource IconConverter}">
<Binding Path="Icon"/>
<Binding ElementName="grid"/>
<Binding ElementName="txt_toast"/>
</MultiBinding>
</iconPacks:PackIconFontAwesome.Kind>
</iconPacks:PackIconFontAwesome>

<TextBlock x:Name="txt_toast" Grid.Column="2" Text="{Binding Message}"
MaxWidth="{Binding TextWidth}" Height="Auto" TextWrapping="Wrap"
Foreground="{Binding Foreground}"
FontStyle="{Binding FontStyle}"
FontStretch="{Binding FontStretch}"
FontSize="{Binding FontSize}"
FontFamily="{Binding FontFamily}"
FontWeight="{Binding FontWeight}"
VerticalAlignment="{Binding VerticalContentAlignment}"
HorizontalAlignment="{Binding HorizontalContentAlignment}" Padding="0 5 10 5">
</TextBlock>
</Grid>
</Border>
</UserControl>

+ 480
- 0
BPASmartClient.CustomResource/UserControls/Toast.xaml.cs View File

@@ -0,0 +1,480 @@
using BPASmartClient.CustomResource.UserControls.Enum;
using BPASmartClient.CustomResource.UserControls.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.Controls.Primitives;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace BPASmartClient.CustomResource.UserControls
{
/// <summary>
/// Toast.xaml 的交互逻辑
/// </summary>
public partial class Toast : UserControl
{
private Window owner = null;
private Popup popup = null;
private DispatcherTimer timer = null;

private Toast()
{
InitializeComponent();
this.DataContext = this;
}

private Toast(Window owner, string message, ToastOptions options = null)
{
Message = message;
InitializeComponent();
if (options != null)
{
if (options.ToastWidth != 0) ToastWidth = options.ToastWidth;
if (options.ToastHeight != 0) ToastHeight = options.ToastHeight;
if (options.TextWidth != 0) TextWidth = options.TextWidth;

Icon = options.Icon;
Location = options.Location;
Time = options.Time;
Closed += options.Closed;
Click += options.Click;
Background = options.Background;
Foreground = options.Foreground;
FontStyle = options.FontStyle;
FontStretch = options.FontStretch;
FontSize = options.FontSize;
FontFamily = options.FontFamily;
FontWeight = options.FontWeight;
IconSize = options.IconSize;
BorderBrush = options.BorderBrush;
BorderThickness = options.BorderThickness;
HorizontalContentAlignment = options.HorizontalContentAlignment;
VerticalContentAlignment = options.VerticalContentAlignment;
CornerRadius = options.CornerRadius;
ToastMargin = options.ToastMargin;
IconForeground = options.IconForeground;
}
this.DataContext = this;
if (owner == null)
{
this.owner = Application.Current.MainWindow;
}
else
{
this.owner = owner;
}
this.owner.Closed += Owner_Closed;
}

private void Owner_Closed(object sender, EventArgs e)
{
this.Close();
}

public static void Show(string msg, ToastOptions options = null)
{
var toast = new Toast(null, msg, options);
int time = toast.Time;
ShowToast(toast, time);
}

public static void Show(Window owner, string msg, ToastOptions options = null)
{
var toast = new Toast(owner, msg, options);
int time = toast.Time;
ShowToast(toast, time);
}

private static void ShowToast(Toast toast, int time)
{
toast.popup = null;
Application.Current.Dispatcher.Invoke(new Action(() =>
{
toast.popup = new Popup
{
PopupAnimation = PopupAnimation.Fade,
AllowsTransparency = true,
StaysOpen = true,
Placement = PlacementMode.Left,
IsOpen = false,
Child = toast,
MinWidth = toast.MinWidth,
MaxWidth = toast.MaxWidth,
MinHeight = toast.MinHeight,
MaxHeight = toast.MaxHeight,
};

if (toast.ToastWidth != 0)
{
toast.popup.Width = toast.ToastWidth;
}

if (toast.ToastHeight != 0)
{
toast.popup.Height = toast.ToastHeight;
}

toast.popup.PlacementTarget = GetPopupPlacementTarget(toast); //为 null 则 Popup 定位相对于屏幕的左上角;
toast.owner.LocationChanged += toast.UpdatePosition;
toast.owner.SizeChanged += toast.UpdatePosition;
toast.popup.Closed += Popup_Closed;

//SetPopupOffset(toast.popup, toast);
//toast.UpdatePosition(toast, null);
toast.popup.IsOpen = true; //先显示出来以确定宽高;
SetPopupOffset(toast.popup, toast);
//toast.UpdatePosition(toast, null);
toast.popup.IsOpen = false; //先关闭再打开来刷新定位;
toast.popup.IsOpen = true;
}));
toast.timer = new DispatcherTimer();
toast.timer.Tick += (sender, e) =>
{
toast.popup.IsOpen = false;
toast.owner.LocationChanged -= toast.UpdatePosition;
toast.owner.SizeChanged -= toast.UpdatePosition;
};
toast.timer.Interval = new TimeSpan(0, 0, 0, 0, time);
toast.timer.Start();
}

private void UpdatePosition(object sender, EventArgs e)
{
var up = typeof(Popup).GetMethod("UpdatePosition", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
if (up == null || popup == null)
{
return;
}
SetPopupOffset(popup, this);
up.Invoke(popup, null);
}

private static void Popup_Closed(object sender, EventArgs e)
{
Popup popup = sender as Popup;
if (popup == null)
{
return;
}
Toast toast = popup.Child as Toast;
if (toast == null)
{
return;
}
toast.RaiseClosed(e);
}

private void UserControl_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (e.ClickCount == 1)
{
RaiseClick(e);
}
}

/// <summary>
/// 获取定位目标
/// </summary>
/// <param name="toast">Toast 对象</param>
/// <returns>容器或null</returns>
private static UIElement GetPopupPlacementTarget(Toast toast)
{
switch (toast.Location)
{
case ToastLocation.ScreenCenter:
case ToastLocation.ScreenLeft:
case ToastLocation.ScreenRight:
case ToastLocation.ScreenTopLeft:
case ToastLocation.ScreenTopCenter:
case ToastLocation.ScreenTopRight:
case ToastLocation.ScreenBottomLeft:
case ToastLocation.ScreenBottomCenter:
case ToastLocation.ScreenBottomRight:
return null;
}
return toast.owner;
}

private static void SetPopupOffset(Popup popup, Toast toast)
{
double winTitleHeight = SystemParameters.CaptionHeight; //标题高度为22;
double owner_width = toast.owner.ActualWidth;
double owner_height = toast.owner.ActualHeight - winTitleHeight;
if (popup.PlacementTarget == null)
{
owner_width = SystemParameters.WorkArea.Size.Width;
owner_height = SystemParameters.WorkArea.Size.Height;
}

double popupWidth = (popup.Child as FrameworkElement)?.ActualWidth ?? 0; //Popup 宽高为其 Child 的宽高;
double popupHeight = (popup.Child as FrameworkElement)?.ActualHeight ?? 0;
double x = SystemParameters.WorkArea.X;
double y = SystemParameters.WorkArea.Y;
Thickness margin = toast.ToastMargin;

/*[dlgcy] 38 和 16 两个数字的猜测:
* PlacementTarget 为 Window 时,当 Placement 为 Bottom 时,Popup 上边缘与 Window 的下边缘的距离为 38;
* 当 Placement 为 Right 时,Popup 左边缘与 Window 的右边缘的距离为 16。
*/
double bottomDistance = 38;
double rightDistance = 16;

//上面创建时 Popup 的 Placement 为 PlacementMode.Left;
switch (toast.Location)
{
case ToastLocation.OwnerLeft: //容器左中间
popup.HorizontalOffset = popupWidth + margin.Left;
popup.VerticalOffset = (owner_height - popupHeight - winTitleHeight) / 2;
break;
case ToastLocation.ScreenLeft: //屏幕左中间
popup.HorizontalOffset = popupWidth + x + margin.Left;
popup.VerticalOffset = (owner_height - popupHeight) / 2 + y;
break;
case ToastLocation.OwnerRight: //容器右中间
popup.HorizontalOffset = owner_width - rightDistance - margin.Right;
popup.VerticalOffset = (owner_height - popupHeight - winTitleHeight) / 2;
break;
case ToastLocation.ScreenRight: //屏幕右中间
popup.HorizontalOffset = owner_width + x - margin.Right;
popup.VerticalOffset = (owner_height - popupHeight) / 2 + y;
break;
case ToastLocation.OwnerTopLeft: //容器左上角
popup.HorizontalOffset = popupWidth + margin.Left;
popup.VerticalOffset = margin.Top;
break;
case ToastLocation.ScreenTopLeft: //屏幕左上角
popup.HorizontalOffset = popupWidth + x + margin.Left;
popup.VerticalOffset = margin.Top;
break;
case ToastLocation.OwnerTopCenter: //容器上中间
popup.HorizontalOffset = popupWidth + (owner_width - popupWidth - rightDistance) / 2;
popup.VerticalOffset = margin.Top;
break;
case ToastLocation.ScreenTopCenter: //屏幕上中间
popup.HorizontalOffset = popupWidth + (owner_width - popupWidth) / 2 + x;
popup.VerticalOffset = y + margin.Top;
break;
case ToastLocation.OwnerTopRight: //容器右上角
popup.HorizontalOffset = owner_width - rightDistance - margin.Right;
popup.VerticalOffset = margin.Top;
break;
case ToastLocation.ScreenTopRight: //屏幕右上角
popup.HorizontalOffset = owner_width + x - margin.Right;
popup.VerticalOffset = y + margin.Top;
break;
case ToastLocation.OwnerBottomLeft: //容器左下角
//popup.HorizontalOffset = popupWidth;
//popup.VerticalOffset = owner_height - popupHeight - winTitleHeight;
popup.Placement = PlacementMode.Bottom;
popup.HorizontalOffset = margin.Left;
popup.VerticalOffset = -(bottomDistance + popupHeight + margin.Bottom);
break;
case ToastLocation.ScreenBottomLeft: //屏幕左下角
popup.HorizontalOffset = popupWidth + x + margin.Left;
popup.VerticalOffset = owner_height - popupHeight + y - margin.Bottom;
break;
case ToastLocation.OwnerBottomCenter: //容器下中间
//popup.HorizontalOffset = popupWidth + (owner_width - popupWidth - rightDistance) / 2;
//popup.VerticalOffset = owner_height - popupHeight - winTitleHeight;
popup.Placement = PlacementMode.Bottom;
popup.HorizontalOffset = (owner_width - popupWidth - rightDistance) / 2;
popup.VerticalOffset = -(bottomDistance + popupHeight + margin.Bottom);
break;
case ToastLocation.ScreenBottomCenter: //屏幕下中间
popup.HorizontalOffset = popupWidth + (owner_width - popupWidth) / 2 + x;
popup.VerticalOffset = owner_height - popupHeight + y - margin.Bottom;
break;
case ToastLocation.OwnerBottomRight: //容器右下角
//popup.HorizontalOffset = popupWidth + (owner_width - popupWidth - rightDistance);
//popup.VerticalOffset = owner_height - popupHeight - winTitleHeight;
popup.Placement = PlacementMode.Bottom;
popup.HorizontalOffset = owner_width - popupWidth - rightDistance - margin.Right;
popup.VerticalOffset = -(bottomDistance + popupHeight + margin.Bottom);
break;
case ToastLocation.ScreenBottomRight: //屏幕右下角
popup.HorizontalOffset = owner_width + x - margin.Right;
popup.VerticalOffset = owner_height - popupHeight + y - margin.Bottom;
break;
case ToastLocation.ScreenCenter: //屏幕正中间
popup.HorizontalOffset = popupWidth + (owner_width - popupWidth) / 2 + x;
popup.VerticalOffset = (owner_height - popupHeight) / 2 + y;
break;
case ToastLocation.OwnerCenter: //容器正中间
case ToastLocation.Default:
//popup.HorizontalOffset = popupWidth + (owner_width - popupWidth - rightDistance) / 2;
//popup.VerticalOffset = (owner_height - popupHeight - winTitleHeight) / 2;
popup.Placement = PlacementMode.Center;
popup.HorizontalOffset = -rightDistance / 2;
popup.VerticalOffset = -bottomDistance / 2;
break;
}
}

public void Close()
{
if (timer != null)
{
timer.Stop();
timer = null;
}
popup.IsOpen = false;
owner.LocationChanged -= UpdatePosition;
owner.SizeChanged -= UpdatePosition;
}

private event EventHandler<EventArgs> Closed;
private void RaiseClosed(EventArgs e)
{
Closed?.Invoke(this, e);
}

private event EventHandler<EventArgs> Click;
private void RaiseClick(EventArgs e)
{
Click?.Invoke(this, e);
}

#region 依赖属性

private string Message
{
get { return (string)GetValue(MessageProperty); }
set { SetValue(MessageProperty, value); }
}
private static readonly DependencyProperty MessageProperty =
DependencyProperty.Register("Message", typeof(string), typeof(Toast), new PropertyMetadata(string.Empty));

private CornerRadius CornerRadius
{
get { return (CornerRadius)GetValue(CornerRadiusProperty); }
set { SetValue(CornerRadiusProperty, value); }
}
private static readonly DependencyProperty CornerRadiusProperty =
DependencyProperty.Register("CornerRadius", typeof(CornerRadius), typeof(Toast), new PropertyMetadata(new CornerRadius(5)));

private double IconSize
{
get { return (double)GetValue(IconSizeProperty); }
set { SetValue(IconSizeProperty, value); }
}
private static readonly DependencyProperty IconSizeProperty =
DependencyProperty.Register("IconSize", typeof(double), typeof(Toast), new PropertyMetadata(26.0));

private new Brush BorderBrush
{
get { return (Brush)GetValue(BorderBrushProperty); }
set { SetValue(BorderBrushProperty, value); }
}
private static new readonly DependencyProperty BorderBrushProperty =
DependencyProperty.Register("BorderBrush", typeof(Brush), typeof(Toast), new PropertyMetadata((Brush)new BrushConverter().ConvertFromString("#FFFFFF")));

private new Thickness BorderThickness
{
get { return (Thickness)GetValue(BorderThicknessProperty); }
set { SetValue(BorderThicknessProperty, value); }
}
private static new readonly DependencyProperty BorderThicknessProperty =
DependencyProperty.Register("BorderThickness", typeof(Thickness), typeof(Toast), new PropertyMetadata(new Thickness(0)));

private new Brush Background
{
get { return (Brush)GetValue(BackgroundProperty); }
set { SetValue(BackgroundProperty, value); }
}
private static new readonly DependencyProperty BackgroundProperty =
DependencyProperty.Register("Background", typeof(Brush), typeof(Toast), new PropertyMetadata((Brush)new BrushConverter().ConvertFromString("#2E2929")));

private new HorizontalAlignment HorizontalContentAlignment
{
get { return (HorizontalAlignment)GetValue(HorizontalContentAlignmentProperty); }
set { SetValue(HorizontalContentAlignmentProperty, value); }
}
private static new readonly DependencyProperty HorizontalContentAlignmentProperty =
DependencyProperty.Register("HorizontalContentAlignment", typeof(HorizontalAlignment), typeof(Toast), new PropertyMetadata(HorizontalAlignment.Left));

private new VerticalAlignment VerticalContentAlignment
{
get { return (VerticalAlignment)GetValue(VerticalContentAlignmentProperty); }
set { SetValue(VerticalContentAlignmentProperty, value); }
}
private static new readonly DependencyProperty VerticalContentAlignmentProperty =
DependencyProperty.Register("VerticalContentAlignment", typeof(VerticalAlignment), typeof(Toast), new PropertyMetadata(VerticalAlignment.Center));

private double ToastWidth
{
get { return (double)GetValue(ToastWidthProperty); }
set { SetValue(ToastWidthProperty, value); }
}
private static readonly DependencyProperty ToastWidthProperty =
DependencyProperty.Register("ToastWidth", typeof(double), typeof(Toast), new PropertyMetadata(0.0));

private double ToastHeight
{
get { return (double)GetValue(ToastHeightProperty); }
set { SetValue(ToastHeightProperty, value); }
}
private static readonly DependencyProperty ToastHeightProperty =
DependencyProperty.Register("ToastHeight", typeof(double), typeof(Toast), new PropertyMetadata(0.0));

private ToastIcons Icon
{
get { return (ToastIcons)GetValue(IconProperty); }
set { SetValue(IconProperty, value); }
}
private static readonly DependencyProperty IconProperty =
DependencyProperty.Register("Icon", typeof(ToastIcons), typeof(Toast), new PropertyMetadata(ToastIcons.None));

private int Time
{
get { return (int)GetValue(TimeProperty); }
set { SetValue(TimeProperty, value); }
}
private static readonly DependencyProperty TimeProperty =
DependencyProperty.Register("Time", typeof(int), typeof(Toast), new PropertyMetadata(2000));

private ToastLocation Location
{
get { return (ToastLocation)GetValue(LocationProperty); }
set { SetValue(LocationProperty, value); }
}
private static readonly DependencyProperty LocationProperty =
DependencyProperty.Register("Location", typeof(ToastLocation), typeof(Toast), new PropertyMetadata(ToastLocation.Default));

public double TextWidth
{
get { return (double)GetValue(TextWidthProperty); }
set { SetValue(TextWidthProperty, value); }
}
public static readonly DependencyProperty TextWidthProperty =
DependencyProperty.Register("TextWidth", typeof(double), typeof(Toast), new PropertyMetadata(double.NaN));

public Thickness ToastMargin
{
get { return (Thickness)GetValue(ToastMarginProperty); }
set { SetValue(ToastMarginProperty, value); }
}
public static readonly DependencyProperty ToastMarginProperty =
DependencyProperty.Register("ToastMargin", typeof(Thickness), typeof(Toast), new PropertyMetadata(new Thickness(0)));

private Brush IconForeground
{
get { return (Brush)GetValue(IconForegroundProperty); }
set { SetValue(IconForegroundProperty, value); }
}
private static readonly DependencyProperty IconForegroundProperty =
DependencyProperty.Register("IconForeground", typeof(Brush), typeof(Toast), new PropertyMetadata((Brush)new BrushConverter().ConvertFromString("#00D91A")));

#endregion
}
}

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

@@ -32,10 +32,6 @@ namespace BPASmartClient.Helper
if (CancellationTokenSources.ContainsKey(guid + key))
{
CancellationTokenSources[guid + key]?.Cancel();
if (key.Equals("MainTask"))
{
ActionManage.GetInstance.Send("FryPotDosingMainTaskExit");
}
ActionManage.GetInstance.Register(ExitCallback, guid + key);
}
else


+ 5
- 3
BPASmartClient.HubHelper/HubHelper.cs View File

@@ -2,6 +2,9 @@

namespace BPASmartClient.HubHelper
{
/// <summary>
/// 客户端
/// </summary>
public class HubHelper
{
private volatile static HubHelper _Instance;
@@ -17,10 +20,9 @@ namespace BPASmartClient.HubHelper
{
hubConnection = new HubConnectionBuilder().WithAutomaticReconnect().WithUrl($"http://{ip}:{port}/personhub").Build();//连接

hubConnection.On<object>("Report", (s) => { Report?.Invoke(s); });

hubConnection.On<object>("Upstreamrequest", (s) => { Upstreamrequest?.Invoke(s); });
hubConnection.On<object>("Report", (s) => { Report?.Invoke(s); });//客户端注册方法

hubConnection.On<object>("Upstreamrequest", (s) => { Upstreamrequest?.Invoke(s); });//客户端注册方法
try
{
hubConnection.StartAsync();


+ 23
- 5
BPASmartClient.Modbus/ModbusTcp.cs View File

@@ -142,6 +142,22 @@ namespace BPASmartClient.Modbus
return LwAddress;
}
}
else if (address.ToUpper().Contains("D") && address.Length == 5)
{
try
{
string head = "4"+(Convert.ToInt32(address.Substring(1, 1)) - 1).ToString();
string tail = address.Substring(2, 3);
address = head + tail;
return Convert.ToInt32(address);
}
catch (Exception)
{
//打印日志
}
}
}
return -1;
}
@@ -171,7 +187,7 @@ namespace BPASmartClient.Modbus
commandType = CommandType.Coils;
return master.ReadCoils(slaveAddress, startAddress, len);
}
else if (address.ToUpper().Contains("VW") || address.ToUpper().Contains("LW"))
else if (address.ToUpper().Contains("VW") || address.ToUpper().Contains("LW")|| address.ToUpper().Contains("D"))
{
commandType = CommandType.HoldingRegisters;
return master.ReadHoldingRegisters(slaveAddress, startAddress, len);
@@ -181,6 +197,7 @@ namespace BPASmartClient.Modbus
commandType = CommandType.Inputs;
return master.ReadInputs(slaveAddress, startAddress, len);
}
}
catch (Exception ex)
{
@@ -199,14 +216,15 @@ namespace BPASmartClient.Modbus
{
try
{
string head = (Convert.ToInt32(address.Substring(1, 1)) - 1).ToString();
string head = "4"+(Convert.ToInt32(address.Substring(1, 1)) - 1).ToString();
string tail = address.Substring(2, 3);
address = head + tail;
address = head + tail;
return Convert.ToInt32(address);
}
catch (Exception)
{
//打印日志
return -1;
}
}

@@ -276,7 +294,7 @@ namespace BPASmartClient.Modbus
else if (value is bool[] boolsValue)
master.WriteMultipleCoils(slaveAddress, startAddress, boolsValue);
}
else if (address.ToUpper().Contains("VW") || address.ToUpper().Contains("LW"))
else if (address.ToUpper().Contains("VW") || address.ToUpper().Contains("LW")|| address.ToUpper().Contains("D"))
{
commandType = CommandType.HoldingRegisters;
if (value is ushort ushortValue)


+ 3
- 1
BPASmartClient.MorkS/View/Debug.xaml.cs View File

@@ -1,4 +1,5 @@
using System;
using BPASmartClient.MorkS.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -24,5 +25,6 @@ namespace BPASmartClient.MorkS.View
{
InitializeComponent();
}

}
}

+ 1
- 1
BPASmartClient.MorkS/View/ParSet.xaml View File

@@ -62,7 +62,7 @@
Content="保存配置"
FontSize="16"
IcoText="&#xe936;"
Style="{StaticResource NewButtonStyle}">
Style="{StaticResource IcoButtonStyle}">
<pry:IcoButton.Foreground>
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
<GradientStop Color="#FFBB662A" />


+ 14
- 14
BPASmartClient.MorkT/Control_MorkT.cs View File

@@ -76,21 +76,21 @@ namespace BPASmartClient.MorkT

public override void MainTask()
{
if (morkTime.AddMinutes(Global.TimeInterval).Minute == DateTime.Now.Minute)
{
morkTime = DateTime.Now;
if ((ELebaiRModel)peripheralStatus["RobotMode"] == ELebaiRModel.空闲状态)
{
MessageLog.GetInstance.Show("机器人开始自嗨!");
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { });
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_自嗨 });
Wait();
EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
Thread.Sleep(50);
}
//if (morkTime.AddMinutes(Global.TimeInterval).Minute == DateTime.Now.Minute)
//{
// morkTime = DateTime.Now;
// if ((ELebaiRModel)peripheralStatus["RobotMode"] == ELebaiRModel.空闲状态)
// {
// MessageLog.GetInstance.Show("机器人开始自嗨!");
// EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 0 }, (o) => { });
// EventBus.EventBus.GetInstance().Publish(new LebaiRobot_LebaiSenceEvent { DeviceId = DeviceId, LebaiSence = Lebai_qsqdCode.SENCE_自嗨 });
// Wait();
// EventBus.EventBus.GetInstance().Publish(new LebaiRobot_SetValueEvent { DeviceId = DeviceId, RobotSetValue = 1 }, (o) => { });
// Thread.Sleep(50);
// }

}
else if (morkTime.AddMinutes(Global.TimeInterval) < DateTime.Now) morkTime = DateTime.Now;
//}
//else if (morkTime.AddMinutes(Global.TimeInterval) < DateTime.Now) morkTime = DateTime.Now;
#region morkt流程
//if (morkT.waitMorkOrder != null)//更新订单取走状态
//{


+ 175
- 0
BPASmartClient.MorkTM/Control_MorkTM.cs View File

@@ -0,0 +1,175 @@
using BPA.Message;
using BPA.Message.Enum;
using BPASmartClient.Device;
using BPASmartClient.EventBus;
using BPASmartClient.Helper;
using BPASmartClient.Message;
using BPASmartClient.Model;
using BPASmartClient.Model.PLC;
using BPASmartClient.MorkTM.Model;
using System.Collections.Concurrent;
using static BPASmartClient.EventBus.EventBus;

namespace BPASmartClient.MorkTM
{
public class Control_MorkTM : BaseDevice
{
public override global::BPA.Message.Enum.DeviceClientType DeviceType { get { return BPA.Message.Enum.DeviceClientType.TMC_MT; } }

GVL_MorkTM morkTM = new GVL_MorkTM();
public override void DoMain()
{
ServerInit();
DataParse();
PolymerBatching.GetMaterialInfo();
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");

DeviceProcessLogShow("设备初始化完成");

}
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 DataParse()
{
EventBus.EventBus.GetInstance().Subscribe<DoOrderEvent>(DeviceId, delegate (IEvent @event, EventCallBackHandle callBack)
{
if(@event == null) return;
if(@event is DoOrderEvent order)
{
if (order.MorkOrder.GoodBatchings == null) return;
OrderCount++;
OrderChange(order.MorkOrder, ORDER_STATUS.WAIT);
DeviceProcessLogShow($"接收到{OrderCount}次订单");
Dictionary<string, int> OrderPushes = new Dictionary<string, int>();
foreach (var item in order.MorkOrder.GoodBatchings)
{
var res = orderMaterialDelivery?.BatchingInfo?.FirstOrDefault(p => p.BatchingId == item.BatchingId);
if (res != null)
{
OrderPushes.TryAdd(res.BatchingLoc, item.BatchingCount);
}
}

morkTM.morkOrderPushesTeaWithMilk.Enqueue(new OrderLocInfo()
{
GoodName = order.MorkOrder.GoodsName,
SuborderId = order.MorkOrder.SuborderId,
GoodPushes = OrderPushes
});
}
});
}
private void OrderChange(MorkOrderPush orderPush, ORDER_STATUS oRDER_STATUS)
{
EventBus.EventBus.GetInstance().Publish(new OrderStatusChangedEvent()
{
SortNum = orderPush.SortNum.ToString(),
GoodName = orderPush.GoodsName,
Status = oRDER_STATUS,
SubOrderId = orderPush.SuborderId,
deviceClientType = DeviceType
});
}


public override void MainTask()
{
IsHealth = true;
MakeTeaWithMilkProcess();
}

private void MakeTeaWithMilkProcess()
{
if(morkTM.morkOrderPushesTeaWithMilk.Count > 0)
{
if(morkTM.morkOrderPushesTeaWithMilk.TryDequeue(out OrderLocInfo orderLoc))
{
morkTM.RecipesPushes.Clear();
morkTM.RecipesPushes = orderLoc.GoodPushes;
foreach(var item in morkTM.RecipesPushes)
{
WriteData(item.Key,item.Value);
while (!RTrig.GetInstance("OutMaterialComplete").Start(morkTM.OutMaterialComplete))
{
Thread.Sleep(100);
}
DeviceProcessLogShow($"奶茶{orderLoc.GoodName}:配料{item.Key}:添加量{item.Value}");
}
}
}
}


public override void ReadData()
{
throw new NotImplementedException();
}

public override void ResetProgram()
{
morkTM = null;
morkTM = new GVL_MorkTM();
}

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

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

public override void SimOrder()
{
ActionManage.GetInstance.Register(new Action<object>((o) =>
{
if (o is string goodName)
{

}
}), "");
}

public override void Stop()
{
throw new NotImplementedException();
}
}
}

+ 40
- 0
BPASmartClient.MorkTM/PolymerBatching.cs View File

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

namespace BPASmartClient.MorkTM
{
public enum MaterialPosion
{
Material_Top_1, Material_Top_2, Material_Top_3, Material_Top_4, Material_Top_5, Material_Top_6,
Material_Mid_1, Material_Mid_2, Material_Mid_3, Material_Mid_4, Material_Mid_5, Material_Mid_6, Material_Mid_7, Material_Mid_8, Material_Mid_9, Material_Mid_10,
Marerial_Bottom_1, Marerial_Bottom_2, Marerial_Bottom_3, Marerial_Bottom_4, Marerial_Bottom_5, Marerial_Bottom_6,
Matetial_Tea_1, Matetial_Tea_2, Matetial_Tea_3, Matetial_Tea_4, Matetial_Tea_5, Matetial_Tea_6

}
public enum OutMaterialPosion
{
OutMaterial_1, OutMaterial_2, OutMaterial_3, OutMaterial_4, OutMaterial_5, OutMaterial_6, OutMaterial_7, OutMaterial_8, OutMaterial_9, OutMaterial_10
}

public class PolymerBatching
{
public static void GetMaterialInfo()
{
Array arrayPosion = Enum.GetValues(typeof(MaterialPosion));
Array arrayOutPosion = Enum.GetValues(typeof(OutMaterialPosion));
for (int i = 0; i < arrayPosion.Length; i++)
{
int j = (int)Math.Ceiling((double)(i + 1) / 3) - 1;
GoodsMaterialPosion.Add((MaterialPosion)arrayPosion.GetValue(i), (OutMaterialPosion)arrayOutPosion.GetValue(j));

}
}

public static Dictionary<MaterialPosion, OutMaterialPosion> GoodsMaterialPosion = new Dictionary<MaterialPosion, OutMaterialPosion>();
}
}

+ 40
- 0
BPASmartClient.MorkTM/ViewModel/DebugViewModel.cs View File

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

namespace BPASmartClient.MorkTM.ViewModel
{
public class DebugViewModel : ObservableObject
{
/// <summary>
/// 出料口集合
/// </summary>
public List<string> Materials { get; set; } = new List<string>();

/// <summary>
/// 奶茶
/// </summary>
public ObservableCollection<string> TeaWithMilkType { get; set; }
/// <summary>
/// 出料
/// </summary>
public RelayCommand OutMaterials { get; set; }
/// <summary>
/// 转盘转动
/// </summary>
public RelayCommand TurnOn { get; set; }
public float MaertialsWight { get { return _maertialsWight; } set { _maertialsWight = value; OnPropertyChanged(); } }
private float _maertialsWight = 10;
public DebugViewModel()
{

}
}
}

+ 9
- 4
BPASmartClient/App.config View File

@@ -6,15 +6,20 @@
<!--<add key="ClientId" value="43"/>-->
<add key="IsEnableTest" value="false"/>

<!--测试环境-->
<add key="apollouri" value="http://10.2.1.21:28080/"/>
<add key="AppId" value="test1_HostComputer"/>
<add key ="Namespaces" value="DEV.test1.Config"/>

<!--开发环境-->
<!--add key="apollouri" value="http://10.2.1.21:28080/"/>
<!--<add key="apollouri" value="http://10.2.1.21:28080/"/>
<add key="AppId" value="dev1_common"/>
<add key ="Namespaces" value="DEV.Config"/>-->

<!--正式环境-->
<add key="apollouri" value="http://47.108.65.220:28080/"/>
<add key="AppId" value="order"/>
<add key ="Namespaces" value="TEST1.Config"/>
<!--<add key="apollouri" value="http://47.108.65.220:28080/"/>
<add key="AppId" value="HostComputer"/>
<add key ="Namespaces" value="TEST1.Config"/>-->

<!--阿里云上报启动方式:API 或者 LOCAL-->
<!--API :通过客户端ID,调用接口查询“设备连接信息”-->


+ 2
- 2
BPASmartClient/Control/ShopDeviceConfigView.xaml View File

@@ -389,7 +389,7 @@
Foreground="{StaticResource TextBlockForeground}"
IcoText="&#xe626;"
MouseLeftButtonDown="IcoButton_MouseLeftButtonDown"
Style="{StaticResource NewButtonStyle}" />
Style="{StaticResource IcoButtonStyle}" />

<pry:IcoButton
Grid.Column="5"
@@ -400,7 +400,7 @@
FontSize="16"
Foreground="{StaticResource TextBlockForeground}"
IcoText="&#xe626;"
Style="{StaticResource NewButtonStyle}" />
Style="{StaticResource IcoButtonStyle}" />

</Grid>



+ 1
- 1
BPASmartClient/MainWindow.xaml View File

@@ -55,7 +55,7 @@
<StackPanel
x:Name="myPanel"
Orientation="Horizontal"
Visibility="Collapsed">
Visibility="Hidden">
<Button
Width="120"
Height="40"


+ 10
- 8
DosingSystem/App.xaml.cs View File

@@ -20,6 +20,7 @@ namespace BPASmartClient.DosingSystem
/// </summary>
public partial class App : Application
{
public static Window MainWindow;
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
@@ -27,13 +28,14 @@ namespace BPASmartClient.DosingSystem
DataInit();

MainView mv = new MainView();
LoginView lv = new LoginView();
var res = lv.ShowDialog();
if (res != null && res == true)
mv.Show();
else
mv.Close();

mv.Show();
//LoginView lv = new LoginView();
//var res = lv.ShowDialog();
//if (res != null && res == true)
// mv.Show();
//else
// mv.Close();
MainWindow = mv;
}

protected override void OnExit(ExitEventArgs e)
@@ -59,7 +61,7 @@ namespace BPASmartClient.DosingSystem
RecipeManage.Add(new SubMenumodel()
{
SubMenuName = "配方下发",
SubMenuPermission = new Permission[] { Permission.操作员 },
SubMenuPermission = new Permission[] { Permission.操作员, Permission.管理员 },
AssemblyName = "BPASmartClient.DosingSystem",
ToggleWindowPath = "View.RecipeControlView"
});


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

@@ -5,9 +5,10 @@
<TargetFramework>net6.0-windows</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationManifest></ApplicationManifest>
<ApplicationIcon>hbl.ico</ApplicationIcon>
<PlatformTarget>AnyCPU</PlatformTarget>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
</PropertyGroup>

<ItemGroup>


+ 27
- 0
DosingSystem/Model/DeviceCurrentStatus.cs View File

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

namespace BPASmartClient.DosingSystem.Model
{
public class DeviceCurrentStatus : ObservableObject
{

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


public bool RunStatus { get { return _mRunStatus; } set { _mRunStatus = value; OnPropertyChanged(); } }
private bool _mRunStatus;


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



}
}

+ 8
- 0
DosingSystem/View/DeviceListView.xaml View File

@@ -46,6 +46,14 @@

<Grid>

<!--<pry:Bottle
Width="80"
Height="500"
CurrentValue="50" />-->

<pry:MotorBottle IsRun="True" CurrentValue="100"/>


<Grid>
<ListView
Grid.Column="1"


+ 294
- 7
DosingSystem/View/HardwareStatusView.xaml View File

@@ -8,8 +8,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
d:DesignHeight="1080"
d:DesignWidth="1920"
mc:Ignorable="d">

<UserControl.DataContext>
@@ -17,11 +17,298 @@
</UserControl.DataContext>

<Grid>
<TextBlock
HorizontalAlignment="Center"



<!--#region 测试-->
<ListView
Height="150"
VerticalAlignment="Center"
FontSize="40"
Foreground="Wheat"
Text="硬件状态" />
Background="Transparent"
BorderThickness="0"
ItemsSource="{Binding TopDeviceCurrentStatuses}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid
HorizontalAlignment="Center"
VerticalAlignment="Center"
Columns="10" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>

<ListView.ItemTemplate>
<DataTemplate>
<Border Background="Transparent">
<Grid Height="100">
<pry:MotorBottle
Height="100"
CurrentValue="{Binding Weight}"
IsRun="{Binding RunStatus}"
RenderTransformOrigin="0.5,0.5">
<pry:MotorBottle.RenderTransform>
<TransformGroup>
<RotateTransform Angle="90" />
</TransformGroup>
</pry:MotorBottle.RenderTransform>
</pry:MotorBottle>
</Grid>
</Border>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
<!--#endregion-->








<UniformGrid Columns="10" Visibility="Collapsed">

<pry:MotorBottle
Width="150"
Height="100"
CurrentValue="66"
IsRun="True"
RenderTransformOrigin="0.5,0.5">
<pry:MotorBottle.RenderTransform>
<TransformGroup>
<RotateTransform Angle="90" />
</TransformGroup>
</pry:MotorBottle.RenderTransform>
</pry:MotorBottle>

<pry:MotorBottle
Width="150"
Height="100"
CurrentValue="40"
IsRun="True"
RenderTransformOrigin="0.5,0.5">
<pry:MotorBottle.RenderTransform>
<TransformGroup>
<RotateTransform Angle="90" />
</TransformGroup>
</pry:MotorBottle.RenderTransform>
</pry:MotorBottle>

<pry:MotorBottle
Width="150"
Height="100"
CurrentValue="88"
IsRun="True"
RenderTransformOrigin="0.5,0.5">
<pry:MotorBottle.RenderTransform>
<TransformGroup>
<RotateTransform Angle="90" />
</TransformGroup>
</pry:MotorBottle.RenderTransform>
</pry:MotorBottle>

<pry:MotorBottle
Width="150"
Height="100"
CurrentValue="25"
IsRun="True"
RenderTransformOrigin="0.5,0.5">
<pry:MotorBottle.RenderTransform>
<TransformGroup>
<RotateTransform Angle="90" />
</TransformGroup>
</pry:MotorBottle.RenderTransform>
</pry:MotorBottle>

<pry:MotorBottle
Width="150"
Height="100"
CurrentValue="97"
IsRun="True"
RenderTransformOrigin="0.5,0.5">
<pry:MotorBottle.RenderTransform>
<TransformGroup>
<RotateTransform Angle="90" />
</TransformGroup>
</pry:MotorBottle.RenderTransform>
</pry:MotorBottle>

<pry:MotorBottle
Width="150"
Height="100"
CurrentValue="10"
IsRun="True"
RenderTransformOrigin="0.5,0.5">
<pry:MotorBottle.RenderTransform>
<TransformGroup>
<RotateTransform Angle="90" />
</TransformGroup>
</pry:MotorBottle.RenderTransform>
</pry:MotorBottle>

<pry:MotorBottle
Width="150"
Height="100"
CurrentValue="60"
IsRun="True"
RenderTransformOrigin="0.5,0.5">
<pry:MotorBottle.RenderTransform>
<TransformGroup>
<RotateTransform Angle="90" />
</TransformGroup>
</pry:MotorBottle.RenderTransform>
</pry:MotorBottle>

<pry:MotorBottle
Width="150"
Height="100"
CurrentValue="96"
IsRun="True"
RenderTransformOrigin="0.5,0.5">
<pry:MotorBottle.RenderTransform>
<TransformGroup>
<RotateTransform Angle="90" />
</TransformGroup>
</pry:MotorBottle.RenderTransform>
</pry:MotorBottle>

</UniformGrid>

<Grid x:Name="gr" Grid.Row="1">

<pry:ConveyorBelt
Grid.Row="1"
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
Margin="0,0,400,0"
ConveyorBeltWidth="70"
Direction="0"
StrokeBrush="Red"
StrokeDashArray="1.5 1.5"
StrokeFillBrush="Red"
StrokeThickness="2" />
</Grid>

<UniformGrid Grid.Row="2" Columns="10">

<pry:MotorBottle
Width="150"
Height="100"
CurrentValue="89"
IsRun="True"
RenderTransformOrigin="0.5,0.5">
<pry:MotorBottle.RenderTransform>
<TransformGroup>
<RotateTransform Angle="270" />
<ScaleTransform ScaleX="-1" />
</TransformGroup>
</pry:MotorBottle.RenderTransform>
</pry:MotorBottle>

<pry:MotorBottle
Width="150"
Height="100"
CurrentValue="13"
IsRun="True"
RenderTransformOrigin="0.5,0.5">
<pry:MotorBottle.RenderTransform>
<TransformGroup>
<RotateTransform Angle="270" />
<ScaleTransform ScaleX="-1" />
</TransformGroup>
</pry:MotorBottle.RenderTransform>
</pry:MotorBottle>

<pry:MotorBottle
Width="150"
Height="100"
CurrentValue="31"
IsRun="True"
RenderTransformOrigin="0.5,0.5">
<pry:MotorBottle.RenderTransform>
<TransformGroup>
<RotateTransform Angle="270" />
<ScaleTransform ScaleX="-1" />
</TransformGroup>
</pry:MotorBottle.RenderTransform>
</pry:MotorBottle>

<pry:MotorBottle
Width="150"
Height="100"
CurrentValue="96"
IsRun="True"
RenderTransformOrigin="0.5,0.5">
<pry:MotorBottle.RenderTransform>
<TransformGroup>
<RotateTransform Angle="270" />
<ScaleTransform ScaleX="-1" />
</TransformGroup>
</pry:MotorBottle.RenderTransform>
</pry:MotorBottle>

<pry:MotorBottle
Width="150"
Height="100"
CurrentValue="80"
IsRun="True"
RenderTransformOrigin="0.5,0.5">
<pry:MotorBottle.RenderTransform>
<TransformGroup>
<RotateTransform Angle="270" />
<ScaleTransform ScaleX="-1" />
</TransformGroup>
</pry:MotorBottle.RenderTransform>
</pry:MotorBottle>

<pry:MotorBottle
Width="150"
Height="100"
CurrentValue="26"
IsRun="True"
RenderTransformOrigin="0.5,0.5">
<pry:MotorBottle.RenderTransform>
<TransformGroup>
<RotateTransform Angle="270" />
<ScaleTransform ScaleX="-1" />
</TransformGroup>
</pry:MotorBottle.RenderTransform>
</pry:MotorBottle>

<pry:MotorBottle
Width="150"
Height="100"
CurrentValue="20"
IsRun="True"
RenderTransformOrigin="0.5,0.5">
<pry:MotorBottle.RenderTransform>
<TransformGroup>
<RotateTransform Angle="270" />
<ScaleTransform ScaleX="-1" />
</TransformGroup>
</pry:MotorBottle.RenderTransform>
</pry:MotorBottle>

<pry:MotorBottle
Width="150"
Height="100"
CurrentValue="100"
IsRun="True"
RenderTransformOrigin="0.5,0.5">
<pry:MotorBottle.RenderTransform>
<TransformGroup>
<RotateTransform Angle="270" />
<ScaleTransform ScaleX="-1" />
</TransformGroup>
</pry:MotorBottle.RenderTransform>
</pry:MotorBottle>

</UniformGrid>

<Grid.RowDefinitions>
<RowDefinition Height="0.5*" />
<RowDefinition />
<RowDefinition Height="0.5*" />
</Grid.RowDefinitions>
</Grid>
</UserControl>

+ 4
- 2
DosingSystem/View/NewRecipeView.xaml View File

@@ -116,7 +116,8 @@
Height="30"
Margin="0,0,7,0"
Command="{Binding AddCommand}"
Content="添加原料" Cursor="Hand" />
Content="添加原料"
Cursor="Hand" />

<Button
Width="80"
@@ -193,7 +194,8 @@
Margin="0,0,8,4"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Text="mg" />
FontSize="20"
Text="g" />

</StackPanel>



+ 81
- 7
DosingSystem/View/RecipeControlView.xaml View File

@@ -44,13 +44,86 @@
</Style>
</UserControl.Resources>

<Grid>
<Grid Margin="20">

<ScrollViewer HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding Recipes}">
<ScrollViewer >

<ListView
Margin="5"
VerticalAlignment="Top"
Background="Transparent"
BorderThickness="0"
ItemsSource="{Binding Recipes}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="8" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>

<ListView.ItemTemplate>
<DataTemplate>
<Border Margin="5" Background="LightSkyBlue">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="0.25*" />
<RowDefinition Height="0.2*" />
</Grid.RowDefinitions>

<Image Source="/BPASmartClient.CustomResource;component/Image/AGV/炒锅.png" />

<TextBlock
Grid.Row="1"
Margin="2,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#dd000000"
Text="{Binding RecipeName}" />

<Grid
Name="gr"
Grid.Row="2"
Background="#00BEFA"
Height="30">

<pry:IcoButton
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
BorderThickness="0"
Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding RecipCode}"
Content="订单下发"
EnterBackground="Red"
FontStyle="Normal"
Foreground="#dd000000"
IcoText="&#xe6cf;"
IsEnabled="{Binding IsEnable}"
Style="{StaticResource IcoButtonStyle}" />


</Grid>

</Grid>
</Border>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>



<!--<ItemsControl ItemsSource="{Binding Recipes}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid Height="150" VerticalAlignment="Top">
<Grid
Height="150"
Margin="0,0,0,50"
VerticalAlignment="Top">
<Border
Name="ShadowElement"
Height="150"
@@ -68,9 +141,9 @@
</Border>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="200" />
<ColumnDefinition />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>

<Grid Margin="20,0,0,0">
@@ -87,6 +160,7 @@
Width="80"
Height="30"
HorizontalAlignment="Left"
Background="#00BEFA"
Command="{Binding DataContext.StartCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
CommandParameter="{Binding RecipeName}"
Content="配方下发"
@@ -182,7 +256,7 @@
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ItemsControl>-->
</ScrollViewer>
</Grid>
</UserControl>

+ 161
- 7
DosingSystem/View/RecipeSettingsView.xaml View File

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

<Style x:Key="TextBlockStyle" TargetType="TextBlock">
<Setter Property="FontFamily" Value="楷体" />
<Setter Property="FontSize" Value="16" />
<Setter Property="FontSize" Value="20" />
<Setter Property="Background" Value="Transparent" />
<!--<Setter Property="Foreground" Value="{StaticResource FontColor}" />-->
<Setter Property="VerticalAlignment" Value="Center" />
@@ -62,7 +62,7 @@
FontSize="16"
Foreground="Aqua"
IcoText="&#xe626;"
Style="{StaticResource NewButtonStyle}" />
Style="{StaticResource IcoButtonStyle}" />

<pry:IcoButton
Grid.Column="3"
@@ -71,12 +71,11 @@
HorizontalAlignment="Left"
Command="{Binding SaveRecipe}"
Content="保存配方"
EnableColor="#FFB7B7B7"
FontSize="17"
Foreground="Aqua"
IcoText="&#xe936;"
IsEnabled="True"
Style="{StaticResource NewButtonStyle}" />
Style="{StaticResource IcoButtonStyle}" />
</StackPanel>
<!--#endregion-->

@@ -149,9 +148,162 @@
</Grid>-->
<!--#endregion-->

<ScrollViewer Grid.Row="2">
<ListView
Margin="5"
VerticalAlignment="Top"
Background="Transparent"
BorderThickness="0"
ItemsSource="{Binding Recipes}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled">
<ListView.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid
HorizontalAlignment="Left"
VerticalAlignment="Top"
Columns="8" />
</ItemsPanelTemplate>
</ListView.ItemsPanel>

<ListView.ItemTemplate>
<DataTemplate>
<Border Margin="5" Background="LightSkyBlue">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="0.25*" />
<RowDefinition Height="0.2*" />
</Grid.RowDefinitions>

<Image Source="/BPASmartClient.CustomResource;component/Image/AGV/炒锅.png" />

<TextBlock
Grid.Row="1"
Margin="2,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#dd000000"
Text="{Binding RecipeName}" />

<Grid
Name="gr"
Grid.Row="2"
Height="30">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<pry:IcoButton
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
BorderThickness="0"
Command="{Binding DataContext.RemoveCommand, RelativeSource={RelativeSource AncestorType=ListView, Mode=FindAncestor}}"
CommandParameter="{Binding RecipCode}"
Content="删除"
EnterBackground="Red"
FontStyle="Normal"
Foreground="#dd000000"
IcoText="&#xe68e;"
Style="{StaticResource IcoButtonStyle}" />

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

</Grid>

</Grid>
</Border>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</ScrollViewer>



<!--<UniformGrid
Grid.Row="2"
Height="200"
VerticalAlignment="Top"
Columns="10">
<Border
Margin="10"
Background="LightSkyBlue"
BorderThickness="1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="0.25*" />
<RowDefinition Height="0.2*" />
</Grid.RowDefinitions>

<Image Source="/BPASmartClient.CustomResource;component/Image/AGV/炒锅.png" />

<TextBlock
Grid.Row="1"
Margin="2,0,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Foreground="#dd000000"
Text="配方名称" />

<Grid Name="gr" Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>

<pry:IcoButton
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
BorderThickness="0"
Content="删除"
EnterBackground="Red"
FontStyle="Normal"
Foreground="#dd000000"
IcoText="&#xe68e;"
Style="{StaticResource IcoButtonStyle}" />

<pry:IcoButton
Grid.Column="1"
Width="{Binding ElementName=gr, Path=ActualWidth}"
Height="{Binding ElementName=gr, Path=ActualHeight}"
HorizontalAlignment="Center"
VerticalAlignment="Center"
BorderThickness="0"
Content="编辑"
EnterBackground="#FF2AB2E7"
Foreground="#dd000000"
IcoText="&#xe68e;"
Style="{StaticResource IcoButtonStyle}" />

</Grid>

</Grid>
</Border>
</UniformGrid>-->


<!--#region 表格数据显示-->
<ScrollViewer
<!--<ScrollViewer
Grid.Row="2"
Visibility="Collapsed"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding Recipes}">
@@ -194,7 +346,8 @@
Style="{StaticResource TextBlockStyle}"
Text="{Binding RecipCode}" />

<!--<Grid Grid.Column="3">
-->
<!--<Grid Grid.Column="3">

<Button
Command="{Binding DataContext.EditCommand, RelativeSource={RelativeSource AncestorType=ItemsControl, Mode=FindAncestor}}"
@@ -202,6 +355,7 @@
Content="编辑"
Style="{StaticResource buttonStyle}" />
</Grid>-->
<!--


<Grid Grid.Column="5">
@@ -240,7 +394,7 @@
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
</ScrollViewer>-->
<!--#endregion-->
</Grid>
</UserControl>

+ 20
- 0
DosingSystem/View/RecipeSettingsView.xaml.cs View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@@ -23,6 +24,25 @@ namespace BPASmartClient.DosingSystem.View
public RecipeSettingsView()
{
InitializeComponent();
//SetAlignment();
}

//public static void SetAlignment()
//{
// //获取系统是以Left-handed(true)还是Right-handed(false)
// var ifLeft = SystemParameters.MenuDropAlignment;

// if (ifLeft)
// {
// Console.WriteLine($"系统为左撇子,转换为右撇子。");

// // change to false
// var t = typeof(SystemParameters);
// var field = t.GetField("_menuDropAlignment", BindingFlags.NonPublic | BindingFlags.Static);
// field.SetValue(null, false);

// ifLeft = SystemParameters.MenuDropAlignment;
// }
//}
}
}

+ 16
- 0
DosingSystem/ViewModel/HardwareStatusViewModel.cs View File

@@ -9,10 +9,26 @@ using System.Collections.ObjectModel;
using System.Windows;
using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.DosingSystem.Model;

namespace BPASmartClient.DosingSystem.ViewModel
{
public class HardwareStatusViewModel : ObservableObject
{
public HardwareStatusViewModel()
{
for (int i = 0; i < 8; i++)
{
TopDeviceCurrentStatuses.Add(new DeviceCurrentStatus()
{
DeviceName = i.ToString(),
RunStatus = false,
Weight = new Random().Next(0, 100)
});
}
}

public ObservableCollection<DeviceCurrentStatus> TopDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>();
public ObservableCollection<DeviceCurrentStatus> BottomDeviceCurrentStatuses { get; set; } = new ObservableCollection<DeviceCurrentStatus>();
}
}

+ 16
- 0
DosingSystem/ViewModel/NewRecipeViewModel.cs View File

@@ -108,6 +108,22 @@ namespace BPASmartClient.DosingSystem.ViewModel
static NewRecipeViewModel()
{
RawMaterialNames.Clear();
//RawMaterialNames.Add("乳化剂");
//RawMaterialNames.Add("酶制剂");
//RawMaterialNames.Add("增味剂");
RawMaterialNames.Add("营养强化剂");
//RawMaterialNames.Add("抗结剂");
//RawMaterialNames.Add("消泡剂");
//RawMaterialNames.Add("膨松剂");
//RawMaterialNames.Add("防腐剂");
//RawMaterialNames.Add("着色剂");
RawMaterialNames.Add("甜味剂");
//RawMaterialNames.Add("酸味剂");
//RawMaterialNames.Add("增白剂");
//RawMaterialNames.Add("香料");
RawMaterialNames.Add("抗氧化剂");
RawMaterialNames.Add("食用香料");
//RawMaterialNames.Add("增稠剂");
}

private string RecipCode = string.Empty;


+ 3
- 1
DosingSystem/ViewModel/RecipeControlViewModel.cs View File

@@ -12,6 +12,8 @@ using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.DosingSystem.Model;
using System.Threading;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.CustomResource.UserControls;

namespace BPASmartClient.DosingSystem.ViewModel
{
@@ -34,7 +36,7 @@ namespace BPASmartClient.DosingSystem.ViewModel
// MessageLog.GetInstance.ShowUserLog($"下发工单 { Recipes.ElementAt(index).RecipeName}");
// devices.Enqueue(deviceName);
//}
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方下发成功!");
MessageLog.GetInstance.ShowUserLog($"下发工单 { Guid.NewGuid().ToString()}");
});



+ 13
- 4
DosingSystem/ViewModel/RecipeSettingsViewModel.cs View File

@@ -11,6 +11,11 @@ using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.Input;
using BPASmartClient.DosingSystem.Model;
using BPASmartClient.DosingSystem.View;
using BPASmartClient.CustomResource.UserControls;
using BPASmartClient.CustomResource.UserControls.Model;
using BPASmartClient.CustomResource.UserControls.Enum;
using System.Windows.Media;
using BPASmartClient.CustomResource.UserControls.MessageShow;

namespace BPASmartClient.DosingSystem.ViewModel
{
@@ -20,12 +25,16 @@ namespace BPASmartClient.DosingSystem.ViewModel
{
//Json<LocaPar>.Read();
Recipes = Json<LocaPar>.Data.Recipes;
NewRecipe = new Action(() =>
NewRecipe = new RelayCommand(() =>
{
NewRecipeView nrv = new NewRecipeView();
nrv.ShowDialog();
});
SaveRecipe = new Action(() => { Json<LocaPar>.Save(); });
SaveRecipe = new RelayCommand(() =>
{
Json<LocaPar>.Save();
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, App.MainWindow, "提示", $"配方保存成功!");
});
RemoveCommand = new RelayCommand<object>((o) =>
{
if (o is string str)
@@ -48,9 +57,9 @@ namespace BPASmartClient.DosingSystem.ViewModel
});
}

public Action NewRecipe { get; set; }
public RelayCommand NewRecipe { get; set; }

public Action SaveRecipe { get; set; }
public RelayCommand SaveRecipe { get; set; }

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



+ 0
- 79
DosingSystem/app.manifest View File

@@ -1,79 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC 清单选项
如果想要更改 Windows 用户帐户控制级别,请使用
以下节点之一替换 requestedExecutionLevel 节点。

<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />

指定 requestedExecutionLevel 元素将禁用文件和注册表虚拟化。
如果你的应用程序需要此虚拟化来实现向后兼容性,则移除此
元素。
-->
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- 设计此应用程序与其一起工作且已针对此应用程序进行测试的
Windows 版本的列表。取消评论适当的元素,
Windows 将自动选择最兼容的环境。 -->

<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->

<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->

<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->

<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->

<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->

</application>
</compatibility>

<!-- 指示该应用程序可感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI,无需
选择加入。选择加入此设置的 Windows 窗体应用程序(面向 .NET Framework 4.6)还应
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。
将应用程序设为感知长路径。请参阅 https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
<longPathAware xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">true</longPathAware>
</windowsSettings>
</application>
-->

<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->

</assembly>

+ 75
- 0
FryPot_DosingSystem/AGV/WhichCart.cs View File

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

namespace FryPot_DosingSystem.AGV
{
/// <summary>
/// 控制车辆型号
/// </summary>
public enum WhichCart
{
一号车,
二号车,
三号车,
四号车,
}
/// <summary>
/// 控制车辆运动方式
/// </summary>
public enum CartMotionTrajectory
{
Stop,//停止

qc_1,//取菜品 1号流水线取菜
qc_2,//取菜品 2号流水线取菜
qc_3,//取菜品 3号流水线取菜

yc_1_1,//运输菜品 1号流水线-1号炒锅
yc_1_2,//运输菜品 1号流水线-2号炒锅
yc_1_3,//运输菜品 1号流水线-3号炒锅
yc_1_4,//运输菜品 1号流水线-4号炒锅
yc_1_5,//运输菜品 1号流水线-5号炒锅

yc_2_1,//运输菜品 2号流水线-1号炒锅
yc_2_2,//运输菜品 2号流水线-2号炒锅
yc_2_3,//运输菜品 2号流水线-3号炒锅
yc_2_4,//运输菜品 2号流水线-4号炒锅
yc_2_5,//运输菜品 2号流水线-5号炒锅

yc_3_1,//运输菜品 3号流水线-1号炒锅
yc_3_2,//运输菜品 3号流水线-2号炒锅
yc_3_3,//运输菜品 3号流水线-3号炒锅
yc_3_4,//运输菜品 3号流水线-4号炒锅
yc_3_5,//运输菜品 3号流水线-5号炒锅

hs_1,//1号炒锅-运输空碗到-空碗流水线
hs_2,//2号炒锅-运输空碗到-空碗流水线
hs_3,//3号炒锅-运输空碗到-空碗流水线
hs_4,//4号炒锅-运输空碗到-空碗流水线
hs_5,//5号炒锅-运输空碗到-空碗流水线

hj,//空碗流水线-回到充电桩或者停车桩
}

/// <summary>
/// 是否
/// </summary>
public enum IsBool
{
Yes,
No,
OnllYes
}
/// <summary>
/// 是否运行
/// </summary>
public enum IsRun
{
Start,
Stop
}
}

+ 31
- 11
FryPot_DosingSystem/App.xaml.cs View File

@@ -15,6 +15,7 @@ using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using AlarmInfo = BPASmartClient.CustomResource.Pages.Model.AlarmInfo;

namespace FryPot_DosingSystem
{
@@ -37,23 +38,25 @@ namespace FryPot_DosingSystem
mv.Show();
DeviceOperate deviceOperate = DeviceOperate.GetInstance;//开启实时PLC数据读取
DosingLogicControl logigControl = DosingLogicControl.GetInstance;//开启逻辑控制任务程序
HubHelper.GetInstance.Connect("192.168.1.14", 8089);
AlarmHelper<AlarmInfo>.Init();
}
else
mv.Close();


HubHelper.GetInstance.Report = new Action<object>((o) =>
{
var res = JsonConvert.DeserializeObject<AGVToUpSystem>(o.ToString());
});
//HubHelper.GetInstance.Report = new Action<object>((o) =>
//{
// var res = JsonConvert.DeserializeObject<AGVToUpSystem>(o.ToString());
//});

HubHelper.GetInstance.Upstreamrequest = new Action<object>((o) =>
{
var res = JsonConvert.DeserializeObject<Upstreamrequest>(o.ToString());
});

HubHelper.GetInstance.Connect("192.168.1.99", 8089);
//HubHelper.GetInstance.Upstreamrequest = new Action<object>((o) =>
//{
// var res = JsonConvert.DeserializeObject<Upstreamrequest>(o.ToString());
//});
//本地服务连接

}
protected override void OnExit(ExitEventArgs e)
{
@@ -171,7 +174,7 @@ namespace FryPot_DosingSystem
SubMenuName = "用户登录",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.技术员 },
AssemblyName = "BPASmartClient.CustomResource",
ToggleWindowPath = "Pages.View.LoginView"
ToggleWindowPath = "Pages.View.SubPagLoginView"
});

UserManager.Add(new SubMenumodel()
@@ -192,6 +195,23 @@ namespace FryPot_DosingSystem
subMenumodels = UserManager,
});
#endregion
ObservableCollection<SubMenumodel> DebugManage = new ObservableCollection<SubMenumodel>();
DebugManage.Add(new SubMenumodel()
{
SubMenuName = "单一流程调试",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
AssemblyName = "FryPot_DosingSystem",
ToggleWindowPath = "View.DebugView"
});
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
MainMenuIcon = "&#xe683;",
MainMenuName = "调试界面",
Alias = "Debug Management",
MainMenuPermission = new Permission[] { Permission.管理员, Permission.技术员 },
subMenumodels = DebugManage,
});

}
private void LoginDataInite()
{


+ 7
- 4
FryPot_DosingSystem/Control/DeviceOperate.cs View File

@@ -20,7 +20,7 @@ namespace FryPot_DosingSystem.Control
ModbusTcp modbus = new ModbusTcp();
private string Ip { get; set; }
private string Port { get; set; }
private bool Connected { get; set; }
public bool Connected { get; set; }

private string DeviceName { get; set; }

@@ -78,7 +78,7 @@ namespace FryPot_DosingSystem.Control
{
foreach (var item in Variables)
{
var res = modbus.Read(item.Address, item.Length, "180项目");
var res = modbus.Read(item.Address, item.Length);
if (Data.ContainsKey(item.Address))
{
Data[item.Address] = res;
@@ -95,8 +95,11 @@ namespace FryPot_DosingSystem.Control
}),$"设备【{DeviceName}】PLC实时数据读取线程");
}
public void WritePlcData(string address,ushort value)
{
modbus.Write(address, value,"180项目");
{
lock (this)
{
modbus.Write(address, value);
}
}
public ConcurrentDictionary<string, object> GetAllData()
{


+ 1703
- 319
FryPot_DosingSystem/Control/DosingLogicControl.cs
File diff suppressed because it is too large
View File


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

@@ -11,6 +11,8 @@ namespace FryPot_DosingSystem.Control
/// </summary>
internal class GlobalVariable
{
/// <summary>
/// 滚筒线1
/// </summary>
@@ -61,19 +63,115 @@ namespace FryPot_DosingSystem.Control
/// </summary>
public bool ExitMainTask { get; set; }
/// <summary>
/// 允许AGV去线体装桶条件
/// 允许AGV去线体1装桶条件
/// </summary>
public bool AllowAgvToLineLoadRoller { get; set; } = true;
/// <summary>
/// 允许AGV去线体2装桶条件
/// </summary>
public bool AllowAgvToLineTwoLoadRoller { get; set; } = true;
/// <summary>
/// 允许AGV去线体3装桶条件
/// </summary>
public bool AllowAgvToLineThreeLoadRoller { get; set; } = true;
/// <summary>
/// 配方唯一ID
/// </summary>
public string RecipeId { get; set; }
/// <summary>
/// 进桶出桶互锁
/// 线体1对应的进桶出桶互锁
/// </summary>
public bool InOrOutputLock { get; set; }
/// <summary>
/// 线体2对应的进桶出桶互锁
/// </summary>
public bool LTwoInOrOutputLock { get; set; }
/// <summary>
/// 线体3对应的进桶出桶互锁
/// </summary>
public bool LThreeInOrOutputLock { get; set; }
/// <summary>
/// 线体1任务执行锁
/// </summary>
public bool LOneTaskLock { get; set; }
/// <summary>
/// 线体2任务执行锁
/// </summary>
public bool LTwoTaskLock { get; set; }
/// <summary>
/// 线体3任务执行锁
/// </summary>
public bool LThreeTaskLock { get; set; }
/// <summary>
/// 线体1当前正在制作的配方名称
/// </summary>
public string LOneCurrentRecipeName { get; set; } = string.Empty;
/// <summary>
/// 线体2当前正在制作的配方名称
/// </summary>
public string LTwoCurrentRecipeName { get; set; } = string.Empty;
/// <summary>
/// 线体3当前正在制作的配方名称
/// </summary>
public string LThreeCurrentRecipeName { get; set; } = string.Empty;
#endregion
#region 线体1流程互锁变量

public bool LoadRoller { get; set; }

public bool AgvToFryPot { get; set; }

public bool PotOneInputMaterialArrive { get; set; }
public bool PotOneOutputRollerArrive { get; set; }
public bool AgvArrivePot { get; set; }
#endregion
#region 线体2流程互锁变量

public bool LTwoLoadRoller { get; set; }

public bool LTwoAgvToFryPot { get; set; }

public bool LTwoPotInputMaterialArrive { get; set; }
public bool LTwoPotOutputRollerArrive { get; set; }
public bool LTwoAgvArrivePot { get; set; }
#endregion
#region 线体3流程互锁变量

public bool LThreeLoadRoller { get; set; }

public bool LThreeAgvToFryPot { get; set; }

public bool LThreePotInputMaterialArrive { get; set; }
public bool LThreePotOutputRollerArrive { get; set; }
public bool LThreeAgvArrivePot { get; set; }
#endregion
#region AGV视图显示变量
public int LOneMaterialNum = 0;
public int LOneFryPotSerial = 1;
public int LOneCurrentCookingStep = 0;
public bool agvArriveUpLoad;
public bool agvArriveUnLoad;
public bool agvFryPotEmptyRollerArrive;
public bool EmptyRollerUnLoadcCom { get; set; }//AGV空桶4号线体下料完成

public int LTwoMaterialNum = 0;
public int LTwoFryPotSerial = 2;
public int LTwoCurrentCookingStep = 0;
public bool agvArriveLTwoUpLoad;
public bool LTwoagvArriveUnLoad;
public bool LTwoagvFryPotEmptyRollerArrive;
public bool LTwoEmptyRollerUnLoadcCom { get; set; }//AGV空桶4号线体下料完成

public int LThreeMaterialNum = 0;
public int LThreeFryPotSerial = 3;
public int LThreeCurrentCookingStep = 0;
public bool agvArriveLThreeUpLoad;
public bool LThreeagvArriveUnLoad;
public bool LThreeagvFryPotEmptyRollerArrive;
public bool LThreeEmptyRollerUnLoadcCom { get; set; }//AGV空桶4号线体下料完成

public int LFourRollerNum = 0;
#endregion
}
/// <summary>
/// 滚筒线1相关变量


+ 17
- 0
FryPot_DosingSystem/Model/MaterialNames.cs View File

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

namespace FryPot_DosingSystem.Model
{
public class MaterialNames:ObservableObject
{
private static MaterialNames _instance;
public static MaterialNames GetInstance=>_instance ?? (_instance = new MaterialNames());
public ObservableCollection<string> Names { get; set; }=new ObservableCollection<string>();
}
}

+ 1
- 1
FryPot_DosingSystem/Model/RecipeModel.cs View File

@@ -25,7 +25,7 @@ namespace FryPot_DosingSystem.Model
/// 配方下发状况信息
/// </summary>
private string _recipeSetInfo;
public string RecipeSetInfo { get { return _recipeSetInfo; } set { _recipeSetInfo = value; OnPropertyChanged(); } }
public string RecipeSetInfo { get { return _recipeSetInfo; } set { _recipeSetInfo = value; OnPropertyChanged(); } }

public ObservableCollection<MaterialType> materialCollection { get; set; } = new ObservableCollection<MaterialType>();
}


+ 1350
- 127
FryPot_DosingSystem/View/AgvView.xaml
File diff suppressed because it is too large
View File


+ 162
- 32
FryPot_DosingSystem/View/AgvView.xaml.cs View File

@@ -1,4 +1,5 @@
using FryPot_DosingSystem.ViewModel;
using FryPot_DosingSystem.AGV;
using FryPot_DosingSystem.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -26,42 +27,171 @@ namespace FryPot_DosingSystem.View
{
InitializeComponent();
this.DataContext = AgvViewModel.GetInstance();
控制命令.ItemsSource = AgvViewModel.GetInstance().GetCommand();
}

private void Button_Click(object sender, RoutedEventArgs e)
{
AnimationByPath(yunshuche,qc_1);
}

/// <summary>
/// 路径动画
/// </summary>
/// <param name="cvs">画板</param>
/// <param name="path">路径</param>
/// <param name="target">动画对象</param>
/// <param name="duration">时间</param>
private void AnimationByPath(TextBox target, Path path, int duration = 5)
{
target.RenderTransformOrigin = new Point(0.5, 0.5);
int id = 1;
if (sender is Button)
{
byte[] data;
bool istrue = false;
Button button = sender as Button;
if (button.Tag != null)
{
switch (button.Tag.ToString())
{
case "设置有车":
try
{
id=int.Parse(tcz_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-5 的数字!");
return;
}
AgvViewModel.GetInstance().Set停车桩(id, IsBool.Yes);
break;
case "设置无车":
try
{
id = int.Parse(tcz_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-5 的数字!");
return;
}
AgvViewModel.GetInstance().Set停车桩(id, IsBool.No);
break;
case "启动":
try
{
id = int.Parse(liaotong_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set滚筒线状态(id, IsRun.Start);
break;
case "停止":
try
{
id = int.Parse(liaotong_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set滚筒线状态(id, IsRun.Stop);
break;
case "设置物料":
try
{
id = int.Parse(liaotongwuliao_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-8 的数字!");
return;
}
AgvViewModel.GetInstance().Set滚筒线上数量(id, liaotongwuliaoshuliang_text.Text);
break;
case "小车停止":
try
{
id = int.Parse(xiaoche_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set小车停止(id);
break;
case "运行小车":
try
{
id = int.Parse(xiaoche_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set小车运动(id, AgvViewModel.GetInstance().GetCommandValue(控制命令.Text));
break;
case "有菜和碗":
try
{
id = int.Parse(xiaochewuping_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set小车是否承载物品(id, IsBool.Yes);
break;
case "只有碗":
try
{
id = int.Parse(xiaochewuping_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set小车是否承载物品(id, IsBool.OnllYes);
break;
case "无物品":
try
{
id = int.Parse(xiaochewuping_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set小车是否承载物品(id, IsBool.No);
break;
case "启动炒锅":
try
{
id = int.Parse(guntongchaoguo_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set启动或停止炒锅(id, IsRun.Start);
break;
case "停止炒锅":
try
{
id = int.Parse(guntongchaoguo_text.Text.ToString());
}
catch (Exception ex)
{
MessageBox.Show("只能输入 1-4 的数字!");
return;
}
AgvViewModel.GetInstance().Set启动或停止炒锅(id, IsRun.Stop);
break;

MatrixTransform matrix = new MatrixTransform();
TransformGroup groups = new TransformGroup();
groups.Children.Add(matrix);
target.RenderTransform = groups;
string registname = "matrix" + Guid.NewGuid().ToString().Replace("-", "");
this.RegisterName(registname, matrix);
MatrixAnimationUsingPath matrixAnimation = new MatrixAnimationUsingPath();
matrixAnimation.PathGeometry = PathGeometry.CreateFromGeometry(Geometry.Parse(path.Data.ToString()));
matrixAnimation.Duration = new Duration(TimeSpan.FromSeconds(duration));
matrixAnimation.DoesRotateWithTangent = true;//跟随路径旋转
matrixAnimation.RepeatBehavior = RepeatBehavior.Forever;//循环
Storyboard story = new Storyboard();
story.Children.Add(matrixAnimation);
Storyboard.SetTargetName(matrixAnimation, registname);
Storyboard.SetTargetProperty(matrixAnimation, new PropertyPath(MatrixTransform.MatrixProperty));
}
}
}
}

story.FillBehavior = FillBehavior.Stop;
story.Begin(target, true);
}
}
}

+ 96
- 0
FryPot_DosingSystem/View/DebugView.xaml View File

@@ -0,0 +1,96 @@
<UserControl x:Class="FryPot_DosingSystem.View.DebugView"
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:FryPot_DosingSystem.View"
xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.DataContext>
<vm:DebugViewModel/>
</UserControl.DataContext>
<UserControl.Resources>
<Style x:Key="buttonStyle" TargetType="Button">
<Setter Property="Width" Value="100"></Setter>
<Setter Property="Height" Value="30"/>
<Setter Property="Background" Value="Transparent"></Setter>
<Setter Property="BorderThickness" Value="2"/>
<Setter Property="BorderBrush" Value="Orange"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Margin" Value="3,3"/>
<Setter Property="Foreground" Value="SkyBlue"/>
<Setter Property="FontSize" Value="13"/>
</Style>
</UserControl.Resources>

<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<UniformGrid Columns="2">
<GroupBox Grid.Column="1" Header="PLC信号" Foreground="Aqua" BorderBrush="Pink">
<WrapPanel Orientation="Horizontal">
<Button Content="滚筒线运行信号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding RollerLineRunning}"></Button>
<!--<Button Content="工位号8桶号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding EightWorkLoc}"></Button>-->
<ComboBox SelectionChanged="ComboBox_SelectionChanged" ItemsSource="{Binding LineOneRollerCode}" Background="Transparent" Width="100" Height="34" Margin="3,3"/>
<Button Content="炒锅进料就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotInputArrive}"/>
<Button Content="炒锅空桶就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotEmptyRollerArrive}"/>
</WrapPanel>
</GroupBox>
<GroupBox Grid.Column="2" Header="AGV信号" Foreground="Aqua">
<WrapPanel Orientation="Horizontal">
<Button Content="AGV线体1上料就位" Style="{StaticResource buttonStyle}" Width="120" Command="{Binding AGVLOneArrive}"/>
<Button Content="AGV炒锅下料就位" Style="{StaticResource buttonStyle}" RenderTransformOrigin="0.5,0.5" Width="114" Command="{Binding AGVFryPotDownArrive}">
</Button>
<Button Content="AGV炒锅空桶上料就位" Style="{StaticResource buttonStyle}" Width="139" Command="{Binding AGVFryPotUpArrive}"/>
<Button Content="AGV拿到空桶信号" Style="{StaticResource buttonStyle}" Width="114" Command="{Binding AGVFryPotGetEmptyRoller}"/>
</WrapPanel>
</GroupBox>
</UniformGrid>
<UniformGrid Columns="2" Grid.Row="1">
<GroupBox Grid.Column="1" Header="PLC信号" Foreground="Aqua" BorderBrush="Pink">
<WrapPanel Orientation="Horizontal">
<Button Content="滚筒线运行信号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding RollerLineTwoRunning}"></Button>
<!--<Button Content="工位号8桶号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding EightWorkLoc}"></Button>-->
<ComboBox SelectionChanged="ComboBox_SelectionChanged_1" ItemsSource="{Binding LineTwoRollerCode}" Background="Transparent" Width="100" Height="34" Margin="3,3"/>
<Button Content="炒锅进料就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotTwoInputArrive}"/>
<Button Content="炒锅空桶就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotTwoEmptyRollerArrive}"/>
</WrapPanel>
</GroupBox>
<GroupBox Grid.Column="2" Header="AGV信号" Foreground="Aqua">
<WrapPanel Orientation="Horizontal">
<Button Content="AGV线体2上料就位" Style="{StaticResource buttonStyle}" Width="120" Command="{Binding AGVLTwoArrive}"/>
<Button Content="AGV炒锅下料就位" Style="{StaticResource buttonStyle}" RenderTransformOrigin="0.5,0.5" Width="114" Command="{Binding AGVFryPotTwoDownArrive}">
</Button>
<Button Content="AGV炒锅空桶上料就位" Style="{StaticResource buttonStyle}" Width="139" Command="{Binding AGVFryPotTwoUpArrive}"/>
<Button Content="AGV拿到空桶信号" Style="{StaticResource buttonStyle}" Width="114" Command="{Binding AGVFryPotTwoGetEmptyRoller}"/>
</WrapPanel>
</GroupBox>
</UniformGrid>
<UniformGrid Columns="2" Grid.Row="2">
<GroupBox Grid.Column="1" Header="PLC信号" Foreground="Aqua" BorderBrush="Pink">
<WrapPanel Orientation="Horizontal">
<Button Content="滚筒线运行信号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding RollerLineThreeRunning}"></Button>
<!--<Button Content="工位号8桶号" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding EightWorkLoc}"></Button>-->
<ComboBox SelectionChanged="ComboBox_SelectionChanged_2" ItemsSource="{Binding LineThreeRollerCode}" Background="Transparent" Width="100" Height="34" Margin="3,3"/>
<Button Content="炒锅进料就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotThreeInputArrive}"/>
<Button Content="炒锅空桶就位" Style="{StaticResource buttonStyle}" VerticalAlignment="Top" Command="{Binding FryPotThreeEmptyRollerArrive}"/>
</WrapPanel>
</GroupBox>
<GroupBox Grid.Column="2" Header="AGV信号" Foreground="Aqua">
<WrapPanel Orientation="Horizontal">
<Button Content="AGV线体3上料就位" Style="{StaticResource buttonStyle}" Width="120" Command="{Binding AGVLThreeArrive}"/>
<Button Content="AGV炒锅下料就位" Style="{StaticResource buttonStyle}" RenderTransformOrigin="0.5,0.5" Width="114" Command="{Binding AGVFryPotThreeDownArrive}">
</Button>
<Button Content="AGV炒锅空桶上料就位" Style="{StaticResource buttonStyle}" Width="139" Command="{Binding AGVFryPotThreeUpArrive}"/>
<Button Content="AGV拿到空桶信号" Style="{StaticResource buttonStyle}" Width="114" Command="{Binding AGVFryPotThreeGetEmptyRoller}"/>
</WrapPanel>
</GroupBox>
</UniformGrid>
</Grid>

</UserControl>

+ 62
- 0
FryPot_DosingSystem/View/DebugView.xaml.cs View File

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

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

private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (sender is ComboBox cbo)
{
if (cbo.SelectedValue != null)
{
ActionManage.GetInstance.Send("EightWorkLoc",cbo.SelectedValue);
}
}
}

private void ComboBox_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
{
if (sender is ComboBox cbo)
{
if (cbo.SelectedValue != null)
{
ActionManage.GetInstance.Send("TwoEightWorkLoc", cbo.SelectedValue);
}
}
}

private void ComboBox_SelectionChanged_2(object sender, SelectionChangedEventArgs e)
{
if (sender is ComboBox cbo)
{
if (cbo.SelectedValue != null)
{
ActionManage.GetInstance.Send("ThreeEightWorkLoc", cbo.SelectedValue);
}
}
}
}
}

+ 7
- 7
FryPot_DosingSystem/View/DeviceListVIew.xaml View File

@@ -18,20 +18,20 @@
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"/>
<RowDefinition Height="20"/>
<RowDefinition Height="55"/>
<RowDefinition Height="10"/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
<Button Width="150" Height="35" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,20,0" Content="添加设备" Command="{Binding AddDeviceCommand}"></Button>
<Button Content="保存设置" Width="150" Height="35" Margin="0,0,20,0" Command="{Binding SaveDeviceConfig}"></Button>
<Button Width="150" Height="35" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,13,10,0" Content="添加设备" Command="{Binding AddDeviceCommand}"></Button>
<Button Content="保存设置" Width="150" Height="35" Margin="0,13,10,0" Command="{Binding SaveDeviceConfig}"></Button>
</StackPanel>
<Line Grid.Row="1" X1="0" Y1="10" X2="1300" Y2="10" Stroke="Aqua" StrokeThickness="1"></Line>
<Line Grid.Row="1" X1="0" Y1="10" X2="1920" Y2="10" Stroke="Aqua" StrokeThickness="1" VerticalAlignment="Center"></Line>
<Viewbox Grid.Row="2" VerticalAlignment="Top" >
<ItemsControl ItemsSource="{Binding devices}">
<ItemsControl ItemsSource="{Binding devices}" Padding="0,5,0,0">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel></StackPanel>


+ 48
- 14
FryPot_DosingSystem/View/NewRecipeView.xaml View File

@@ -190,25 +190,59 @@
<Grid >
<Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="80"></RowDefinition>
<RowDefinition Height="40"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<TextBlock Text="配方信息" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" FontSize="25" Margin="0,10"></TextBlock>
<UniformGrid Grid.Row="1" Columns="2">
<StackPanel Orientation="Horizontal">
<TextBlock Text="请输入配方名称:" Foreground="Aqua" FontSize="18" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBox Style="{DynamicResource TextBoxStyle}" Text="{Binding RecipeName}" Width="230" Height="30" BorderThickness="1" Background="Transparent" Foreground="Orange"
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal" Margin="0,8">
<TextBlock Text="请输入配方名称:" Foreground="Aqua" FontSize="18" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBox Style="{DynamicResource TextBoxStyle}" Text="{Binding RecipeName}" Width="230" Height="30" BorderThickness="1" Background="Transparent" Foreground="Orange"
VerticalContentAlignment="Center"
BorderBrush="Aqua" VerticalAlignment="Center" FontSize="16" ></TextBox>
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="请输入桶的数量:" Foreground="Aqua" FontSize="18" Margin="10,0,5,0" VerticalAlignment="Center"></TextBlock>
<TextBox Style="{DynamicResource TextBoxStyle}" Text="{Binding RecipeRollerNum}" InputMethod.IsInputMethodEnabled="False" Width="230" Height="30" BorderThickness="1" Background="Transparent" Foreground="Orange"
VerticalContentAlignment="Center"
BorderBrush="Aqua" VerticalAlignment="Center" FontSize="16" TextChanged="TextBox_TextChanged"></TextBox>
</StackPanel>
</StackPanel>
<StackPanel Orientation="Horizontal">
<Button Content="添加原料" Width="150" Margin="10" Height="30" Background="Transparent" BorderBrush="Aqua" Foreground="Aqua" Cursor="Hand" Command="{Binding AddRecipe}" ></Button>
<Button Content="确认" Height="30" Width="100" Margin="5,10" Background="Transparent" BorderBrush="Aqua" Foreground="Aqua" Command="{Binding Comfirm}"></Button>
<Button Click="Button_Click" Content="取消" Height="30" FontSize="20" Background="Transparent" BorderBrush="Aqua" Foreground="Aqua" Width="100" Margin="8,10" Cursor="Hand"></Button>
</StackPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
<Button Content="添加原料" Width="180" Margin="0,0,10,0" Height="30" Background="Transparent" BorderBrush="Aqua" Foreground="Aqua" Cursor="Hand" Command="{Binding AddRecipe}" ></Button>
<Button Content="确认更新" Height="30" Width="180" Background="Transparent" BorderBrush="Aqua" Foreground="Aqua" Command="{Binding Comfirm}"></Button>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Row="1" HorizontalAlignment="Center">
<Button Content="另存为" Height="30" Width="180" Margin="0,0,10,0" Command="{Binding SaveAs}" Cursor="Hand"/>
<Button Click="Button_Click" Content="取消" Height="30" FontSize="20" Background="Transparent" BorderBrush="Aqua" Foreground="Aqua" Width="180" Cursor="Hand"></Button>
</StackPanel>
</Grid>
</UniformGrid>
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Hidden">
<Grid Grid.Row="2" Background="Cyan" Margin="0,0,0,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="210"/>
<ColumnDefinition Width="225"/>
<ColumnDefinition Width="225"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="原料名称" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Tomato"/>
<GridSplitter></GridSplitter>
<TextBlock Grid.Column="1" Text="原料桶号" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Tomato"/>
<GridSplitter Grid.Column="1"></GridSplitter>
<TextBlock Grid.Column="2" Text="原料重量" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Tomato"></TextBlock>
<GridSplitter Grid.Column="2"></GridSplitter>
<TextBlock Grid.Column="3" Text="操作" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="Tomato"/>
</Grid>
<ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding materials}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
@@ -228,8 +262,8 @@
<ColumnDefinition Width="225"></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
</Grid.ColumnDefinitions>
<ComboBox ItemsSource="{Binding DataContext.materialNames,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" Text="{Binding MaterialName}" Margin="10,0,0,10" Width="190" FontSize="14" Style="{StaticResource ComboBoxStyle1}">
<ComboBox.ItemContainerStyle>
<ComboBox ItemsSource="{Binding DataContext.materialNames,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" Text="{Binding MaterialName}" Margin="10,0,0,10" Width="190" FontSize="14" KeyUp="ComboBox_KeyUp" LostFocus="ComboBox_LostFocus" Style="{StaticResource ComboBoxStyle1}">
<ComboBox.ItemContainerStyle>
<Style TargetType="{x:Type ComboBoxItem}">
<Setter Property="Background" Value="White" />
<Setter Property="Foreground" Value="#e69519"/>
@@ -252,7 +286,7 @@
Content="删除"
Width="94"
FontSize="14"
Margin="0,0,10,10"
Margin="0,0,20,10"
Background="Transparent"
BorderBrush="#e69519" Foreground="LightGray" HorizontalAlignment="Right"
Command="{Binding DataContext.RemoveRecipe,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}"


+ 53
- 0
FryPot_DosingSystem/View/NewRecipeView.xaml.cs View File

@@ -1,8 +1,10 @@
using BPASmartClient.Helper;
using FryPot_DosingSystem.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
@@ -32,5 +34,56 @@ namespace FryPot_DosingSystem.View
{
this.Close();
}

private void ComboBox_KeyUp(object sender, KeyEventArgs e)
{
var res = sender as ComboBox;
Json<MaterialNames>.Read();
if (res.Text != null)
{
var datas = Json<MaterialNames>.Data.Names.Where(s => s.Contains(res.Text.Trim()));
// var datas = Json<MaterialNames>.Data.Names.ToList().FindAll(s => s.Contains(res.Text.Trim()));
if (datas.Count() > 0)
{
res.ItemsSource = datas;
res.IsDropDownOpen = true;
}
else
{
res.IsDropDownOpen = false;
}
}
}

private void ComboBox_LostFocus(object sender, RoutedEventArgs e)
{
var res = sender as ComboBox;
if (res.Text != null)
{
if (!MaterialNames.GetInstance.Names.Contains(res.Text.Trim()))//判断是否存在原料
{
MaterialNames.GetInstance.Names.Add(res.Text.Trim());
Json<MaterialNames>.Data = MaterialNames.GetInstance;
Json<MaterialNames>.Save();
}
}
}

private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
{
if (sender is TextBox txt)
{
if (new Regex("^[1-8]$").IsMatch(txt.Text))//全匹配
{

}
else
{
txt.Text=string.Empty;
}
}
}
}
}

+ 2
- 1
FryPot_DosingSystem/View/RecipeSendDownView.xaml View File

@@ -19,6 +19,7 @@
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
@@ -109,7 +110,7 @@
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Line StrokeThickness="3" Grid.Column="0" HorizontalAlignment="Left" Stroke="LawnGreen" X1="0" Y1="5" X2="0" Y2="110"></Line>
<TextBlock Grid.Column="1" FontSize="16" Text="{Binding RecipeSetInfo}" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
<TextBlock Grid.Column="1" FontSize="16" Text="{Binding RecipeSetInfo}" VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
</Grid>
</Grid>



+ 37
- 23
FryPot_DosingSystem/View/RecipeSetView.xaml View File

@@ -44,39 +44,53 @@
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50"></RowDefinition>
<RowDefinition Height="20"></RowDefinition>
<RowDefinition Height="55"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition></RowDefinition>
</Grid.RowDefinitions>
<UniformGrid Columns="2">
<Image Source="../hbl.ico" HorizontalAlignment="Left"></Image>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Column="2">
<pry:IcoButton Content="新建配方"
Margin="80,5,15,5"
Margin="80,15,10,0"
Width="150"
FontSize="16"
Foreground="Aqua"
IcoText="&#xe626;"
Cursor="Hand"
Style="{StaticResource NewButtonStyle}"
Style="{StaticResource IcoButtonStyle}"
Command="{Binding NewRecipe}">
</pry:IcoButton>
<pry:IcoButton
Content="保存配方" Margin="5,5"
Content="保存配方" Margin="5,15,10,0"
Width="150"
FontSize="16"
Foreground="Aqua"
IcoText="&#xe626;"
Cursor="Hand"
Style="{StaticResource NewButtonStyle}"
Style="{StaticResource IcoButtonStyle}"
Command="{Binding SaveRecipe}">
</pry:IcoButton>

</StackPanel>
</UniformGrid>
<!--<TextBlock Grid.Row="1" Text="配方信息" Foreground="Aquamarine" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="18" Margin="0,5" ></TextBlock>-->
<Line Grid.Row="1" X1="0" Y1="10" X2="1000" Y2="10" Stroke="Aqua"></Line>
<ScrollViewer Grid.Row="2" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden">
<!--<Line Grid.Row="1" X1="0" Y1="5" X2="1920" Y2="10" Stroke="Aqua" VerticalAlignment="Center"></Line>-->
<Grid Grid.Row="1" Background="Cyan" Margin="0,5,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
<ColumnDefinition Width="0.3*"/>
<!--<ColumnDefinition/>-->
</Grid.ColumnDefinitions>
<!--<TextBlock Text="编号" FontSize="16" Foreground="Tomato" HorizontalAlignment="Center" VerticalAlignment="Center"/>-->
<TextBlock Grid.Column="0" Text="配方名称" FontSize="16" Foreground="Tomato" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<GridSplitter BorderThickness="0.5" BorderBrush="CadetBlue"/>
<TextBlock Grid.Column="1" Text="编辑配方" FontSize="16" Foreground="Tomato" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<GridSplitter Grid.Column="1" BorderThickness="0.5" BorderBrush="CadetBlue"></GridSplitter>
<TextBlock Grid.Column="2" Text="删除配方" FontSize="16" Foreground="Tomato" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<ScrollViewer Grid.Row="2" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden" Padding="0,5,0,0">
<ItemsControl ItemsSource="{Binding recipeModels}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
@@ -90,26 +104,26 @@
<ControlTemplate>
<Grid x:Name="gr">
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="0.25*"></ColumnDefinition>
<ColumnDefinition Width="0.25*"></ColumnDefinition>
<ColumnDefinition Width="0.25*"></ColumnDefinition>
<!--<ColumnDefinition Width="0.25*"></ColumnDefinition>-->
</Grid.ColumnDefinitions>
<TextBlock Text="{Binding RecipeId}" Grid.Column="0" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center"
<!--<TextBlock Text="{Binding RecipeId}" Grid.Column="0" FontSize="16" HorizontalAlignment="Left" VerticalAlignment="Center"
Foreground="Aqua"
Margin="5,0,0,5"></TextBlock>
<TextBlock Text="{Binding RecipeName}" Grid.Column="1" Margin="5,0,0,5"
Margin="5,0,0,5"></TextBlock>-->
<TextBlock Text="{Binding RecipeName}" Grid.Column="0" Margin="5,0,0,5"
HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Aqua" FontSize="16"></TextBlock>
<Grid Grid.Column="3">
<Button FontSize="16"
Margin="5,0,0,5" Content="编辑配方" Style="{StaticResource buttonStyle}" Command="{Binding DataContext.EditRecipeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}"
<Button FontSize="16" Grid.Column="1"
Margin="5,0,0,5" Content="编辑" Style="{StaticResource buttonStyle}" Command="{Binding DataContext.EditRecipeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}"
CommandParameter="{Binding RecipeId}"></Button>
</Grid>
<Grid Grid.Column="4">
<Button Margin="5,0,0,5" FontSize="16" Content="删除配方" Style="{StaticResource buttonStyle}" Command="{Binding DataContext.DeleteRecipeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" CommandParameter="{Binding RecipeId}">
<Button Margin="5,0,0,5" FontSize="16" Grid.Column="2" Content="删除" Style="{StaticResource buttonStyle}" Command="{Binding DataContext.DeleteRecipeCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=ItemsControl}}" CommandParameter="{Binding RecipeId}">
</Button>
</Grid>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">


+ 1109
- 2
FryPot_DosingSystem/ViewModel/AgvViewModel.cs
File diff suppressed because it is too large
View File


+ 165
- 0
FryPot_DosingSystem/ViewModel/DebugViewModel.cs View File

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

namespace FryPot_DosingSystem.ViewModel
{
internal class DebugViewModel : ObservableObject
{
public ObservableCollection<ushort> LineOneRollerCode { get; set; } = new ObservableCollection<ushort>() { 101,102,103,104,105,106,107,108,401,402,403,404,405,406,407,408};
public ObservableCollection<ushort> LineTwoRollerCode { get; set; } = new ObservableCollection<ushort>() {201,202,203,204,205,206,207,208,501,502,503,504,505,506,507,508 };
public ObservableCollection<ushort> LineThreeRollerCode { get; set; } = new ObservableCollection<ushort>() { 301,302,303,304,305,306,307,308};
//滚筒线1绑定命令
public RelayCommand RollerLineRunning { get; set; }
public RelayCommand EightWorkLoc { get; set; }
public RelayCommand FryPotInputArrive { get; set; }
public RelayCommand FryPotEmptyRollerArrive { get; set; }


public RelayCommand AGVLOneArrive { get; set; }
public RelayCommand AGVFryPotDownArrive { get; set; }
public RelayCommand AGVFryPotUpArrive { get; set; }
public RelayCommand AGVFryPotGetEmptyRoller { get; set; }

//滚筒线2绑定命令
public RelayCommand RollerLineTwoRunning { get; set; }
//public RelayCommand EightWorkLoc { get; set; }
public RelayCommand FryPotTwoInputArrive { get; set; }
public RelayCommand FryPotTwoEmptyRollerArrive { get; set; }


public RelayCommand AGVLTwoArrive { get; set; }
public RelayCommand AGVFryPotTwoDownArrive { get; set; }
public RelayCommand AGVFryPotTwoUpArrive { get; set; }
public RelayCommand AGVFryPotTwoGetEmptyRoller { get; set; }
//滚筒线3绑定命令
public RelayCommand RollerLineThreeRunning { get; set; }
//public RelayCommand EightWorkLoc { get; set; }
public RelayCommand FryPotThreeInputArrive { get; set; }
public RelayCommand FryPotThreeEmptyRollerArrive { get; set; }


public RelayCommand AGVLThreeArrive { get; set; }
public RelayCommand AGVFryPotThreeDownArrive { get; set; }
public RelayCommand AGVFryPotThreeUpArrive { get; set; }
public RelayCommand AGVFryPotThreeGetEmptyRoller { get; set; }

public DebugViewModel()
{
RollerLineRunning = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("RollerLineRunning");

}));
FryPotInputArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("FryPotInputArrive");

}));
FryPotEmptyRollerArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("FryPotEmptyRollerArrive");

}));
AGVLOneArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("AGVLOneArrive");

}));
AGVFryPotDownArrive = new RelayCommand(new Action(() =>
{

ActionManage.GetInstance.Send("AGVFryPotDownArrive");
}));
AGVFryPotUpArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("AGVFryPotUpArrive");

}));
AGVFryPotGetEmptyRoller = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("AGVFryPotGetEmptyRoller");
}));
//滚筒线2
RollerLineTwoRunning = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("RollerLineTwoRunning");

}));

FryPotTwoInputArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("FryPotTwoInputArrive");

}));
FryPotTwoEmptyRollerArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("FryPotTwoEmptyRollerArrive");

}));
AGVLTwoArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("AGVLTwoArrive");

}));
AGVFryPotTwoDownArrive = new RelayCommand(new Action(() =>
{

ActionManage.GetInstance.Send("AGVFryPotTwoDownArrive");
}));
AGVFryPotTwoUpArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("AGVFryPotTwoUpArrive");

}));
AGVFryPotTwoGetEmptyRoller = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("AGVFryPotTwoGetEmptyRoller");
}));
//滚筒线3
RollerLineThreeRunning = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("RollerLineThreeRunning");

}));

FryPotThreeInputArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("FryPotThreeInputArrive");

}));
FryPotThreeEmptyRollerArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("FryPotThreeEmptyRollerArrive");

}));
AGVLThreeArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("AGVLThreeArrive");

}));
AGVFryPotThreeDownArrive = new RelayCommand(new Action(() =>
{

ActionManage.GetInstance.Send("AGVFryPotThreeDownArrive");
}));
AGVFryPotThreeUpArrive = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("AGVFryPotThreeUpArrive");

}));
AGVFryPotThreeGetEmptyRoller = new RelayCommand(new Action(() =>
{
ActionManage.GetInstance.Send("AGVFryPotThreeGetEmptyRoller");
}));
}
}
}

+ 74
- 21
FryPot_DosingSystem/ViewModel/NewRecipeViewModel.cs View File

@@ -1,4 +1,5 @@
using BPASmartClient.Helper;
using BPASmartClient.CustomResource.Pages.Model;
using BPASmartClient.Helper;
using FryPot_DosingSystem.Model;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
@@ -18,27 +19,39 @@ namespace FryPot_DosingSystem.ViewModel
/// </summary>
public string recipeId { get; set; }
/// <summary>
/// 配名称
/// 配名称
/// </summary>
private string _recipeName;
public string RecipeName { get { return _recipeName; } set { _recipeName = value; OnPropertyChanged(); } }

private int _recipeRollerNum;
/// <summary>
/// 配方中桶数
/// </summary>
public int RecipeRollerNum { get { return _recipeRollerNum; } set { _recipeRollerNum = value; OnPropertyChanged(); } }

public ObservableCollection<MaterialType> materials { get; set; } = new ObservableCollection<MaterialType>();

public ObservableCollection<string> materialNames { get; set; } = new ObservableCollection<string>() { "肉","葱","蒜"};
public ObservableCollection<string> materialNames { get; set; } = new ObservableCollection<string>();

public RelayCommand AddRecipe { get; set; }
public RelayCommand<string> RemoveRecipe { get; set; }
public RelayCommand Comfirm { get; set; }
public RelayCommand SaveAs { get; set; }
public NewRecipeViewModel()
{
ActionManage.GetInstance.Register(new Action<object>(Id => {
Json<MaterialNames>.Read();
MaterialNames.GetInstance.Names = Json<MaterialNames>.Data.Names;
materialNames = Json<MaterialNames>.Data.Names;
ActionManage.GetInstance.Register(new Action<object>(Id =>
{
if (Id != null && Id is string strId)
{
var res = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeId == strId);
if (res != null && res is NewRecipeModel rom)
{
RecipeName = rom.RecipeName;
RecipeRollerNum = rom.materialCollection.Count;
foreach (var item in rom.materialCollection)
{
materials.Add(item);
@@ -46,20 +59,25 @@ namespace FryPot_DosingSystem.ViewModel
recipeId = strId;
}
}
}),"EditRecipe");
}), "EditRecipe");
AddRecipe = new RelayCommand(() =>
{
pr:
string materialCode = Guid.NewGuid().ToString();//原料唯一ID ,后期需要根据实际要求更改
var res = materials.FirstOrDefault(p => p.MaterialCode == materialCode);
if (res == null)
for (int i = 0; i < RecipeRollerNum; i++)
{
materials.Add(new MaterialType() { MaterialCode = materialCode });
}
else
{
goto pr;
pr1:
string materialCode = Guid.NewGuid().ToString();//原料唯一ID ,后期需要根据实际要求更改
var res = materials.FirstOrDefault(p => p.MaterialCode == materialCode);
if (res == null)
{
materials.Add(new MaterialType() { MaterialCode = materialCode });
}
else
{
goto pr1;
}
}

});
RemoveRecipe = new RelayCommand<string>(code =>
{
@@ -72,27 +90,62 @@ namespace FryPot_DosingSystem.ViewModel
var bom = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeId);
if (bom == null)//新配方
{
prop: string recipeID = Guid.NewGuid().ToString();//配方唯一ID,后期根据实际要求更改
var res = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeID);
if (res == null)
if (RecipeRollerNum != 0)
{
Json<RecipeManage>.Data.Recipes.Add(new NewRecipeModel { RecipeId = recipeID, RecipeName = RecipeName, materialCollection = materials });//配方添加
prop: string recipeID = Guid.NewGuid().ToString();//配方唯一ID,后期根据实际要求更改
var res = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeID);
if (res == null)
{
Json<RecipeManage>.Data.Recipes.Add(new NewRecipeModel { RecipeId = recipeID, RecipeName = RecipeName, materialCollection = materials });//配方添加

}
else
{
goto prop;
}
MessageLog.GetInstance.ShowUserLog("新建配方成功");
}
else
{
goto prop;
MessageLog.GetInstance.ShowUserLog("新建配方无效【配方中没有添加原料】");
}
ActionManage.GetInstance.Send("CloseNewRecipeView");
}
else //已有配方,用于编辑
{
bom.materialCollection= materials;
bom.materialCollection = materials;
bom.RecipeName = RecipeName;
ActionManage.GetInstance.Send("CloseNewRecipeView");
}
});
SaveAs = new RelayCommand(() =>
{
var bom = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeName == RecipeName);
if (bom == null)//配方名称更改
{
if (RecipeRollerNum != 0)
{
prop: string recipeID = Guid.NewGuid().ToString();//配方唯一ID,后期根据实际要求更改
var res = Json<RecipeManage>.Data.Recipes.FirstOrDefault(p => p.RecipeId == recipeID);
if (res == null)
{
Json<RecipeManage>.Data.Recipes.Add(new NewRecipeModel { RecipeId = recipeID, RecipeName = RecipeName, materialCollection = materials });//配方添加

}
else
{
goto prop;
}
MessageLog.GetInstance.ShowUserLog("新建配方成功");
}
else
{
MessageLog.GetInstance.ShowUserLog("新建配方无效【配方中没有添加原料】");
}
ActionManage.GetInstance.Send("CloseNewRecipeView");
}
ActionManage.GetInstance.Send("CloseNewRecipeView");
});
}
}
}

+ 10
- 9
FryPot_DosingSystem/ViewModel/RecipeSetDownViewModel.cs View File

@@ -14,7 +14,7 @@ namespace FryPot_DosingSystem.ViewModel
{
internal class RecipeSetDownViewModel : ObservableObject
{

/// <summary>
/// 配方下发
@@ -36,18 +36,19 @@ namespace FryPot_DosingSystem.ViewModel
var res = Recipes.FirstOrDefault(p => p.RecipeId == strId);
if (res != null)
{
RecipeSetDown(res);
RecipeSetDown(new NewRecipeModel[] { res });
}
}
});
AllRecipeSetDownCommand = new RelayCommand(() =>
{
if (Recipes!=null)
if (Recipes != null)
{
foreach (var recipeModel in Recipes)
{
RecipeSetDown(recipeModel);
}
//foreach (var recipeModel in Recipes)
//{
// RecipeSetDown(recipeModel);
//}
RecipeSetDown(Recipes.ToArray());
}

});
@@ -55,9 +56,9 @@ namespace FryPot_DosingSystem.ViewModel
/// <summary>
/// 数据下发方法
/// </summary>
public void RecipeSetDown(NewRecipeModel recipeModel)
public void RecipeSetDown(NewRecipeModel[] recipes)
{
ActionManage.GetInstance.Send("RecipeSetDown",recipeModel);
ActionManage.GetInstance.Send("RecipeSetDown", recipes);
}
}
}

+ 22
- 2
FryPot_DosingSystem/ViewModel/RecipeSetViewModel.cs View File

@@ -10,6 +10,7 @@ using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace FryPot_DosingSystem.ViewModel
{
@@ -44,14 +45,32 @@ namespace FryPot_DosingSystem.ViewModel
{
Json<RecipeManage>.Read();
recipeModels = Json<RecipeManage>.Data.Recipes;
int count = recipeModels.Count;
ActionManage.GetInstance.CancelRegister("RecipeIsChange");
ActionManage.GetInstance.Register(new Action(() =>
{
bool b = Json<RecipeManage>.Data.Recipes.Count==count ? true : false;
if (!b)
{
MessageBoxResult result = MessageBox.Show("配方数据未保存,是否保存", "提示", MessageBoxButton.OKCancel, MessageBoxImage.Information);
if (result == MessageBoxResult.OK)
{
Json<RecipeManage>.Save();//保存配方
count = recipeModels.Count;
}
}

}), "RecipeIsChange");
NewRecipe = new Action(() =>
{
NewRecipeView nrv = new NewRecipeView();
nrv.ShowDialog();
MessageLog.GetInstance.Show("新建配方");
});
SaveRecipe = new Action(() => {
SaveRecipe = new Action(() =>
{
Json<RecipeManage>.Save();
count = recipeModels.Count;
});
EditRecipeCommand = new RelayCommand<object>((Id) =>
{
@@ -67,11 +86,12 @@ namespace FryPot_DosingSystem.ViewModel
{
if (Id != null && Id is String strId)
{
var res= recipeModels.FirstOrDefault(p => p.RecipeId == strId);
var res = recipeModels.FirstOrDefault(p => p.RecipeId == strId);
if (res != null && res is NewRecipeModel nes)
{
recipeModels.Remove(res);//删除配方
Json<RecipeManage>.Save();//保存配方
count = recipeModels.Count;
}
}
});


+ 22
- 22
SmartClient.sln View File

@@ -114,7 +114,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestDemo", "TestDemo\TestDe
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.HubHelper", "BPASmartClient.HubHelper\BPASmartClient.HubHelper.csproj", "{099E047C-F40E-47A3-A5BA-81FC1500D5E8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.MorkTSingle", "BPASmartClient.MorkTSingle\BPASmartClient.MorkTSingle.csproj", "{84B7D506-C720-4E67-A161-1E9A8E94B6EF}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTM", "BPASmartClient.MorkTM\BPASmartClient.MorkTM.csproj", "{76B6B333-0109-4EE8-A9B2-3E53A7421D92}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -1070,26 +1070,26 @@ Global
{099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|x64.Build.0 = Release|Any CPU
{099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|x86.ActiveCfg = Release|Any CPU
{099E047C-F40E-47A3-A5BA-81FC1500D5E8}.Release|x86.Build.0 = Release|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Debug|ARM.ActiveCfg = Debug|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Debug|ARM.Build.0 = Debug|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Debug|ARM64.Build.0 = Debug|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Debug|x64.ActiveCfg = Debug|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Debug|x64.Build.0 = Debug|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Debug|x86.ActiveCfg = Debug|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Debug|x86.Build.0 = Debug|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Release|Any CPU.Build.0 = Release|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Release|ARM.ActiveCfg = Release|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Release|ARM.Build.0 = Release|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Release|ARM64.ActiveCfg = Release|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Release|ARM64.Build.0 = Release|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Release|x64.ActiveCfg = Release|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Release|x64.Build.0 = Release|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Release|x86.ActiveCfg = Release|Any CPU
{84B7D506-C720-4E67-A161-1E9A8E94B6EF}.Release|x86.Build.0 = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|Any CPU.Build.0 = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|ARM.ActiveCfg = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|ARM.Build.0 = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|ARM64.ActiveCfg = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|ARM64.Build.0 = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|x64.ActiveCfg = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|x64.Build.0 = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|x86.ActiveCfg = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Debug|x86.Build.0 = Debug|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|Any CPU.ActiveCfg = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|Any CPU.Build.0 = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|ARM.ActiveCfg = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|ARM.Build.0 = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|ARM64.ActiveCfg = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|ARM64.Build.0 = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|x64.ActiveCfg = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|x64.Build.0 = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|x86.ActiveCfg = Release|Any CPU
{76B6B333-0109-4EE8-A9B2-3E53A7421D92}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -1142,7 +1142,7 @@ Global
{E7168B03-68E5-4285-BB95-5660F877577A} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{A49E1C5A-9489-451C-9CE6-CEA586234B84} = {8712125E-14CD-4E1B-A1CE-4BDE03805942}
{099E047C-F40E-47A3-A5BA-81FC1500D5E8} = {3D1D0E04-03FD-480A-8CF8-6E01A2E28625}
{84B7D506-C720-4E67-A161-1E9A8E94B6EF} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
{76B6B333-0109-4EE8-A9B2-3E53A7421D92} = {9FB27073-61A0-4FE3-94DB-5FDDE062332F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9AEC9B81-0222-4DE9-B642-D915C29222AC}


+ 2
- 2
TestDemo/Form1.cs View File

@@ -16,7 +16,7 @@ namespace TestDemo
{
AGVToUpSystem aGVToUpSystem = new AGVToUpSystem();
string value = JsonConvert.SerializeObject(aGVToUpSystem);
string url = $"http://192.168.1.99:8089/apicallback/quicktron/robotjob/report?sign={value}";
string url = $"http://192.168.1.14:8089/apicallback/quicktron/robotjob/report?sign={value}";
var res = APIHelper.GetInstance.HttpRequest(url, "", aGVToUpSystem, RequestType.POST);
}

@@ -25,7 +25,7 @@ namespace TestDemo

Upstreamrequest aGVToUpSystem = new Upstreamrequest();
string value = JsonConvert.SerializeObject(aGVToUpSystem);
string url = $"http://192.168.1.99:8089/apicallback/quicktron/robotjob/upstreamrequest?sign={value}";
string url = $"http://192.168.1.14:8089/apicallback/quicktron/robotjob/upstreamrequest?sign={value}";
var res = APIHelper.GetInstance.HttpRequest(url, "", aGVToUpSystem, RequestType.POST);
}
}

Loading…
Cancel
Save